chiark / gitweb /
udev: libudev - bump soname, remove deprecated functions, introduce symbol versions
authorKay Sievers <kay@vrfy.org>
Tue, 15 May 2012 20:57:58 +0000 (22:57 +0200)
committerKay Sievers <kay@vrfy.org>
Tue, 15 May 2012 21:06:26 +0000 (23:06 +0200)
Makefile.am
TODO
docs/libudev/libudev-sections.txt
src/libudev/libudev-device.c
src/libudev/libudev-enumerate.c
src/libudev/libudev-monitor.c
src/libudev/libudev-queue.c
src/libudev/libudev.c
src/libudev/libudev.h
src/libudev/libudev.sym [new file with mode: 0644]

index a4e3433..7c1b431 100644 (file)
@@ -23,9 +23,9 @@ AM_MAKEFLAGS = --no-print-directory
 
 SUBDIRS = . po
 
-LIBUDEV_CURRENT=13
-LIBUDEV_REVISION=3
-LIBUDEV_AGE=13
+LIBUDEV_CURRENT=1
+LIBUDEV_REVISION=0
+LIBUDEV_AGE=0
 
 LIBGUDEV_CURRENT=1
 LIBGUDEV_REVISION=1
@@ -1330,7 +1330,8 @@ libudev_la_CFLAGS = \
 
 libudev_la_LDFLAGS = \
        $(AM_LDFLAGS) \
-       -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE)
+       -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \
+       -Wl,--version-script=$(top_srcdir)/src/libudev/libudev.sym
 
 libudev_la_LIBADD = \
        libsystemd-shared.la
@@ -1339,7 +1340,8 @@ pkgconfiglib_DATA += \
        src/libudev/libudev.pc
 
 EXTRA_DIST += \
-       src/libudev/libudev.pc.in
+       src/libudev/libudev.pc.in \
+       src/libudev/libudev.sym
 
 CLEANFILES += \
        src/libudev/libudev.pc
diff --git a/TODO b/TODO
index a3b4165..5d18a64 100644 (file)
--- a/TODO
+++ b/TODO
@@ -87,14 +87,6 @@ Features:
 
 * udev: add trigger --subsystem-match=usb/usb_device device
 
-* udev: libudev.so.1
-  - use symbol versioning
-  - always return object with *_unref()
-  - remove deprecated symbols
-    - udev_monitor_from_socket()
-    - udev_queue_get_failed_list_entry()
-    - udev_get_{dev,sys,run}_path()
-
 * allow configuration of console width/height in vconsole.conf
 
 * fstab should take priority over units in /usr
index 31f356f..9f41ca6 100644 (file)
@@ -10,9 +10,6 @@ udev_get_log_priority
 udev_set_log_priority
 udev_get_userdata
 udev_set_userdata
-udev_get_sys_path
-udev_get_dev_path
-udev_get_run_path
 </SECTION>
 
 <SECTION>
index 9ef4610..f0aab5d 100644 (file)
@@ -1023,13 +1023,13 @@ _public_ struct udev_device *udev_device_ref(struct udev_device *udev_device)
  * the resources of the device will be released.
  *
  **/
-_public_ void udev_device_unref(struct udev_device *udev_device)
+_public_ 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);
@@ -1049,6 +1049,7 @@ _public_ void udev_device_unref(struct udev_device *udev_device)
         free(udev_device->envp);
         free(udev_device->monitor_buf);
         free(udev_device);
+        return NULL;
 }
 
 /**
index 9e6f467..671bfd7 100644 (file)
@@ -112,15 +112,15 @@ _public_ struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_e
  * Drop a reference of an enumeration context. If the refcount reaches zero,
  * all resources of the enumeration context will be released.
  **/
-_public_ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate)
+_public_ 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);
@@ -134,6 +134,7 @@ _public_ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate)
                 free(udev_enumerate->devices[i].syspath);
         free(udev_enumerate->devices);
         free(udev_enumerate);
