/[rdesktop]/sourceforge.net/trunk/rdesktop/disk.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/disk.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 865 by stargo, Tue Mar 15 11:25:50 2005 UTC revision 873 by stargo, Sat Apr 2 17:31:27 2005 UTC
# Line 18  Line 18 
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */  */
20    
 #include "rdesktop.h"  
21  #include "disk.h"  #include "disk.h"
22    
23  #include <sys/types.h>  #include <sys/types.h>
# Line 38  Line 37 
37  #define DIRFD(a) ((a)->DIR_FD_MEMBER_NAME)  #define DIRFD(a) ((a)->DIR_FD_MEMBER_NAME)
38  #endif  #endif
39    
40  /* TODO: let autoconf figure out everything below... */  /* TODO: Fix mntent-handling for solaris
41  #if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))   * #include <sys/mntent.h> */
42  #define SOLARIS  #if (defined(HAVE_MNTENT_H) && defined(HAVE_SETMNTENT))
43    #include <mntent.h>
44    #define MNTENT_PATH "/etc/mtab"
45    #define USE_SETMNTENT
46  #endif  #endif
47    
48  #if (defined(SOLARIS) || defined (__hpux) || defined(__BEOS__))  #ifdef HAVE_SYS_VFS_H
49  #include <sys/statvfs.h>        /* solaris statvfs */  #include <sys/vfs.h>
50  /* TODO: Fix mntent-handling for solaris/hpux  #endif
51   * #include <sys/mntent.h> */  
52  #undef HAVE_MNTENT_H  #ifdef HAVE_SYS_STATVFS_H
53  #define MNTENT_PATH "/etc/mnttab"  #include <sys/statvfs.h>
54  #define STATFS_FN(path, buf) (statvfs(path,buf))  #endif
 #define STATFS_T statvfs  
 #define F_NAMELEN(buf) ((buf).f_namemax)  
55    
56  #elif (defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__APPLE__))  #ifdef HAVE_SYS_STATFS_H
57    #include <sys/statfs.h>
58    #endif
59    
60    #ifdef HAVE_SYS_PARAM_H
61  #include <sys/param.h>  #include <sys/param.h>
62    #endif
63    
64    #ifdef HAVE_SYS_MOUNT_H
65  #include <sys/mount.h>  #include <sys/mount.h>
66  #define STATFS_FN(path, buf) (statfs(path,buf))  #endif
67    
68    #include "rdesktop.h"
69    
70    #ifdef STAT_STATFS3_OSF1
71    #define STATFS_FN(path, buf) (statfs(path,buf,sizeof(buf)))
72  #define STATFS_T statfs  #define STATFS_T statfs
73  #define F_NAMELEN(buf) (NAME_MAX)  #define USE_STATFS
74    #endif
75    
76  #elif (defined(__SGI_IRIX__))  #ifdef STAT_STATVFS
 #include <sys/types.h>  
 #include <sys/statvfs.h>  
77  #define STATFS_FN(path, buf) (statvfs(path,buf))  #define STATFS_FN(path, buf) (statvfs(path,buf))
78  #define STATFS_T statvfs  #define STATFS_T statvfs
79  #define F_NAMELEN(buf) ((buf).f_namemax)  #define USE_STATVFS
80    #endif
81    
82  #elif (defined(__alpha) && !defined(linux))  #ifdef STAT_STATVFS64
83  #include <sys/mount.h>          /* osf1 statfs */  #define STATFS_FN(path, buf) (statvfs64(path,buf))
84  #define STATFS_FN(path, buf) (statfs(path,buf,sizeof(buf)))  #define STATFS_T statvfs64
85  #define STATFS_T statfs  #define USE_STATVFS
86  #define F_NAMELEN(buf) (255)  #endif
87    
88  #else  #if (defined(STAT_STATFS2_FS_DATA) || defined(STAT_STATFS2_BSIZE) || defined(STAT_STATFS2_FSIZE))
 #include <sys/vfs.h>            /* linux statfs */  
 #include <mntent.h>  
 #define HAVE_MNTENT_H  
 #define MNTENT_PATH "/etc/mtab"  
