[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: mountpoint
From: Vladimir Dronnikov <dronnikov () gmail ! com>
Date: 2009-10-29 6:30:48
Message-ID: 6784529b0910282330y25f5e229ka1d4a4b1d08bfbb5 () mail ! gmail ! com
[Download RAW message or body]
Hello, Bernhard!
"mountpoint -n PATH" refuses to find out the name of mounted device in
case of so-called "anonymous superblock", e.g. for btrfs.
That is, reported st.st_rdev doesn't correspond to any block device under /dev
http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg02870.html
To outline the problem I prepared a patch (attached).
Please, comment, and may be fix.
Regards,
--
Vladimir
["test.patch" (application/octet-stream)]
--- busybox.orig/miscutils/mountpoint.c Tue May 5 17:03:35 2009
+++ busybox/miscutils/mountpoint.c Mon Oct 26 11:24:50 2009
@@ -55,8 +55,17 @@
if (opt & OPT_d)
printf("%u:%u\n", major(st_dev), minor(st_dev));
- if (opt & OPT_n)
- printf("%s %s\n", find_block_device(arg), arg);
+ if (opt & OPT_n) {
+ // get the name of mounted block device
+ char *d = find_block_device(arg);
+ // name is undefined, but device is mounted -> anonymous superblock!
+ if (NULL == d) {
+ d = (char *)"UNKNOWN";
+ // TODO: iterate /proc/mounts, or /proc/self/mountinfo
+ // to find out the device name
+ }
+ printf("%s %s\n", d, arg);
+ }
if (!(opt & (OPT_q | OPT_d | OPT_n)))
printf("%s is %sa mountpoint\n", arg, is_not_mnt ? "not " : "");
return is_not_mnt;
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic