aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-03-20 11:31:07 +0000
committerRon Yorston <rmy@pobox.com>2019-03-20 11:38:32 +0000
commita8c63f25b3a8d4b8c9e12b8f6db65c61596da602 (patch)
tree7c39ee80787a2eba5702246a1b6f24276290f8c8
parent18bffeae48f300c813a4999067373498b534c166 (diff)
downloadbusybox-w32-a8c63f25b3a8d4b8c9e12b8f6db65c61596da602.tar.gz
busybox-w32-a8c63f25b3a8d4b8c9e12b8f6db65c61596da602.tar.bz2
busybox-w32-a8c63f25b3a8d4b8c9e12b8f6db65c61596da602.zip
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).
-rw-r--r--configs/mingw32_defconfig4
-rw-r--r--configs/mingw64_defconfig4
-rw-r--r--coreutils/stat.c3
-rw-r--r--libbb/appletlib.c3
-rw-r--r--win32/mntent.c9
-rw-r--r--win32/statfs.c11
6 files changed, 23 insertions, 11 deletions
diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig
index d7a32e53f..a51805b84 100644
--- a/configs/mingw32_defconfig
+++ b/configs/mingw32_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Busybox version: 1.31.0.git 3# Busybox version: 1.31.0.git
4# Thu Mar 7 14:31:51 2019 4# Wed Mar 20 11:37:19 2019
5# 5#
6CONFIG_HAVE_DOT_CONFIG=y 6CONFIG_HAVE_DOT_CONFIG=y
7# CONFIG_PLATFORM_POSIX is not set 7# CONFIG_PLATFORM_POSIX is not set
@@ -234,7 +234,7 @@ CONFIG_DD=y
234CONFIG_FEATURE_DD_IBS_OBS=y 234CONFIG_FEATURE_DD_IBS_OBS=y
235CONFIG_FEATURE_DD_STATUS=y 235CONFIG_FEATURE_DD_STATUS=y
236CONFIG_DF=y 236CONFIG_DF=y
237# CONFIG_FEATURE_DF_FANCY is not set 237CONFIG_FEATURE_DF_FANCY=y
238CONFIG_DIRNAME=y 238CONFIG_DIRNAME=y
239CONFIG_DOS2UNIX=y 239CONFIG_DOS2UNIX=y
240CONFIG_UNIX2DOS=y 240CONFIG_UNIX2DOS=y
diff --git a/configs/mingw64_defconfig b/configs/mingw64_defconfig
index 98317c358..b773fb1b1 100644
--- a/configs/mingw64_defconfig
+++ b/configs/mingw64_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Busybox version: 1.31.0.git 3# Busybox version: 1.31.0.git
4# Thu Mar 7 14:31:51 2019 4# Wed Mar 20 11:37:19 2019
5# 5#
6CONFIG_HAVE_DOT_CONFIG=y 6CONFIG_HAVE_DOT_CONFIG=y
7# CONFIG_PLATFORM_POSIX is not set 7# CONFIG_PLATFORM_POSIX is not set
@@ -234,7 +234,7 @@ CONFIG_DD=y
234CONFIG_FEATURE_DD_IBS_OBS=y 234CONFIG_FEATURE_DD_IBS_OBS=y
235CONFIG_FEATURE_DD_STATUS=y 235CONFIG_FEATURE_DD_STATUS=y
236CONFIG_DF=y 236CONFIG_DF=y
237# CONFIG_FEATURE_DF_FANCY is not set 237CONFIG_FEATURE_DF_FANCY=y
238CONFIG_DIRNAME=y 238CONFIG_DIRNAME=y
239CONFIG_DOS2UNIX=y 239CONFIG_DOS2UNIX=y
240CONFIG_UNIX2DOS=y 240CONFIG_UNIX2DOS=y
diff --git a/coreutils/stat.c b/coreutils/stat.c
index cf13af0b6..78b60603d 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -204,6 +204,9 @@ static const char *human_fstype(uint32_t f_type)
204 { 0x012FF7B5, "sysv4" }, 204 { 0x012FF7B5, "sysv4" },
205 { 0x012FF7B6, "sysv2" }, 205 { 0x012FF7B6, "sysv2" },
206 { 0x012FF7B7, "coh" }, 206 { 0x012FF7B7, "coh" },
207#if ENABLE_PLATFORM_MINGW32
208 { 0x15013346, "udf" },
209#endif
207 { 0x00011954, "ufs" }, 210 { 0x00011954, "ufs" },
208 { 0x012FD16D, "xia" }, 211 { 0x012FD16D, "xia" },
209 { 0x5346544e, "ntfs" }, 212 { 0x5346544e, "ntfs" },
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 35aabe758..58e391fd9 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -1233,6 +1233,9 @@ int main(int argc UNUSED_PARAM, char **argv)
1233# if ENABLE_FEATURE_EURO 1233# if ENABLE_FEATURE_EURO
1234 init_codepage(); 1234 init_codepage();
1235# endif 1235# endif
1236 /* Ignore critical errors, such as calling GetVolumeInformation() on
1237 * a floppy or CDROM drive with no media. */
1238 SetErrorMode(SEM_FAILCRITICALERRORS);
1236#endif 1239#endif
1237 1240
1238#if defined(__MINGW64_VERSION_MAJOR) 1241#if defined(__MINGW64_VERSION_MAJOR)
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)
32{ 32{
33 struct mntdata *data = (struct mntdata *)stream; 33 struct mntdata *data = (struct mntdata *)stream;
34 struct mntent *entry; 34 struct mntent *entry;
35 UINT drive_type;
35 36
36 data->me.mnt_fsname = data->mnt_fsname; 37 data->me.mnt_fsname = data->mnt_fsname;
37 data->me.mnt_dir = data->mnt_dir; 38 data->me.mnt_dir = data->mnt_dir;
@@ -48,15 +49,17 @@ struct mntent *getmntent(FILE *stream)
48 data->mnt_fsname[2] = '\0'; 49 data->mnt_fsname[2] = '\0';
49 data->mnt_dir[0] = 'A' + data->index; 50 data->mnt_dir[0] = 'A' + data->index;
50 data->mnt_dir[1] = ':'; 51 data->mnt_dir[1] = ':';
51 data->mnt_dir[2] = '\\'; 52 data->mnt_dir[2] = '/';
52 data->mnt_dir[3] = '\0'; 53 data->mnt_dir[3] = '\0';
53 data->mnt_type[0] = '\0'; 54 data->mnt_type[0] = '\0';
54 data->mnt_opts[0] = '\0'; 55 data->mnt_opts[0] = '\0';
55 56
56 if ( GetDriveType(data->mnt_dir) == DRIVE_FIXED ) { 57 drive_type = GetDriveType(data->mnt_dir);
58 if ( drive_type == DRIVE_FIXED || drive_type == DRIVE_CDROM ||
59 drive_type == DRIVE_REMOVABLE) {
57 if ( !GetVolumeInformation(data->mnt_dir, NULL, 0, NULL, NULL, 60 if ( !GetVolumeInformation(data->mnt_dir, NULL, 0, NULL, NULL,
58 NULL, data->mnt_type, 100) ) { 61 NULL, data->mnt_type, 100) ) {
59 data->mnt_type[0] = '\0'; 62 continue;
60 } 63 }
61 64
62 entry = &data->me; 65 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)
51 51
52 /* 52 /*
53 * Valid filesystem names don't seem to be documented. The following 53 * Valid filesystem names don't seem to be documented. The following
54 * are present in Wine. 54 * are present in Wine (dlls/kernel32/volume.c).
55 */ 55 */
56 if ( strcmp(fsname, "NTFS") == 0 ) { 56 if ( strcmp(fsname, "NTFS") == 0 ) {
57 buf->f_type = 0x5346544e; 57 buf->f_type = 0x5346544e;
@@ -62,6 +62,9 @@ int statfs(const char *file, struct statfs *buf)
62 else if ( strcmp(fsname, "CDFS") == 0 ) { 62 else if ( strcmp(fsname, "CDFS") == 0 ) {
63 buf->f_type = 0x9660; 63 buf->f_type = 0x9660;
64 } 64 }
65 else if ( strcmp(fsname, "UDF") == 0 ) {
66 buf->f_type = 0x15013346;
67 }
65 else { 68 else {
66 buf->f_type = 0; 69 buf->f_type = 0;
67 } 70 }
@@ -70,10 +73,10 @@ int statfs(const char *file, struct statfs *buf)
70 buf->f_blocks = total_number_of_bytes / buf->f_bsize; 73 buf->f_blocks = total_number_of_bytes / buf->f_bsize;
71 buf->f_bfree = total_number_of_free_bytes / buf->f_bsize; 74 buf->f_bfree = total_number_of_free_bytes / buf->f_bsize;
72 buf->f_bavail = free_bytes_available / buf->f_bsize; 75 buf->f_bavail = free_bytes_available / buf->f_bsize;
73 buf->f_files = UINT32_MAX; 76 buf->f_files = 0;
74 buf->f_ffree = UINT32_MAX; 77 buf->f_ffree = 0;
75 buf->f_fsid = serial; 78 buf->f_fsid = serial;
76 buf->f_flag = UINT64_MAX; 79 buf->f_flag = 0;
77 buf->f_namelen = namelen; 80 buf->f_namelen = namelen;
78 81
79 return 0; 82 return 0;