From 1fb13606fada0b8aeedcdd11e562353b7cc53b8d Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Tue, 10 Dec 2013 06:38:58 -0500 Subject: [PATCH 4/5] udev: split out new libudev-hwdb.h header Split the udev_hwdb public APIs into a separate libudev-hwdb.h header, including this new header from libudev.h. We also move the udev_list public APIs here because they are needed by users of hwdb. We could add another file just for the list APIs but if we view .h files as public entry points to the API, it makes more sense just to do it as we have done here. https://bugs.freedesktop.org/show_bug.cgi?id=72562 --- Makefile.am | 1 + src/libudev/libudev-hwdb.h | 64 ++++++++++++++++++++++++++++++++++++++++++++++ src/libudev/libudev.h | 34 +----------------------- 3 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 src/libudev/libudev-hwdb.h diff --git a/Makefile.am b/Makefile.am index c13956d..3fe037f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2292,6 +2292,7 @@ noinst_DATA += \ endif include_HEADERS += \ + src/libudev/libudev-hwdb.h \ src/libudev/libudev.h lib_LTLIBRARIES += \ diff --git a/src/libudev/libudev-hwdb.h b/src/libudev/libudev-hwdb.h new file mode 100644 index 0000000..8b38781 --- /dev/null +++ b/src/libudev/libudev-hwdb.h @@ -0,0 +1,64 @@ +/*** + This file is part of systemd. + + Copyright 2008-2012 Kay Sievers + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +#ifndef _LIBUDEV_HWDB_H_ +#define _LIBUDEV_HWDB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * udev_list + * + * access to libudev generated lists + */ +struct udev_list_entry; +struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); +struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); +const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); +const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); +/** + * udev_list_entry_foreach: + * @list_entry: entry to store the current position + * @first_entry: first entry to start with + * + * Helper to iterate over all entries of a list. + */ +#define udev_list_entry_foreach(list_entry, first_entry) \ + for (list_entry = first_entry; \ + list_entry != NULL; \ + list_entry = udev_list_entry_get_next(list_entry)) + +/* + * udev_hwdb + * + * access to the static hardware properties database + */ +struct udev_hwdb; +struct udev_hwdb *udev_hwdb_new(void *unused); +struct udev_hwdb *udev_hwdb_ref(struct udev_hwdb *hwdb); +struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb); +struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* _LIBUDEV_HWDB_H_ */ diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h index 8c4fc7a..f3e6174 100644 --- a/src/libudev/libudev.h +++ b/src/libudev/libudev.h @@ -23,6 +23,7 @@ #include #include #include +#include "libudev-hwdb.h" #ifdef __cplusplus extern "C" { @@ -48,28 +49,6 @@ void *udev_get_userdata(struct udev *udev); void udev_set_userdata(struct udev *udev, void *userdata); /* - * udev_list - * - * access to libudev generated lists - */ -struct udev_list_entry; -struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); -struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); -const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); -const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); -/** - * udev_list_entry_foreach: - * @list_entry: entry to store the current position - * @first_entry: first entry to start with - * - * Helper to iterate over all entries of a list. - */ -#define udev_list_entry_foreach(list_entry, first_entry) \ - for (list_entry = first_entry; \ - list_entry != NULL; \ - list_entry = udev_list_entry_get_next(list_entry)) - -/* * udev_device * * access to sysfs/kernel devices @@ -180,17 +159,6 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); /* - * udev_hwdb - * - * access to the static hardware properties database - */ -struct udev_hwdb; -struct udev_hwdb *udev_hwdb_new(void *unused); -struct udev_hwdb *udev_hwdb_ref(struct udev_hwdb *hwdb); -struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb); -struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags); - -/* * udev_util * * udev specific utilities -- 1.8.4.2