@@ -526,6 +526,25 @@ find_path_by_devt (const struct _vector *pathvec, const char * dev_t)
return NULL;
}
+struct path *mp_find_path_by_devt(const struct multipath *mpp, const char *devt)
+{
+ struct path *pp;
+ struct pathgroup *pgp;
+ unsigned int i, j;
+
+ pp = find_path_by_devt(mpp->paths, devt);
+ if (pp)
+ return pp;
+
+ vector_foreach_slot (mpp->pg, pgp, i){
+ vector_foreach_slot (pgp->paths, pp, j){
+ if (!strcmp(pp->dev_t, devt))
+ return pp;
+ }
+ }
+ return NULL;
+}
+
static int do_pathcount(const struct multipath *mpp, const int *states,
unsigned int nr_states)
{
@@ -568,6 +568,9 @@ struct path * find_path_by_devt (const struct _vector *pathvec, const char *devt
struct path * find_path_by_dev (const struct _vector *pathvec, const char *dev);
struct path * first_path (const struct multipath *mpp);
+struct path *mp_find_path_by_devt(const struct multipath *mpp, const char *devt);
+
+
int pathcount (const struct multipath *, int);
int count_active_paths(const struct multipath *);
int count_active_pending_paths(const struct multipath *);
A helper function that searches a struct multipath by dev_t, and works whether or not mpp->paths is currently available. Signed-off-by: Martin Wilck <mwilck@suse.com> --- libmultipath/structs.c | 19 +++++++++++++++++++ libmultipath/structs.h | 3 +++ 2 files changed, 22 insertions(+)