/[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 570 by stargo, Wed Jan 21 18:02:38 2004 UTC revision 574 by stargo, Wed Jan 21 23:53:55 2004 UTC
# Line 64  Line 64 
64    
65  #define MAX_OPEN_FILES  0x100  #define MAX_OPEN_FILES  0x100
66    
67    #if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
68    #define SOLARIS
69    #endif
70    
71    #ifdef SOLARIS
72    #define DIRFD(a) ((a)->dd_fd)
73    #else
74    #define DIRFD(a) (dirfd(a))
75    #endif
76    
77  #include <sys/types.h>  #include <sys/types.h>
78  #include <sys/stat.h>  #include <sys/stat.h>
 #include <sys/vfs.h>            /* linux statfs */  
79  #include <unistd.h>  #include <unistd.h>
80  #include <fcntl.h>              /* open, close */  #include <fcntl.h>              /* open, close */
81  #include <dirent.h>             /* opendir, closedir, readdir */  #include <dirent.h>             /* opendir, closedir, readdir */
82  #include <fnmatch.h>  #include <fnmatch.h>
83  #include <errno.h>              /* errno */  #include <errno.h>              /* errno */
84    
85    #if defined(SOLARIS)
86    #include <sys/statvfs.h>        /* solaris statvfs */
87    #define STATFS_FN(path, buf) (statvfs(path,buf))
88    #define STATFS_T statvfs
89    #define F_NAMELEN(buf) ((buf).f_namemax)
90    
91    #elif defined(__OpenBSD__)
92    #include <sys/param.h>
93    #include <sys/mount.h>
94    #define STATFS_FN(path, buf) (statfs(path,buf))
95    #define STATFS_T statfs
96    #define F_NAMELEN(buf) (NAME_MAX)
97    
98    #else
99    #include <sys/vfs.h>            /* linux statfs */
100    #define STATFS_FN(path, buf) (statfs(path,buf))
101    #define STATFS_T statfs
102    #define F_NAMELEN(buf) ((buf).f_namelen)
103    #endif
104    
105  #include "rdesktop.h"  #include "rdesktop.h"
106    
107  extern RDPDR_DEVICE g_rdpdr_device[];  extern RDPDR_DEVICE g_rdpdr_device[];
# Line 212  disk_create(uint32 device_id, uint32 acc Line 242  disk_create(uint32 device_id, uint32 acc
242                                          return STATUS_NO_SUCH_FILE;                                          return STATUS_NO_SUCH_FILE;
243                          }                          }
244                  }                  }
245                  handle = dirfd(dirp); /* FIXME: dirfd is not portable */                  handle = DIRFD(dirp);
246          }          }
247          else          else
248          {          {
# Line 476  NTSTATUS Line 506  NTSTATUS
506  disk_query_volume_information(HANDLE handle, uint32 info_class, STREAM out)  disk_query_volume_information(HANDLE handle, uint32 info_class, STREAM out)
507  {  {
508          char *volume, *fs_type;          char *volume, *fs_type;
509          struct statfs stat_fs;          struct STATFS_T stat_fs;
510          struct fileinfo *pfinfo;          struct fileinfo *pfinfo;
511    
512          pfinfo = &(g_fileinfo[handle]);          pfinfo = &(g_fileinfo[handle]);
513          volume = "RDESKTOP";          volume = "RDESKTOP";
514          fs_type = "RDPFS";          fs_type = "RDPFS";
515    
516          if (statfs(pfinfo->path, &stat_fs) != 0)        /* FIXME: statfs is not portable */          if (STATFS_FN(pfinfo->path, &stat_fs) != 0)     /* FIXME: statfs is not portable */
517          {          {
518                  perror("statfs");                  perror("statfs");
519                  return STATUS_ACCESS_DENIED;                  return STATUS_ACCESS_DENIED;
# Line 514  disk_query_volume_information(HANDLE han Line 544  disk_query_volume_information(HANDLE han
544                  case 5: /* FileFsAttributeInformation */                  case 5: /* FileFsAttributeInformation */
545    
546                          out_uint32_le(out, FS_CASE_SENSITIVE | FS_CASE_IS_PRESERVED);   /* fs attributes */                          out_uint32_le(out, FS_CASE_SENSITIVE | FS_CASE_IS_PRESERVED);   /* fs attributes */
547                          out_uint32_le(out, stat_fs.f_namelen);  /* max length of filename */                          out_uint32_le(out, F_NAMELEN(stat_fs)); /* max length of filename */
548                          out_uint32_le(out, 2 * strlen(fs_type));        /* length of fs_type */                          out_uint32_le(out, 2 * strlen(fs_type));        /* length of fs_type */
549                          rdp_out_unistr(out, fs_type, 2 * strlen(fs_type) - 2);                          rdp_out_unistr(out, fs_type, 2 * strlen(fs_type) - 2);
550                          break;                          break;

Legend:
Removed from v.570  
changed lines
  Added in v.574

  ViewVC Help
Powered by ViewVC 1.1.26