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]

 



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".

On 10 June 2015 at 14:38, Tom Yan <tom.ty89@xxxxxxxxx> wrote:
> In commit c48508c2, findfs was given ability to work with PARTUUID and
> PARTLABEL. It works on all four types with blkid_evaluate_tag().
>
> When blkid is run in form of `blkid -lt NAME=value -o device` for UUID
> and LABEL, it works the same way as findfs:
>
>     /* 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;
>     }
>
> but not always for PARTUUID and PARTLABEL.
>
> Would it be a good idea to add them in the test as well, so that
> `findfs` can be considered an equivalence/shortcut as blkid in that
> form?
>
> [tom@localhost ~]$ blkid -t PARTLABEL="EFI System" -o device
> /dev/sda1
> /dev/sdb1
> [tom@localhost ~]$ blkid -t LABEL=TEST -o device
> /dev/sda1
> /dev/sdb1
> [tom@localhost ~]$ blkid -lt PARTLABEL="EFI System" -o device
> /dev/sda1
> [tom@localhost ~]$ findfs PARTLABEL="EFI System"
> /dev/sdb1
> [tom@localhost ~]$ blkid -lt LABEL=TEST -o device
> /dev/sdb1
> [tom@localhost ~]$ findfs LABEL=TEST
> /dev/sdb1
--
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