Lines Matching defs:dev
36 static int node_symlink(struct udev_device *dev, const char *node, const char *slink) {
103 strscpyl(slink_tmp, sizeof(slink_tmp), slink, ".tmp-", udev_device_get_id_filename(dev), NULL);
129 static const char *link_find_prioritized(struct udev_device *dev, bool add, const char *stackdir, char *buf, size_t bufsize) {
130 struct udev *udev = udev_device_get_udev(dev);
136 priority = udev_device_get_devlink_priority(dev);
137 strscpy(buf, bufsize, udev_device_get_devnode(dev));
157 if (streq(dent->d_name, udev_device_get_id_filename(dev)))
182 static void link_update(struct udev_device *dev, const char *slink, bool add) {
189 util_path_encode(slink + strlen("/dev"), name_enc, sizeof(name_enc));
191 strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL);
196 target = link_find_prioritized(dev, add, dirname, buf, sizeof(buf));
203 node_symlink(dev, target, slink);
224 void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old) {
235 udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) {
247 name, udev_device_get_devpath(dev));
248 link_update(dev, name, false);
252 static int node_permissions_apply(struct udev_device *dev, bool apply,
255 const char *devnode = udev_device_get_devnode(dev);
256 dev_t devnum = udev_device_get_devnum(dev);
261 if (streq(udev_device_get_subsystem(dev), "block"))
274 udev_device_get_devnode(dev), udev_device_get_id_filename(dev));
337 void udev_node_add(struct udev_device *dev, bool apply,
344 udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid);
346 if (node_permissions_apply(dev, apply, mode, uid, gid, seclabel_list) < 0)
349 /* always add /dev/{block,char}/$major:$minor */
350 xsprintf(filename, "/dev/%s/%u:%u",
351 streq(udev_device_get_subsystem(dev), "block") ? "block" : "char",
352 major(udev_device_get_devnum(dev)),
353 minor(udev_device_get_devnum(dev)));
354 node_symlink(dev, udev_device_get_devnode(dev), filename);
357 udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev))
358 link_update(dev, udev_list_entry_get_name(list_entry), true);
361 void udev_node_remove(struct udev_device *dev) {
366 udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev))
367 link_update(dev, udev_list_entry_get_name(list_entry), false);
369 /* remove /dev/{block,char}/$major:$minor */
370 xsprintf(filename, "/dev/%s/%u:%u",
371 streq(udev_device_get_subsystem(dev), "block") ? "block" : "char",
372 major(udev_device_get_devnum(dev)),
373 minor(udev_device_get_devnum(dev)));