+        return NULL;
 }
 
 /**
index 5f448e6..96506fe 100644 (file)
@@ -97,23 +97,6 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev)
         return udev_monitor;
 }
 
-/**
- * udev_monitor_new_from_socket:
- * @udev: udev library context
- * @socket_path: unix socket path
- *
- * This function is removed from libudev and will not do anything.
- *
- * Returns: #NULL
- **/
-struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path);
-_public_ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path)
-{
-        udev_err(udev, "udev_monitor_new_from_socket() does not do anything; please migrate to netlink\n");
-        errno = ENOSYS;
-        return NULL;
-}
-
 struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd)
 {
         struct udev_monitor *udev_monitor;
@@ -418,18 +401,19 @@ _public_ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor
  * will be released.
  *
  **/
-_public_ void udev_monitor_unref(struct udev_monitor *udev_monitor)
+_public_ 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);
         free(udev_monitor);
+        return NULL;
 }
 
 /**
index 81f40db..15a7f55 100644 (file)
@@ -93,15 +93,16 @@ _public_ struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue)
  * Drop a reference of a udev queue context. If the refcount reaches zero,
  * the resources of the queue context will be released.
  **/
-_public_ void udev_queue_unref(struct udev_queue *udev_queue)
+_public_ 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;
 }
 
 /**
@@ -469,11 +470,3 @@ _public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_qu
 
         return udev_list_get_entry(&udev_queue->queue_list);
 }
-
-struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue);
-_public_ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue)
-{
-        udev_err(udev_queue->udev, "udev_queue_get_failed_list_entry() does not return anything; failed events are not recorded\n");
-        errno = ENOSYS;
-        return NULL;
-}
index a0ec39d..5b754a2 100644 (file)
@@ -222,15 +222,16 @@ _public_ struct udev *udev_ref(struct udev *udev)
  * reaches zero, the resources of the context will be released.
  *
  **/
-_public_ void udev_unref(struct udev *udev)
+_public_ 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);
+        return NULL;
 }
 
 /**
@@ -283,51 +284,6 @@ _public_ void udev_set_log_priority(struct udev *udev, int priority)
         udev_add_property(udev, "UDEV_LOG", num);
 }
 
-/**
- * udev_get_sys_path:
- * @udev: udev library context
- *
- * Returns always "/sys"; deprecated, will be removed in a future version.
- *
- * Returns: the sys mount point
- **/
-_public_ const char *udev_get_sys_path(struct udev *udev)
-{
-        if (udev == NULL)
-                return NULL;
-        return "/sys";
-}
-
-/**
- * udev_get_dev_path:
- * @udev: udev library context
- *
- * Returns always "/dev"; deprecated, will be removed in a future version.
- *
- * Returns: the device directory path
- **/
-_public_ const char *udev_get_dev_path(struct udev *udev)
-{
-        if (udev == NULL)
-                return NULL;
-        return "/dev";
-}
-
-/**
- * udev_get_run_path:
- * @udev: udev library context
- *
- * Returns always "/run/udev"; deprecated, will be removed in a future version.
- *
- * Returns: the runtime directory path
- **/
-_public_ const char *udev_get_run_path(struct udev *udev)
-{
-        if (udev == NULL)
-                return NULL;
-        return "/run/udev";
-}
-
 struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value)
 {
         if (value == NULL) {
index 79842e6..8643984 100644 (file)
@@ -28,7 +28,7 @@ extern "C" {
  */
 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,
@@ -36,9 +36,6 @@ void udev_set_log_fn(struct udev *udev,
                                            const char *format, va_list args));
 int udev_get_log_priority(struct udev *udev);
 void udev_set_log_priority(struct udev *udev, int priority);
-const char *udev_get_sys_path(struct udev *udev);
-const char *udev_get_dev_path(struct udev *udev);
-const char *udev_get_run_path(struct udev *udev);
 void *udev_get_userdata(struct udev *udev);
 void udev_set_userdata(struct udev *udev, void *userdata);
 
@@ -71,7 +68,7 @@ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry);
  */
 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);
