Print this page
LOCAL: disk-lights work 2

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/fm/topo/libtopo/common/topo_node.c
          +++ new/usr/src/lib/fm/topo/libtopo/common/topo_node.c
↓ open down ↓ 829 lines elided ↑ open up ↑
 830  830          }
 831  831  
 832  832          wp->tw_root = node;
 833  833          wp->tw_cb = cb_f;
 834  834          wp->tw_pdata = pdata;
 835  835          wp->tw_thp = thp;
 836  836          wp->tw_mod = mod;
 837  837  
 838  838          return (wp);
 839  839  }
      840 +
      841 +/*
      842 + * Walk the direct children of the given node.
      843 + */
      844 +int
      845 +topo_node_child_walk(topo_hdl_t *thp, tnode_t *pnode, topo_walk_cb_t cb_f,
      846 +    void *arg, int *errp)
      847 +{
      848 +        int ret = TOPO_WALK_TERMINATE;
      849 +        tnode_t *cnode;
      850 +
      851 +        topo_node_hold(pnode);
      852 +
      853 +        /*
      854 +         * First Child:
      855 +         */
      856 +        topo_node_lock(pnode);
      857 +        cnode = topo_child_first(pnode);
      858 +        topo_node_unlock(pnode);
      859 +
      860 +        if (cnode == NULL) {
      861 +                *errp = ETOPO_WALK_EMPTY;
      862 +                ret = TOPO_WALK_ERR;
      863 +                goto out;
      864 +        }
      865 +
      866 +        while (cnode != NULL) {
      867 +                int iret;
      868 +
      869 +                /*
      870 +                 * Call the walker callback:
      871 +                 */
      872 +                topo_node_hold(cnode);
      873 +                iret = cb_f(thp, cnode, arg);
      874 +                topo_node_rele(cnode);
      875 +                if (iret != TOPO_WALK_NEXT) {
      876 +                        ret = iret;
      877 +                        break;
      878 +                }
      879 +
      880 +                /*
      881 +                 * Next child:
      882 +                 */
      883 +                topo_node_lock(pnode);
      884 +                cnode = topo_child_next(pnode, cnode);
      885 +                topo_node_unlock(pnode);
      886 +        }
      887 +
      888 +out:
      889 +        topo_node_rele(pnode);
      890 +        return (ret);
      891 +}
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX