]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
gpt-auto-generator: apply partition-type flags only to specific partition-types 929/head
authorKay Sievers <kay@vrfy.org>
Tue, 11 Aug 2015 11:07:25 +0000 (13:07 +0200)
committerKay Sievers <kay@vrfy.org>
Tue, 11 Aug 2015 11:07:25 +0000 (13:07 +0200)
The partition-type flags are defined independently for every partition-type. Apply
them only to the types where they are defined, and not to the ESP, which does not
appear to share the same set of flags.

  https://github.com/systemd/systemd/issues/920

src/gpt-auto-generator/gpt-auto-generator.c
src/udev/udev-builtin-blkid.c

index 9d889c17d8df71d7c3be842ce7ffd9cb9a97eb17..40caec5ab5dd71236403b2d1bdc3596d13d7221a 100644 (file)
@@ -666,7 +666,6 @@ static int enumerate_partitions(dev_t devnum) {
                 blkid_partition pp;
                 dev_t qn;
                 int nr;
-                unsigned long long flags;
 
                 q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
                 if (!q)
@@ -690,13 +689,6 @@ static int enumerate_partitions(dev_t devnum) {
                 if (!pp)
                         continue;
 
-                flags = blkid_partition_get_flags(pp);
-
-                /* Ignore partitions that are not marked for automatic
-                 * mounting on discovery */
-                if (flags & GPT_FLAG_NO_AUTO)
-                        continue;
-
                 nr = blkid_partition_get_partno(pp);
                 if (nr < 0)
                         continue;
@@ -709,6 +701,11 @@ static int enumerate_partitions(dev_t devnum) {
                         continue;
 
                 if (sd_id128_equal(type_id, GPT_SWAP)) {
+                        unsigned long long flags;
+
+                        flags = blkid_partition_get_flags(pp);
+                        if (flags & GPT_FLAG_NO_AUTO)
+                                continue;
 
                         if (flags & GPT_FLAG_READ_ONLY) {
                                 log_debug("%s marked as read-only swap partition, which is bogus. Ignoring.", subnode);
@@ -732,6 +729,11 @@ static int enumerate_partitions(dev_t devnum) {
                                 return log_oom();
 
                 } else if (sd_id128_equal(type_id, GPT_HOME)) {
+                        unsigned long long flags;
+
+                        flags = blkid_partition_get_flags(pp);
+                        if (flags & GPT_FLAG_NO_AUTO)
+                                continue;
 
                         /* We only care for the first /home partition */
                         if (home && nr >= home_nr)
@@ -745,6 +747,11 @@ static int enumerate_partitions(dev_t devnum) {
                                 return log_oom();
 
                 } else if (sd_id128_equal(type_id, GPT_SRV)) {
+                        unsigned long long flags;
+
+                        flags = blkid_partition_get_flags(pp);
+                        if (flags & GPT_FLAG_NO_AUTO)
+                                continue;
 
                         /* We only care for the first /srv partition */
                         if (srv && nr >= srv_nr)
index 1dad4476f33de248f408b01620a8dc03bfa2f399..b8066ea6e9c40fef5be6987a2fbd3c9be657b7f0 100644 (file)
@@ -143,6 +143,11 @@ static int find_gpt_root(struct udev_device *dev, blkid_probe pr, bool test) {
 
                 if (sd_id128_equal(type, GPT_ESP)) {
                         sd_id128_t id, esp;
+                        unsigned long long flags;
+
+                        flags = blkid_partition_get_flags(pp);
+                        if (flags & GPT_FLAG_NO_AUTO)
+                                continue;
 
                         /* We found an ESP, let's see if it matches
                          * the ESP we booted from. */