[multipath]
authorroot <root@xa-s05.(none)>
Wed, 4 May 2005 15:46:28 +0000 (17:46 +0200)
committerroot <root@xa-s05.(none)>
Wed, 4 May 2005 15:46:28 +0000 (17:46 +0200)
0:0:0:0 is a valid host/bus/target/lun tuple, so don't print that for disappeared paths that are kept in the map in case they come back up.
print_path now prints #:#:#:# instead.

libmultipath/structs.c
multipath/main.c

index 79783eb..3a1d55b 100644 (file)
 struct path *
 alloc_path (void)
 {
-       return (struct path *)MALLOC(sizeof(struct path));
+       struct path * pp;
+       
+       pp = (struct path *)MALLOC(sizeof(struct path));
+
+       if (pp) {
+               pp->sg_id.host_no = -1;
+               pp->sg_id.channel = -1;
+               pp->sg_id.scsi_id = -1;
+               pp->sg_id.lun = -1;
+       }
+       return pp;
 }
 
 void
index 40f310c..60cce73 100644 (file)
@@ -154,12 +154,15 @@ print_path (struct path * pp, int style)
        else
                printf ("  \\_ ");
 
-       printf("%i:%i:%i:%i ",
-              pp->sg_id.host_no,
-              pp->sg_id.channel,
-              pp->sg_id.scsi_id,
-              pp->sg_id.lun);
-
+       if (pp->sg_id.host_no < 0)
+               printf("#:#:#:# ");
+       else {
+               printf("%i:%i:%i:%i ",
+                      pp->sg_id.host_no,
+                      pp->sg_id.channel,
+                      pp->sg_id.scsi_id,
+                      pp->sg_id.lun);
+       }
        if (pp->dev)
                printf("%-4s ", pp->dev);