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 |
|
|
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) |
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; |
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; |