Handle rootfs is_mounted properly
David Zeuthen
david at fubar.dk
Wed Apr 6 15:03:40 PDT 2005
On Wed, 2005-04-06 at 14:58 +0200, Tom Parker wrote:
> I've written a patch to do proper handling of the is_mounted setup in
> hald/linux2/blockdev.c for root filesystems. This is mostly based on a
> patch for parted [0], that I am unable to work out ownership for, but
> should be ok license wise (as Parted is a GNU project using the GPL).
> Should be all ok, but 2nd/3rd/4th/etc opinions are welcomed.
Well, the idea is good enough; here are some points to address
1. Coding style doesn't fit with the rest of the hal code
2. Declarations of variables need to be in the beginning of a
composite expression (after the {) (even though C99 allows
this, I don't like it)
3. The usage of realpath() looks like a buffer overflow but the
man page says something about PATH_MAX so I guess it's ok,
however see 4.
4. Suggest to just use stat(2) on /dev/root (it should follow
symlinks, otherwise use realpath to get to the real /dev
file) and compare the st_dev result with block.major,
block.minor on the HalDevice object. Also, use
My rootfs is on LVM2 on the systems here at work, so I can't really test
this myself.
Cheers,
David
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list