chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] 034 release
[elogind.git]
/
udevdb.c
diff --git
a/udevdb.c
b/udevdb.c
index 22d439d6388d0bea47157e799309340bf2aef618..c4dc4f005cbd307deadffcc51095180d058bb12d 100644
(file)
--- a/
udevdb.c
+++ b/
udevdb.c
@@
-1,5
+1,5
@@
/*
/*
- * udevdb.c
+ * udevdb.c
- udev database library
*
* Userspace devfs
*
*
* Userspace devfs
*
@@
-21,13
+21,11
@@
*
*/
*
*/
-/*
- * udev database library
- */
#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <stddef.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
@@
-35,8
+33,9
@@
#include <signal.h>
#include "libsysfs/sysfs/libsysfs.h"
#include <signal.h>
#include "libsysfs/sysfs/libsysfs.h"
-#include "udev_version.h"
#include "udev.h"
#include "udev.h"
+#include "udev_lib.h"
+#include "udev_version.h"
#include "logging.h"
#include "namedev.h"
#include "udevdb.h"
#include "logging.h"
#include "namedev.h"
#include "udevdb.h"
@@
-53,13
+52,14
@@
int udevdb_add_dev(const char *path, const struct udevice *dev)
if ((path == NULL) || (dev == NULL))
return -ENODEV;
if ((path == NULL) || (dev == NULL))
return -ENODEV;
- memset(keystr, 0,
NAME_SIZE
);
+ memset(keystr, 0,
SYSFS_PATH_MAX
);
strfieldcpy(keystr, path);
key.dptr = keystr;
key.dsize = strlen(keystr) + 1;
data.dptr = (void *)dev;
data.dsize = UDEVICE_LEN;
strfieldcpy(keystr, path);
key.dptr = keystr;
key.dsize = strlen(keystr) + 1;
data.dptr = (void *)dev;
data.dsize = UDEVICE_LEN;
+ dbg("store key '%s' for device '%s'", path, dev->name);
return tdb_store(udevdb, key, data, TDB_REPLACE);
}
return tdb_store(udevdb, key, data, TDB_REPLACE);
}
@@
-179,25
+179,26
@@
static int find_found;
static int find_device_by_name(char *path, struct udevice *dev)
{
static int find_device_by_name(char *path, struct udevice *dev)
{
- int pos, len;
+ char *pos;
+ int len;
if (strncmp(dev->name, find_name, sizeof(dev->name)) == 0) {
memcpy(find_dev, dev, sizeof(struct udevice));
if (strncmp(dev->name, find_name, sizeof(dev->name)) == 0) {
memcpy(find_dev, dev, sizeof(struct udevice));
- str
nfieldcpy
(find_path, path, NAME_SIZE);
+ str
fieldcpymax
(find_path, path, NAME_SIZE);
find_found = 1;
/* stop search */
return 1;
}
/* look for matching symlink*/
foreach_strpart(dev->symlink, " ", pos, len) {
find_found = 1;
/* stop search */
return 1;
}
/* look for matching symlink*/
foreach_strpart(dev->symlink, " ", pos, len) {
- if (strncmp(
&dev->symlink[pos]
, find_name, len) != 0)
+ if (strncmp(
pos
, find_name, len) != 0)
continue;
if (len != strlen(find_name))
continue;
memcpy(find_dev, dev, sizeof(struct udevice));
continue;
if (len != strlen(find_name))
continue;
memcpy(find_dev, dev, sizeof(struct udevice));
- str
nfieldcpy
(find_path, path, NAME_SIZE);
+ str
fieldcpymax
(find_path, path, NAME_SIZE);
find_found = 1;
return 1;
}
find_found = 1;
return 1;
}