[systemd-devel] [v2] udev: Expose new ISO9660 props from libblkid

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Sat Feb 16 13:53:48 PST 2013


On Sat, Feb 16, 2013 at 8:04 PM, Kay Sievers <kay at vrfy.org> wrote:
> On Sat, Feb 16, 2013 at 5:52 PM, Zeeshan Ali (Khattak)
> <zeeshanak at gnome.org> wrote:
>> On Sat, Feb 16, 2013 at 5:45 PM, Zbigniew Jędrzejewski-Szmek
>> <zbyszek at in.waw.pl> wrote:
>>> On Wed, Feb 13, 2013 at 05:39:54AM +0200, Zeeshan Ali (Khattak) wrote:
>>>> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>>>>
>>>> This version 2 removes the bogus 'FS_' prefix from blkid property names.
>>>>
>>>> ---
>>>>  src/udev/udev-builtin-blkid.c | 13 ++++++++++++-
>>>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
>>>> index 56a05f5..c42c19e 100644
>>>> --- a/src/udev/udev-builtin-blkid.c
>>>> +++ b/src/udev/udev-builtin-blkid.c
>>>> @@ -78,7 +78,18 @@ static void print_property(struct udev_device *dev, bool test, const char *name,
>>>>          } else if (startswith(name, "PART_ENTRY_")) {
>>>>                  strscpyl(s, sizeof(s), "ID_", name, NULL);
>>>>                  udev_builtin_add_property(dev, test, s, value);
>>>> -        }
>>>> +
>>>> +        } else if (streq(name, "SYSTEM_ID"))
>>>> +                udev_builtin_add_property(dev, test, "ID_FS_SYSTEM_ID", value);
>>>> +
>>>> +        else if (streq(name, "PUBLISHER_ID"))
>>>> +                udev_builtin_add_property(dev, test, "ID_FS_PUBLISHER_ID", value);
>>>> +
>>>> +        else if (streq(name, "APPLICATION_ID"))
>>>> +                udev_builtin_add_property(dev, test, "ID_FS_APPLICATION_ID", value);
>>>> +
>>>> +        else if (streq(name, "BOOT_SYSTEM_ID"))
>>>> +                udev_builtin_add_property(dev, test, "ID_FS_BOOT_SYSTEM_ID", value);
>>> Hi Zeeshan,
>>> iiuc, those strings are under the control of the FS creator.
>>> Shouldn't they be treated like e.g. LABEL and passed through
>>> blkid_safe_string and blkid_encode_string?
>>
>> Since Kay agrees, you are mostly likely correct. :) I have a question
>> though, why do we replace spaces with underscores? I ask cause I'll
>> have to do the opposite in my app to ensure libosinfo can match the ID
>> strings with known values (or adjust the regex in libosinfo database
>> accordingly). However, I'm curious to know why udev doesn't expose the
>> strings as is?
>
> We just hex encode stuff that isn't ascii or valid utf8, udev just
> mangles some old values for compat reasons, new stuff should only use
> encoding.

You mean these new values I'm adding will only pass through
blkid_encode_string and not blkid_safe_string? Cause  docs for
blkid_safe_string() say: "Replaces all whitespaces with '_'." If so
IMHO it'd be also nice for apps to be able to get the volume ID with
whitespace intact (not talking of leading/trailing WS that blkid
removes for you already and doubtful to be useful to anyone). Pretty
sure you have good reasons to not change the format of existing
'ID_FS_LABEL' property but maybe raw label could be exposed as a
separate property for anyone interested?

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124


More information about the systemd-devel mailing list