[PATCH] 4/6: Helper function to derive the raid_set that goes with a raid_dev

Adam DiCarlo <[email protected]>
Newsgroups gmane.linux.ataraid
Message-ID <[email protected]>
Signed-off-by: Adam DiCarlo <[email protected]>
Signed-off-by: James Simshaw <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>

_______________________________________________
Ataraid-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ataraid-list
metadata.patch (text/x-patch, 1.2 KB)
--- ORIGINAL/lib/metadata/metadata.c	2006-07-26 14:28:08.000000000 -0700
+++ PATCHED/lib/metadata/metadata.c	2006-08-18 11:43:37.000000000 -0700
@@ -813,6 +813,20 @@ struct dmraid_format *get_format(struct 
 	return DEVS(rs) ? (RD_RS(rs))->fmt : NULL;
 }
 
+/* Find the set associated with a device */
+struct raid_set *get_raid_set(struct lib_context *lc, struct raid_dev *dev)
+{
+	struct raid_set *rs;
+	struct raid_dev *rd;
+
+	list_for_each_entry(rs, LC_RS(lc), list)
+		list_for_each_entry(rd, &rs->devs, devs)
+			if (dev == rd)
+				return rs;
+
+	return NULL;
+}
+
 /* Check metadata consistency of raid sets. */
 static void check_raid_sets(struct lib_context *lc)
 {
--- ORIGINAL/include/dmraid/metadata.h	2006-07-26 14:24:17.000000000 -0700
+++ PATCHED/include/dmraid/metadata.h	2006-08-03 14:46:23.000000000 -0700
@@ -207,6 +207,8 @@ struct raid_set {
 	enum status status;		/* Status of set. */
 };
 
+extern struct raid_set *get_raid_set(struct lib_context *lc,
+				     struct raid_dev *rd);
 extern struct dmraid_format *get_format(struct raid_set *rs);
 extern const char *get_type(struct lib_context *lc, enum type type);
 extern const char *get_dm_type(struct lib_context *lc, enum type type);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.