Lines Matching defs:dp
84 struct perms_ dp;
107 node->dp.name = strdup(name);
108 if (!node->dp.name)
112 node->dp.attr = strdup(attr);
113 if (!node->dp.attr)
117 node->dp.perm = perm;
118 node->dp.uid = uid;
119 node->dp.gid = gid;
120 node->dp.prefix = prefix;
121 node->dp.wildcard = wildcard;
135 struct perms_ *dp;
141 dp = &(node_to_item(node, struct perm_node, plist))->dp;
142 if (dp->prefix) {
143 if (strncmp(upath, dp->name + 4, strlen(dp->name + 4)))
145 } else if (dp->wildcard) {
146 if (fnmatch(dp->name + 4, upath, FNM_PATHNAME) != 0)
149 if (strcmp(upath, dp->name + 4))
153 if ((strlen(upath) + strlen(dp->attr) + 6) > sizeof(buf))
156 snprintf(buf, sizeof(buf), "/sys%s/%s", upath, dp->attr);
157 INFO("fixup %s %d %d 0%o\n", buf, dp->uid, dp->gid, dp->perm);
158 chown(buf, dp->uid, dp->gid);
159 chmod(buf, dp->perm);
174 static bool perm_path_matches(const char *path, struct perms_ *dp)
176 if (dp->prefix) {
177 if (strncmp(path, dp->name, strlen(dp->name)) == 0)
179 } else if (dp->wildcard) {
180 if (fnmatch(dp->name, path, FNM_PATHNAME) == 0)
183 if (strcmp(path, dp->name) == 0)
195 struct perms_ *dp;
204 dp = &perm_node->dp;
206 if (perm_path_matches(path, dp)) {
212 if (perm_path_matches(links[i], dp)) {
221 *uid = dp->uid;
222 *gid = dp->gid;
223 return dp->perm;