/[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 573 by stargo, Wed Jan 21 22:13:20 2004 UTC revision 574 by stargo, Wed Jan 21 23:53:55 2004 UTC
# Line 84  Line 84 
84    
85  #if defined(SOLARIS)  #if defined(SOLARIS)
86  #include <sys/statvfs.h>        /* solaris statvfs */  #include <sys/statvfs.h>        /* solaris statvfs */
87  #define HAVE_STATVFS  #define STATFS_FN(path, buf) (statvfs(path,buf))
88    #define STATFS_T statvfs
89  #define F_NAMELEN(buf) ((buf).f_namemax)  #define F_NAMELEN(buf) ((buf).f_namemax)
90    
91  #elif defined(__OpenBSD__)  #elif defined(__OpenBSD__)
92  #include <sys/param.h>  #include <sys/param.h>
93  #include <sys/mount.h>  #include <sys/mount.h>
94  #define HAVE_STATFS  #define STATFS_FN(path, buf) (statfs(path,buf))
95    #define STATFS_T statfs
96  #define F_NAMELEN(buf) (NAME_MAX)  #define F_NAMELEN(buf) (NAME_MAX)
97    
98  #else  #else
99  #include <sys/vfs.h>            /* linux statfs */  #include <sys/vfs.h>            /* linux statfs */
100  #define HAVE_STATFS  #define STATFS_FN(path, buf) (statfs(path,buf))
101    #define STATFS_T statfs
102  #define F_NAMELEN(buf) ((buf).f_namelen)  #define F_NAMELEN(buf) ((buf).f_namelen)
103  #endif  #endif
104    
# Line 114  struct fileinfo Line 117  struct fileinfo
117  }  }
118  g_fileinfo[MAX_OPEN_FILES];  g_fileinfo[MAX_OPEN_FILES];
119    
 struct fsinfo  
 {  
         uint32 f_blocks, f_bfree, f_bsize, f_namelen;  
 };  
   
120  /* Convert seconds since 1970 to a filetime */  /* Convert seconds since 1970 to a filetime */
121  void  void
122  seconds_since_1970_to_filetime(time_t seconds, uint32 * high, uint32 * low)  seconds_since_1970_to_filetime(time_t seconds, uint32 * high, uint32 * low)
# Line 504  disk_set_information(HANDLE handle, uint Line 502  disk_set_information(HANDLE handle, uint
502          return STATUS_SUCCESS;          return STATUS_SUCCESS;
503  }  }
504    
 int fsstat(const char *path, struct fsinfo *buf)  
 {  
         int ret;  
 #if defined(HAVE_STATFS)  
         struct statfs statbuf;  
 #elif defined(HAVE_STATVFS)  
         struct statvfs statbuf;  
 #endif  
   
 #if defined(HAVE_STATFS)  
         ret = statfs(path, &statbuf);  
 #elif defined(HAVE_STATVFS)  
         ret = statvfs(path, &statbuf);  
 #else  
         ret=-1;  
 #endif  
   
         buf->f_blocks = statbuf.f_blocks;  
         buf->f_bfree = statbuf.f_bfree;  
         buf->f_bsize = statbuf.f_bsize;  
         buf->f_namelen = F_NAMELEN(statbuf);  
   
         return ret;  
 }  
   
505  NTSTATUS  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 fsinfo 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 (fsstat(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 571  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.573  
changed lines
  Added in v.574

  ViewVC Help
Powered by ViewVC 1.1.26