1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

udev: libudev - bump soname, remove deprecated functions, introduce symbol versions

This commit is contained in:
Kay Sievers 2012-05-15 22:57:58 +02:00
parent 6e92b23f0d
commit 20bbd54f60
10 changed files with 129 additions and 109 deletions

View File

@ -23,9 +23,9 @@ AM_MAKEFLAGS = --no-print-directory
SUBDIRS = . po SUBDIRS = . po
LIBUDEV_CURRENT=13 LIBUDEV_CURRENT=1
LIBUDEV_REVISION=3 LIBUDEV_REVISION=0
LIBUDEV_AGE=13 LIBUDEV_AGE=0
LIBGUDEV_CURRENT=1 LIBGUDEV_CURRENT=1
LIBGUDEV_REVISION=1 LIBGUDEV_REVISION=1
@ -1330,7 +1330,8 @@ libudev_la_CFLAGS = \
libudev_la_LDFLAGS = \ libudev_la_LDFLAGS = \
$(AM_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 = \ libudev_la_LIBADD = \
libsystemd-shared.la libsystemd-shared.la
@ -1339,7 +1340,8 @@ pkgconfiglib_DATA += \
src/libudev/libudev.pc src/libudev/libudev.pc
EXTRA_DIST += \ EXTRA_DIST += \
src/libudev/libudev.pc.in src/libudev/libudev.pc.in \
src/libudev/libudev.sym
CLEANFILES += \ CLEANFILES += \
src/libudev/libudev.pc src/libudev/libudev.pc

8
TODO
View File

@ -87,14 +87,6 @@ Features:
* udev: add trigger --subsystem-match=usb/usb_device device * 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 * allow configuration of console width/height in vconsole.conf
* fstab should take priority over units in /usr * fstab should take priority over units in /usr

View File

@ -10,9 +10,6 @@ udev_get_log_priority
udev_set_log_priority udev_set_log_priority
udev_get_userdata udev_get_userdata
udev_set_userdata udev_set_userdata
udev_get_sys_path
udev_get_dev_path
udev_get_run_path
</SECTION> </SECTION>
<SECTION> <SECTION>

View 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. * 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) if (udev_device == NULL)
return; return NULL;
udev_device->refcount--; udev_device->refcount--;
if (udev_device->refcount > 0) if (udev_device->refcount > 0)
return; return udev_device;
if (udev_device->parent_device != NULL) if (udev_device->parent_device != NULL)
udev_device_unref(udev_device->parent_device); udev_device_unref(udev_device->parent_device);
free(udev_device->syspath); 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->envp);
free(udev_device->monitor_buf); free(udev_device->monitor_buf);
free(udev_device); free(udev_device);
return NULL;
} }
/** /**

View 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, * Drop a reference of an enumeration context. If the refcount reaches zero,
* all resources of the enumeration context will be released. * 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; unsigned int i;
if (udev_enumerate == NULL) if (udev_enumerate == NULL)
return; return NULL;
udev_enumerate->refcount--; udev_enumerate->refcount--;
if (udev_enumerate->refcount > 0) if (udev_enumerate->refcount > 0)
return; return udev_enumerate;
udev_list_cleanup(&udev_enumerate->sysattr_match_list); udev_list_cleanup(&udev_enumerate->sysattr_match_list);
udev_list_cleanup(&udev_enumerate->sysattr_nomatch_list); udev_list_cleanup(&udev_enumerate->sysattr_nomatch_list);
udev_list_cleanup(&udev_enumerate->subsystem_match_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[i].syspath);
free(udev_enumerate->devices); free(udev_enumerate->devices);
free(udev_enumerate); free(udev_enumerate);
return NULL;
} }
/** /**

View File

@ -97,23 +97,6 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev)
return udev_monitor; 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_new_from_netlink_fd(struct udev *udev, const char *name, int fd)
{ {
struct udev_monitor *udev_monitor; struct udev_monitor *udev_monitor;
@ -418,18 +401,19 @@ _public_ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor
* will be released. * 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) if (udev_monitor == NULL)
return; return NULL;
udev_monitor->refcount--; udev_monitor->refcount--;
if (udev_monitor->refcount > 0) if (udev_monitor->refcount > 0)
return; return udev_monitor;
if (udev_monitor->sock >= 0) if (udev_monitor->sock >= 0)
close(udev_monitor->sock); close(udev_monitor->sock);
udev_list_cleanup(&udev_monitor->filter_subsystem_list); udev_list_cleanup(&udev_monitor->filter_subsystem_list);
udev_list_cleanup(&udev_monitor->filter_tag_list); udev_list_cleanup(&udev_monitor->filter_tag_list);
free(udev_monitor); free(udev_monitor);
return NULL;
} }
/** /**

View 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, * Drop a reference of a udev queue context. If the refcount reaches zero,
* the resources of the queue context will be released. * 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) if (udev_queue == NULL)
return; return NULL;
udev_queue->refcount--; udev_queue->refcount--;
if (udev_queue->refcount > 0) if (udev_queue->refcount > 0)
return; return udev_queue;
udev_list_cleanup(&udev_queue->queue_list); udev_list_cleanup(&udev_queue->queue_list);
free(udev_queue); 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); 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;
}

View File

@ -222,15 +222,16 @@ _public_ struct udev *udev_ref(struct udev *udev)
* reaches zero, the resources of the context will be released. * 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) if (udev == NULL)
return; return NULL;
udev->refcount--; udev->refcount--;
if (udev->refcount > 0) if (udev->refcount > 0)
return; return udev;
udev_list_cleanup(&udev->properties_list); udev_list_cleanup(&udev->properties_list);
free(udev); 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_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) struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value)
{ {
if (value == NULL) { if (value == NULL) {

View File

@ -28,7 +28,7 @@ extern "C" {
*/ */
struct udev; struct udev;
struct udev *udev_ref(struct udev *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); struct udev *udev_new(void);
void udev_set_log_fn(struct udev *udev, void udev_set_log_fn(struct udev *udev,
void (*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)); const char *format, va_list args));
int udev_get_log_priority(struct udev *udev); int udev_get_log_priority(struct udev *udev);
void udev_set_log_priority(struct udev *udev, int priority); 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_get_userdata(struct udev *udev);
void udev_set_userdata(struct udev *udev, void *userdata); 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;
struct udev_device *udev_device_ref(struct udev_device *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 *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_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_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;
struct udev_monitor *udev_monitor_ref(struct udev_monitor *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); struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
/* kernel and udev generated events over netlink */ /* kernel and udev generated events over netlink */
struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); 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;
struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *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 *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate);
struct udev_enumerate *udev_enumerate_new(struct udev *udev); struct udev_enumerate *udev_enumerate_new(struct udev *udev);
/* device properties filter */ /* 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;
struct udev_queue *udev_queue_ref(struct udev_queue *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 *udev_queue_get_udev(struct udev_queue *udev_queue);
struct udev_queue *udev_queue_new(struct udev *udev); struct udev_queue *udev_queue_new(struct udev *udev);
unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue); unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue);

97
src/libudev/libudev.sym Normal file
View File

@ -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:
*;
};