[systemd-devel] [PATCH v3] Bootchart: use /proc/pid/mountinfo for root bdev
Karel Zak
kzak at redhat.com
Fri Oct 31 01:57:15 PDT 2014
On Fri, Oct 31, 2014 at 07:51:59AM +0300, Timofey Titovets wrote:
> 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?
findmnt -o TARGET,SOURCE,ID
don't forget that mount IDs are sequential numbers and we usually don't mount
the real root as the first thing (for example /sys, /proc, /dev are mounted
more early in initrd).
> >> 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 ?
somewhere in systemd code is mountinfo parser.. or see
https://github.com/karelzak/util-linux/blob/master/libmount/src/tab_parse.c#L124
it seems you also want to read:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/proc.txt#n1589
Karel
--
Karel Zak <kzak at redhat.com>
http://karelzak.blogspot.com
More information about the systemd-devel
mailing list