diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-07-26 13:11:12 +0400 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-07-26 13:11:12 +0400 |
commit | 4f807a84c5d936c931cd93c9e98d087305295a1c (patch) | |
tree | 46c3a59fa158ebbd7303454f2657c330abfc24fe /coreutils | |
parent | 5dcf15e02de10e648ac8e8d86500678f2043d2e6 (diff) |
BusyBox has no business hard coding the number of major and minor bits for a
dev_t. This is especially important now that the user space concept of a dev_t
and the kernel concept of a dev_t are divergant. The only bit of user space
allowed to know the number of major and minor bits is include/sys/sysmacros.h
(i.e. part of libc). When used with a current C library and a 2.6.x kernel,
this fix should allow BusyBox to support wide device major/minor numbers.
-Erik
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/ls.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 5fc60a347..a87f0ec2d 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -61,6 +61,7 @@ enum { #include <signal.h> #include <termios.h> #include <sys/ioctl.h> +#include <sys/sysmacros.h> /* major() and minor() */ #include "busybox.h" #ifdef CONFIG_SELINUX #include <fs_secure.h> @@ -72,11 +73,6 @@ enum { #include <time.h> #endif -#ifndef MAJOR -#define MAJOR(dev) (((dev)>>8)&0xff) -#define MINOR(dev) ((dev)&0xff) -#endif - /* what is the overall style of the listing */ #define STYLE_AUTO (0) #define STYLE_COLUMNS (1U<<21) /* fill columns */ @@ -700,8 +696,8 @@ static int list_single(struct dnode *dn) case LIST_SIZE: case LIST_DEV: if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) { - column += printf("%4d, %3d ", (int) MAJOR(dn->dstat.st_rdev), - (int) MINOR(dn->dstat.st_rdev)); + column += printf("%4d, %3d ", (int) major(dn->dstat.st_rdev), + (int) minor(dn->dstat.st_rdev)); } else { #ifdef CONFIG_FEATURE_HUMAN_READABLE if (all_fmt & LS_DISP_HR) { |