chiark / gitweb /
fix util_lookup_group to handle large groups
[elogind.git] / libudev / libudev.c
index a9baa707995b17f7cf44d15994aa57f36b80d277..695443cf3bd29ecddc6cf73456e4e0dd626b57f8 100644 (file)
 #include "libudev.h"
 #include "libudev-private.h"
 
+/**
+ * SECTION:libudev
+ * @short_description: libudev context
+ *
+ * The context contains the default values read from the udev config file,
+ * and is passed to all library operations.
+ */
+
+/**
+ * udev:
+ *
+ * Opaque object representing the library context.
+ */
 struct udev {
        int refcount;
        void (*log_fn)(struct udev *udev,
@@ -41,9 +54,6 @@ void udev_log(struct udev *udev,
 {
        va_list args;
 
-       if (priority > udev->log_priority)
-               return;
-
        va_start(args, format);
        udev->log_fn(udev, priority, file, line, fn, format, args);
        va_end(args);
@@ -57,6 +67,15 @@ static void log_stderr(struct udev *udev,
        vfprintf(stderr, format, args);
 }
 
+/**
+ * udev_get_userdata:
+ * @udev: udev library context
+ *
+ * Retrieve stored data pointer from library context. This might be useful
+ * to access from callbacks.
+ *
+ * Returns: stored userdata
+ **/
 void *udev_get_userdata(struct udev *udev)
 {
        if (udev == NULL)
@@ -64,6 +83,13 @@ void *udev_get_userdata(struct udev *udev)
        return udev->userdata;
 }
 
+/**
+ * udev_set_userdata:
+ * @udev: udev library context
+ * @userdata: data pointer
+ *
+ * Store custom @userdata in the library context.
+ **/
 void udev_set_userdata(struct udev *udev, void *userdata)
 {
        if (udev == NULL)
@@ -74,7 +100,8 @@ void udev_set_userdata(struct udev *udev, void *userdata)
 /**
  * udev_new:
  *
- * Create udev library context.
+ * Create udev library context. This reads the udev configuration
+ * file, and fills in the default values.
  *
  * The initial refcount is 1, and needs to be decremented to
  * release the resources of the udev library context.
@@ -96,7 +123,7 @@ struct udev *udev_new(void)
        udev->log_priority = LOG_ERR;
        udev_list_init(&udev->properties_list);
        udev->run = 1;
-       udev->dev_path = strdup(UDEV_PREFIX "/dev");
+       udev->dev_path = strdup("/dev");
        udev->sys_path = strdup("/sys");
        config_file = strdup(SYSCONFDIR "/udev/udev.conf");
        if (udev->dev_path == NULL ||
@@ -296,11 +323,28 @@ void udev_set_log_fn(struct udev *udev,
        info(udev, "custom logging function %p registered\n", udev);
 }
 
+/**
+ * udev_get_log_priority:
+ * @udev: udev library context
+ *
+ * The initial syslog priortity is read from the udev config file
+ * at startup.
+ *
+ * Returns: the current syslog priority
+ **/
 int udev_get_log_priority(struct udev *udev)
 {
        return udev->log_priority;
 }
 
+/**
+ * udev_set_log_priority:
+ * @udev: udev library context
+ * @priority: the new syslog priority
+ *
+ * Set the current syslog priority. The value controls which messages
+ * are send to syslog.
+ **/
 void udev_set_log_priority(struct udev *udev, int priority)
 {
        char num[32];