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
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user