Now it rests near its sister-function disassemble_map().
Edward Goggin, EMC
return 0;
}
+/*
+ * Transforms the path group vector into a proper device map string
+ */
+int
+assemble_map (struct multipath * mp)
+{
+ int i, j;
+ int shift, freechar;
+ int minio;
+ char * p;
+ struct pathgroup * pgp;
+ struct path * pp;
+
+ minio = mp->minio;
+ p = mp->params;
+ freechar = sizeof(mp->params);
+
+ shift = snprintf(p, freechar, "%s %s %i %i",
+ mp->features, mp->hwhandler,
+ VECTOR_SIZE(mp->pg), mp->bestpg);
+
+ if (shift >= freechar) {
+ fprintf(stderr, "mp->params too small\n");
+ return 1;
+ }
+ p += shift;
+ freechar -= shift;
+
+ vector_foreach_slot (mp->pg, pgp, i) {
+ pgp = VECTOR_SLOT(mp->pg, i);
+ shift = snprintf(p, freechar, " %s %i 1", mp->selector,
+ VECTOR_SIZE(pgp->paths));
+ if (shift >= freechar) {
+ fprintf(stderr, "mp->params too small\n");
+ return 1;
+ }
+ p += shift;
+ freechar -= shift;
+
+ vector_foreach_slot (pgp->paths, pp, j) {
+ if (mp->rr_weight == RR_WEIGHT_PRIO && pp->priority)
+ minio *= pp->priority;
+
+ shift = snprintf(p, freechar, " %s %d",
+ pp->dev_t, minio);
+ if (shift >= freechar) {
+ fprintf(stderr, "mp->params too small\n");
+ return 1;
+ }
+ p += shift;
+ freechar -= shift;
+ }
+ }
+ if (freechar < 1) {
+ fprintf(stderr, "mp->params too small\n");
+ return 1;
+ }
+ snprintf(p, 1, "\n");
+ return 0;
+}
+
extern int
disassemble_map (vector pathvec, char * params, struct multipath * mpp)
{
+int assemble_map (struct multipath *);
int disassemble_map (vector, char *, struct multipath *);
int disassemble_status (char *, struct multipath *);
return 0;
}
-/*
- * Transforms the path group vector into a proper device map string
- */
-int
-assemble_map (struct multipath * mp)
-{
- int i, j;
- int shift, freechar;
- int minio;
- char * p;
- struct pathgroup * pgp;
- struct path * pp;
-
- minio = mp->minio;
- p = mp->params;
- freechar = sizeof(mp->params);
-
- shift = snprintf(p, freechar, "%s %s %i %i",
- mp->features, mp->hwhandler,
- VECTOR_SIZE(mp->pg), mp->bestpg);
-
- if (shift >= freechar) {
- fprintf(stderr, "mp->params too small\n");
- return 1;
- }
- p += shift;
- freechar -= shift;
-
- vector_foreach_slot (mp->pg, pgp, i) {
- pgp = VECTOR_SLOT(mp->pg, i);
- shift = snprintf(p, freechar, " %s %i 1", mp->selector,
- VECTOR_SIZE(pgp->paths));
- if (shift >= freechar) {
- fprintf(stderr, "mp->params too small\n");
- return 1;
- }
- p += shift;
- freechar -= shift;
-
- vector_foreach_slot (pgp->paths, pp, j) {
- if (mp->rr_weight == RR_WEIGHT_PRIO && pp->priority)
- minio *= pp->priority;
-
- shift = snprintf(p, freechar, " %s %d",
- pp->dev_t, minio);
- if (shift >= freechar) {
- fprintf(stderr, "mp->params too small\n");
- return 1;
- }
- p += shift;
- freechar -= shift;
- }
- }
- if (freechar < 1) {
- fprintf(stderr, "mp->params too small\n");
- return 1;
- }
- snprintf(p, 1, "\n");
-
- if (conf->verbosity > 2)
- print_map(mp);
-
- return 0;
-}
-
static int
setup_map (struct multipath * mpp)
{