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] switch major/minor to dev_t
[elogind.git]
/
udev_db.c
diff --git
a/udev_db.c
b/udev_db.c
index e07e72b85843e079dec58d0948083d47c5294672..b9c504430f311a7dfd5aced114fbda9ab2637d60 100644
(file)
--- a/
udev_db.c
+++ b/
udev_db.c
@@
-33,7
+33,7
@@
#include "libsysfs/sysfs/libsysfs.h"
#include "udev.h"
#include "libsysfs/sysfs/libsysfs.h"
#include "udev.h"
-#include "udev_
lib
.h"
+#include "udev_
utils
.h"
#include "logging.h"
#include "udev_db.h"
#include "logging.h"
#include "udev_db.h"
@@
-79,6
+79,7
@@
int udev_db_add_device(struct udevice *udev)
fprintf(f, "P:%s\n", udev->devpath);
fprintf(f, "N:%s\n", udev->name);
fprintf(f, "S:%s\n", udev->symlink);
fprintf(f, "P:%s\n", udev->devpath);
fprintf(f, "N:%s\n", udev->name);
fprintf(f, "S:%s\n", udev->symlink);
+ fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt));
fprintf(f, "A:%u\n", udev->partitions);
fprintf(f, "R:%u\n", udev->ignore_remove);
fprintf(f, "A:%u\n", udev->partitions);
fprintf(f, "R:%u\n", udev->ignore_remove);
@@
-90,6
+91,8
@@
int udev_db_add_device(struct udevice *udev)
static int parse_db_file(struct udevice *udev, const char *filename)
{
char line[NAME_SIZE];
static int parse_db_file(struct udevice *udev, const char *filename)
{
char line[NAME_SIZE];
+ char temp[NAME_SIZE];
+ unsigned int major, minor;
char *bufline;
char *buf;
size_t bufsize;
char *bufline;
char *buf;
size_t bufsize;
@@
-120,6
+123,14
@@
static int parse_db_file(struct udevice *udev, const char *filename)
strncpy(udev->name, &bufline[2], count-2);
udev->name[count-2] = '\0';
break;
strncpy(udev->name, &bufline[2], count-2);
udev->name[count-2] = '\0';
break;
+ case 'M':
+ if (count > NAME_SIZE)
+ count = NAME_SIZE-1;
+ strncpy(temp, &bufline[2], count-2);
+ temp[count-2] = '\0';
+ sscanf(temp, "%u:%u", &major, &minor);
+ udev->devt = makedev(major, minor);
+ break;
case 'S':
if (count > NAME_SIZE)
count = NAME_SIZE-1;
case 'S':
if (count > NAME_SIZE)
count = NAME_SIZE-1;
@@
-195,7
+206,7
@@
int udev_db_get_device_byname(struct udevice *udev, const char *name)
memset(&db_udev, 0x00, sizeof(struct udevice));
if (parse_db_file(&db_udev, filename) == 0) {
char *pos;
memset(&db_udev, 0x00, sizeof(struct udevice));
if (parse_db_file(&db_udev, filename) == 0) {
char *pos;
- int len;
+
unsigned
int len;
if (strncmp(name, db_udev.name, NAME_SIZE) == 0) {
goto found;
if (strncmp(name, db_udev.name, NAME_SIZE) == 0) {
goto found;