[systemd-devel] [PATCH v3] Bootchart: use /proc/pid/mountinfo for root bdev

Timofey Titovets nefelim4ag at gmail.com
Thu Oct 30 21:51:59 PDT 2014


2014-10-31 3:06 GMT+03:00 Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>:
> On Thu, Oct 30, 2014 at 05:45:53PM +0300, Timofey Titovets wrote:
>> Good time of day, list.
>> I have try to fix "Fixme" in svg.c:
>> /* FIXME: this works only in the simple case */
>>
>> By default function try to get only root=/dev/*
>> I also attach patch. Thanks.
>>
>> v2:
>>       Rewrited with use fstab_node_to_udev_node() and
>> canonicalize_file_name() functions.
>> v3:
>>       Rewrited for parsing /proc/self/mountinfo
>>
>> Please test it, i'm can't test because i not have /proc/schedstat
>> file (custom kernel)
>>
>> I use " 0 " for searching root device its correct?
>> For test:
>> [$]: grep " 0 " /proc/self/mountinfo
> No:
>
> 13 1 179:53 / / rw,noatime shared:1 - ext4 /dev/root rw,data=ordered
>
> Why not check field 5 for "/"?

To be honest - I don't know how write it prettily >_<
read file with fscanf like:
fscanf(fd, "%s %s %s %s %s %s %s - %s %s %s\n", ...) //Looks ugly.

Then, perhaps can i search 'shared:1 '  entry ?

>> I'm not use major:minor because on some setups it useless.
>> As example, my system root:
>> 50 0 0:28 /@ / rw,relatime shared:1 - btrfs /dev/sda3
>> rw,compress=zlib,space_cache,autodefrag         ^
> True, but you have the device name in there too   |
>
> Zbyszek

Hm.. If you insinuate that i can use block device name from "root
mount" line, i already did it:
> +               ptr = strtok(ptr, " /dev/");
> +               strncpy(rootbdev, &ptr[6], 3);

-- 
Have a nice day,
Timofey.


More information about the systemd-devel mailing list