/[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 879 by astrand, Sun Apr 3 18:08:05 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
55  #define STATFS_T statvfs  
56  #define F_NAMELEN(buf) ((buf).f_namemax)  #ifdef HAVE_SYS_STATFS_H
57    #include <sys/statfs.h>
58    #endif
59    
60  #elif (defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__APPLE__))  #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;
117            long f_bsize;
118            long f_blocks;
119            int f_namelen;
120            int f_namemax;
121    };
122    
123    int
124    dummy_statfs(struct dummy_statfs_t *buf)
125    {
126            buf->f_blocks = 262144;
127            buf->f_bfree = 131072;
128            buf->f_bsize = 512;
129            buf->f_namelen = 255;
130            buf->f_namemax = 255;
131    
132            return 0;
133    }
134    
135    #define STATFS_T dummy_statfs_t
136    #define STATFS_FN(path,buf) (dummy_statfs(buf))
137    #endif
138    
139  extern RDPDR_DEVICE g_rdpdr_device[];  extern RDPDR_DEVICE g_rdpdr_device[];
140    
141  FILEINFO g_fileinfo[MAX_OPEN_FILES];  FILEINFO g_fileinfo[MAX_OPEN_FILES];
# Line 335  disk_create(uint32 device_id, uint32 acc Line 388  disk_create(uint32 device_id, uint32 acc
388                          break;                          break;
389          }          }
390    
391          /*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); */
392    
393          /* Get information about file and set that flag ourselfs */          /* Get information about file and set that flag ourselfs */
394          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 888  disk_check_notify(NTHANDLE handle)
888    
889          if (memcmp(&pfinfo->notify, &notify, sizeof(NOTIFY)))          if (memcmp(&pfinfo->notify, &notify, sizeof(NOTIFY)))
890          {          {
891                  /*printf("disk_check_notify found changed event\n");*/                  /*printf("disk_check_notify found changed event\n"); */
892                  memcpy(&pfinfo->notify, &notify, sizeof(NOTIFY));                  memcpy(&pfinfo->notify, &notify, sizeof(NOTIFY));
893                  status = STATUS_NOTIFY_ENUM_DIR;                  status = STATUS_NOTIFY_ENUM_DIR;
894          }          }
# Line 926  FsVolumeInfo(char *fpath) Line 979  FsVolumeInfo(char *fpath)
979  {  {
980    
981          static FsInfoType info;          static FsInfoType info;
982  #ifdef HAVE_MNTENT_H  #ifdef USE_SETMNTENT
983          FILE *fdfs;          FILE *fdfs;
984          struct mntent *e;          struct mntent *e;
985  #endif  #endif
# Line 936  FsVolumeInfo(char *fpath) Line 989  FsVolumeInfo(char *fpath)
989          strcpy(info.label, "RDESKTOP");          strcpy(info.label, "RDESKTOP");
990          strcpy(info.type, "RDPFS");          strcpy(info.type, "RDPFS");
991    
992  #ifdef HAVE_MNTENT_H  #ifdef USE_SETMNTENT
993          fdfs = setmntent(MNTENT_PATH, "r");          fdfs = setmntent(MNTENT_PATH, "r");
994          if (!fdfs)          if (!fdfs)
995                  return &info;                  return &info;

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

  ViewVC Help
Powered by ViewVC 1.1.26