[PATCH 15/44] libmultipath: add cleanup helpers for struct multipath

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Export cleanup_multipath_and_paths(), which will be used by multipath.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 libmultipath/libmultipath.version |  1 +
 libmultipath/structs.c            | 12 ++++++++++++
 libmultipath/structs.h            |  2 ++
 3 files changed, 15 insertions(+)

diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
index eb51174..f58cb1d 100644
--- a/libmultipath/libmultipath.version
+++ b/libmultipath/libmultipath.version
@@ -66,6 +66,7 @@ global:
 	check_foreign;
 	cleanup_bindings;
 	cleanup_lock;
+	cleanup_multipath_and_paths;
 	coalesce_paths;
 	count_active_paths;
 	delete_all_foreign;
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index be3125e..1583e00 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -329,6 +329,18 @@ free_multipath (struct multipath * mpp, enum free_path_mode free_paths)
 	free(mpp);
 }
 
+void cleanup_multipath(struct multipath **pmpp)
+{
+	if (*pmpp)
+		free_multipath(*pmpp, KEEP_PATHS);
+}
+
+void cleanup_multipath_and_paths(struct multipath **pmpp)
+{
+	if (*pmpp)
+		free_multipath(*pmpp, FREE_PATHS);
+}
+
 void
 drop_multipath (vector mpvec, char * wwid, enum free_path_mode free_paths)
 {
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index dbaf4d4..3b91e39 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -544,6 +544,8 @@ void free_pathvec (vector vec, enum free_path_mode free_paths);
 void free_pathgroup (struct pathgroup * pgp, enum free_path_mode free_paths);
 void free_pgvec (vector pgvec, enum free_path_mode free_paths);
 void free_multipath (struct multipath *, enum free_path_mode free_paths);
+void cleanup_multipath(struct multipath **pmpp);
+void cleanup_multipath_and_paths(struct multipath **pmpp);
 void free_multipath_attributes (struct multipath *);
 void drop_multipath (vector mpvec, char * wwid, enum free_path_mode free_paths);
 void free_multipathvec (vector mpvec, enum free_path_mode free_paths);
-- 
2.45.2





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux