Re: making `blkid -lt NAME=value -o device` equivalent to `findfs` for PART{UUID,LABEL}

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

 



On Wed, Jun 10, 2015 at 03:23:56PM +0800, Tom Yan wrote:
> By the way, according to the blkid(8):
> 
>        -l     Look up only one device that matches the search
> parameter specified with the -t option.  If there are multiple devices
> that match the specified search parameter,  then  the  device  with
> the
>               highest  priority  is  returned,  and/or the first
> device found at a given priority...
> 
> However, as you can see in my last email, blkid_evaluate_tag() doesn't
> seem to return the first device. Only `blkid -lt PARTLABEL="EFI
> System" -o device`, which doesn't use the function, output the
> "/dev/sda1".

blkid_evaluate_tag() follows /etc/blkid.conf EVALUATE= setting (see
man blkid). The default is to use udev and /dev/disk/by-* symlinks
rather than the cache maintained by libblkid.

Maybe the best solution will be:

 1/ add info about this behavior to findfs man page
 2/ remove the shortcut:

> >     /* convert LABEL/UUID lookup to evaluate request */
> >     if (lookup && output_format == OUTPUT_DEVICE_ONLY && search_type &&
> >         (!strcmp(search_type, "LABEL") || !strcmp(search_type, "UUID"))) {
> >         eval++;
> >         lookup = 0;
> >     }

 .. and for blkid always use cache based results to keep it
 consistent.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" 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