BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001471 [BusyBox] New Features major always 08-24-07 03:11 02-20-08 10:33
Reporter levin View Status public  
Assigned To BusyBox
Priority normal Resolution won't fix  
Status closed   Product Version svn
Summary 0001471: 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.
Additional Information Maybe this is already fixed at http://bugs.busybox.net/view.php?id=1347 [^]
I post it in case someone needs it too.
Attached Files

- Relationships

- Notes
(0005194)
vapier
02-20-08 10:33

mdev.conf allows for you to declare symlinks, but i dont think that's what you were going for here

the tree walking has been rewritten, so creating a /dev tree that matches the symlink layout of /sys isnt feasible anymore
 

- 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
02-20-08 10:33 vapier Note Added: 0005194
02-20-08 10:33 vapier Status assigned => closed
02-20-08 10:33 vapier Resolution open => won't fix


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker