[systemd-devel] [PATCH 1/4] fstab-generator: place /sysroot* mount units in initrd-fs.target

harald at redhat.com harald at redhat.com
Mon Mar 4 22:28:41 PST 2013


From: Harald Hoyer <harald at redhat.com>

---
 src/fstab-generator/fstab-generator.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 910bbc1..fade192 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -200,8 +200,8 @@ static bool mount_in_initrd(struct mntent *me) {
 }
 
 static int add_mount(const char *what, const char *where, const char *type, const char *opts,
-                     int passno, bool noauto, bool nofail, bool automount, bool isbind, bool isnetwork,
-                     const char *source) {
+                     int passno, bool noauto, bool nofail, bool automount, bool isbind,
+                     bool remote_fs_target, bool initrd_fs_target, const char *source) {
         char _cleanup_free_
                 *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL,
                 *automount_name = NULL, *automount_unit = NULL;
@@ -227,9 +227,12 @@ static int add_mount(const char *what, const char *where, const char *type, cons
             mount_point_ignore(where))
                 return 0;
 
-        if (isnetwork) {
+        if (remote_fs_target) {
                 post = SPECIAL_REMOTE_FS_TARGET;
                 pre = SPECIAL_REMOTE_FS_PRE_TARGET;
+        } else if (initrd_fs_target) {
+                post = SPECIAL_INITRD_FS_TARGET;
+                pre = SPECIAL_INITRD_FS_PRE_TARGET;
         } else {
                 post = SPECIAL_LOCAL_FS_TARGET;
                 pre = SPECIAL_LOCAL_FS_PRE_TARGET;
@@ -432,8 +435,8 @@ static int parse_fstab(const char *prefix, bool initrd) {
                         isnetwork = mount_is_network(me);
 
                         k = add_mount(what, where, me->mnt_type, me->mnt_opts,
-                                     me->mnt_passno, noauto, nofail, automount,
-                                     isbind, isnetwork, fstab_path);
+                                      me->mnt_passno, noauto, nofail, automount,
+                                      isbind, isnetwork, initrd, fstab_path);
                 }
 
                 if (k < 0)
@@ -514,7 +517,7 @@ static int parse_new_root_from_proc_cmdline(void) {
 
         log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
         r = add_mount(what, "/sysroot", type, opts, 0, false, false, false,
-                      false, false, "/proc/cmdline");
+                      false, false, true, "/proc/cmdline");
 
         return (r < 0) ? r : 0;
 }
-- 
1.8.1



More information about the systemd-devel mailing list