braindamaged avatar braindamaged committed 77aad09

libudev: *_unref's now return values for compatibility with systemd-udev

Comments (0)

Files changed (6)

src/libudev-device.c

  * the resources of the device will be released.
  *
  **/
-UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device)
+UDEV_EXPORT struct udev_device *udev_device_unref(struct udev_device *udev_device)
 {
         if (udev_device == NULL)
-                return;
+                return NULL;
         udev_device->refcount--;
         if (udev_device->refcount > 0)
-                return;
+                return udev_device;
         if (udev_device->parent_device != NULL)
                 udev_device_unref(udev_device->parent_device);
         free(udev_device->syspath);
         free(udev_device->monitor_buf);
         dbg(udev_device->udev, "udev_device: %p released\n", udev_device);
         free(udev_device);
+        return NULL;
 }
 
 /**

src/libudev-enumerate.c

  * Drop a reference of an enumeration context. If the refcount reaches zero,
  * all resources of the enumeration context will be released.
  **/
-UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate)
+UDEV_EXPORT struct udev_enumerate *udev_enumerate_unref(struct udev_enumerate *udev_enumerate)
 {
         unsigned int i;
 
         if (udev_enumerate == NULL)
-                return;
+                return NULL;
         udev_enumerate->refcount--;
         if (udev_enumerate->refcount > 0)
-                return;
+                return udev_enumerate;
         udev_list_cleanup(&udev_enumerate->sysattr_match_list);
         udev_list_cleanup(&udev_enumerate->sysattr_nomatch_list);
         udev_list_cleanup(&udev_enumerate->subsystem_match_list);
                 free(udev_enumerate->devices[i].syspath);
         free(udev_enumerate->devices);
         free(udev_enumerate);
+        return NULL;
 }
 
 /**

src/libudev-monitor.c

  * will be released.
  *
  **/
-UDEV_EXPORT void udev_monitor_unref(struct udev_monitor *udev_monitor)
+UDEV_EXPORT struct udev_monitor *udev_monitor_unref(struct udev_monitor *udev_monitor)
 {
         if (udev_monitor == NULL)
-                return;
+                return NULL;
         udev_monitor->refcount--;
         if (udev_monitor->refcount > 0)
-                return;
+                return udev_monitor;
         if (udev_monitor->sock >= 0)
                 close(udev_monitor->sock);
         udev_list_cleanup(&udev_monitor->filter_subsystem_list);
         udev_list_cleanup(&udev_monitor->filter_tag_list);
         dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor);
         free(udev_monitor);
+        return NULL;
 }
 
 /**

src/libudev-queue.c

  * Drop a reference of a udev queue context. If the refcount reaches zero,
  * the resources of the queue context will be released.
  **/
-UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue)
+UDEV_EXPORT struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue)
 {
         if (udev_queue == NULL)
-                return;
+                return NULL;
         udev_queue->refcount--;
         if (udev_queue->refcount > 0)
-                return;
+                return udev_queue;
         udev_list_cleanup(&udev_queue->queue_list);
         free(udev_queue);
+        return NULL;
 }
 
 /**
  * reaches zero, the resources of the context will be released.
  *
  **/
-UDEV_EXPORT void udev_unref(struct udev *udev)
+UDEV_EXPORT struct udev *udev_unref(struct udev *udev)
 {
         if (udev == NULL)
-                return;
+                return NULL;
         udev->refcount--;
         if (udev->refcount > 0)
-                return;
+                return udev;
         udev_list_cleanup(&udev->properties_list);
         free(udev->dev_path);
         free(udev->sys_path);
         free(udev->run_path);
         dbg(udev, "context %p released\n", udev);
         free(udev);
+        return NULL;
 }
 
 /**
  */
 struct udev;
 struct udev *udev_ref(struct udev *udev);
-void udev_unref(struct udev *udev);
+struct udev *udev_unref(struct udev *udev);
 struct udev *udev_new(void);
 void udev_set_log_fn(struct udev *udev,
                             void (*log_fn)(struct udev *udev,
  */
 struct udev_device;
 struct udev_device *udev_device_ref(struct udev_device *udev_device);
-void udev_device_unref(struct udev_device *udev_device);
+struct udev_device *udev_device_unref(struct udev_device *udev_device);
 struct udev *udev_device_get_udev(struct udev_device *udev_device);
 struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath);
 struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum);
  */
 struct udev_monitor;
 struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor);
-void udev_monitor_unref(struct udev_monitor *udev_monitor);
+struct udev_monitor *udev_monitor_unref(struct udev_monitor *udev_monitor);
 struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
 /* kernel and udev generated events over netlink */
 struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name);
  */
 struct udev_enumerate;
 struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate);
-void udev_enumerate_unref(struct udev_enumerate *udev_enumerate);
+struct udev_enumerate *udev_enumerate_unref(struct udev_enumerate *udev_enumerate);
 struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate);
 struct udev_enumerate *udev_enumerate_new(struct udev *udev);
 /* device properties filter */
  */
 struct udev_queue;
 struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue);
-void udev_queue_unref(struct udev_queue *udev_queue);
+struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue);
 struct udev *udev_queue_get_udev(struct udev_queue *udev_queue);
 struct udev_queue *udev_queue_new(struct udev *udev);
 unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.