[systemd-devel] [PATCH 2/4] Adding unmount functions to be used in shutdown

Gustavo Sverzut Barbieri barbieri at profusion.mobi
Thu Oct 7 03:58:32 PDT 2010


On Thu, Oct 7, 2010 at 4:24 AM, Kay Sievers <kay.sievers at vrfy.org> wrote:
> On Thu, Oct 7, 2010 at 06:03,  <fidencio at profusion.mobi> wrote:
>> +        if (udev_enumerate_add_match_subsystem(e, "block") < 0) {
>> +                r = -EIO;
>> +                goto finish;
>> +        }
>> +
>> +        if (udev_enumerate_scan_devices(e) < 0) {
>> +                r = -EIO;
>> +                goto finish;
>> +        }
>> +
>> +        first = udev_enumerate_get_list_entry(e);
>> +
>> +        udev_list_entry_foreach(item, first) {
>> +                MountPoint *lb;
>> +                char buf[PATH_MAX];
>> +                char *loop;
>> +
>> +                snprintf(buf, sizeof(buf), "%s", udev_list_entry_get_name(item));
>> +                if (strstr(buf, "loop"))
>
> I think, here you can let libudev return only the loop devices with:
>  udev_enumerate_add_match_sysname(, "loop*");

and the snprintf() is totally useless, the strstr case should be early
continue "if (!strstr(..)) continue"


-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbieri at gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202


More information about the systemd-devel mailing list