- if (stat(p, &st) == 0) {
- int ret = (st_dev != st.st_dev) ||
- (st_dev == st.st_dev && st_ino == st.st_ino);
- if (opt & OPT_d)
- printf("%u:%u\n", major(st_dev), minor(st_dev));
- else if (!(opt & OPT_q))
- printf("%s is %sa mountpoint\n", arg, ret?"":"not ");
- return !ret;
+ if (stat(p, &st) == 0) {
+ //int is_mnt = (st_dev != st.st_dev) || (st_dev == st.st_dev && st_ino == st.st_ino);
+ int is_not_mnt = (st_dev == st.st_dev) && (st_ino != st.st_ino);
+
+ if (opt & OPT_d)
+ printf("%u:%u\n", major(st_dev), minor(st_dev));
+ if (opt & OPT_n) {
+ const char *d = find_block_device(arg);
+ /* name is undefined, but device is mounted -> anonymous superblock! */
+ /* happens with btrfs */
+ if (!d) {
+ d = "UNKNOWN";
+ /* TODO: iterate /proc/mounts, or /proc/self/mountinfo
+ * to find out the device name */
+ }
+ printf("%s %s\n", d, arg);