libudev Reference Manual | ||||
---|---|---|---|---|
Top | Description |
struct udev; struct udev * udev_ref (struct udev *udev
); void udev_unref (struct udev *udev
); struct udev * udev_new (void
); 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)
); int udev_get_log_priority (struct udev *udev
); void udev_set_log_priority (struct udev *udev
,int priority
); const char * udev_get_sys_path (struct udev *udev
); const char * udev_get_dev_path (struct udev *udev
); const char * udev_get_run_path (struct udev *udev
); void * udev_get_userdata (struct udev *udev
); void udev_set_userdata (struct udev *udev
,void *userdata
);
The context contains the default values read from the udev config file, and is passed to all library operations.
struct udev * udev_ref (struct udev *udev
);
Take a reference of the udev library context.
|
udev library context |
Returns : |
the passed udev library context |
void udev_unref (struct udev *udev
);
Drop a reference of the udev library context. If the refcount reaches zero, the resources of the context will be released.
|
udev library context |
struct udev * udev_new (void
);
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.
Returns : |
a new udev library context |
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)
);
The built-in logging writes to stderr. It can be overridden by a custom function, to plug log messages into the users' logging functionality.
|
udev library context |
|
function to be called for logging messages |
int udev_get_log_priority (struct udev *udev
);
The initial logging priority is read from the udev config file at startup.
|
udev library context |
Returns : |
the current logging priority |
void udev_set_log_priority (struct udev *udev
,int priority
);
Set the current logging priority. The value controls which messages are logged.
|
udev library context |
|
the new logging priority |
const char * udev_get_sys_path (struct udev *udev
);
Retrieve the sysfs mount point. The default is "/sys". For testing purposes, it can be overridden with the environment variable SYSFS_PATH.
|
udev library context |
Returns : |
the sys mount point |
const char * udev_get_dev_path (struct udev *udev
);
Retrieve the device directory path. The default value is "/dev", the actual value may be overridden in the udev configuration file.
|
udev library context |
Returns : |
the device directory path |
const char * udev_get_run_path (struct udev *udev
);
Retrieve the udev runtime directory path. The default is "/run/udev".
|
udev library context |
Returns : |
the runtime directory path |
void * udev_get_userdata (struct udev *udev
);
Retrieve stored data pointer from library context. This might be useful to access from callbacks like a custom logging function.
|
udev library context |
Returns : |
stored userdata |