Skip to content

Commit

Permalink
libmultipath: move pathcmp() to configure.c
Browse files Browse the repository at this point in the history
... as it has only one caller, and make it static. No functional changes.

Signed-off-by: Martin Wilck <[email protected]>
  • Loading branch information
mwilck committed Nov 25, 2024
1 parent 0ca2e61 commit 8ad901d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
19 changes: 19 additions & 0 deletions libmultipath/configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,25 @@ compute_pgid(struct pathgroup * pgp)
pgp->id ^= (long)pp;
}

static int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp)
{
int i, j;
struct path *pp, *cpp;
int pnum = 0, found = 0;

vector_foreach_slot(pgp->paths, pp, i) {
pnum++;
vector_foreach_slot(cpgp->paths, cpp, j) {
if ((long)pp == (long)cpp) {
found++;
break;
}
}
}

return pnum - found;
}

static int
pgcmp (struct multipath * mpp, struct multipath * cmpp)
{
Expand Down
19 changes: 0 additions & 19 deletions libmultipath/structs.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,25 +627,6 @@ int count_active_pending_paths(const struct multipath *mpp)
return do_pathcount(mpp, states, 3);
}

int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp)
{
int i, j;
struct path *pp, *cpp;
int pnum = 0, found = 0;

vector_foreach_slot(pgp->paths, pp, i) {
pnum++;
vector_foreach_slot(cpgp->paths, cpp, j) {
if ((long)pp == (long)cpp) {
found++;
break;
}
}
}

return pnum - found;
}

struct path *
first_path (const struct multipath * mpp)
{
Expand Down
1 change: 0 additions & 1 deletion libmultipath/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,6 @@ 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 *);
int pathcmp (const struct pathgroup *, const struct pathgroup *);
int add_feature (char **, const char *);
int remove_feature (char **, const char *);

Expand Down

0 comments on commit 8ad901d

Please sign in to comment.