summaryrefslogtreecommitdiff
path: root/udev/lib/libudev.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-08-28 23:05:01 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-08-28 23:05:01 +0200
commitba6929f6690a72485ac3c6b7610ffbd5ab319be7 (patch)
tree0c6988f9530bfe5ce88004c79ac106a80dd83ce6 /udev/lib/libudev.c
parent530fc1f526ee04360f6937812b31cc1df526e505 (diff)
libudev: add udev event monitor API
Diffstat (limited to 'udev/lib/libudev.c')
-rw-r--r--udev/lib/libudev.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c
index 56bd47741d..a5f33eb08f 100644
--- a/udev/lib/libudev.c
+++ b/udev/lib/libudev.c
@@ -32,6 +32,13 @@
#include "libudev-private.h"
#include "../udev.h"
+struct udev {
+ int refcount;
+ void (*log_fn)(struct udev *udev,
+ int priority, const char *file, int line, const char *fn,
+ const char *format, va_list args);
+};
+
void udev_log(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, ...)
@@ -110,6 +117,8 @@ struct udev *udev_new(void)
**/
struct udev *udev_ref(struct udev *udev)
{
+ if (udev == NULL)
+ return NULL;
udev->refcount++;
return udev;
}
@@ -124,6 +133,8 @@ struct udev *udev_ref(struct udev *udev)
**/
void udev_unref(struct udev *udev)
{
+ if (udev == NULL)
+ return;
udev->refcount--;
if (udev->refcount > 0)
return;
@@ -164,6 +175,8 @@ void udev_set_log_fn(struct udev *udev,
**/
const char *udev_get_sys_path(struct udev *udev)
{
+ if (udev == NULL)
+ return NULL;
return sysfs_path;
}
@@ -179,5 +192,7 @@ const char *udev_get_sys_path(struct udev *udev)
**/
const char *udev_get_dev_path(struct udev *udev)
{
+ if (udev == NULL)
+ return NULL;
return udev_root;
}