+static int add_perm_dev(struct perm_device *new_dev)
+{
+ struct perm_device *dev;
+ struct perm_device *tmp_dev;
+
+ /* update the values if we already have the device */
+ list_for_each_entry(dev, &perm_device_list, node) {
+ if (strcmp(new_dev->name, dev->name) != 0)
+ continue;
+
+ set_empty_perms(dev, new_dev->mode, new_dev->owner, new_dev->group);
+ return 0;
+ }
+
+ /* not found, add new structure to the perm list */
+ tmp_dev = malloc(sizeof(*tmp_dev));
+ if (!tmp_dev)
+ return -ENOMEM;
+
+ memcpy(tmp_dev, new_dev, sizeof(*tmp_dev));
+ list_add_tail(&tmp_dev->node, &perm_device_list);
+ //dump_perm_dev(tmp_dev);
+ return 0;
+}
+