From a8c63f25b3a8d4b8c9e12b8f6db65c61596da602 Mon Sep 17 00:00:00 2001 From: Ron Yorston <rmy@pobox.com> Date: Wed, 20 Mar 2019 11:31:07 +0000 Subject: win32: improve filesystem detection and display Miscellaneous improvements: - Enable '-a' option to display all filesystems in df(1). - Detect the UDF CDROM filesystem and display it in 'stat -f'. - Let getmntent(3) handle CDROM and floppy devices, ignoring those that have no media. - Set number of inodes and filesystem flags to 0 in statfs(2). --- win32/mntent.c | 9 ++++++--- win32/statfs.c | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'win32') diff --git a/win32/mntent.c b/win32/mntent.c index f9a2d26d4..2a07476e3 100644 --- a/win32/mntent.c +++ b/win32/mntent.c @@ -32,6 +32,7 @@ struct mntent *getmntent(FILE *stream) { struct mntdata *data = (struct mntdata *)stream; struct mntent *entry; + UINT drive_type; data->me.mnt_fsname = data->mnt_fsname; data->me.mnt_dir = data->mnt_dir; @@ -48,15 +49,17 @@ struct mntent *getmntent(FILE *stream) data->mnt_fsname[2] = '\0'; data->mnt_dir[0] = 'A' + data->index; data->mnt_dir[1] = ':'; - data->mnt_dir[2] = '\\'; + data->mnt_dir[2] = '/'; data->mnt_dir[3] = '\0'; data->mnt_type[0] = '\0'; data->mnt_opts[0] = '\0'; - if ( GetDriveType(data->mnt_dir) == DRIVE_FIXED ) { + drive_type = GetDriveType(data->mnt_dir); + if ( drive_type == DRIVE_FIXED || drive_type == DRIVE_CDROM || + drive_type == DRIVE_REMOVABLE) { if ( !GetVolumeInformation(data->mnt_dir, NULL, 0, NULL, NULL, NULL, data->mnt_type, 100) ) { - data->mnt_type[0] = '\0'; + continue; } entry = &data->me; diff --git a/win32/statfs.c b/win32/statfs.c index d81a69380..22fc591ec 100644 --- a/win32/statfs.c +++ b/win32/statfs.c @@ -51,7 +51,7 @@ int statfs(const char *file, struct statfs *buf) /* * Valid filesystem names don't seem to be documented. The following - * are present in Wine. + * are present in Wine (dlls/kernel32/volume.c). */ if ( strcmp(fsname, "NTFS") == 0 ) { buf->f_type = 0x5346544e; @@ -62,6 +62,9 @@ int statfs(const char *file, struct statfs *buf) else if ( strcmp(fsname, "CDFS") == 0 ) { buf->f_type = 0x9660; } + else if ( strcmp(fsname, "UDF") == 0 ) { + buf->f_type = 0x15013346; + } else { buf->f_type = 0; } @@ -70,10 +73,10 @@ int statfs(const char *file, struct statfs *buf) buf->f_blocks = total_number_of_bytes / buf->f_bsize; buf->f_bfree = total_number_of_free_bytes / buf->f_bsize; buf->f_bavail = free_bytes_available / buf->f_bsize; - buf->f_files = UINT32_MAX; - buf->f_ffree = UINT32_MAX; + buf->f_files = 0; + buf->f_ffree = 0; buf->f_fsid = serial; - buf->f_flag = UINT64_MAX; + buf->f_flag = 0; buf->f_namelen = namelen; return 0; -- cgit v1.2.3-55-g6feb