]> sourceware.org Git - lvm2.git/commitdiff
Use is_orphan_vg in place of hard-coded prefix tests.
authorAlasdair Kergon <agk@redhat.com>
Wed, 19 May 2010 00:52:55 +0000 (00:52 +0000)
committerAlasdair Kergon <agk@redhat.com>
Wed, 19 May 2010 00:52:55 +0000 (00:52 +0000)
WHATS_NEW
lib/cache/lvmcache.c
lib/locking/cluster_locking.c
lib/locking/file_locking.c
lib/locking/locking.c

index 3feb1eb4c5fff57a9ba7b3b0448c2020c6c2baad..25324b94b24fe7150d52913d48fdcd7cd5f4aa38 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.66 - 
 ===============================
+  Use is_orphan_vg in place of hard-coded prefix tests.
 
 Version 2.02.65 - 17th May 2010
 ===============================
index 940c61f39cc45d0bfcf50c261b25ad320b5d6dd1..22e4517b271ed97593a56fd3c2a906e2d1ea9f1d 100644 (file)
@@ -224,11 +224,11 @@ void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
 
 /*
  * Ensure vgname2 comes after vgname1 alphabetically.
- * Special VG names beginning with '#' don't count.
+ * Orphans don't count.
  */
 static int _vgname_order_correct(const char *vgname1, const char *vgname2)
 {
-       if ((*vgname1 == '#') || (*vgname2 == '#'))
+       if (is_orphan_vg(vgname1) || is_orphan_vg(vgname2))
                return 1;
 
        if (strcmp(vgname1, vgname2) < 0)
index aff213a93c3e2756bd73e3ecb73897f1392b18e3..58f59fc73101cea4bb94951f2ef27bec399ea179 100644 (file)
@@ -406,7 +406,7 @@ int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags)
                }
 
                /* If the VG name is empty then lock the unused PVs */
-               if (*resource == '#' || (flags & LCK_CACHE))
+               if (is_orphan_vg(resource) || (flags & LCK_CACHE))
                        dm_snprintf(lockname, sizeof(lockname), "P_%s",
                                    resource);
                else
index f47961dfd8d62add6435c4440fcb190c2b0e7fcf..a6ef086a0193da0fc6fdfe65e0b02f516c84cc8b 100644 (file)
@@ -265,7 +265,7 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
                if (flags & LCK_CACHE)
                        break;
 
-               if (*resource == '#')
+               if (is_orphan_vg(resource))
                        dm_snprintf(lockfile, sizeof(lockfile),
                                     "%s/P_%s", _lock_dir, resource + 1);
                else
index c663c28536389dbc3a29847a79c38419a7d7e2f3..3abf8f288e1c9e7c4e4fdfe4e049c9f22c0d5abc 100644 (file)
@@ -369,7 +369,7 @@ static int _lock_vol(struct cmd_context *cmd, const char *resource,
                return 0;
        }
 
-       if (*resource == '#' && (flags & LCK_CACHE)) {
+       if (is_orphan_vg(resource) && (flags & LCK_CACHE)) {
                log_error(INTERNAL_ERROR "P_%s referenced", resource);
                return 0;
        }
@@ -423,7 +423,7 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
                if (!_blocking_supported)
                        flags |= LCK_NONBLOCK;
 
-               if (vol[0] != '#' &&
+               if (!is_orphan_vg(vol) && 
                    ((flags & LCK_TYPE_MASK) != LCK_UNLOCK) &&
                    (!(flags & LCK_CACHE)) &&
                    !lvmcache_verify_lock_order(vol))
This page took 0.050144 seconds and 5 git commands to generate.