Re: [PATCH] mount: libvolume_id support and removal of old fs detection code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hi Matthias,

> @@ -364,11 +366,21 @@ getfsfile (const char *file) {
>  struct mntentchn *
>  getfsspec (const char *spec) {
>  	struct mntentchn *mc, *mc0;
> +	const char *nspec, *fsname;
>  
>  	mc0 = fstab_head();
> -	for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
> -		if (streq(mc->m.mnt_fsname, spec))
> +	for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
> +		if (!strncmp (mc->m.mnt_fsname, "LABEL=", 6)) {
> +			fsname = mount_volume_get_devname_by_label(mc->m.mnt_fsname + 6);
> +		} else if (!strncmp(mc->m.mnt_fsname, "UUID=", 5)) {
> +			fsname = mount_volume_get_devname_by_uuid(mc->m.mnt_fsname + 5);
> +		} else {
> +			fsname = mc->m.mnt_fsname;
> +		}
> +		nspec = canonicalize(fsname);
> +		if (streq(nspec, spec))
>  			return mc;
> +	}
>  	return NULL;
>  }

 I don't understand this change. The getfsspec() compares a SPEC with 
 spec-es from fstab. Your

   if (streq(nspec, spec))

 will never work, because the "nspec" is path to a device and the "spec" is
 LABEL=foo, UUID=foo or /dev/foo. The other problem is that you want
 to scan (by mount_volume_get_* ) all devices which are defined in fstab -- 
 this is not acceptable (because performance, udev, ...).

 I think the original version 
 
    for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
        if (streq(mc->m.mnt_fsname, spec))

 .. is correct. Or not?

 Note, I'm already working on your patch so you don't have to send me
 a new version, I'll fix it directly with some others tiny details.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux