summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2010-04-16 13:09:41 -0400
committerDoug Ledford <dledford@redhat.com>2010-04-16 13:09:41 -0400
commitc7e7c90ce625db7d937dbfa87a10003514a7ebfd (patch)
tree076eaca6d9f731117192634353f8c1228d998f64
parentce03f04bde040ac014c61c74d2722981f7f2e02f (diff)
downloadmdadm-c7e7c90ce625db7d937dbfa87a10003514a7ebfd.tar.gz
mdadm-c7e7c90ce625db7d937dbfa87a10003514a7ebfd.tar.xz
mdadm-c7e7c90ce625db7d937dbfa87a10003514a7ebfd.zip
Add some helper functions to make code cleaner looking
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--Incremental.c17
-rw-r--r--mdadm.h3
2 files changed, 6 insertions, 14 deletions
diff --git a/Incremental.c b/Incremental.c
index ace80c4..5fdf509 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -909,7 +909,7 @@ int IncrementalNewDisk(char *devname, int verbose, int export)
domain = conf_get_domain(devname);
if (!domain)
return 0;
- if ((domain->action & action_mask) <= incremental)
+ if (action(domain) <= incremental)
/* Nothing to do. We only get called in the case that there
* is no current superblock on the device in question, and
* since our matching domain says we should either ignore or
@@ -917,19 +917,8 @@ int IncrementalNewDisk(char *devname, int verbose, int export)
* superblock. Since we don't, we're done.
*/
return 0;
- if (domain->action == partition) {
- /* Special case. Basically, we can only put this action on
- * whole disk devices, and since we are partitioning them,
- * the whole device necessarily won't ever be part of an
- * array, so we will never have any arrays in our domain, ever.
- * As such, we have to figure out what to do from other
- * hints.
- */
- /* We haven't filled this out yet */
- return 0;
- }
- mdstat = arrays_in_domain(devname, domain);
- if (!mdstat) {
+ if (action(domain) != partition &&
+ (mdstat = arrays_in_domain(devname, domain)) == NULL) {
/* As a technical design decision, we *must* have at least one
* array in our domain that we can add this device to or else
* we simply can't do anything with this device.
diff --git a/mdadm.h b/mdadm.h
index 8eb7bc7..a020ad9 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -292,6 +292,9 @@ enum domain_actions {
other metadata on them */
};
+#define action(domain) ((domain)->action & action_mask)
+#define force(domain) ((domain)->action & force)
+
struct domain_ent {
char *spare_group; /* only set this in monitor mode
when we know what arrays we