[BusyBox 0001471]: support device symlinks in /sys
bugs at busybox.net
bugs at busybox.net
Fri Aug 24 03:12:00 PDT 2007
The following issue has been SUBMITTED.
======================================================================
http://busybox.net/bugs/view.php?id=1471
======================================================================
Reported By: levin
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 1471
Category: New Features
Reproducibility: always
Severity: major
Priority: normal
Status: assigned
======================================================================
Date Submitted: 08-24-2007 03:11 PDT
Last Modified: 08-24-2007 03:11 PDT
======================================================================
Summary: support device symlinks in /sys
Description:
This patch is again busybox 1.6.1.
In linux kernel 2.6.22.3, I find that tty1 in /dev/class/tty/ is actually
symbol link to ../../devices/virtual/tty/tty1, and mdev in busybox 1.6.1
won't create the device node. So I write this patch to solve it.
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index a4716e2..1a6a86f 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -219,12 +219,22 @@ static void find_dev(char *path)
// uClibc doesn't fill out entry->d_type reliably. so we
use lstat().
snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name);
- if (!lstat(path, &st) && S_ISDIR(st.st_mode))
find_dev(path);
- path[len] = 0;
-
- /* If there's a dev entry, mknod it */
-
- if (!strcmp(entry->d_name, "dev")) make_device(path, 0);
+ if (lstat(path, &st))
+ continue;
+ if (S_ISDIR(st.st_mode))
+ find_dev(path);
+ else if (S_ISLNK(st.st_mode)) {
+ snprintf(path+len, PATH_MAX-len, "/%s/dev",
entry->d_name);
+ if (!lstat(path, &st) && S_ISREG(st.st_mode)) {
+ snprintf(path+len, PATH_MAX-len, "/%s",
entry->d_name);
+ make_device(path, 0);
+ }
+ }
+ else if (S_ISREG(st.st_mode) && !strcmp(entry->d_name,
"dev")) {
+ /* This is a dev entry, mknod it */
+ path[len] = 0;
+ make_device(path, 0);
+ }
}
closedir(dir);
It's not neat. Hope it helps anyway.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
08-24-07 03:12 levin New Issue
08-24-07 03:12 levin Status new => assigned
08-24-07 03:12 levin Assigned To => BusyBox
======================================================================
More information about the busybox-cvs
mailing list