libudev: private - drop some functions from the internal API

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
Tom Gundersen 2015-01-26 14:48:04 +01:00 committed by Anthony G. Basile
parent b39a4a3aba
commit e0bb33e4a8
3 changed files with 41 additions and 52 deletions

7
NOTES
View File

@ -1,12 +1,5 @@
Newest entries are on top.
2015-02-08
* We also skip "libudev: private - drop some functions from the internal API"
http://cgit.freedesktop.org/systemd/systemd/commit/src/libudev?id=71ef8b3ac49fd8b5cff36ee7efc945a751ab9a09
This follows on the privious skipped commit. Since we did not move the renaming, a
residual call to udev_device_set_syspath() remains in udev-event.c.
2014-12-15
* We did not move builtin-hwdb - port to sd-hwdb:

View File

@ -161,7 +161,7 @@ _public_ dev_t udev_device_get_devnum(struct udev_device *udev_device)
return udev_device->devnum;
}
int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
{
char num[32];
@ -258,7 +258,7 @@ static int udev_device_set_devtype(struct udev_device *udev_device, const char *
return 0;
}
int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem)
static int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem)
{
free(udev_device->subsystem);
udev_device->subsystem = strdup(subsystem);
@ -392,6 +392,44 @@ static struct udev_list_entry *udev_device_add_property_from_string(struct udev_
return udev_device_add_property(udev_device, name, val);
}
static int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath)
{
const char *pos;
size_t len;
free(udev_device->syspath);
udev_device->syspath = strdup(syspath);
if (udev_device->syspath == NULL)
return -ENOMEM;
udev_device->devpath = udev_device->syspath + strlen("/sys");
udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath);
pos = strrchr(udev_device->syspath, '/');
if (pos == NULL)
return -EINVAL;
udev_device->sysname = strdup(&pos[1]);
if (udev_device->sysname == NULL)
return -ENOMEM;
/* some devices have '!' in their name, change that to '/' */
len = 0;
while (udev_device->sysname[len] != '\0') {
if (udev_device->sysname[len] == '!')
udev_device->sysname[len] = '/';
len++;
}
/* trailing number */
while (len > 0 && isdigit(udev_device->sysname[--len]))
udev_device->sysnum = &udev_device->sysname[len];
/* sysname is completely numeric */
if (len == 0)
udev_device->sysnum = NULL;
return 0;
}
/*
* parse property string, and if needed, update internal values accordingly
*
@ -637,7 +675,7 @@ void udev_device_set_info_loaded(struct udev_device *device)
device->info_loaded = true;
}
struct udev_device *udev_device_new(struct udev *udev)
static struct udev_device *udev_device_new(struct udev *udev)
{
struct udev_device *udev_device;
@ -1607,44 +1645,6 @@ _public_ struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_
return udev_list_get_entry(&udev_device->sysattr_list);
}
int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath)
{
const char *pos;
size_t len;
free(udev_device->syspath);
udev_device->syspath = strdup(syspath);
if (udev_device->syspath == NULL)
return -ENOMEM;
udev_device->devpath = udev_device->syspath + strlen("/sys");
udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath);
pos = strrchr(udev_device->syspath, '/');
if (pos == NULL)
return -EINVAL;
udev_device->sysname = strdup(&pos[1]);
if (udev_device->sysname == NULL)
return -ENOMEM;
/* some devices have '!' in their name, change that to '/' */
len = 0;
while (udev_device->sysname[len] != '\0') {
if (udev_device->sysname[len] == '!')
udev_device->sysname[len] = '/';
len++;
}
/* trailing number */
while (len > 0 && isdigit(udev_device->sysname[--len]))
udev_device->sysnum = &udev_device->sysname[len];
/* sysname is completely numeric */
if (len == 0)
udev_device->sysnum = NULL;
return 0;
}
static int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode)
{
free(udev_device->devnode);

View File

@ -37,16 +37,12 @@
int udev_get_rules_path(struct udev *udev, char **path[], usec_t *ts_usec[]);
/* libudev-device.c */
struct udev_device *udev_device_new(struct udev *udev);
struct udev_device *udev_device_new_from_nulstr(struct udev *udev, char *nulstr, ssize_t buflen);
struct udev_device *udev_device_shallow_clone(struct udev_device *old_device);
mode_t udev_device_get_devnode_mode(struct udev_device *udev_device);
uid_t udev_device_get_devnode_uid(struct udev_device *udev_device);
gid_t udev_device_get_devnode_gid(struct udev_device *udev_device);
int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem);
int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
int udev_device_rename(struct udev_device *udev_device, const char *new_name);
int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum);
int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink);
void udev_device_cleanup_devlinks_list(struct udev_device *udev_device);
struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value);