aboutsummaryrefslogtreecommitdiff
path: root/coreutils/ls.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-07-26 09:11:12 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-07-26 09:11:12 +0000
commit9cdf461f9fa82384c18bc1e149fb70d4243995f4 (patch)
tree46c3a59fa158ebbd7303454f2657c330abfc24fe /coreutils/ls.c
parent9d39a896a95f562a8229c88ed1fdeaa929a06010 (diff)
downloadbusybox-w32-9cdf461f9fa82384c18bc1e149fb70d4243995f4.tar.gz
busybox-w32-9cdf461f9fa82384c18bc1e149fb70d4243995f4.tar.bz2
busybox-w32-9cdf461f9fa82384c18bc1e149fb70d4243995f4.zip
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 git-svn-id: svn://busybox.net/trunk/busybox@9015 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r--coreutils/ls.c10
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 {
61#include <signal.h> 61#include <signal.h>
62#include <termios.h> 62#include <termios.h>
63#include <sys/ioctl.h> 63#include <sys/ioctl.h>
64#include <sys/sysmacros.h> /* major() and minor() */
64#include "busybox.h" 65#include "busybox.h"
65#ifdef CONFIG_SELINUX 66#ifdef CONFIG_SELINUX
66#include <fs_secure.h> 67#include <fs_secure.h>
@@ -72,11 +73,6 @@ enum {
72#include <time.h> 73#include <time.h>
73#endif 74#endif
74 75
75#ifndef MAJOR
76#define MAJOR(dev) (((dev)>>8)&0xff)
77#define MINOR(dev) ((dev)&0xff)
78#endif
79
80/* what is the overall style of the listing */ 76/* what is the overall style of the listing */
81#define STYLE_AUTO (0) 77#define STYLE_AUTO (0)
82#define STYLE_COLUMNS (1U<<21) /* fill columns */ 78#define STYLE_COLUMNS (1U<<21) /* fill columns */
@@ -700,8 +696,8 @@ static int list_single(struct dnode *dn)
700 case LIST_SIZE: 696 case LIST_SIZE:
701 case LIST_DEV: 697 case LIST_DEV:
702 if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) { 698 if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) {
703 column += printf("%4d, %3d ", (int) MAJOR(dn->dstat.st_rdev), 699 column += printf("%4d, %3d ", (int) major(dn->dstat.st_rdev),
704 (int) MINOR(dn->dstat.st_rdev)); 700 (int) minor(dn->dstat.st_rdev));
705 } else { 701 } else {
706#ifdef CONFIG_FEATURE_HUMAN_READABLE 702#ifdef CONFIG_FEATURE_HUMAN_READABLE
707 if (all_fmt & LS_DISP_HR) { 703 if (all_fmt & LS_DISP_HR) {