187d2adbcSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 387d2adbcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 487d2adbcSAndrew Rist * or more contributor license agreements. See the NOTICE file 587d2adbcSAndrew Rist * distributed with this work for additional information 687d2adbcSAndrew Rist * regarding copyright ownership. The ASF licenses this file 787d2adbcSAndrew Rist * to you under the Apache License, Version 2.0 (the 887d2adbcSAndrew Rist * "License"); you may not use this file except in compliance 987d2adbcSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 1187d2adbcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 1387d2adbcSAndrew Rist * Unless required by applicable law or agreed to in writing, 1487d2adbcSAndrew Rist * software distributed under the License is distributed on an 1587d2adbcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1687d2adbcSAndrew Rist * KIND, either express or implied. See the License for the 1787d2adbcSAndrew Rist * specific language governing permissions and limitations 1887d2adbcSAndrew Rist * under the License. 19cdf0e10cSrcweir * 2087d2adbcSAndrew Rist *************************************************************/ 2187d2adbcSAndrew Rist 2287d2adbcSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "osl/file.h" 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "osl/diagnose.h" 27cdf0e10cSrcweir #include "osl/thread.h" 28cdf0e10cSrcweir #include "rtl/alloc.h" 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include "file_error_transl.h" 31cdf0e10cSrcweir #include "file_url.h" 32cdf0e10cSrcweir #include "system.h" 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <errno.h> 35cdf0e10cSrcweir #include <limits.h> 36cdf0e10cSrcweir #include <stdio.h> 37cdf0e10cSrcweir #include <string.h> 38cdf0e10cSrcweir #include <unistd.h> 39cdf0e10cSrcweir #include <sys/wait.h> 40cdf0e10cSrcweir 41cdf0e10cSrcweir #ifdef HAVE_STATFS_H 42cdf0e10cSrcweir #undef HAVE_STATFS_H 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir 45cdf0e10cSrcweir #if defined(LINUX) && defined(__FreeBSD_kernel__) 46cdf0e10cSrcweir #undef LINUX 47cdf0e10cSrcweir #define FREEBSD 1 48cdf0e10cSrcweir #endif 49cdf0e10cSrcweir 50cdf0e10cSrcweir 51cdf0e10cSrcweir #if defined(SOLARIS) 52cdf0e10cSrcweir 53cdf0e10cSrcweir #include <sys/mnttab.h> 54cdf0e10cSrcweir #include <sys/statvfs.h> 55cdf0e10cSrcweir #define HAVE_STATFS_H 56cdf0e10cSrcweir #include <sys/fs/ufs_quota.h> 57cdf0e10cSrcweir static const sal_Char* MOUNTTAB="/etc/mnttab"; 58cdf0e10cSrcweir 59cdf0e10cSrcweir #elif defined(LINUX) 60cdf0e10cSrcweir 61cdf0e10cSrcweir #include <mntent.h> 62cdf0e10cSrcweir #include <sys/vfs.h> 63cdf0e10cSrcweir #define HAVE_STATFS_H 64cdf0e10cSrcweir #include <sys/quota.h> 65cdf0e10cSrcweir //#include <ctype.h> 66cdf0e10cSrcweir static const sal_Char* MOUNTTAB="/etc/mtab"; 67cdf0e10cSrcweir 68cdf0e10cSrcweir #elif defined(NETBSD) || defined(FREEBSD) 69cdf0e10cSrcweir 70cdf0e10cSrcweir #include <sys/param.h> 71cdf0e10cSrcweir #include <sys/ucred.h> 72cdf0e10cSrcweir #include <sys/mount.h> 73cdf0e10cSrcweir #include <ufs/ufs/quota.h> 74cdf0e10cSrcweir //#include <ctype.h> 75cdf0e10cSrcweir #define HAVE_STATFS_H 76cdf0e10cSrcweir 77cdf0e10cSrcweir /* No mounting table on *BSD 78cdf0e10cSrcweir * This information is stored only in the kernel. */ 79cdf0e10cSrcweir /* static const sal_Char* MOUNTTAB="/etc/mtab"; */ 80cdf0e10cSrcweir 81cdf0e10cSrcweir #elif defined(MACOSX) 82cdf0e10cSrcweir 83*38fa8b40SHerbert Dürr #include <sys/quota.h> 84cdf0e10cSrcweir #include <sys/param.h> 85cdf0e10cSrcweir #include <sys/mount.h> 86cdf0e10cSrcweir #define HAVE_STATFS_H 87cdf0e10cSrcweir // static const sal_Char* MOUNTTAB="/etc/mtab"; 88cdf0e10cSrcweir 89cdf0e10cSrcweir #endif /* HAVE_STATFS_H */ 90cdf0e10cSrcweir 91cdf0e10cSrcweir /************************************************************************ 92cdf0e10cSrcweir * ToDo 93cdf0e10cSrcweir * 94cdf0e10cSrcweir * - Fix: check for corresponding struct sizes in exported functions 95cdf0e10cSrcweir * - check size/use of oslVolumeDeviceHandle 96cdf0e10cSrcweir * - check size/use of oslVolumeInfo 97cdf0e10cSrcweir ***********************************************************************/ 98cdf0e10cSrcweir /****************************************************************************** 99cdf0e10cSrcweir * 100cdf0e10cSrcweir * Data Type Definition 101cdf0e10cSrcweir * 102cdf0e10cSrcweir ******************************************************************************/ 103cdf0e10cSrcweir 104cdf0e10cSrcweir typedef struct _oslVolumeDeviceHandleImpl 105cdf0e10cSrcweir { 106cdf0e10cSrcweir sal_Char pszMountPoint[PATH_MAX]; 107cdf0e10cSrcweir sal_Char pszFilePath[PATH_MAX]; 108cdf0e10cSrcweir sal_Char pszDevice[PATH_MAX]; 109cdf0e10cSrcweir sal_Char ident[4]; 110cdf0e10cSrcweir sal_uInt32 RefCount; 111cdf0e10cSrcweir } oslVolumeDeviceHandleImpl; 112cdf0e10cSrcweir 113cdf0e10cSrcweir /****************************************************************************** 114cdf0e10cSrcweir * 115cdf0e10cSrcweir * 'removeable device' aka floppy functions 116cdf0e10cSrcweir * 117cdf0e10cSrcweir *****************************************************************************/ 118cdf0e10cSrcweir 119cdf0e10cSrcweir static oslVolumeDeviceHandle osl_isFloppyDrive(const sal_Char* pszPath); 120cdf0e10cSrcweir static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy); 121cdf0e10cSrcweir static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy); 122cdf0e10cSrcweir 123cdf0e10cSrcweir #if defined(SOLARIS) 124cdf0e10cSrcweir static sal_Bool osl_isFloppyMounted(sal_Char* pszPath, sal_Char* pszMountPath); 125cdf0e10cSrcweir static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, sal_Char* pBuffer); 126cdf0e10cSrcweir static sal_Bool osl_checkFloppyPath(sal_Char* pszPath, sal_Char* pszFilePath, sal_Char* pszDevicePath); 127cdf0e10cSrcweir #endif /* SOLARIS */ 128cdf0e10cSrcweir 129cdf0e10cSrcweir #if defined(LINUX) 130cdf0e10cSrcweir static sal_Bool osl_isFloppyMounted(oslVolumeDeviceHandleImpl* pDevice); 131cdf0e10cSrcweir static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem); 132cdf0e10cSrcweir #endif /* LINUX */ 133cdf0e10cSrcweir 134cdf0e10cSrcweir #ifdef DEBUG_OSL_FILE 135cdf0e10cSrcweir static void osl_printFloppyHandle(oslVolumeDeviceHandleImpl* hFloppy); 136cdf0e10cSrcweir #endif /* DEBUG_OSL_FILE */ 137cdf0e10cSrcweir 138cdf0e10cSrcweir /****************************************************************************** 139cdf0e10cSrcweir * 140cdf0e10cSrcweir * C-String Function Declarations 141cdf0e10cSrcweir * 142cdf0e10cSrcweir *****************************************************************************/ 143cdf0e10cSrcweir 144cdf0e10cSrcweir static oslFileError osl_psz_getVolumeInformation(const sal_Char* , oslVolumeInfo* pInfo, sal_uInt32 uFieldMask); 145cdf0e10cSrcweir 146cdf0e10cSrcweir /****************************************************************************/ 147cdf0e10cSrcweir /* osl_getVolumeInformation */ 148cdf0e10cSrcweir /****************************************************************************/ 149cdf0e10cSrcweir 150cdf0e10cSrcweir oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeInfo* pInfo, sal_uInt32 uFieldMask ) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir char path[PATH_MAX]; 153cdf0e10cSrcweir oslFileError eRet; 154cdf0e10cSrcweir 155cdf0e10cSrcweir OSL_ASSERT( ustrDirectoryURL ); 156cdf0e10cSrcweir OSL_ASSERT( pInfo ); 157cdf0e10cSrcweir 158cdf0e10cSrcweir /* convert directory url to system path */ 159cdf0e10cSrcweir eRet = FileURLToPath( path, PATH_MAX, ustrDirectoryURL ); 160cdf0e10cSrcweir if( eRet != osl_File_E_None ) 161cdf0e10cSrcweir return eRet; 162cdf0e10cSrcweir 163cdf0e10cSrcweir #ifdef MACOSX 164cdf0e10cSrcweir if ( macxp_resolveAlias( path, PATH_MAX ) != 0 ) 165cdf0e10cSrcweir return oslTranslateFileError( OSL_FET_ERROR, errno ); 166cdf0e10cSrcweir #endif/* MACOSX */ 167cdf0e10cSrcweir 168cdf0e10cSrcweir return osl_psz_getVolumeInformation( path, pInfo, uFieldMask); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir /****************************************************************************** 172cdf0e10cSrcweir * 173cdf0e10cSrcweir * C-String Versions of Exported Module Functions 174cdf0e10cSrcweir * 175cdf0e10cSrcweir *****************************************************************************/ 176cdf0e10cSrcweir 177cdf0e10cSrcweir #ifdef HAVE_STATFS_H 178cdf0e10cSrcweir 179cdf0e10cSrcweir #if defined(FREEBSD) || defined(NETBSD) || defined(MACOSX) 180cdf0e10cSrcweir # define __OSL_STATFS_STRUCT struct statfs 181cdf0e10cSrcweir # define __OSL_STATFS(dir, sfs) statfs((dir), (sfs)) 182cdf0e10cSrcweir # define __OSL_STATFS_BLKSIZ(a) ((sal_uInt64)((a).f_bsize)) 183cdf0e10cSrcweir # define __OSL_STATFS_TYPENAME(a) ((a).f_fstypename) 184cdf0e10cSrcweir # define __OSL_STATFS_ISREMOTE(a) (((a).f_type & MNT_LOCAL) == 0) 185cdf0e10cSrcweir 186cdf0e10cSrcweir /* always return true if queried for the properties of 187cdf0e10cSrcweir the file system. If you think this is wrong under any 188cdf0e10cSrcweir of the target platforms fix it!!!! */ 189cdf0e10cSrcweir # define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a) (1) 190cdf0e10cSrcweir # define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) (1) 191cdf0e10cSrcweir #endif /* FREEBSD || NETBSD || MACOSX */ 192cdf0e10cSrcweir 193cdf0e10cSrcweir #if defined(LINUX) 194cdf0e10cSrcweir # define __OSL_NFS_SUPER_MAGIC 0x6969 195cdf0e10cSrcweir # define __OSL_SMB_SUPER_MAGIC 0x517B 196cdf0e10cSrcweir # define __OSL_MSDOS_SUPER_MAGIC 0x4d44 197cdf0e10cSrcweir # define __OSL_NTFS_SUPER_MAGIC 0x5346544e 198cdf0e10cSrcweir # define __OSL_STATFS_STRUCT struct statfs 199cdf0e10cSrcweir # define __OSL_STATFS(dir, sfs) statfs((dir), (sfs)) 200cdf0e10cSrcweir # define __OSL_STATFS_BLKSIZ(a) ((sal_uInt64)((a).f_bsize)) 201cdf0e10cSrcweir # define __OSL_STATFS_IS_NFS(a) (__OSL_NFS_SUPER_MAGIC == (a).f_type) 202cdf0e10cSrcweir # define __OSL_STATFS_IS_SMB(a) (__OSL_SMB_SUPER_MAGIC == (a).f_type) 203cdf0e10cSrcweir # define __OSL_STATFS_ISREMOTE(a) (__OSL_STATFS_IS_NFS((a)) || __OSL_STATFS_IS_SMB((a))) 204cdf0e10cSrcweir # define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a) ((__OSL_MSDOS_SUPER_MAGIC != (a).f_type) && (__OSL_NTFS_SUPER_MAGIC != (a).f_type)) 205cdf0e10cSrcweir # define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) ((__OSL_MSDOS_SUPER_MAGIC != (a).f_type)) 206cdf0e10cSrcweir #endif /* LINUX */ 207cdf0e10cSrcweir 208cdf0e10cSrcweir #if defined(SOLARIS) 209cdf0e10cSrcweir # define __OSL_STATFS_STRUCT struct statvfs 210cdf0e10cSrcweir # define __OSL_STATFS(dir, sfs) statvfs((dir), (sfs)) 211cdf0e10cSrcweir # define __OSL_STATFS_BLKSIZ(a) ((sal_uInt64)((a).f_frsize)) 212cdf0e10cSrcweir # define __OSL_STATFS_TYPENAME(a) ((a).f_basetype) 213cdf0e10cSrcweir # define __OSL_STATFS_ISREMOTE(a) (rtl_str_compare((a).f_basetype, "nfs") == 0) 214cdf0e10cSrcweir 215cdf0e10cSrcweir /* always return true if queried for the properties of 216cdf0e10cSrcweir the file system. If you think this is wrong under any 217cdf0e10cSrcweir of the target platforms fix it!!!! */ 218cdf0e10cSrcweir # define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a) (1) 219cdf0e10cSrcweir # define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) (1) 220cdf0e10cSrcweir #endif /* SOLARIS */ 221cdf0e10cSrcweir 222cdf0e10cSrcweir # define __OSL_STATFS_INIT(a) (memset(&(a), 0, sizeof(__OSL_STATFS_STRUCT))) 223cdf0e10cSrcweir 224cdf0e10cSrcweir #else /* no statfs available */ 225cdf0e10cSrcweir 226cdf0e10cSrcweir # define __OSL_STATFS_STRUCT struct dummy {int i;} 227cdf0e10cSrcweir # define __OSL_STATFS_INIT(a) ((void)0) 228cdf0e10cSrcweir # define __OSL_STATFS(dir, sfs) (1) 229cdf0e10cSrcweir # define __OSL_STATFS_ISREMOTE(sfs) (0) 230cdf0e10cSrcweir # define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a) (1) 231cdf0e10cSrcweir # define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) (1) 232cdf0e10cSrcweir #endif /* HAVE_STATFS_H */ 233cdf0e10cSrcweir 234cdf0e10cSrcweir 235cdf0e10cSrcweir static oslFileError osl_psz_getVolumeInformation ( 236cdf0e10cSrcweir const sal_Char* pszDirectory, oslVolumeInfo* pInfo, sal_uInt32 uFieldMask) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir __OSL_STATFS_STRUCT sfs; 239cdf0e10cSrcweir 240cdf0e10cSrcweir if (!pInfo) 241cdf0e10cSrcweir return osl_File_E_INVAL; 242cdf0e10cSrcweir 243cdf0e10cSrcweir __OSL_STATFS_INIT(sfs); 244cdf0e10cSrcweir 245cdf0e10cSrcweir pInfo->uValidFields = 0; 246cdf0e10cSrcweir pInfo->uAttributes = 0; 247cdf0e10cSrcweir 248cdf0e10cSrcweir if ((__OSL_STATFS(pszDirectory, &sfs)) < 0) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir oslFileError result = oslTranslateFileError(OSL_FET_ERROR, errno); 251cdf0e10cSrcweir return (result); 252cdf0e10cSrcweir } 253cdf0e10cSrcweir 254cdf0e10cSrcweir /* FIXME: how to detect the kind of storage (fixed, cdrom, ...) */ 255cdf0e10cSrcweir if (uFieldMask & osl_VolumeInfo_Mask_Attributes) 256cdf0e10cSrcweir { 257cdf0e10cSrcweir if (__OSL_STATFS_ISREMOTE(sfs)) 258cdf0e10cSrcweir pInfo->uAttributes |= osl_Volume_Attribute_Remote; 259cdf0e10cSrcweir 260cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_Attributes; 261cdf0e10cSrcweir } 262cdf0e10cSrcweir 263cdf0e10cSrcweir if (uFieldMask & osl_VolumeInfo_Mask_FileSystemCaseHandling) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir if (__OSL_STATFS_IS_CASE_SENSITIVE_FS(sfs)) 266cdf0e10cSrcweir pInfo->uAttributes |= osl_Volume_Attribute_Case_Sensitive; 267cdf0e10cSrcweir 268cdf0e10cSrcweir if (__OSL_STATFS_IS_CASE_PRESERVING_FS(sfs)) 269cdf0e10cSrcweir pInfo->uAttributes |= osl_Volume_Attribute_Case_Is_Preserved; 270cdf0e10cSrcweir 271cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_Attributes; 272cdf0e10cSrcweir } 273cdf0e10cSrcweir 274cdf0e10cSrcweir pInfo->uTotalSpace = 0; 275cdf0e10cSrcweir pInfo->uFreeSpace = 0; 276cdf0e10cSrcweir pInfo->uUsedSpace = 0; 277cdf0e10cSrcweir 278cdf0e10cSrcweir #if defined(__OSL_STATFS_BLKSIZ) 279cdf0e10cSrcweir 280cdf0e10cSrcweir if ((uFieldMask & osl_VolumeInfo_Mask_TotalSpace) || 281cdf0e10cSrcweir (uFieldMask & osl_VolumeInfo_Mask_UsedSpace)) 282cdf0e10cSrcweir { 283cdf0e10cSrcweir pInfo->uTotalSpace = __OSL_STATFS_BLKSIZ(sfs); 284cdf0e10cSrcweir pInfo->uTotalSpace *= (sal_uInt64)(sfs.f_blocks); 285cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_TotalSpace; 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir if ((uFieldMask & osl_VolumeInfo_Mask_FreeSpace) || 289cdf0e10cSrcweir (uFieldMask & osl_VolumeInfo_Mask_UsedSpace)) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir pInfo->uFreeSpace = __OSL_STATFS_BLKSIZ(sfs); 292cdf0e10cSrcweir 293cdf0e10cSrcweir if (getuid() == 0) 294cdf0e10cSrcweir pInfo->uFreeSpace *= (sal_uInt64)(sfs.f_bfree); 295cdf0e10cSrcweir else 296cdf0e10cSrcweir pInfo->uFreeSpace *= (sal_uInt64)(sfs.f_bavail); 297cdf0e10cSrcweir 298cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_FreeSpace; 299cdf0e10cSrcweir } 300cdf0e10cSrcweir 301cdf0e10cSrcweir #endif /* __OSL_STATFS_BLKSIZ */ 302cdf0e10cSrcweir 303cdf0e10cSrcweir if ((pInfo->uValidFields & osl_VolumeInfo_Mask_TotalSpace) && 304cdf0e10cSrcweir (pInfo->uValidFields & osl_VolumeInfo_Mask_FreeSpace )) 305cdf0e10cSrcweir { 306cdf0e10cSrcweir pInfo->uUsedSpace = pInfo->uTotalSpace - pInfo->uFreeSpace; 307cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_UsedSpace; 308cdf0e10cSrcweir } 309cdf0e10cSrcweir 310cdf0e10cSrcweir pInfo->uMaxNameLength = 0; 311cdf0e10cSrcweir if (uFieldMask & osl_VolumeInfo_Mask_MaxNameLength) 312cdf0e10cSrcweir { 313cdf0e10cSrcweir long nLen = pathconf(pszDirectory, _PC_NAME_MAX); 314cdf0e10cSrcweir if (nLen > 0) 315cdf0e10cSrcweir { 316cdf0e10cSrcweir pInfo->uMaxNameLength = (sal_uInt32)nLen; 317cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_MaxNameLength; 318cdf0e10cSrcweir } 319cdf0e10cSrcweir } 320cdf0e10cSrcweir 321cdf0e10cSrcweir pInfo->uMaxPathLength = 0; 322cdf0e10cSrcweir if (uFieldMask & osl_VolumeInfo_Mask_MaxPathLength) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir long nLen = pathconf (pszDirectory, _PC_PATH_MAX); 325cdf0e10cSrcweir if (nLen > 0) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir pInfo->uMaxPathLength = (sal_uInt32)nLen; 328cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_MaxPathLength; 329cdf0e10cSrcweir } 330cdf0e10cSrcweir } 331cdf0e10cSrcweir 332cdf0e10cSrcweir #if defined(__OSL_STATFS_TYPENAME) 333cdf0e10cSrcweir 334cdf0e10cSrcweir if (uFieldMask & osl_VolumeInfo_Mask_FileSystemName) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir rtl_string2UString( 337cdf0e10cSrcweir &(pInfo->ustrFileSystemName), 338cdf0e10cSrcweir __OSL_STATFS_TYPENAME(sfs), 339cdf0e10cSrcweir rtl_str_getLength(__OSL_STATFS_TYPENAME(sfs)), 340cdf0e10cSrcweir osl_getThreadTextEncoding(), 341cdf0e10cSrcweir OUSTRING_TO_OSTRING_CVTFLAGS); 342cdf0e10cSrcweir OSL_ASSERT(pInfo->ustrFileSystemName != 0); 343cdf0e10cSrcweir 344cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_FileSystemName; 345cdf0e10cSrcweir } 346cdf0e10cSrcweir 347cdf0e10cSrcweir #endif /* __OSL_STATFS_TYPENAME */ 348cdf0e10cSrcweir 349cdf0e10cSrcweir if (uFieldMask & osl_VolumeInfo_Mask_DeviceHandle) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir /* FIXME: check also entries in mntent for the device 352cdf0e10cSrcweir and fill it with correct values */ 353cdf0e10cSrcweir 354cdf0e10cSrcweir *pInfo->pDeviceHandle = osl_isFloppyDrive(pszDirectory); 355cdf0e10cSrcweir 356cdf0e10cSrcweir if (*pInfo->pDeviceHandle) 357cdf0e10cSrcweir { 358cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_DeviceHandle; 359cdf0e10cSrcweir pInfo->uAttributes |= osl_Volume_Attribute_Removeable; 360cdf0e10cSrcweir pInfo->uValidFields |= osl_VolumeInfo_Mask_Attributes; 361cdf0e10cSrcweir } 362cdf0e10cSrcweir } 363cdf0e10cSrcweir return osl_File_E_None; 364cdf0e10cSrcweir } 365cdf0e10cSrcweir 366cdf0e10cSrcweir /****************************************************************************** 367cdf0e10cSrcweir * 368cdf0e10cSrcweir * GENERIC FLOPPY FUNCTIONS 369cdf0e10cSrcweir * 370cdf0e10cSrcweir *****************************************************************************/ 371cdf0e10cSrcweir 372cdf0e10cSrcweir 373cdf0e10cSrcweir /***************************************** 374cdf0e10cSrcweir * osl_unmountVolumeDevice 375cdf0e10cSrcweir ****************************************/ 376cdf0e10cSrcweir 377cdf0e10cSrcweir oslFileError osl_unmountVolumeDevice( oslVolumeDeviceHandle Handle ) 378cdf0e10cSrcweir { 379cdf0e10cSrcweir oslFileError tErr = osl_File_E_NOSYS; 380cdf0e10cSrcweir 381cdf0e10cSrcweir tErr = osl_unmountFloppy(Handle); 382cdf0e10cSrcweir 383cdf0e10cSrcweir /* Perhaps current working directory is set to mount point */ 384cdf0e10cSrcweir 385cdf0e10cSrcweir if ( tErr ) 386cdf0e10cSrcweir { 387cdf0e10cSrcweir sal_Char *pszHomeDir = getenv("HOME"); 388cdf0e10cSrcweir 389cdf0e10cSrcweir if ( pszHomeDir && strlen( pszHomeDir ) && 0 == chdir( pszHomeDir ) ) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir /* try again */ 392cdf0e10cSrcweir 393cdf0e10cSrcweir tErr = osl_unmountFloppy(Handle); 394cdf0e10cSrcweir 395cdf0e10cSrcweir OSL_ENSURE( tErr, "osl_unmountvolumeDevice: CWD was set to volume mount point" ); 396cdf0e10cSrcweir } 397cdf0e10cSrcweir } 398cdf0e10cSrcweir 399cdf0e10cSrcweir return tErr; 400cdf0e10cSrcweir } 401cdf0e10cSrcweir 402cdf0e10cSrcweir /***************************************** 403cdf0e10cSrcweir * osl_automountVolumeDevice 404cdf0e10cSrcweir ****************************************/ 405cdf0e10cSrcweir 406cdf0e10cSrcweir oslFileError osl_automountVolumeDevice( oslVolumeDeviceHandle Handle ) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir oslFileError tErr = osl_File_E_NOSYS; 409cdf0e10cSrcweir 410cdf0e10cSrcweir tErr = osl_mountFloppy(Handle); 411cdf0e10cSrcweir 412cdf0e10cSrcweir return tErr; 413cdf0e10cSrcweir } 414cdf0e10cSrcweir 415cdf0e10cSrcweir /***************************************** 416cdf0e10cSrcweir * osl_getVolumeDeviceMountPath 417cdf0e10cSrcweir ****************************************/ 418cdf0e10cSrcweir static rtl_uString* oslMakeUStrFromPsz(const sal_Char* pszStr, rtl_uString** ustrValid) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir rtl_string2UString( 421cdf0e10cSrcweir ustrValid, 422cdf0e10cSrcweir pszStr, 423cdf0e10cSrcweir rtl_str_getLength( pszStr ), 424cdf0e10cSrcweir osl_getThreadTextEncoding(), 425cdf0e10cSrcweir OUSTRING_TO_OSTRING_CVTFLAGS ); 426cdf0e10cSrcweir OSL_ASSERT(*ustrValid != 0); 427cdf0e10cSrcweir 428cdf0e10cSrcweir return *ustrValid; 429cdf0e10cSrcweir } 430cdf0e10cSrcweir 431cdf0e10cSrcweir oslFileError osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle, rtl_uString **pstrPath ) 432cdf0e10cSrcweir { 433cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pItem = (oslVolumeDeviceHandleImpl*) Handle; 434cdf0e10cSrcweir sal_Char Buffer[PATH_MAX]; 435cdf0e10cSrcweir 436cdf0e10cSrcweir Buffer[0] = '\0'; 437cdf0e10cSrcweir 438cdf0e10cSrcweir if ( pItem == 0 || pstrPath == 0 ) 439cdf0e10cSrcweir { 440cdf0e10cSrcweir return osl_File_E_INVAL; 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir return osl_File_E_INVAL; 446cdf0e10cSrcweir } 447cdf0e10cSrcweir 448cdf0e10cSrcweir #ifdef DEBUG_OSL_FILE 449cdf0e10cSrcweir fprintf(stderr,"Handle is:\n"); 450cdf0e10cSrcweir osl_printFloppyHandle(pItem); 451cdf0e10cSrcweir #endif 452cdf0e10cSrcweir 453cdf0e10cSrcweir snprintf(Buffer, sizeof(Buffer), "file://%s", pItem->pszMountPoint); 454cdf0e10cSrcweir 455cdf0e10cSrcweir #ifdef DEBUG_OSL_FILE 456cdf0e10cSrcweir fprintf(stderr,"Mount Point is: '%s'\n",Buffer); 457cdf0e10cSrcweir #endif 458cdf0e10cSrcweir 459cdf0e10cSrcweir oslMakeUStrFromPsz(Buffer, pstrPath); 460cdf0e10cSrcweir 461cdf0e10cSrcweir return osl_File_E_None; 462cdf0e10cSrcweir } 463cdf0e10cSrcweir 464cdf0e10cSrcweir /***************************************** 465cdf0e10cSrcweir * osl_acquireVolumeDeviceHandle 466cdf0e10cSrcweir ****************************************/ 467cdf0e10cSrcweir 468cdf0e10cSrcweir oslFileError SAL_CALL osl_acquireVolumeDeviceHandle( oslVolumeDeviceHandle Handle ) 469cdf0e10cSrcweir { 470cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pItem =(oslVolumeDeviceHandleImpl*) Handle; 471cdf0e10cSrcweir 472cdf0e10cSrcweir if ( pItem == 0 ) 473cdf0e10cSrcweir { 474cdf0e10cSrcweir return osl_File_E_INVAL; 475cdf0e10cSrcweir } 476cdf0e10cSrcweir 477cdf0e10cSrcweir if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir return osl_File_E_INVAL; 480cdf0e10cSrcweir } 481cdf0e10cSrcweir 482cdf0e10cSrcweir ++pItem->RefCount; 483cdf0e10cSrcweir 484cdf0e10cSrcweir return osl_File_E_None; 485cdf0e10cSrcweir } 486cdf0e10cSrcweir 487cdf0e10cSrcweir /***************************************** 488cdf0e10cSrcweir * osl_releaseVolumeDeviceHandle 489cdf0e10cSrcweir ****************************************/ 490cdf0e10cSrcweir 491cdf0e10cSrcweir oslFileError osl_releaseVolumeDeviceHandle( oslVolumeDeviceHandle Handle ) 492cdf0e10cSrcweir { 493cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pItem =(oslVolumeDeviceHandleImpl*) Handle; 494cdf0e10cSrcweir 495cdf0e10cSrcweir if ( pItem == 0 ) 496cdf0e10cSrcweir { 497cdf0e10cSrcweir return osl_File_E_INVAL; 498cdf0e10cSrcweir } 499cdf0e10cSrcweir 500cdf0e10cSrcweir if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) 501cdf0e10cSrcweir { 502cdf0e10cSrcweir return osl_File_E_INVAL; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir 505cdf0e10cSrcweir --pItem->RefCount; 506cdf0e10cSrcweir 507cdf0e10cSrcweir if ( pItem->RefCount == 0 ) 508cdf0e10cSrcweir { 509cdf0e10cSrcweir rtl_freeMemory(pItem); 510cdf0e10cSrcweir } 511cdf0e10cSrcweir 512cdf0e10cSrcweir return osl_File_E_None; 513cdf0e10cSrcweir } 514cdf0e10cSrcweir 515cdf0e10cSrcweir #ifndef MACOSX 516cdf0e10cSrcweir 517cdf0e10cSrcweir /***************************************** 518cdf0e10cSrcweir * osl_newVolumeDeviceHandleImpl 519cdf0e10cSrcweir ****************************************/ 520cdf0e10cSrcweir 521cdf0e10cSrcweir static oslVolumeDeviceHandleImpl* osl_newVolumeDeviceHandleImpl() 522cdf0e10cSrcweir { 523cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pHandle; 524cdf0e10cSrcweir const size_t nSizeOfHandle = sizeof(oslVolumeDeviceHandleImpl); 525cdf0e10cSrcweir 526cdf0e10cSrcweir pHandle = (oslVolumeDeviceHandleImpl*) rtl_allocateMemory (nSizeOfHandle); 527cdf0e10cSrcweir if (pHandle != NULL) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir pHandle->ident[0] = 'O'; 530cdf0e10cSrcweir pHandle->ident[1] = 'V'; 531cdf0e10cSrcweir pHandle->ident[2] = 'D'; 532cdf0e10cSrcweir pHandle->ident[3] = 'H'; 533cdf0e10cSrcweir pHandle->pszMountPoint[0] = '\0'; 534cdf0e10cSrcweir pHandle->pszFilePath[0] = '\0'; 535cdf0e10cSrcweir pHandle->pszDevice[0] = '\0'; 536cdf0e10cSrcweir pHandle->RefCount = 1; 537cdf0e10cSrcweir } 538cdf0e10cSrcweir return pHandle; 539cdf0e10cSrcweir } 540cdf0e10cSrcweir 541cdf0e10cSrcweir /***************************************** 542cdf0e10cSrcweir * osl_freeVolumeDeviceHandleImpl 543cdf0e10cSrcweir ****************************************/ 544cdf0e10cSrcweir 545cdf0e10cSrcweir static void osl_freeVolumeDeviceHandleImpl (oslVolumeDeviceHandleImpl* pHandle) 546cdf0e10cSrcweir { 547cdf0e10cSrcweir if (pHandle != NULL) 548cdf0e10cSrcweir rtl_freeMemory (pHandle); 549cdf0e10cSrcweir } 550cdf0e10cSrcweir #endif 551cdf0e10cSrcweir 552cdf0e10cSrcweir /****************************************************************************** 553cdf0e10cSrcweir * 554cdf0e10cSrcweir * SOLARIS FLOPPY FUNCTIONS 555cdf0e10cSrcweir * 556cdf0e10cSrcweir *****************************************************************************/ 557cdf0e10cSrcweir 558cdf0e10cSrcweir #if defined(SOLARIS) 559cdf0e10cSrcweir /* compare a given devicename with the typical device names on a Solaris box */ 560cdf0e10cSrcweir static sal_Bool 561cdf0e10cSrcweir osl_isAFloppyDevice (const char* pDeviceName) 562cdf0e10cSrcweir { 563cdf0e10cSrcweir const char* pFloppyDevice [] = { 564cdf0e10cSrcweir "/dev/fd", "/dev/rfd", 565cdf0e10cSrcweir "/dev/diskette", "/dev/rdiskette", 566cdf0e10cSrcweir "/vol/dev/diskette", "/vol/dev/rdiskette" 567cdf0e10cSrcweir }; 568cdf0e10cSrcweir 569cdf0e10cSrcweir int i; 570cdf0e10cSrcweir for (i = 0; i < (sizeof(pFloppyDevice)/sizeof(pFloppyDevice[0])); i++) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir if (strncmp(pDeviceName, pFloppyDevice[i], strlen(pFloppyDevice[i])) == 0) 573cdf0e10cSrcweir return sal_True; 574cdf0e10cSrcweir } 575cdf0e10cSrcweir return sal_False; 576cdf0e10cSrcweir } 577cdf0e10cSrcweir 578cdf0e10cSrcweir /* compare two directories whether the first may be a parent of the second. this 579cdf0e10cSrcweir * does not realpath() resolving */ 580cdf0e10cSrcweir static sal_Bool 581cdf0e10cSrcweir osl_isAParentDirectory (const char* pParentDir, const char* pSubDir) 582cdf0e10cSrcweir { 583cdf0e10cSrcweir return strncmp(pParentDir, pSubDir, strlen(pParentDir)) == 0; 584cdf0e10cSrcweir } 585cdf0e10cSrcweir 586cdf0e10cSrcweir /* the name of the routine is obviously silly. But anyway create a 587cdf0e10cSrcweir * oslVolumeDeviceHandle with correct mount point, device name and a resolved filepath 588cdf0e10cSrcweir * only if pszPath points to file or directory on a floppy */ 589cdf0e10cSrcweir static oslVolumeDeviceHandle 590cdf0e10cSrcweir osl_isFloppyDrive(const sal_Char* pszPath) 591cdf0e10cSrcweir { 592cdf0e10cSrcweir FILE* pMountTab; 593cdf0e10cSrcweir struct mnttab aMountEnt; 594cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pHandle; 595cdf0e10cSrcweir 596cdf0e10cSrcweir if ((pHandle = osl_newVolumeDeviceHandleImpl()) == NULL) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir return NULL; 599cdf0e10cSrcweir } 600cdf0e10cSrcweir if (realpath(pszPath, pHandle->pszFilePath) == NULL) 601cdf0e10cSrcweir { 602cdf0e10cSrcweir osl_freeVolumeDeviceHandleImpl (pHandle); 603cdf0e10cSrcweir return NULL; 604cdf0e10cSrcweir } 605cdf0e10cSrcweir if ((pMountTab = fopen (MOUNTTAB, "r")) == NULL) 606cdf0e10cSrcweir { 607cdf0e10cSrcweir osl_freeVolumeDeviceHandleImpl (pHandle); 608cdf0e10cSrcweir return NULL; 609cdf0e10cSrcweir } 610cdf0e10cSrcweir 611cdf0e10cSrcweir while (getmntent(pMountTab, &aMountEnt) == 0) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir const char *pMountPoint = aMountEnt.mnt_mountp; 614cdf0e10cSrcweir const char *pDevice = aMountEnt.mnt_special; 615cdf0e10cSrcweir if ( osl_isAParentDirectory (aMountEnt.mnt_mountp, pHandle->pszFilePath) 616cdf0e10cSrcweir && osl_isAFloppyDevice (aMountEnt.mnt_special)) 617cdf0e10cSrcweir { 618cdf0e10cSrcweir /* skip the last item for it is the name of the disk */ 619cdf0e10cSrcweir char * pc = strrchr( aMountEnt.mnt_special, '/' ); 620cdf0e10cSrcweir 621cdf0e10cSrcweir if ( NULL != pc ) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir int len = pc - aMountEnt.mnt_special; 624cdf0e10cSrcweir 625cdf0e10cSrcweir strncpy( pHandle->pszDevice, aMountEnt.mnt_special, len ); 626cdf0e10cSrcweir pHandle->pszDevice[len] = '\0'; 627cdf0e10cSrcweir } 628cdf0e10cSrcweir else 629cdf0e10cSrcweir { 630cdf0e10cSrcweir /* #106048 use save str functions to avoid buffer overflows */ 631cdf0e10cSrcweir memset(pHandle->pszDevice, 0, sizeof(pHandle->pszDevice)); 632cdf0e10cSrcweir strncpy(pHandle->pszDevice, aMountEnt.mnt_special, sizeof(pHandle->pszDevice) - 1); 633cdf0e10cSrcweir } 634cdf0e10cSrcweir 635cdf0e10cSrcweir /* remember the mount point */ 636cdf0e10cSrcweir memset(pHandle->pszMountPoint, 0, sizeof(pHandle->pszMountPoint)); 637cdf0e10cSrcweir strncpy(pHandle->pszMountPoint, aMountEnt.mnt_mountp, sizeof(pHandle->pszMountPoint) - 1); 638cdf0e10cSrcweir 639cdf0e10cSrcweir fclose (pMountTab); 640cdf0e10cSrcweir return pHandle; 641cdf0e10cSrcweir } 642cdf0e10cSrcweir } 643cdf0e10cSrcweir 644cdf0e10cSrcweir fclose (pMountTab); 645cdf0e10cSrcweir osl_freeVolumeDeviceHandleImpl (pHandle); 646cdf0e10cSrcweir return NULL; 647cdf0e10cSrcweir } 648cdf0e10cSrcweir 649cdf0e10cSrcweir static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy) 650cdf0e10cSrcweir { 651cdf0e10cSrcweir FILE* pMountTab; 652cdf0e10cSrcweir struct mnttab aMountEnt; 653cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pHandle = (oslVolumeDeviceHandleImpl*) hFloppy; 654cdf0e10cSrcweir 655cdf0e10cSrcweir int nRet=0; 656cdf0e10cSrcweir sal_Char pszCmd[512] = ""; 657cdf0e10cSrcweir 658cdf0e10cSrcweir if ( pHandle == 0 ) 659cdf0e10cSrcweir return osl_File_E_INVAL; 660cdf0e10cSrcweir 661cdf0e10cSrcweir /* FIXME: don't know what this is good for */ 662cdf0e10cSrcweir if ( pHandle->ident[0] != 'O' || pHandle->ident[1] != 'V' || pHandle->ident[2] != 'D' || pHandle->ident[3] != 'H' ) 663cdf0e10cSrcweir return osl_File_E_INVAL; 664cdf0e10cSrcweir 665cdf0e10cSrcweir snprintf(pszCmd, sizeof(pszCmd), "eject -q %s > /dev/null 2>&1", pHandle->pszDevice); 666cdf0e10cSrcweir 667cdf0e10cSrcweir nRet = system( pszCmd ); 668cdf0e10cSrcweir 669cdf0e10cSrcweir switch ( WEXITSTATUS(nRet) ) 670cdf0e10cSrcweir { 671cdf0e10cSrcweir case 0: 672cdf0e10cSrcweir { 673cdf0e10cSrcweir /* lookup the device in mount tab again */ 674cdf0e10cSrcweir if ((pMountTab = fopen (MOUNTTAB, "r")) == NULL) 675cdf0e10cSrcweir return osl_File_E_BUSY; 676cdf0e10cSrcweir 677cdf0e10cSrcweir while (getmntent(pMountTab, &aMountEnt) == 0) 678cdf0e10cSrcweir { 679cdf0e10cSrcweir const char *pMountPoint = aMountEnt.mnt_mountp; 680cdf0e10cSrcweir const char *pDevice = aMountEnt.mnt_special; 681cdf0e10cSrcweir if ( 0 == strncmp( pHandle->pszDevice, aMountEnt.mnt_special, strlen(pHandle->pszDevice) ) ) 682cdf0e10cSrcweir { 683cdf0e10cSrcweir memset(pHandle->pszMountPoint, 0, sizeof(pHandle->pszMountPoint)); 684cdf0e10cSrcweir strncpy (pHandle->pszMountPoint, aMountEnt.mnt_mountp, sizeof(pHandle->pszMountPoint) - 1); 685cdf0e10cSrcweir 686cdf0e10cSrcweir fclose (pMountTab); 687cdf0e10cSrcweir return osl_File_E_None; 688cdf0e10cSrcweir } 689cdf0e10cSrcweir } 690cdf0e10cSrcweir 691cdf0e10cSrcweir fclose (pMountTab); 692cdf0e10cSrcweir return osl_File_E_BUSY; 693cdf0e10cSrcweir } 694cdf0e10cSrcweir //break; // break not necessary here, see return statements before 695cdf0e10cSrcweir 696cdf0e10cSrcweir case 1: 697cdf0e10cSrcweir return osl_File_E_BUSY; 698cdf0e10cSrcweir 699cdf0e10cSrcweir default: 700cdf0e10cSrcweir break; 701cdf0e10cSrcweir } 702cdf0e10cSrcweir 703cdf0e10cSrcweir return osl_File_E_BUSY; 704cdf0e10cSrcweir } 705cdf0e10cSrcweir 706cdf0e10cSrcweir static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir // FILE* pMountTab; 709cdf0e10cSrcweir // struct mnttab aMountEnt; 710cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pHandle = (oslVolumeDeviceHandleImpl*) hFloppy; 711cdf0e10cSrcweir 712cdf0e10cSrcweir int nRet=0; 713cdf0e10cSrcweir sal_Char pszCmd[512] = ""; 714cdf0e10cSrcweir 715cdf0e10cSrcweir if ( pHandle == 0 ) 716cdf0e10cSrcweir return osl_File_E_INVAL; 717cdf0e10cSrcweir 718cdf0e10cSrcweir /* FIXME: don't know what this is good for */ 719cdf0e10cSrcweir if ( pHandle->ident[0] != 'O' || pHandle->ident[1] != 'V' || pHandle->ident[2] != 'D' || pHandle->ident[3] != 'H' ) 720cdf0e10cSrcweir return osl_File_E_INVAL; 721cdf0e10cSrcweir 722cdf0e10cSrcweir snprintf(pszCmd, sizeof(pszCmd), "eject %s > /dev/null 2>&1", pHandle->pszDevice); 723cdf0e10cSrcweir 724cdf0e10cSrcweir nRet = system( pszCmd ); 725cdf0e10cSrcweir 726cdf0e10cSrcweir switch ( WEXITSTATUS(nRet) ) 727cdf0e10cSrcweir { 728cdf0e10cSrcweir case 0: 729cdf0e10cSrcweir { 730cdf0e10cSrcweir FILE* pMountTab; 731cdf0e10cSrcweir struct mnttab aMountEnt; 732cdf0e10cSrcweir 733cdf0e10cSrcweir /* lookup if device is still in mount tab */ 734cdf0e10cSrcweir if ((pMountTab = fopen (MOUNTTAB, "r")) == NULL) 735cdf0e10cSrcweir return osl_File_E_BUSY; 736cdf0e10cSrcweir 737cdf0e10cSrcweir while (getmntent(pMountTab, &aMountEnt) == 0) 738cdf0e10cSrcweir { 739cdf0e10cSrcweir const char *pMountPoint = aMountEnt.mnt_mountp; 740cdf0e10cSrcweir const char *pDevice = aMountEnt.mnt_special; 741cdf0e10cSrcweir if ( 0 == strncmp( pHandle->pszDevice, aMountEnt.mnt_special, strlen(pHandle->pszDevice) ) ) 742cdf0e10cSrcweir { 743cdf0e10cSrcweir fclose (pMountTab); 744cdf0e10cSrcweir return osl_File_E_BUSY; 745cdf0e10cSrcweir } 746cdf0e10cSrcweir } 747cdf0e10cSrcweir 748cdf0e10cSrcweir fclose (pMountTab); 749cdf0e10cSrcweir pHandle->pszMountPoint[0] = 0; 750cdf0e10cSrcweir return osl_File_E_None; 751cdf0e10cSrcweir } 752cdf0e10cSrcweir 753cdf0e10cSrcweir //break; //break not necessary, see return statements before 754cdf0e10cSrcweir 755cdf0e10cSrcweir case 1: 756cdf0e10cSrcweir return osl_File_E_NODEV; 757cdf0e10cSrcweir 758cdf0e10cSrcweir case 4: 759cdf0e10cSrcweir pHandle->pszMountPoint[0] = 0; 760cdf0e10cSrcweir return osl_File_E_None; 761cdf0e10cSrcweir 762cdf0e10cSrcweir default: 763cdf0e10cSrcweir break; 764cdf0e10cSrcweir } 765cdf0e10cSrcweir 766cdf0e10cSrcweir return osl_File_E_BUSY; 767cdf0e10cSrcweir } 768cdf0e10cSrcweir 769cdf0e10cSrcweir #endif /* SOLARIS */ 770cdf0e10cSrcweir 771cdf0e10cSrcweir /****************************************************************************** 772cdf0e10cSrcweir * 773cdf0e10cSrcweir * LINUX FLOPPY FUNCTIONS 774cdf0e10cSrcweir * 775cdf0e10cSrcweir *****************************************************************************/ 776cdf0e10cSrcweir 777cdf0e10cSrcweir #if defined(LINUX) 778cdf0e10cSrcweir static oslVolumeDeviceHandle 779cdf0e10cSrcweir osl_isFloppyDrive (const sal_Char* pszPath) 780cdf0e10cSrcweir { 781cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pItem = osl_newVolumeDeviceHandleImpl(); 782cdf0e10cSrcweir if (osl_getFloppyMountEntry(pszPath, pItem)) 783cdf0e10cSrcweir return (oslVolumeDeviceHandle) pItem; 784cdf0e10cSrcweir 785cdf0e10cSrcweir osl_freeVolumeDeviceHandleImpl (pItem); 786cdf0e10cSrcweir return 0; 787cdf0e10cSrcweir } 788cdf0e10cSrcweir #endif /* LINUX */ 789cdf0e10cSrcweir 790cdf0e10cSrcweir #if defined(LINUX) 791cdf0e10cSrcweir static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir sal_Bool bRet = sal_False; 794cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pItem=0; 795cdf0e10cSrcweir int nRet; 796cdf0e10cSrcweir sal_Char pszCmd[PATH_MAX]; 797cdf0e10cSrcweir const sal_Char* pszMountProg = "mount"; 798cdf0e10cSrcweir sal_Char* pszSuDo = 0; 799cdf0e10cSrcweir sal_Char* pszTmp = 0; 800cdf0e10cSrcweir 801cdf0e10cSrcweir pszCmd[0] = '\0'; 802cdf0e10cSrcweir 803cdf0e10cSrcweir #ifdef TRACE_OSL_FILE 804cdf0e10cSrcweir fprintf(stderr,"In osl_mountFloppy\n"); 805cdf0e10cSrcweir #endif 806cdf0e10cSrcweir 807cdf0e10cSrcweir pItem = (oslVolumeDeviceHandleImpl*) hFloppy; 808cdf0e10cSrcweir 809cdf0e10cSrcweir if ( pItem == 0 ) 810cdf0e10cSrcweir { 811cdf0e10cSrcweir #ifdef TRACE_OSL_FILE 812cdf0e10cSrcweir fprintf(stderr,"Out osl_mountFloppy [pItem == 0]\n"); 813cdf0e10cSrcweir #endif 814cdf0e10cSrcweir 815cdf0e10cSrcweir return osl_File_E_INVAL; 816cdf0e10cSrcweir } 817cdf0e10cSrcweir 818cdf0e10cSrcweir if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) 819cdf0e10cSrcweir { 820cdf0e10cSrcweir #ifdef TRACE_OSL_FILE 821cdf0e10cSrcweir fprintf(stderr,"Out osl_mountFloppy [invalid handle]\n"); 822cdf0e10cSrcweir #endif 823cdf0e10cSrcweir return osl_File_E_INVAL; 824cdf0e10cSrcweir } 825cdf0e10cSrcweir 826cdf0e10cSrcweir bRet = osl_isFloppyMounted(pItem); 827cdf0e10cSrcweir if ( bRet == sal_True ) 828cdf0e10cSrcweir { 829cdf0e10cSrcweir #ifdef DEBUG_OSL_FILE 830cdf0e10cSrcweir fprintf(stderr,"detected mounted floppy at '%s'\n",pItem->pszMountPoint); 831cdf0e10cSrcweir #endif 832cdf0e10cSrcweir return osl_File_E_BUSY; 833cdf0e10cSrcweir } 834cdf0e10cSrcweir 835cdf0e10cSrcweir /* mfe: we can't use the mount(2) system call!!! */ 836cdf0e10cSrcweir /* even if we are root */ 837cdf0e10cSrcweir /* since mtab is not updated!!! */ 838cdf0e10cSrcweir /* but we need it to be updated */ 839cdf0e10cSrcweir /* some "magic" must be done */ 840cdf0e10cSrcweir 841cdf0e10cSrcweir /* nRet = mount(pItem->pszDevice,pItem->pszMountPoint,0,0,0); */ 842cdf0e10cSrcweir /* if ( nRet != 0 ) */ 843cdf0e10cSrcweir /* { */ 844cdf0e10cSrcweir /* nRet=errno; */ 845cdf0e10cSrcweir /* #ifdef DEBUG_OSL_FILE */ 846cdf0e10cSrcweir /* perror("mount"); */ 847cdf0e10cSrcweir /* #endif */ 848cdf0e10cSrcweir /* } */ 849cdf0e10cSrcweir 850cdf0e10cSrcweir pszTmp = getenv("SAL_MOUNT_MOUNTPROG"); 851cdf0e10cSrcweir if ( pszTmp != 0 ) 852cdf0e10cSrcweir { 853cdf0e10cSrcweir pszMountProg=pszTmp; 854cdf0e10cSrcweir } 855cdf0e10cSrcweir 856cdf0e10cSrcweir pszTmp=getenv("SAL_MOUNT_SU_DO"); 857cdf0e10cSrcweir if ( pszTmp != 0 ) 858cdf0e10cSrcweir { 859cdf0e10cSrcweir pszSuDo=pszTmp; 860cdf0e10cSrcweir } 861cdf0e10cSrcweir 862cdf0e10cSrcweir if ( pszSuDo != 0 ) 863cdf0e10cSrcweir { 864cdf0e10cSrcweir snprintf(pszCmd, sizeof(pszCmd), "%s %s %s %s",pszSuDo,pszMountProg,pItem->pszDevice,pItem->pszMountPoint); 865cdf0e10cSrcweir } 866cdf0e10cSrcweir else 867cdf0e10cSrcweir { 868cdf0e10cSrcweir snprintf(pszCmd, sizeof(pszCmd), "%s %s",pszMountProg,pItem->pszMountPoint); 869cdf0e10cSrcweir } 870cdf0e10cSrcweir 871cdf0e10cSrcweir 872cdf0e10cSrcweir #ifdef DEBUG_OSL_FILE 873cdf0e10cSrcweir fprintf(stderr,"executing '%s'\n",pszCmd); 874cdf0e10cSrcweir #endif 875cdf0e10cSrcweir 876cdf0e10cSrcweir nRet = system(pszCmd); 877cdf0e10cSrcweir 878cdf0e10cSrcweir #ifdef DEBUG_OSL_FILE 879cdf0e10cSrcweir fprintf(stderr,"call returned '%i'\n",nRet); 880cdf0e10cSrcweir fprintf(stderr,"exit status is '%i'\n", WEXITSTATUS(nRet)); 881cdf0e10cSrcweir #endif 882cdf0e10cSrcweir 883cdf0e10cSrcweir 884cdf0e10cSrcweir switch ( WEXITSTATUS(nRet) ) 885cdf0e10cSrcweir { 886cdf0e10cSrcweir case 0: 887cdf0e10cSrcweir nRet=0; 888cdf0e10cSrcweir break; 889cdf0e10cSrcweir 890cdf0e10cSrcweir case 2: 891cdf0e10cSrcweir nRet=EPERM; 892cdf0e10cSrcweir break; 893cdf0e10cSrcweir 894cdf0e10cSrcweir case 4: 895cdf0e10cSrcweir nRet=ENOENT; 896cdf0e10cSrcweir break; 897cdf0e10cSrcweir 898cdf0e10cSrcweir case 8: 899cdf0e10cSrcweir nRet=EINTR; 900cdf0e10cSrcweir break; 901cdf0e10cSrcweir 902cdf0e10cSrcweir case 16: 903cdf0e10cSrcweir nRet=EPERM; 904cdf0e10cSrcweir break; 905cdf0e10cSrcweir 906cdf0e10cSrcweir case 32: 907cdf0e10cSrcweir nRet=EBUSY; 908cdf0e10cSrcweir break; 909cdf0e10cSrcweir 910cdf0e10cSrcweir case 64: 911cdf0e10cSrcweir nRet=EAGAIN; 912cdf0e10cSrcweir break; 913cdf0e10cSrcweir 914cdf0e10cSrcweir default: 915cdf0e10cSrcweir nRet=EBUSY; 916cdf0e10cSrcweir break; 917cdf0e10cSrcweir } 918cdf0e10cSrcweir 919cdf0e10cSrcweir return ((0 == nRet) ? oslTranslateFileError(OSL_FET_SUCCESS, nRet) : oslTranslateFileError(OSL_FET_ERROR, nRet)); 920cdf0e10cSrcweir } 921cdf0e10cSrcweir #endif /* LINUX */ 922cdf0e10cSrcweir 923cdf0e10cSrcweir 924cdf0e10cSrcweir #if defined(LINUX) 925cdf0e10cSrcweir static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy) 926cdf0e10cSrcweir { 927cdf0e10cSrcweir oslVolumeDeviceHandleImpl* pItem=0; 928cdf0e10cSrcweir int nRet=0; 929cdf0e10cSrcweir sal_Char pszCmd[PATH_MAX]; 930cdf0e10cSrcweir sal_Char* pszTmp = 0; 931cdf0e10cSrcweir sal_Char* pszSuDo = 0; 932cdf0e10cSrcweir const sal_Char* pszUmountProg = "umount"; 933cdf0e10cSrcweir 934cdf0e10cSrcweir pszCmd[0] = '\0'; 935cdf0e10cSrcweir 936cdf0e10cSrcweir #ifdef TRACE_OSL_FILE 937cdf0e10cSrcweir fprintf(stderr,"In osl_unmountFloppy\n"); 938cdf0e10cSrcweir #endif 939cdf0e10cSrcweir 940cdf0e10cSrcweir pItem = (oslVolumeDeviceHandleImpl*) hFloppy; 941cdf0e10cSrcweir 942cdf0e10cSrcweir if ( pItem == 0 ) 943cdf0e10cSrcweir { 944cdf0e10cSrcweir #ifdef TRACE_OSL_FILE 945cdf0e10cSrcweir fprintf(stderr,"Out osl_unmountFloppy [pItem==0]\n"); 946cdf0e10cSrcweir #endif 947cdf0e10cSrcweir return osl_File_E_INVAL; 948cdf0e10cSrcweir } 949cdf0e10cSrcweir 950cdf0e10cSrcweir if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) 951cdf0e10cSrcweir { 952cdf0e10cSrcweir #ifdef TRACE_OSL_FILE 953cdf0e10cSrcweir fprintf(stderr,"Out osl_unmountFloppy [invalid handle]\n"); 954cdf0e10cSrcweir #endif 955cdf0e10cSrcweir return osl_File_E_INVAL; 956cdf0e10cSrcweir } 957cdf0e10cSrcweir 958cdf0e10cSrcweir /* mfe: we can't use the umount(2) system call!!! */ 959cdf0e10cSrcweir /* even if we are root */ 960cdf0e10cSrcweir /* since mtab is not updated!!! */ 961cdf0e10cSrcweir /* but we need it to be updated */ 962cdf0e10cSrcweir /* some "magic" must be done */ 963cdf0e10cSrcweir 964cdf0e10cSrcweir /* nRet=umount(pItem->pszDevice); */ 965cdf0e10cSrcweir /* if ( nRet != 0 ) */ 966cdf0e10cSrcweir /* { */ 967cdf0e10cSrcweir /* nRet = errno; */ 968cdf0e10cSrcweir 969cdf0e10cSrcweir /* #ifdef DEBUG_OSL_FILE */ 970cdf0e10cSrcweir /* perror("mount"); */ 971cdf0e10cSrcweir /* #endif */ 972cdf0e10cSrcweir /* } */ 973cdf0e10cSrcweir 974cdf0e10cSrcweir 975cdf0e10cSrcweir pszTmp = getenv("SAL_MOUNT_UMOUNTPROG"); 976cdf0e10cSrcweir if ( pszTmp != 0 ) 977cdf0e10cSrcweir { 978cdf0e10cSrcweir pszUmountProg=pszTmp; 979cdf0e10cSrcweir } 980cdf0e10cSrcweir 981cdf0e10cSrcweir pszTmp = getenv("SAL_MOUNT_SU_DO"); 982cdf0e10cSrcweir if ( pszTmp != 0 ) 983cdf0e10cSrcweir { 984cdf0e10cSrcweir pszSuDo=pszTmp; 985cdf0e10cSrcweir } 986cdf0e10cSrcweir 987cdf0e10cSrcweir if ( pszSuDo != 0 ) 988cdf0e10cSrcweir { 989cdf0e10cSrcweir snprintf(pszCmd, sizeof(pszCmd), "%s %s %s",pszSuDo,pszUmountProg,pItem->pszMountPoint); 990cdf0e10cSrcweir } 991cdf0e10cSrcweir else 992cdf0e10cSrcweir { 993cdf0e10cSrcweir snprintf(pszCmd, sizeof(pszCmd), "%s %s",pszUmountProg,pItem->pszMountPoint); 994cdf0e10cSrcweir } 995cdf0e10cSrcweir 996cdf0e10cSrcweir 997cdf0e10cSrcweir #ifdef DEBUG_OSL_FILE 998cdf0e10cSrcweir fprintf(stderr,"executing '%s'\n",pszCmd); 999cdf0e10cSrcweir #endif 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir nRet = system(pszCmd); 1002cdf0e10cSrcweir 1003cdf0e10cSrcweir #ifdef DEBUG_OSL_FILE 1004cdf0e10cSrcweir fprintf(stderr,"call returned '%i'\n",nRet); 1005cdf0e10cSrcweir fprintf(stderr,"exit status is '%i'\n", WEXITSTATUS(nRet)); 1006cdf0e10cSrcweir #endif 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir switch ( WEXITSTATUS(nRet) ) 1009cdf0e10cSrcweir { 1010cdf0e10cSrcweir case 0: 1011cdf0e10cSrcweir nRet=0; 1012cdf0e10cSrcweir break; 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir default: 1015cdf0e10cSrcweir nRet=EBUSY; 1016cdf0e10cSrcweir break; 1017cdf0e10cSrcweir } 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir #ifdef TRACE_OSL_FILE 1020cdf0e10cSrcweir fprintf(stderr,"Out osl_unmountFloppy [ok]\n"); 1021cdf0e10cSrcweir #endif 1022cdf0e10cSrcweir 1023cdf0e10cSrcweir return ((0 == nRet) ? oslTranslateFileError(OSL_FET_SUCCESS, nRet) : oslTranslateFileError(OSL_FET_ERROR, nRet)); 1024cdf0e10cSrcweir 1025cdf0e10cSrcweir /* return osl_File_E_None;*/ 1026cdf0e10cSrcweir } 1027cdf0e10cSrcweir 1028cdf0e10cSrcweir #endif /* LINUX */ 1029cdf0e10cSrcweir 1030cdf0e10cSrcweir #if defined(LINUX) 1031cdf0e10cSrcweir static sal_Bool 1032cdf0e10cSrcweir osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem) 1033cdf0e10cSrcweir { 1034cdf0e10cSrcweir struct mntent* pMountEnt; 1035cdf0e10cSrcweir FILE* pMountTab; 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir pMountTab = setmntent (MOUNTTAB, "r"); 1038cdf0e10cSrcweir if (pMountTab == 0) 1039cdf0e10cSrcweir return sal_False; 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir while ((pMountEnt = getmntent(pMountTab)) != 0) 1042cdf0e10cSrcweir { 1043cdf0e10cSrcweir if ( strncmp(pMountEnt->mnt_dir, pszPath, strlen(pMountEnt->mnt_dir)) == 0 1044cdf0e10cSrcweir && strncmp(pMountEnt->mnt_fsname, "/dev/fd", strlen("/dev/fd")) == 0) 1045cdf0e10cSrcweir { 1046cdf0e10cSrcweir memset(pItem->pszMountPoint, 0, sizeof(pItem->pszMountPoint)); 1047cdf0e10cSrcweir strncpy(pItem->pszMountPoint, pMountEnt->mnt_dir, sizeof(pItem->pszMountPoint) - 1); 1048cdf0e10cSrcweir 1049cdf0e10cSrcweir memset(pItem->pszFilePath, 0, sizeof(pItem->pszFilePath)); 1050cdf0e10cSrcweir strncpy(pItem->pszFilePath, pMountEnt->mnt_dir, sizeof(pItem->pszFilePath) - 1); 1051cdf0e10cSrcweir 1052cdf0e10cSrcweir memset(pItem->pszDevice, 0, sizeof(pItem->pszDevice)); 1053cdf0e10cSrcweir strncpy(pItem->pszDevice, pMountEnt->mnt_fsname, sizeof(pItem->pszDevice) - 1); 1054cdf0e10cSrcweir 1055cdf0e10cSrcweir endmntent (pMountTab); 1056cdf0e10cSrcweir return sal_True; 1057cdf0e10cSrcweir } 1058cdf0e10cSrcweir } 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir endmntent (pMountTab); 1061cdf0e10cSrcweir return sal_False; 1062cdf0e10cSrcweir } 1063cdf0e10cSrcweir #endif /* LINUX */ 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir #if defined(LINUX) 1066cdf0e10cSrcweir static sal_Bool 1067cdf0e10cSrcweir osl_isFloppyMounted (oslVolumeDeviceHandleImpl* pDevice) 1068cdf0e10cSrcweir { 1069cdf0e10cSrcweir oslVolumeDeviceHandleImpl aItem; 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir if ( osl_getFloppyMountEntry (pDevice->pszMountPoint, &aItem) 1072cdf0e10cSrcweir && strcmp (aItem.pszMountPoint, pDevice->pszMountPoint) == 0 1073cdf0e10cSrcweir && strcmp (aItem.pszDevice, pDevice->pszDevice) == 0) 1074cdf0e10cSrcweir { 1075cdf0e10cSrcweir return sal_True; 1076cdf0e10cSrcweir } 1077cdf0e10cSrcweir return sal_False; 1078cdf0e10cSrcweir } 1079cdf0e10cSrcweir #endif /* LINUX */ 1080cdf0e10cSrcweir 1081cdf0e10cSrcweir /* NetBSD floppy functions have to be added here. Until we have done that, 1082cdf0e10cSrcweir * we use the MACOSX definitions for nonexistent floppy. 1083cdf0e10cSrcweir * */ 1084cdf0e10cSrcweir 1085cdf0e10cSrcweir /****************************************************************************** 1086cdf0e10cSrcweir * 1087cdf0e10cSrcweir * MAC OS X FLOPPY FUNCTIONS 1088cdf0e10cSrcweir * 1089cdf0e10cSrcweir *****************************************************************************/ 1090cdf0e10cSrcweir 1091cdf0e10cSrcweir #if (defined(MACOSX) || defined(NETBSD) || defined(FREEBSD)) 1092cdf0e10cSrcweir static oslVolumeDeviceHandle osl_isFloppyDrive(const sal_Char* pszPath) 1093cdf0e10cSrcweir { 1094cdf0e10cSrcweir return NULL; 1095cdf0e10cSrcweir } 1096cdf0e10cSrcweir #endif /* MACOSX */ 1097cdf0e10cSrcweir 1098cdf0e10cSrcweir #if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD)) 1099cdf0e10cSrcweir static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy) 1100cdf0e10cSrcweir { 1101cdf0e10cSrcweir return osl_File_E_BUSY; 1102cdf0e10cSrcweir } 1103cdf0e10cSrcweir #endif /* MACOSX */ 1104cdf0e10cSrcweir 1105cdf0e10cSrcweir #if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD)) 1106cdf0e10cSrcweir static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy) 1107cdf0e10cSrcweir { 1108cdf0e10cSrcweir return osl_File_E_BUSY; 1109cdf0e10cSrcweir } 1110cdf0e10cSrcweir #endif /* MACOSX */ 1111cdf0e10cSrcweir 1112cdf0e10cSrcweir #if ( defined(NETBSD) || defined(FREEBSD) ) 1113cdf0e10cSrcweir static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem) 1114cdf0e10cSrcweir { 1115cdf0e10cSrcweir return sal_False; 1116cdf0e10cSrcweir } 1117cdf0e10cSrcweir #endif /* NETBSD || FREEBSD */ 1118cdf0e10cSrcweir 1119cdf0e10cSrcweir #if ( defined(NETBSD) || defined(FREEBSD) ) 1120cdf0e10cSrcweir static sal_Bool osl_isFloppyMounted(oslVolumeDeviceHandleImpl* pDevice) 1121cdf0e10cSrcweir { 1122cdf0e10cSrcweir return sal_False; 1123cdf0e10cSrcweir } 1124cdf0e10cSrcweir #endif /* NETBSD || FREEBSD */ 1125cdf0e10cSrcweir 1126cdf0e10cSrcweir 1127cdf0e10cSrcweir #ifdef DEBUG_OSL_FILE 1128cdf0e10cSrcweir static void osl_printFloppyHandle(oslVolumeDeviceHandleImpl* pItem) 1129cdf0e10cSrcweir { 1130cdf0e10cSrcweir if (pItem == 0 ) 1131cdf0e10cSrcweir { 1132cdf0e10cSrcweir fprintf(stderr,"NULL Handle\n"); 1133cdf0e10cSrcweir return; 1134cdf0e10cSrcweir } 1135cdf0e10cSrcweir if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) 1136cdf0e10cSrcweir { 1137cdf0e10cSrcweir #ifdef TRACE_OSL_FILE 1138cdf0e10cSrcweir fprintf(stderr,"Invalid Handle]\n"); 1139cdf0e10cSrcweir #endif 1140cdf0e10cSrcweir return; 1141cdf0e10cSrcweir } 1142cdf0e10cSrcweir 1143cdf0e10cSrcweir 1144cdf0e10cSrcweir fprintf(stderr,"MountPoint : '%s'\n",pItem->pszMountPoint); 1145cdf0e10cSrcweir fprintf(stderr,"FilePath : '%s'\n",pItem->pszFilePath); 1146cdf0e10cSrcweir fprintf(stderr,"Device : '%s'\n",pItem->pszDevice); 1147cdf0e10cSrcweir 1148cdf0e10cSrcweir return; 1149cdf0e10cSrcweir } 1150cdf0e10cSrcweir #endif 1151