Lines Matching refs:clp

631 	cache_link_t *clp;
650 clp = link_insert(hdp, pcmp, path, content, dlp->attr);
651 if (clp == NULL) {
657 nidx, clp->path, pcmp == NULL ? "(DANGLING)" : "");
915 cache_link_t *clp,
925 if (clp != NULL && ((pdmp == NULL) ^ (clp == CACHE(hdp)->dngl))) {
931 for (; clp != NULL; clp = clp->sib) {
933 assert(clp->path != NULL);
935 if ((pdmp == NULL) ^ (clp->minor == NULL)) {
937 "(%s)\n", fcn, clp->path);
948 dlp->path = write_string(hdp, clp->path, next);
949 dlp->content = write_string(hdp, clp->content, next);
956 dlp->attr = clp->attr;
970 clp->path, pdmp == NULL ? "(DANGLING)" : "");
973 return (clp ? -1 : 0);
1054 cache_link_t *clp;
1064 clp = CACHE(hdp)->dngl;
1065 CACHE(hdp)->dngl = clp->sib;
1066 assert(clp->minor == NULL);
1067 link_free(&clp);
1107 cache_link_t *clp;
1124 clp = cmnp->link;
1125 cmnp->link = clp->sib;
1126 rm_link_from_hash(hdp, clp);
1127 link_free(&clp);
1136 rm_link_from_hash(struct di_devlink_handle *hdp, cache_link_t *clp)
1141 if (clp == NULL)
1144 if (clp->path == NULL)
1147 hval = hashfn(hdp, clp->path);
1150 if (*pp == clp) {
1151 *pp = clp->hash;
1152 clp->hash = NULL;
1157 dprintf(DBG_ERR, "rm_link_from_hash: link(%s) not found\n", clp->path);
1164 cache_link_t **pp, *clp;
1171 for (; (clp = *pp) != NULL; pp = &clp->hash) {
1172 if (strcmp(clp->path, link) == 0) {
1177 if (clp == NULL)
1181 *pp = clp->hash;
1182 clp->hash = NULL;
1185 return (clp);
1189 link2minor(struct di_devlink_handle *hdp, cache_link_t *clp)
1197 if (TYPE_PRI(attr2type(clp->attr))) {
1201 if (!is_minor_node(clp->content, &minor_path)) {
1218 if (strncmp(clp->content, DEV"/", strlen(DEV"/")) == 0) {
1219 cp = &clp->content[strlen(DEV"/")];
1220 } else if (clp->content[0] != '/') {
1221 if ((cp = strrchr(clp->path, '/')) != NULL) {
1224 (void) snprintf(buf, sizeof (buf), "%s", clp->path);
1227 (void) strlcat(buf, clp->content, sizeof (buf));
1242 (void) snprintf(link, sizeof (link), "%s/%s", hdp->dev_dir, clp->path);
1288 cache_link_t *clp, **pp;
1291 clp = *pp;
1292 if ((cmnp = link2minor(hdp, clp)) != NULL) {
1293 *pp = clp->sib;
1294 clp->sib = cmnp->link;
1295 cmnp->link = clp;
1296 assert(clp->minor == NULL);
1297 clp->minor = cmnp;
1300 " unresolved\n", clp->path);
1301 pp = &clp->sib;
1347 cache_link_t *clp = *pp;
1351 if (clp == NULL)
1354 free(clp->path);
1355 free(clp->content);
1356 free(clp);
1731 cache_link_t *clp;
1744 if ((clp = link_hash(hdp, link, UNLINK_FROM_HASH)) == NULL) {
1748 link_delete(hdp, clp);
1765 link_delete(di_devlink_handle_t hdp, cache_link_t *clp)
1770 (void) dprintf(DBG_STEP, "%s: removing link: %s\n", fcn, clp->path);
1772 if (clp->minor == NULL)
1775 pp = &clp->minor->link;
1778 if (*pp == clp)
1784 fcn, clp->path);
1786 *pp = clp->sib;
1789 delete_unused_minor(hdp, clp->minor);
1791 clp->minor = NULL;
1793 link_free(&clp);
1829 cache_link_t *clp;
1842 if ((clp = link_hash(hdp, link, 0)) != NULL) {
1843 if (link_cmp(clp, content, LINK_TYPE(flags)) != 0) {
1846 return (clp);
1881 link_cmp(cache_link_t *clp, const char *content, int type)
1883 if (strcmp(clp->content, content) != 0)
1886 if (attr2type(clp->attr) != type)
1913 cache_link_t *clp;
1931 for (clp = CACHE_HASH(hdp, hval); clp != NULL; ) {
1932 if (GET_VALID_ATTR(clp->attr)) {
1933 CLR_VALID_ATTR(clp->attr);
1934 clp = clp->hash;
1943 (void) snprintf(pdup, sizeof (pdup), "%s", clp->path);
1944 clp = clp->hash;
2202 cache_link_t *clp;
2224 if ((clp = add_link(hdp, link, content, flags)) != NULL) {
2225 SET_VALID_ATTR(clp->attr);
2758 cache_link_t *clp;
2766 if ((clp = calloc(1, sizeof (cache_link_t))) == NULL) {
2771 clp->path = strdup(path);
2772 clp->content = strdup(content);
2773 if (clp->path == NULL || clp->content == NULL) {
2775 link_free(&clp);
2779 clp->attr = attr;
2780 hash_insert(hdp, clp);
2781 clp->minor = cmnp;
2785 clp->sib = cmnp->link;
2786 cmnp->link = clp;
2788 clp->sib = CACHE(hdp)->dngl;
2789 CACHE(hdp)->dngl = clp;
2792 return (clp);
2796 hash_insert(struct di_devlink_handle *hdp, cache_link_t *clp)
2800 hval = hashfn(hdp, clp->path);
2801 clp->hash = CACHE_HASH(hdp, hval);
2802 CACHE_HASH(hdp, hval) = clp;
2953 cache_link_t *clp;
2964 for (clp = CACHE(hdp)->dngl; clp != NULL; clp = clp->sib) {
2965 count_link(clp, count);
3004 cache_link_t *clp;
3013 for (clp = cmnp->link; clp != NULL; clp = clp->sib) {
3014 count_link(clp, count);
3019 count_link(cache_link_t *clp, uint32_t *count)
3021 if (clp == NULL)
3025 count_string(clp->path, count);
3026 count_string(clp->content, count);
3616 walk_cache_links(di_devlink_handle_t hdp, cache_link_t *clp, link_desc_t *linkp)
3623 clp ? clp->path : "<NULL>");
3632 for (; clp != NULL; clp = clp->sib) {
3635 assert(clp->path[0] != '/');
3637 vlink.rel_path = clp->path;
3638 vlink.content = clp->content;
3639 vlink.type = attr2type(clp->attr);
3644 "terminating at link: %s\n", clp->path);
3649 clp = CACHE(hdp)->dngl;
3662 cache_link_t *clp;
3667 clp = CACHE_HASH(hdp, i);
3668 for (; clp; clp = clp->hash) {
3671 assert(clp->path[0] != '/');
3673 vlink.rel_path = clp->path;
3674 vlink.content = clp->content;
3675 vlink.type = attr2type(clp->attr);
3679 "walk at link: %s\n", clp->path);