@@ -110,7 +107,7 @@ int udev_device_has_tag(struct udev_device *udev_device, const char *tag);
  */
 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);
@@ -133,7 +130,7 @@ int udev_monitor_filter_remove(struct udev_monitor *udev_monitor);
  */
 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 */
@@ -160,7 +157,7 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude
  */
 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);
diff --git a/src/libudev/libudev.sym b/src/libudev/libudev.sym
new file mode 100644 (file)
index 0000000..47683ec
--- /dev/null
@@ -0,0 +1,97 @@
+/***
+  This file is part of systemd.
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+***/
+
+LIBUDEV_183 {
+global:
+        udev_device_get_action;
+        udev_device_get_devlinks_list_entry;
+        udev_device_get_devnode;
+        udev_device_get_devnum;
+        udev_device_get_devpath;
+        udev_device_get_devtype;
+        udev_device_get_driver;
+        udev_device_get_is_initialized;
+        udev_device_get_parent;
+        udev_device_get_parent_with_subsystem_devtype;
+        udev_device_get_properties_list_entry;
+        udev_device_get_property_value;
+        udev_device_get_seqnum;
+        udev_device_get_subsystem;
+        udev_device_get_sysattr_list_entry;
+        udev_device_get_sysattr_value;
+        udev_device_get_sysname;
+        udev_device_get_sysnum;
+        udev_device_get_syspath;
+        udev_device_get_tags_list_entry;
+        udev_device_get_udev;
+        udev_device_get_usec_since_initialized;
+        udev_device_has_tag;
+        udev_device_new_from_devnum;
+        udev_device_new_from_environment;
+        udev_device_new_from_subsystem_sysname;
+        udev_device_new_from_syspath;
+        udev_device_ref;
+        udev_device_unref;
+        udev_enumerate_add_match_is_initialized;
+        udev_enumerate_add_match_parent;
+        udev_enumerate_add_match_property;
+        udev_enumerate_add_match_subsystem;
+        udev_enumerate_add_match_sysattr;
+        udev_enumerate_add_match_sysname;
+        udev_enumerate_add_match_tag;
+        udev_enumerate_add_nomatch_subsystem;
+        udev_enumerate_add_nomatch_sysattr;
+        udev_enumerate_add_syspath;
+        udev_enumerate_get_list_entry;
+        udev_enumerate_get_udev;
+        udev_enumerate_new;
+        udev_enumerate_ref;
+        udev_enumerate_scan_devices;
+        udev_enumerate_scan_subsystems;
+        udev_enumerate_unref;
+        udev_get_log_priority;
+        udev_get_userdata;
+        udev_list_entry_get_by_name;
+        udev_list_entry_get_name;
+        udev_list_entry_get_next;
+        udev_list_entry_get_value;
+        udev_monitor_enable_receiving;
+        udev_monitor_filter_add_match_subsystem_devtype;
+        udev_monitor_filter_add_match_tag;
+        udev_monitor_filter_remove;
+        udev_monitor_filter_update;
+        udev_monitor_get_fd;
+        udev_monitor_get_udev;
+        udev_monitor_new_from_netlink;
+        udev_monitor_new_from_socket;
+        udev_monitor_receive_device;
+        udev_monitor_ref;
+        udev_monitor_set_receive_buffer_size;
+        udev_monitor_unref;
+        udev_new;
+        udev_queue_get_kernel_seqnum;
+        udev_queue_get_queue_is_empty;
+        udev_queue_get_queued_list_entry;
+        udev_queue_get_seqnum_is_finished;
+        udev_queue_get_seqnum_sequence_is_finished;
+        udev_queue_get_udev;
+        udev_queue_get_udev_is_active;
+        udev_queue_get_udev_seqnum;
+        udev_queue_new;
+        udev_queue_ref;
+        udev_queue_unref;
+        udev_ref;
+        udev_set_log_fn;
+        udev_set_log_priority;
+        udev_set_userdata;
+        udev_unref;
+        udev_util_encode_string;
+local:
+        *;
+};