return mpp;
}
-void
-free_multipath (struct multipath * mpp, int free_paths)
+extern void
+free_multipath_attributes (struct multipath * mpp)
{
if (!mpp)
return;
if (mpp->selector &&
mpp->selector != conf->selector &&
(!mpp->mpe || (mpp->mpe && mpp->selector != mpp->mpe->selector)) &&
- (!mpp->hwe || (mpp->hwe && mpp->selector != mpp->hwe->selector)))
+ (!mpp->hwe || (mpp->hwe && mpp->selector != mpp->hwe->selector))) {
FREE(mpp->selector);
-
- if (mpp->alias &&
- (!mpp->mpe || (mpp->mpe && mpp->alias != mpp->mpe->alias)) &&
- (mpp->wwid && mpp->alias != mpp->wwid))
- FREE(mpp->alias);
+ mpp->selector = NULL;
+ }
if (mpp->features &&
mpp->features != conf->features &&
- (!mpp->hwe || (mpp->hwe && mpp->features != mpp->hwe->features)))
+ (!mpp->hwe || (mpp->hwe && mpp->features != mpp->hwe->features))) {
FREE(mpp->features);
+ mpp->features = NULL;
+ }
if (mpp->hwhandler &&
mpp->hwhandler != conf->default_hwhandler &&
- (!mpp->hwe || (mpp->hwe && mpp->hwhandler != mpp->hwe->hwhandler)))
+ (!mpp->hwe || (mpp->hwe && mpp->hwhandler != mpp->hwe->hwhandler))) {
FREE(mpp->hwhandler);
+ mpp->hwhandler = NULL;
+ }
+}
+
+void
+free_multipath (struct multipath * mpp, int free_paths)
+{
+ if (!mpp)
+ return;
+
+ free_multipath_attributes(mpp);
+
+ if (mpp->alias &&
+ (!mpp->mpe || (mpp->mpe && mpp->alias != mpp->mpe->alias)) &&
+ (mpp->wwid && mpp->alias != mpp->wwid)) {
+ FREE(mpp->alias);
+ mpp->alias = NULL;
+ }
if (mpp->dmi)
FREE(mpp->dmi);
void free_pathgroup (struct pathgroup * pgp, int free_paths);
void free_pgvec (vector pgvec, int free_paths);
void free_multipath (struct multipath *, int free_paths);
+void free_multipath_attributes (struct multipath *);
void drop_multipath (vector mpvec, char * wwid, int free_paths);
void free_multipathvec (vector mpvec, int free_paths);
static int
update_multipath_strings (struct multipath *mpp, vector pathvec)
{
- if (mpp->selector) {
- FREE(mpp->selector);
- mpp->selector = NULL;
- }
-
- if (mpp->features) {
- FREE(mpp->features);
- mpp->features = NULL;
- }
-
- if (mpp->hwhandler) {
- FREE(mpp->hwhandler);
- mpp->hwhandler = NULL;
- }
-
+ free_multipath_attributes(mpp);
free_pgvec(mpp->pg, KEEP_PATHS);
mpp->pg = NULL;