Hi Zbyszek, I had been thinking about adding more device-less fs types, too, and came to the same conclusion:-)
I'll rework the patch with the new else, use streq_ptr and alse rename type_is_tmpfs to fstype_is_tmpfs. I think that is cleaner. I'll send it as soon as I get round to it. Thanks for the review! Best Regards, Tobias On Mon, Mar 23, 2015 at 2:46 AM, Zbigniew Jędrzejewski-Szmek <[email protected]> wrote: > On Sun, Mar 22, 2015 at 08:29:25AM +0300, Andrei Borzenkov wrote: >> В Sun, 22 Mar 2015 00:57:23 +0100 >> Tobias Hunger <[email protected]> пишет: >> >> > src/fstab-generator/fstab-generator.c | 12 +++++++++++- >> > 1 file changed, 11 insertions(+), 1 deletion(-) >> > >> > diff --git a/src/fstab-generator/fstab-generator.c >> > b/src/fstab-generator/fstab-generator.c >> > index ccc7c6e..6b9719b 100644 >> > --- a/src/fstab-generator/fstab-generator.c >> > +++ b/src/fstab-generator/fstab-generator.c >> > @@ -145,6 +145,10 @@ static bool mount_in_initrd(struct mntent *me) { >> > streq(me->mnt_dir, "/usr"); >> > } >> > >> > +static bool type_is_tmpfs(char *type) { >> > + return !isempty(type) && streq(type, "tmpfs"); >> > +} >> > + > This is basically streq_ptr(type, "tmpfs"). > >> > static int add_mount( >> > const char *what, >> > const char *where, >> > @@ -388,13 +392,19 @@ static int add_root_mount(void) { >> > _cleanup_free_ char *what = NULL; >> > const char *opts; >> > >> > + if (type_is_tmpfs(arg_root_fstype)) { >> > + /* normalize what to mount to tmpfs */ >> > + if (free_and_strdup(&arg_root_what, "tmpfs") < 0) >> > + return log_oom(); >> > + } > >> Following code makes sense only for real device, so >> >> else { >> >> > + >> > if (isempty(arg_root_what)) { >> > log_debug("Could not find a root= entry on the kernel >> > command line."); >> > return 0; >> > } >> > >> > what = fstab_node_to_udev_node(arg_root_what); >> > - if (!path_is_absolute(what)) { >> > + if (!path_is_absolute(what) && !type_is_tmpfs(what)) { >> >> ... which makes this type_is_tmpfs() redundant >> >> > log_debug("Skipping entry what=%s where=/sysroot >> > type=%s", what, strna(arg_root_fstype)); >> > return 0; >> > } > > Looks OK. I'm wondering if we should support other device-less fs types > in the same manner. There's ramfs, but it's deprecated, and I don't think > there's > anything else we should support, so there's no need to make it more generic. > Can you remake the patch with streq_ptr and the additional else? > > Zbyszek _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
