aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2026-06-15 12:36:38 +0100
committerRon Yorston <rmy@pobox.com>2026-06-15 12:43:03 +0100
commitd4fefaceac846bbf8acbb110924b0caff6df698e (patch)
treede208d030a8955772f6cd7b156a264b84341c3d4
parent862f87a8725d5cc9693021066869e94512d5d8e1 (diff)
downloadbusybox-w32-mount_point.tar.gz
busybox-w32-mount_point.tar.bz2
busybox-w32-mount_point.zip
df,lsattr: support Unix-like mount pointsmount_point
Update 'lsattr' to distinguish between mount points and junctions. Use the new 'mntent' functions in 'df' to display mount points as well as drive letters. If mount point is associated with a drive letter this is displayed as the filesystem. The Windows-specific '-w' option forces the volume name to be displayed instead, if avaialable. Adds 87-111 bytes. Signed-off-by: Ron Yorston <rmy@pobox.com>
-rw-r--r--coreutils/df.c16
-rw-r--r--e2fsprogs/e2fs_lib.c6
-rw-r--r--e2fsprogs/lsattr.c3
3 files changed, 24 insertions, 1 deletions
diff --git a/coreutils/df.c b/coreutils/df.c
index 01c41db38..3b533b610 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -85,6 +85,9 @@
85//usage: ) 85//usage: )
86//usage: "\n -B SIZE Blocksize" 86//usage: "\n -B SIZE Blocksize"
87//usage: ) 87//usage: )
88//usage: IF_PLATFORM_MINGW32(
89//usage: "\n -w Show Windows volumes"
90//usage: )
88//usage: 91//usage:
89//usage:#define df_example_usage 92//usage:#define df_example_usage
90//usage: "$ df\n" 93//usage: "$ df\n"
@@ -139,6 +142,7 @@ int df_main(int argc UNUSED_PARAM, char **argv)
139 OPT_HUMAN = (1 << (4 + 2*ENABLE_FEATURE_DF_FANCY + ENABLE_FEATURE_DF_FANCY_POSIX)) * ENABLE_FEATURE_HUMAN_READABLE, 142 OPT_HUMAN = (1 << (4 + 2*ENABLE_FEATURE_DF_FANCY + ENABLE_FEATURE_DF_FANCY_POSIX)) * ENABLE_FEATURE_HUMAN_READABLE,
140 OPT_HUMANDEC = (1 << (5 + 2*ENABLE_FEATURE_DF_FANCY + ENABLE_FEATURE_DF_FANCY_POSIX)) * ENABLE_FEATURE_HUMAN_READABLE, 143 OPT_HUMANDEC = (1 << (5 + 2*ENABLE_FEATURE_DF_FANCY + ENABLE_FEATURE_DF_FANCY_POSIX)) * ENABLE_FEATURE_HUMAN_READABLE,
141 OPT_MEGA = (1 << (6 + 2*ENABLE_FEATURE_DF_FANCY + ENABLE_FEATURE_DF_FANCY_POSIX)) * ENABLE_FEATURE_HUMAN_READABLE, 144 OPT_MEGA = (1 << (6 + 2*ENABLE_FEATURE_DF_FANCY + ENABLE_FEATURE_DF_FANCY_POSIX)) * ENABLE_FEATURE_HUMAN_READABLE,
145 OPT_WINVOL = (1 << (7 + 2*ENABLE_FEATURE_DF_FANCY + ENABLE_FEATURE_DF_FANCY_POSIX)) * ENABLE_FEATURE_HUMAN_READABLE,
142 }; 146 };
143 const char *disp_units_hdr = NULL; 147 const char *disp_units_hdr = NULL;
144 char *chp, *opt_t; 148 char *chp, *opt_t;
@@ -160,6 +164,9 @@ int df_main(int argc UNUSED_PARAM, char **argv)
160 IF_FEATURE_DF_FANCY("aB:") 164 IF_FEATURE_DF_FANCY("aB:")
161#endif 165#endif
162 IF_FEATURE_HUMAN_READABLE("hHm") 166 IF_FEATURE_HUMAN_READABLE("hHm")
167#if ENABLE_PLATFORM_MINGW32
168 "w"
169#endif
163 "\0" 170 "\0"
164#if ENABLE_FEATURE_HUMAN_READABLE && ENABLE_FEATURE_DF_FANCY 171#if ENABLE_FEATURE_HUMAN_READABLE && ENABLE_FEATURE_DF_FANCY
165 "k-mB:m-Bk:B-km" 172 "k-mB:m-Bk:B-km"
@@ -248,7 +255,12 @@ int df_main(int argc UNUSED_PARAM, char **argv)
248 } 255 }
249 } 256 }
250 257
258#if ENABLE_PLATFORM_MINGW32
259 device = (opt & OPT_WINVOL) && mount_entry->mnt_volname[0] ?
260 mount_entry->mnt_volname : mount_entry->mnt_fsname;
261#else
251 device = mount_entry->mnt_fsname; 262 device = mount_entry->mnt_fsname;
263#endif
252 264
253 /* GNU coreutils 6.10 skips certain mounts, try to be compatible */ 265 /* GNU coreutils 6.10 skips certain mounts, try to be compatible */
254 if (ENABLE_FEATURE_SKIP_ROOTFS && strcmp(device, "rootfs") == 0) 266 if (ENABLE_FEATURE_SKIP_ROOTFS && strcmp(device, "rootfs") == 0)
@@ -266,6 +278,10 @@ int df_main(int argc UNUSED_PARAM, char **argv)
266 bb_simple_perror_msg(mount_point); 278 bb_simple_perror_msg(mount_point);
267 goto set_error; 279 goto set_error;
268 } 280 }
281#if ENABLE_PLATFORM_MINGW32
282 // Trailing slash was needed for statvfs(), strip it for display
283 bs_to_slash_strip_slash(mount_entry->mnt_dir);
284#endif
269 /* Some uclibc versions were seen to lose f_frsize 285 /* Some uclibc versions were seen to lose f_frsize
270 * (kernel does return it, but then uclibc does not copy it) 286 * (kernel does return it, but then uclibc does not copy it)
271 */ 287 */
diff --git a/e2fsprogs/e2fs_lib.c b/e2fsprogs/e2fs_lib.c
index dd75ebc18..45a6430e8 100644
--- a/e2fsprogs/e2fs_lib.c
+++ b/e2fsprogs/e2fs_lib.c
@@ -132,6 +132,9 @@ void print_e2flags_long(struct stat *sb)
132 case IO_REPARSE_TAG_SYMLINK: 132 case IO_REPARSE_TAG_SYMLINK:
133 ln = "Symbolic_Link"; 133 ln = "Symbolic_Link";
134 break; 134 break;
135 case BB_REPARSE_TAG_JUNCTION:
136 ln = "Junction";
137 break;
135 case IO_REPARSE_TAG_MOUNT_POINT: 138 case IO_REPARSE_TAG_MOUNT_POINT:
136 ln = "Mount_Point"; 139 ln = "Mount_Point";
137 break; 140 break;
@@ -174,6 +177,9 @@ void print_e2flags(struct stat *sb)
174 case IO_REPARSE_TAG_SYMLINK: 177 case IO_REPARSE_TAG_SYMLINK:
175 c = 'l'; 178 c = 'l';
176 break; 179 break;
180 case BB_REPARSE_TAG_JUNCTION:
181 c = 'j';
182 break;
177 case IO_REPARSE_TAG_MOUNT_POINT: 183 case IO_REPARSE_TAG_MOUNT_POINT:
178 c = 'm'; 184 c = 'm';
179 break; 185 break;
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c
index 7c3e8ae4b..1c6523745 100644
--- a/e2fsprogs/lsattr.c
+++ b/e2fsprogs/lsattr.c
@@ -45,7 +45,8 @@
45//usage: ) 45//usage: )
46//usage: IF_PLATFORM_MINGW32( 46//usage: IF_PLATFORM_MINGW32(
47//usage: "\n\nAttributes:\n" 47//usage: "\n\nAttributes:\n"
48//usage: "\n m Mount (junction/volume)" 48//usage: "\n m Mount point"
49//usage: "\n j Junction"
49//usage: "\n l Symbolic link" 50//usage: "\n l Symbolic link"
50//usage: "\n A App exec link" 51//usage: "\n A App exec link"
51//usage: "\n R Unidentified reparse point" 52//usage: "\n R Unidentified reparse point"