summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am10
-rw-r--r--TODO2
-rw-r--r--libudev/exported_symbols84
-rw-r--r--libudev/libudev-device.c56
-rw-r--r--libudev/libudev-enumerate.c32
-rw-r--r--libudev/libudev-list.c8
-rw-r--r--libudev/libudev-monitor.c26
-rw-r--r--libudev/libudev-private.h2
-rw-r--r--libudev/libudev-queue.c24
-rw-r--r--libudev/libudev.c22
10 files changed, 91 insertions, 175 deletions
diff --git a/Makefile.am b/Makefile.am
index 1b0d6a3797..1537d56ebe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,7 +42,7 @@ dist_libexec_SCRIPTS =
# libudev
# ------------------------------------------------------------------------------
LIBUDEV_CURRENT=11
-LIBUDEV_REVISION=4
+LIBUDEV_REVISION=5
LIBUDEV_AGE=11
SUBDIRS += libudev/docs
@@ -60,12 +60,8 @@ libudev_libudev_la_SOURCES =\
libudev/libudev-monitor.c \
libudev/libudev-queue.c
-libudev_libudev_la_CFLAGS = \
- -fvisibility=default
-
libudev_libudev_la_LDFLAGS = \
- -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \
- -export-symbols $(top_srcdir)/libudev/exported_symbols
+ -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE)
noinst_LTLIBRARIES = \
libudev/libudev-private.la
@@ -85,7 +81,7 @@ endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libudev/libudev.pc
-EXTRA_DIST += libudev/exported_symbols libudev/COPYING
+EXTRA_DIST += libudev/COPYING
# move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed
libudev-install-move-hook:
if test "$(libdir)" != "$(rootlib_execdir)"; then \
diff --git a/TODO b/TODO
index c5dee4a7cb..3b583fd00f 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,5 @@
+ - make private functions in libudev-device.c static
+
- delete mobile-action-modeswitch
(moved to usb_modeswitch)
diff --git a/libudev/exported_symbols b/libudev/exported_symbols
deleted file mode 100644
index 4089ec377c..0000000000
--- a/libudev/exported_symbols
+++ /dev/null
@@ -1,84 +0,0 @@
-udev_new
-udev_ref
-udev_unref
-udev_set_log_fn
-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
-udev_list_entry_get_next
-udev_list_entry_get_by_name
-udev_list_entry_get_name
-udev_list_entry_get_value
-udev_device_new_from_syspath
-udev_device_new_from_devnum
-udev_device_new_from_subsystem_sysname
-udev_device_new_from_environment
-udev_device_get_parent
-udev_device_get_parent_with_subsystem_devtype
-udev_device_ref
-udev_device_unref
-udev_device_get_udev
-udev_device_get_syspath
-udev_device_get_devpath
-udev_device_get_devnode
-udev_device_get_sysname
-udev_device_get_sysnum
-udev_device_get_subsystem
-udev_device_get_devtype
-udev_device_get_is_initialized
-udev_device_get_devlinks_list_entry
-udev_device_get_properties_list_entry
-udev_device_get_tags_list_entry
-udev_device_get_sysattr_list_entry
-udev_device_get_property_value
-udev_device_get_action
-udev_device_get_driver
-udev_device_get_devnum
-udev_device_get_seqnum
-udev_device_get_usec_since_initialized
-udev_device_get_sysattr_value
-udev_enumerate_new
-udev_enumerate_ref
-udev_enumerate_unref
-udev_enumerate_get_udev
-udev_enumerate_get_list_entry
-udev_enumerate_add_match_subsystem
-udev_enumerate_add_nomatch_subsystem
-udev_enumerate_add_match_sysattr
-udev_enumerate_add_nomatch_sysattr
-udev_enumerate_add_match_property
-udev_enumerate_add_match_tag
-udev_enumerate_add_match_is_initialized
-udev_enumerate_add_match_sysname
-udev_enumerate_scan_devices
-udev_enumerate_scan_subsystems
-udev_enumerate_add_syspath
-udev_monitor_new_from_socket
-udev_monitor_new_from_netlink
-udev_monitor_set_receive_buffer_size
-udev_monitor_enable_receiving
-udev_monitor_ref
-udev_monitor_unref
-udev_monitor_get_udev
-udev_monitor_get_fd
-udev_monitor_receive_device
-udev_monitor_filter_add_match_subsystem_devtype
-udev_monitor_filter_add_match_tag
-udev_monitor_filter_update
-udev_monitor_filter_remove
-udev_queue_new
-udev_queue_ref
-udev_queue_unref
-udev_queue_get_udev
-udev_queue_get_kernel_seqnum
-udev_queue_get_udev_seqnum
-udev_queue_get_udev_is_active
-udev_queue_get_queue_is_empty
-udev_queue_get_seqnum_is_finished
-udev_queue_get_seqnum_sequence_is_finished
-udev_queue_get_queued_list_entry
-udev_queue_get_failed_list_entry
diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c
index d57a9eb597..47cabea984 100644
--- a/libudev/libudev-device.c
+++ b/libudev/libudev-device.c
@@ -226,7 +226,7 @@ int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_d
*
* Returns: the value of a device property, or #NULL if there is no such property.
**/
-const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key)
+UDEV_EXPORT const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key)
{
struct udev_list_entry *list_entry;
@@ -405,7 +405,7 @@ struct udev_device *udev_device_new(struct udev *udev)
*
* Returns: a new udev device, or #NULL, if it does not exist
**/
-struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath)
+UDEV_EXPORT struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath)
{
size_t len;
const char *subdir;
@@ -481,7 +481,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *
*
* Returns: a new udev device, or #NULL, if it does not exist
**/
-struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum)
+UDEV_EXPORT struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum)
{
char path[UTIL_PATH_SIZE];
const char *type_str;
@@ -569,7 +569,7 @@ struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id
*
* Returns: a new udev device, or #NULL, if it does not exist
**/
-struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname)
+UDEV_EXPORT struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname)
{
char path_full[UTIL_PATH_SIZE];
char *path;
@@ -653,7 +653,7 @@ found:
*
* Returns: a new udev device, or #NULL, if it does not exist
**/
-struct udev_device *udev_device_new_from_environment(struct udev *udev)
+UDEV_EXPORT struct udev_device *udev_device_new_from_environment(struct udev *udev)
{
int i;
struct udev_device *udev_device;
@@ -716,7 +716,7 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic
*
* Returns: a new udev device, or #NULL, if it no parent exist.
**/
-struct udev_device *udev_device_get_parent(struct udev_device *udev_device)
+UDEV_EXPORT struct udev_device *udev_device_get_parent(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -751,7 +751,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device)
*
* Returns: a new udev device, or #NULL if no matching parent exists.
**/
-struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype)
+UDEV_EXPORT struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype)
{
struct udev_device *parent;
@@ -784,7 +784,7 @@ struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_de
*
* Returns: the udev library context
**/
-struct udev *udev_device_get_udev(struct udev_device *udev_device)
+UDEV_EXPORT struct udev *udev_device_get_udev(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -799,7 +799,7 @@ struct udev *udev_device_get_udev(struct udev_device *udev_device)
*
* Returns: the passed udev device
**/
-struct udev_device *udev_device_ref(struct udev_device *udev_device)
+UDEV_EXPORT struct udev_device *udev_device_ref(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -815,7 +815,7 @@ struct udev_device *udev_device_ref(struct udev_device *udev_device)
* the resources of the device will be released.
*
**/
-void udev_device_unref(struct udev_device *udev_device)
+UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device)
{
if (udev_device == NULL)
return;
@@ -855,7 +855,7 @@ void udev_device_unref(struct udev_device *udev_device)
*
* Returns: the devpath of the udev device
**/
-const char *udev_device_get_devpath(struct udev_device *udev_device)
+UDEV_EXPORT const char *udev_device_get_devpath(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -871,7 +871,7 @@ const char *udev_device_get_devpath(struct udev_device *udev_device)
*
* Returns: the sys path of the udev device
**/
-const char *udev_device_get_syspath(struct udev_device *udev_device)
+UDEV_EXPORT const char *udev_device_get_syspath(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -884,7 +884,7 @@ const char *udev_device_get_syspath(struct udev_device *udev_device)
*
* Returns: the sys name of the device device
**/
-const char *udev_device_get_sysname(struct udev_device *udev_device)
+UDEV_EXPORT const char *udev_device_get_sysname(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -897,7 +897,7 @@ const char *udev_device_get_sysname(struct udev_device *udev_device)
*
* Returns: the trailing number of of the device name
**/
-const char *udev_device_get_sysnum(struct udev_device *udev_device)
+UDEV_EXPORT const char *udev_device_get_sysnum(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -913,7 +913,7 @@ const char *udev_device_get_sysnum(struct udev_device *udev_device)
*
* Returns: the device node file name of the udev device, or #NULL if no device node exists
**/
-const char *udev_device_get_devnode(struct udev_device *udev_device)
+UDEV_EXPORT const char *udev_device_get_devnode(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -951,7 +951,7 @@ mode_t udev_device_get_devnode_mode(struct udev_device *udev_device)
*
* Returns: the subsystem name of the udev device, or #NULL if it can not be determined
**/
-const char *udev_device_get_subsystem(struct udev_device *udev_device)
+UDEV_EXPORT const char *udev_device_get_subsystem(struct udev_device *udev_device)
{
char subsystem[UTIL_NAME_SIZE];
@@ -991,7 +991,7 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device)
*
* Returns: the devtype name of the udev device, or #NULL if it can not be determined
**/
-const char *udev_device_get_devtype(struct udev_device *udev_device)
+UDEV_EXPORT const char *udev_device_get_devtype(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -1015,7 +1015,7 @@ const char *udev_device_get_devtype(struct udev_device *udev_device)
*
* Returns: the first entry of the device node link list
**/
-struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device)
+UDEV_EXPORT struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -1042,7 +1042,7 @@ void udev_device_cleanup_devlinks_list(struct udev_device *udev_device)
*
* Returns: the first entry of the property list
**/
-struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device)
+UDEV_EXPORT struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -1091,7 +1091,7 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device
*
* Returns: the driver string, or #NULL if there is no driver attached.
**/
-const char *udev_device_get_driver(struct udev_device *udev_device)
+UDEV_EXPORT const char *udev_device_get_driver(struct udev_device *udev_device)
{
char driver[UTIL_NAME_SIZE];
@@ -1111,7 +1111,7 @@ const char *udev_device_get_driver(struct udev_device *udev_device)
*
* Returns: the device major/minor number.
**/
-dev_t udev_device_get_devnum(struct udev_device *udev_device)
+UDEV_EXPORT dev_t udev_device_get_devnum(struct udev_device *udev_device)
{
if (udev_device == NULL)
return makedev(0, 0);
@@ -1130,7 +1130,7 @@ dev_t udev_device_get_devnum(struct udev_device *udev_device)
*
* Returns: the kernel action value, or #NULL if there is no action value available.
**/
-const char *udev_device_get_action(struct udev_device *udev_device)
+UDEV_EXPORT const char *udev_device_get_action(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
@@ -1146,7 +1146,7 @@ const char *udev_device_get_action(struct udev_device *udev_device)
*
* Returns: the kernel event sequence number, or 0 if there is no sequence number available.
**/
-unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device)
+UDEV_EXPORT unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device)
{
if (udev_device == NULL)
return 0;
@@ -1165,7 +1165,7 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device)
*
* Returns: the number of microseconds since the device was first seen.
**/
-unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device)
+UDEV_EXPORT unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device)
{
unsigned long long now;
@@ -1201,7 +1201,7 @@ void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned
*
* Returns: the content of a sys attribute file, or #NULL if there is no sys attribute value.
**/
-const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr)
+UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr)
{
struct udev_list_entry *list_entry;
char path[UTIL_PATH_SIZE];
@@ -1344,7 +1344,7 @@ static int udev_device_sysattr_list_read(struct udev_device *udev_device)
*
* Returns: the first entry of the property list
**/
-struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device)
+UDEV_EXPORT struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device)
{
if (!udev_device->sysattr_list_read) {
int ret;
@@ -1496,7 +1496,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device)
*
* Returns: 1 if the device is set up. 0 otherwise.
**/
-int udev_device_get_is_initialized(struct udev_device *udev_device)
+UDEV_EXPORT int udev_device_get_is_initialized(struct udev_device *udev_device)
{
if (!udev_device->info_loaded)
udev_device_read_db(udev_device, NULL);
@@ -1535,7 +1535,7 @@ void udev_device_cleanup_tags_list(struct udev_device *udev_device)
*
* Returns: the first entry of the tag list
**/
-struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device)
+UDEV_EXPORT struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device)
{
if (udev_device == NULL)
return NULL;
diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c
index 018d89cc04..12de24e244 100644
--- a/libudev/libudev-enumerate.c
+++ b/libudev/libudev-enumerate.c
@@ -66,7 +66,7 @@ struct udev_enumerate {
*
* Returns: an enumeration context
**/
-struct udev_enumerate *udev_enumerate_new(struct udev *udev)
+UDEV_EXPORT struct udev_enumerate *udev_enumerate_new(struct udev *udev)
{
struct udev_enumerate *udev_enumerate;
@@ -94,7 +94,7 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev)
*
* Returns: the passed enumeration context
**/
-struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate)
+UDEV_EXPORT struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate)
{
if (udev_enumerate == NULL)
return NULL;
@@ -109,7 +109,7 @@ struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate)
* Drop a reference of an enumeration context. If the refcount reaches zero,
* all resources of the enumeration context will be released.
**/
-void udev_enumerate_unref(struct udev_enumerate *udev_enumerate)
+UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate)
{
unsigned int i;
@@ -138,7 +138,7 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate)
*
* Returns: the udev library context.
*/
-struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate)
+UDEV_EXPORT struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate)
{
if (udev_enumerate == NULL)
return NULL;
@@ -247,7 +247,7 @@ static size_t devices_delay_later(struct udev *udev, const char *syspath)
*
* Returns: the first entry of the sorted list of device paths.
*/
-struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate)
+UDEV_EXPORT struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate)
{
if (udev_enumerate == NULL)
return NULL;
@@ -329,7 +329,7 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem)
+UDEV_EXPORT int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem)
{
if (udev_enumerate == NULL)
return -EINVAL;
@@ -348,7 +348,7 @@ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, co
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem)
+UDEV_EXPORT int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem)
{
if (udev_enumerate == NULL)
return -EINVAL;
@@ -368,7 +368,7 @@ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate,
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value)
+UDEV_EXPORT int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value)
{
if (udev_enumerate == NULL)
return -EINVAL;
@@ -388,7 +388,7 @@ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, cons
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value)
+UDEV_EXPORT int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value)
{
if (udev_enumerate == NULL)
return -EINVAL;
@@ -428,7 +428,7 @@ exit:
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value)
+UDEV_EXPORT int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value)
{
if (udev_enumerate == NULL)
return -EINVAL;
@@ -447,7 +447,7 @@ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, con
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag)
+UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag)
{
if (udev_enumerate == NULL)
return -EINVAL;
@@ -477,7 +477,7 @@ int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const ch
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate)
+UDEV_EXPORT int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate)
{
if (udev_enumerate == NULL)
return -EINVAL;
@@ -492,7 +492,7 @@ int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerat
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname)
+UDEV_EXPORT int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname)
{
if (udev_enumerate == NULL)
return -EINVAL;
@@ -710,7 +710,7 @@ static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir,
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath)
+UDEV_EXPORT int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath)
{
struct udev_device *udev_device;
@@ -733,7 +733,7 @@ int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char
*
* Returns: 0 on success, otherwise a negative error value.
**/
-int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate)
+UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate)
{
struct udev *udev = udev_enumerate_get_udev(udev_enumerate);
char base[UTIL_PATH_SIZE];
@@ -793,7 +793,7 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate)
*
* Returns: 0 on success, otherwise a negative error value.
**/
-int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate)
+UDEV_EXPORT int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate)
{
struct udev *udev = udev_enumerate_get_udev(udev_enumerate);
char base[UTIL_PATH_SIZE];
diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c
index 29453ac251..e828a4e4c6 100644
--- a/libudev/libudev-list.c
+++ b/libudev/libudev-list.c
@@ -204,7 +204,7 @@ struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list)
*
* Returns: the next entry from the list, #NULL is no more entries are found.
*/
-struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry)
+UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry)
{
struct udev_list_node *next;
@@ -224,7 +224,7 @@ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_en
*
* Returns: the entry where @name matched, #NULL if no matching entry is found.
*/
-struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name)
+UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name)
{
struct udev_list_entry *entry;
@@ -243,7 +243,7 @@ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list
*
* Returns: the name string of this entry.
*/
-const char *udev_list_entry_get_name(struct udev_list_entry *list_entry)
+UDEV_EXPORT const char *udev_list_entry_get_name(struct udev_list_entry *list_entry)
{
if (list_entry == NULL)
return NULL;
@@ -256,7 +256,7 @@ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry)
*
* Returns: the value string of this entry.
*/
-const char *udev_list_entry_get_value(struct udev_list_entry *list_entry)
+UDEV_EXPORT const char *udev_list_entry_get_value(struct udev_list_entry *list_entry)
{
if (list_entry == NULL)
return NULL;
diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c
index 5917b9e497..ec76698836 100644
--- a/libudev/libudev-monitor.c
+++ b/libudev/libudev-monitor.c
@@ -117,7 +117,7 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev)
*
* Returns: a new udev monitor, or #NULL, in case of an error
**/
-struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path)
+UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path)
{
struct udev_monitor *udev_monitor;
struct stat statbuf;
@@ -225,7 +225,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c
*
* Returns: a new udev monitor, or #NULL, in case of an error
**/
-struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name)
+UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name)
{
return udev_monitor_new_from_netlink_fd(udev, name, -1);
}
@@ -261,7 +261,7 @@ static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i,
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_monitor_filter_update(struct udev_monitor *udev_monitor)
+UDEV_EXPORT int udev_monitor_filter_update(struct udev_monitor *udev_monitor)
{
struct sock_filter ins[512];
struct sock_fprog filter;
@@ -373,7 +373,7 @@ int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
+UDEV_EXPORT int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
{
int err = 0;
const int on = 1;
@@ -430,7 +430,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
*
* Returns: 0 on success, otherwise -1 on error.
*/
-int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size)
+UDEV_EXPORT int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size)
{
if (udev_monitor == NULL)
return -1;
@@ -454,7 +454,7 @@ int udev_monitor_disconnect(struct udev_monitor *udev_monitor)
*
* Returns: the passed udev monitor
**/
-struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor)
+UDEV_EXPORT struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor)
{
if (udev_monitor == NULL)
return NULL;
@@ -471,7 +471,7 @@ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor)
* will be released.
*
**/
-void udev_monitor_unref(struct udev_monitor *udev_monitor)
+UDEV_EXPORT void udev_monitor_unref(struct udev_monitor *udev_monitor)
{
if (udev_monitor == NULL)
return;
@@ -494,7 +494,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor)
*
* Returns: the udev library context
**/
-struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor)
+UDEV_EXPORT struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor)
{
if (udev_monitor == NULL)
return NULL;
@@ -509,7 +509,7 @@ struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor)
*
* Returns: the socket file descriptor
**/
-int udev_monitor_get_fd(struct udev_monitor *udev_monitor)
+UDEV_EXPORT int udev_monitor_get_fd(struct udev_monitor *udev_monitor)
{
if (udev_monitor == NULL)
return -1;
@@ -570,7 +570,7 @@ tag:
*
* Returns: a new udev device, or #NULL, in case of an error
**/
-struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor)
+UDEV_EXPORT struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor)
{
struct udev_device *udev_device;
struct msghdr smsg;
@@ -823,7 +823,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor,
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype)
+UDEV_EXPORT int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype)
{
if (udev_monitor == NULL)
return -EINVAL;
@@ -847,7 +847,7 @@ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_mo
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag)
+UDEV_EXPORT int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag)
{
if (udev_monitor == NULL)
return -EINVAL;
@@ -867,7 +867,7 @@ int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const c
*
* Returns: 0 on success, otherwise a negative error value.
*/
-int udev_monitor_filter_remove(struct udev_monitor *udev_monitor)
+UDEV_EXPORT int udev_monitor_filter_remove(struct udev_monitor *udev_monitor)
{
static struct sock_fprog filter = { 0, NULL };
diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h
index 39b46dde31..9703fb5875 100644
--- a/libudev/libudev-private.h
+++ b/libudev/libudev-private.h
@@ -45,6 +45,8 @@ udev_log_null(struct udev *udev, const char *format, ...) {}
# define err(udev, arg...) udev_log_null(udev, ## arg)
#endif
+#define UDEV_EXPORT __attribute__ ((visibility("default")))
+
static inline void udev_log_init(const char *program_name)
{
openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON);
diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c
index be6409d02a..73e7fb23aa 100644
--- a/libudev/libudev-queue.c
+++ b/libudev/libudev-queue.c
@@ -55,7 +55,7 @@ struct udev_queue {
*
* Returns: the udev queue context, or #NULL on error.
**/
-struct udev_queue *udev_queue_new(struct udev *udev)
+UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev)
{
struct udev_queue *udev_queue;
@@ -80,7 +80,7 @@ struct udev_queue *udev_queue_new(struct udev *udev)
*
* Returns: the same udev queue context.
**/
-struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue)
+UDEV_EXPORT struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue)
{
if (udev_queue == NULL)
return NULL;
@@ -95,7 +95,7 @@ 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.
**/
-void udev_queue_unref(struct udev_queue *udev_queue)
+UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue)
{
if (udev_queue == NULL)
return;
@@ -115,7 +115,7 @@ void udev_queue_unref(struct udev_queue *udev_queue)
*
* Returns: the udev library context.
**/
-struct udev *udev_queue_get_udev(struct udev_queue *udev_queue)
+UDEV_EXPORT struct udev *udev_queue_get_udev(struct udev_queue *udev_queue)
{
if (udev_queue == NULL)
return NULL;
@@ -149,7 +149,7 @@ unsigned long long int udev_get_kernel_seqnum(struct udev *udev)
*
* Returns: the current kernel event sequence number.
**/
-unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue)
+UDEV_EXPORT unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue)
{
unsigned long long int seqnum;
@@ -234,7 +234,7 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i
*
* Returns: the last known udev event sequence number.
**/
-unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue)
+UDEV_EXPORT unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue)
{
unsigned long long int seqnum_udev;
FILE *queue_file;
@@ -266,7 +266,7 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue)
*
* Returns: a flag indicating if udev is active.
**/
-int udev_queue_get_udev_is_active(struct udev_queue *udev_queue)
+UDEV_EXPORT int udev_queue_get_udev_is_active(struct udev_queue *udev_queue)
{
unsigned long long int seqnum_start;
FILE *queue_file;
@@ -285,7 +285,7 @@ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue)
*
* Returns: a flag indicating if udev is currently handling events.
**/
-int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue)
+UDEV_EXPORT int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue)
{
unsigned long long int seqnum_kernel;
unsigned long long int seqnum_udev = 0;
@@ -345,7 +345,7 @@ out:
*
* Returns: a flag indicating if any of the sequence numbers in the given range is currently active.
**/
-int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
+UDEV_EXPORT int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
unsigned long long int start, unsigned long long int end)
{
unsigned long long int seqnum;
@@ -407,7 +407,7 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
*
* Returns: a flag indicating if the given sequence number is currently active.
**/
-int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum)
+UDEV_EXPORT int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum)
{
if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum))
return 0;
@@ -422,7 +422,7 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo
*
* Returns: the first entry of the list of queued events.
**/
-struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue)
+UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue)
{
unsigned long long int seqnum;
FILE *queue_file;
@@ -475,7 +475,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev
*
* Returns: the first entry of the list of recorded failed events.
**/
-struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue)
+UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue)
{
char path[UTIL_PATH_SIZE];
DIR *dir;
diff --git a/libudev/libudev.c b/libudev/libudev.c
index 6b5c5e9f84..ad8c914e84 100644
--- a/libudev/libudev.c
+++ b/libudev/libudev.c
@@ -77,7 +77,7 @@ static void log_stderr(struct udev *udev,
*
* Returns: stored userdata
**/
-void *udev_get_userdata(struct udev *udev)
+UDEV_EXPORT void *udev_get_userdata(struct udev *udev)
{
if (udev == NULL)
return NULL;
@@ -91,7 +91,7 @@ void *udev_get_userdata(struct udev *udev)
*
* Store custom @userdata in the library context.
**/
-void udev_set_userdata(struct udev *udev, void *userdata)
+UDEV_EXPORT void udev_set_userdata(struct udev *udev, void *userdata)
{
if (udev == NULL)
return;
@@ -117,7 +117,7 @@ static char *set_value(char **s, const char *v)
*
* Returns: a new udev library context
**/
-struct udev *udev_new(void)
+UDEV_EXPORT struct udev *udev_new(void)
{
struct udev *udev;
const char *env;
@@ -284,7 +284,7 @@ err:
*
* Returns: the passed udev library context
**/
-struct udev *udev_ref(struct udev *udev)
+UDEV_EXPORT struct udev *udev_ref(struct udev *udev)
{
if (udev == NULL)
return NULL;
@@ -300,7 +300,7 @@ struct udev *udev_ref(struct udev *udev)
* reaches zero, the resources of the context will be released.
*
**/
-void udev_unref(struct udev *udev)
+UDEV_EXPORT void udev_unref(struct udev *udev)
{
if (udev == NULL)
return;
@@ -327,7 +327,7 @@ void udev_unref(struct udev *udev)
* into the users' logging functionality.
*
**/
-void udev_set_log_fn(struct udev *udev,
+UDEV_EXPORT void udev_set_log_fn(struct udev *udev,
void (*log_fn)(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, va_list args))
@@ -345,7 +345,7 @@ void udev_set_log_fn(struct udev *udev,
*
* Returns: the current logging priority
**/
-int udev_get_log_priority(struct udev *udev)
+UDEV_EXPORT int udev_get_log_priority(struct udev *udev)
{
return udev->log_priority;
}
@@ -358,7 +358,7 @@ int udev_get_log_priority(struct udev *udev)
* Set the current logging priority. The value controls which messages
* are logged.
**/
-void udev_set_log_priority(struct udev *udev, int priority)
+UDEV_EXPORT void udev_set_log_priority(struct udev *udev, int priority)
{
char num[32];
@@ -382,7 +382,7 @@ const char *udev_get_rules_path(struct udev *udev)
*
* Returns: the sys mount point
**/
-const char *udev_get_sys_path(struct udev *udev)
+UDEV_EXPORT const char *udev_get_sys_path(struct udev *udev)
{
if (udev == NULL)
return NULL;
@@ -399,7 +399,7 @@ const char *udev_get_sys_path(struct udev *udev)
*
* Returns: the device directory path
**/
-const char *udev_get_dev_path(struct udev *udev)
+UDEV_EXPORT const char *udev_get_dev_path(struct udev *udev)
{
if (udev == NULL)
return NULL;
@@ -419,7 +419,7 @@ const char *udev_get_run_config_path(struct udev *udev)
*
* Returns: the runtime directory path
**/
-const char *udev_get_run_path(struct udev *udev)
+UDEV_EXPORT const char *udev_get_run_path(struct udev *udev)
{
if (udev->run_path != NULL)
return udev->run_path;