/*
* libudev - interface to udev device information
*
- * Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2008-2010 Kay Sievers <kay.sievers@vrfy.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#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:
*
- * Library context, passed to all operations.
+ * Opaque object representing the library context.
*/
struct udev {
int refcount;
char *rules_path;
struct udev_list_node properties_list;
int log_priority;
- int run;
};
void udev_log(struct udev *udev,
* @udev: udev library context
*
* Retrieve stored data pointer from library context. This might be useful
- * to access from callbacks.
+ * to access from callbacks like a custom logging function.
*
* Returns: stored userdata
**/
udev->log_fn = log_stderr;
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 ||
udev_add_property(udev, "SYSFS_PATH", udev->sys_path);
}
- env = getenv("UDEV_RUN");
- if (env != NULL && strcmp(env, "0") == 0)
- udev->run = 0;
-
env = getenv("UDEV_CONFIG_FILE");
if (env != NULL) {
free(config_file);
}
if (config_file == NULL)
goto err;
- f = fopen(config_file, "r");
+ f = fopen(config_file, "re");
if (f != NULL) {
char line[UTIL_LINE_SIZE];
int line_nr = 0;
* udev_get_log_priority:
* @udev: udev library context
*
- * The initial syslog priortity is read from the udev config file
+ * The initial logging priority is read from the udev config file
* at startup.
*
- * Returns: the current syslog priority
+ * Returns: the current logging priority
**/
int udev_get_log_priority(struct udev *udev)
{
/**
* udev_set_log_priority:
* @udev: udev library context
- * @priority: the new syslog priority
+ * @priority: the new logging priority
*
- * Set the current syslog priority. The value controls which messages
- * are send to syslog.
+ * Set the current logging priority. The value controls which messages
+ * are logged.
**/
void udev_set_log_priority(struct udev *udev, int priority)
{
return udev->rules_path;
}
-int udev_get_run(struct udev *udev)
-{
- return udev->run;
-}
-
/**
* udev_get_sys_path:
* @udev: udev library context