63                 if (strcmp(pos->is_name, name) == 0)
  64                         return (pos);
  65 
  66                 pos2 = find_iodev_by_name(pos->is_children, name);
  67                 if (pos2 != NULL)
  68                         return (pos2);
  69         }
  70 
  71         return (NULL);
  72 }
  73 
  74 static enum iodev_type
  75 parent_iodev_type(enum iodev_type type)
  76 {
  77         switch (type) {
  78                 case IODEV_CONTROLLER: return (0);
  79                 case IODEV_IOPATH_LT: return (0);
  80                 case IODEV_IOPATH_LI: return (0);
  81                 case IODEV_NFS: return (0);
  82                 case IODEV_TAPE: return (0);
  83                 case IODEV_IOPATH_LTI: return (IODEV_DISK);
  84                 case IODEV_DISK: return (IODEV_CONTROLLER);
  85                 case IODEV_PARTITION: return (IODEV_DISK);
  86         }
  87         return (IODEV_UNKNOWN);
  88 }
  89 
  90 static int
  91 id_match(struct iodev_id *id1, struct iodev_id *id2)
  92 {
  93         return (id1->id == id2->id &&
  94             strcmp(id1->tid, id2->tid) == 0);
  95 }
  96 
  97 static struct iodev_snapshot *
  98 find_parent(struct snapshot *ss, struct iodev_snapshot *iodev)
  99 {
 100         enum iodev_type parent_type = parent_iodev_type(iodev->is_type);
 101         struct iodev_snapshot *pos;
 102         struct iodev_snapshot *pos2;
 
 661         /*
 662          * we fill in pretty name wether it is asked for or not because
 663          * it could be used in a filter by match_iodevs.
 664          */
 665         iodev->is_pretty = pretty;
 666 }
 667 
 668 static enum iodev_type
 669 get_iodev_type(kstat_t *ksp)
 670 {
 671         if (strcmp(ksp->ks_class, "disk") == 0)
 672                 return (IODEV_DISK);
 673         if (strcmp(ksp->ks_class, "partition") == 0)
 674                 return (IODEV_PARTITION);
 675         if (strcmp(ksp->ks_class, "nfs") == 0)
 676                 return (IODEV_NFS);
 677         if (strcmp(ksp->ks_class, "iopath") == 0)
 678                 return (IODEV_IOPATH_LTI);
 679         if (strcmp(ksp->ks_class, "tape") == 0)
 680                 return (IODEV_TAPE);
 681         return (IODEV_UNKNOWN);
 682 }
 683 
 684 /* get the lun/target/initiator from the name, return 1 on success */
 685 static int
 686 get_lti(char *s,
 687         char *lname, int *l, char *tname, int *t, char *iname, int *i)
 688 {
 689         int  num = 0;
 690 
 691         num = sscanf(s, "%[a-z]%d%*[.]%[a-z]%d%*[.]%[a-z_]%d", lname, l,
 692             tname, t, iname, i);
 693         return ((num == 6) ? 1 : 0);
 694 }
 695 
 696 
 697 /* get the lun, target, and initiator name and instance */
 698 static void
 699 get_path_info(struct iodev_snapshot *io, char *mod, size_t modlen, int *type,
 700     int *inst, char *name, size_t size)
 
 | 
 
 
  63                 if (strcmp(pos->is_name, name) == 0)
  64                         return (pos);
  65 
  66                 pos2 = find_iodev_by_name(pos->is_children, name);
  67                 if (pos2 != NULL)
  68                         return (pos2);
  69         }
  70 
  71         return (NULL);
  72 }
  73 
  74 static enum iodev_type
  75 parent_iodev_type(enum iodev_type type)
  76 {
  77         switch (type) {
  78                 case IODEV_CONTROLLER: return (0);
  79                 case IODEV_IOPATH_LT: return (0);
  80                 case IODEV_IOPATH_LI: return (0);
  81                 case IODEV_NFS: return (0);
  82                 case IODEV_TAPE: return (0);
  83                 case IODEV_ZFS: return (0);
  84                 case IODEV_IOPATH_LTI: return (IODEV_DISK);
  85                 case IODEV_DISK: return (IODEV_CONTROLLER);
  86                 case IODEV_PARTITION: return (IODEV_DISK);
  87         }
  88         return (IODEV_UNKNOWN);
  89 }
  90 
  91 static int
  92 id_match(struct iodev_id *id1, struct iodev_id *id2)
  93 {
  94         return (id1->id == id2->id &&
  95             strcmp(id1->tid, id2->tid) == 0);
  96 }
  97 
  98 static struct iodev_snapshot *
  99 find_parent(struct snapshot *ss, struct iodev_snapshot *iodev)
 100 {
 101         enum iodev_type parent_type = parent_iodev_type(iodev->is_type);
 102         struct iodev_snapshot *pos;
 103         struct iodev_snapshot *pos2;
 
 662         /*
 663          * we fill in pretty name wether it is asked for or not because
 664          * it could be used in a filter by match_iodevs.
 665          */
 666         iodev->is_pretty = pretty;
 667 }
 668 
 669 static enum iodev_type
 670 get_iodev_type(kstat_t *ksp)
 671 {
 672         if (strcmp(ksp->ks_class, "disk") == 0)
 673                 return (IODEV_DISK);
 674         if (strcmp(ksp->ks_class, "partition") == 0)
 675                 return (IODEV_PARTITION);
 676         if (strcmp(ksp->ks_class, "nfs") == 0)
 677                 return (IODEV_NFS);
 678         if (strcmp(ksp->ks_class, "iopath") == 0)
 679                 return (IODEV_IOPATH_LTI);
 680         if (strcmp(ksp->ks_class, "tape") == 0)
 681                 return (IODEV_TAPE);
 682         if (strcmp(ksp->ks_class, "zfs") == 0)
 683                 return (IODEV_ZFS);
 684         return (IODEV_UNKNOWN);
 685 }
 686 
 687 /* get the lun/target/initiator from the name, return 1 on success */
 688 static int
 689 get_lti(char *s,
 690         char *lname, int *l, char *tname, int *t, char *iname, int *i)
 691 {
 692         int  num = 0;
 693 
 694         num = sscanf(s, "%[a-z]%d%*[.]%[a-z]%d%*[.]%[a-z_]%d", lname, l,
 695             tname, t, iname, i);
 696         return ((num == 6) ? 1 : 0);
 697 }
 698 
 699 
 700 /* get the lun, target, and initiator name and instance */
 701 static void
 702 get_path_info(struct iodev_snapshot *io, char *mod, size_t modlen, int *type,
 703     int *inst, char *name, size_t size)
 
 |