From 4f807a84c5d936c931cd93c9e98d087305295a1c Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 26 Jul 2004 09:11:12 +0000 Subject: 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 --- coreutils/ls.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'coreutils') 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 #include #include +#include /* major() and minor() */ #include "busybox.h" #ifdef CONFIG_SELINUX #include @@ -72,11 +73,6 @@ enum { #include #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) { -- cgit v1.2.3