89  #define STATFS_FN(path, buf) (statfs(path,buf))  #define STATFS_FN(path, buf) (statfs(path,buf))
90  #define STATFS_T statfs  #define STATFS_T statfs
91    #define USE_STATFS
92    #endif
93    
94    #ifdef STAT_STATFS4
95    #define STATFS_FN(path, buf) (statfs(path,buf,sizeof(buf),0))
96    #define STATFS_T statfs
97    #define USE_STATFS
98    #endif
99    
100    #if ((defined(USE_STATFS) && defined(HAVE_STRUCT_STATFS_F_NAMEMAX)) || (defined(USE_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_NAMEMAX)))
101    #define F_NAMELEN(buf) ((buf).f_namemax)
102    #endif
103    
104    #if ((defined(USE_STATFS) && defined(HAVE_STRUCT_STATFS_F_NAMELEN)) || (defined(USE_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_NAMELEN)))
105  #define F_NAMELEN(buf) ((buf).f_namelen)  #define F_NAMELEN(buf) ((buf).f_namelen)
106  #endif  #endif
107    
108    #ifndef F_NAMELEN
109    #define F_NAMELEN(buf) (255)
110    #endif
111    
112    /* Dummy statfs fallback */
113    #ifndef STATFS_T
114    struct dummy_statfs_t
115    {
116            long f_bfree = 1;
117            long f_bsize = 512;
118            long f_blocks = 1;
119    };
120    #define STATFS_T dummy_statfs_t
121    #define STATFS_FN(path,buf) 0
122    #endif
123    
124  extern RDPDR_DEVICE g_rdpdr_device[];  extern RDPDR_DEVICE g_rdpdr_device[];
125    
126  FILEINFO g_fileinfo[MAX_OPEN_FILES];  FILEINFO g_fileinfo[MAX_OPEN_FILES];
# Line 335  disk_create(uint32 device_id, uint32 acc Line 373  disk_create(uint32 device_id, uint32 acc
373                          break;                          break;
374          }          }
375    
376          /*printf("Open: \"%s\"  flags: %X, accessmask: %X sharemode: %X create disp: %X\n", path, flags_and_attributes, accessmask, sharemode, create_disposition);*/          /*printf("Open: \"%s\"  flags: %X, accessmask: %X sharemode: %X create disp: %X\n", path, flags_and_attributes, accessmask, sharemode, create_disposition); */
377    
378          /* Get information about file and set that flag ourselfs */          /* Get information about file and set that flag ourselfs */
379          if ((stat(path, &filestat) == 0) && (S_ISDIR(filestat.st_mode)))          if ((stat(path, &filestat) == 0) && (S_ISDIR(filestat.st_mode)))
# Line 835  disk_check_notify(NTHANDLE handle) Line 873  disk_check_notify(NTHANDLE handle)
873    
874          if (memcmp(&pfinfo->notify, &notify, sizeof(NOTIFY)))          if (memcmp(&pfinfo->notify, &notify, sizeof(NOTIFY)))
875          {          {
876                  /*printf("disk_check_notify found changed event\n");*/                  /*printf("disk_check_notify found changed event\n"); */
877                  memcpy(&pfinfo->notify, &notify, sizeof(NOTIFY));                  memcpy(&pfinfo->notify, &notify, sizeof(NOTIFY));
878                  status = STATUS_NOTIFY_ENUM_DIR;                  status = STATUS_NOTIFY_ENUM_DIR;
879          }          }
# Line 926  FsVolumeInfo(char *fpath) Line 964  FsVolumeInfo(char *fpath)
964  {  {
965    
966          static FsInfoType info;          static FsInfoType info;
967  #ifdef HAVE_MNTENT_H  #ifdef USE_SETMNTENT
968          FILE *fdfs;          FILE *fdfs;
969          struct mntent *e;          struct mntent *e;
970  #endif  #endif
# Line 936  FsVolumeInfo(char *fpath) Line 974  FsVolumeInfo(char *fpath)
974          strcpy(info.label, "RDESKTOP");          strcpy(info.label, "RDESKTOP");
975          strcpy(info.type, "RDPFS");          strcpy(info.type, "RDPFS");
976    
977  #ifdef HAVE_MNTENT_H  #ifdef USE_SETMNTENT
978          fdfs = setmntent(MNTENT_PATH, "r");          fdfs = setmntent(MNTENT_PATH, "r");
979          if (!fdfs)          if (!fdfs)
980                  return &info;                  return &info;

Legend:
Removed from v.865  
changed lines
  Added in v.873

  ViewVC Help
Powered by ViewVC 1.1.26