[systemd-devel] [RFC] link against util-linux for fstab parsing

Karel Zak kzak at redhat.com
Tue Feb 21 05:37:30 PST 2012

On Mon, Feb 20, 2012 at 09:50:54AM -0500, Dave Reisner wrote:
> Well, it does get shorter if you keep going with it (there's code in
> umount that can be replaced). replacing the mountinfo sscanf parsing
> with libmount seems like more of a win to me. My working tree is
> currently looking like +172/-219 and replaces code in
> src/{,u}mount.c and src/cryptsetup/cryptsetup-generator.c
> Rewriting remount-api-vfs purely with libmount almost works, but then
> doesn't if you want to be able to fork for each mount call. Karel, maybe
> I missed something... mnt_context_next_mount() doesn't seem to let you
> filter in the way sd's mount_point_is_api() does (filtering on target),

 Currently it's impossible, it uses fstype and options patterns only
 (it's backend for "umount -a" and "mount -a"). But we can extend for
 example libmnt_context or libmnt_iter to call some external filter

> but you can't fork internally for mount(2) if you don't use that call.

 Yes, maybe the fork() stuff should be moved into mnt_context_mount()
 and then it will be available without mnt_context_next_mount()
 machinery. I'll try to improve it for the next release.

> Perhaps Karel can be a better salesman than I can. =P

 It seems I missed the opportunity to buy a few beers to Lennart last week ;-)

> > Dave, Karel, can you fill in any reasons here? If not I think we
> > shouldn't apply this patch...

 This is Dave's activity, but I'm happy that someone wants to use the
 library. (So thanks Dave!)

 I have talked with Lennart about libmount for systemd on IRC few
 months ago and I know about the fork(2) requirement (and the
 requirement makes a lot of sense). So the libmount for systemd was
 not my primary goal, it's more long-term wish ;-)

 Anyway, number of removed lines should not be the real reason. We're
 slowly moving important low-level system stuff to the shared
 libraries to avoid duplicate code and consolidate functionality.

 BTW, for the next libmount release (2.22) I'd like to support
 swapon(2) and swapoff(2) in the library.


 Karel Zak  <kzak at redhat.com>

More information about the systemd-devel mailing list