Cleaning usage of MAJOR/MINOR

Change-Id: I4d7718c51967930375a5f0657b61f869745cf644
This commit is contained in:
Lionel Sambuc 2012-12-12 14:30:19 +01:00
parent 0c3ae37f52
commit 22e69f558e
8 changed files with 11 additions and 41 deletions

View file

@ -229,13 +229,6 @@ void *alloc(size_t n)
return m;
}
#ifndef makedev /* Missing in sys/types.h */
#define minor(dev) (((dev) >> MINOR) & BYTE)
#define major(dev) (((dev) >> MAJOR) & BYTE)
#define makedev(major, minor) \
((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
#endif
typedef enum parttype { DUNNO, SUBPART, PRIMARY, FLOPPY } parttype_t;
typedef struct device {

View file

@ -958,8 +958,7 @@ void list(ino_t ino, d_inode *ip)
switch (ip->i_mode & I_TYPE) {
case I_CHAR_SPECIAL:
case I_BLOCK_SPECIAL:
printf(" %2x,%2x ", (dev_t) ip->i_zone[0] >> MAJOR & 0xFF,
(dev_t) ip->i_zone[0] >> MINOR & 0xFF);
printf(" %2x,%2x ", major(ip->i_zone[0]), minor(ip->i_zone[0]));
break;
default: printf("%7ld ", ip->i_size);
}

View file

@ -200,13 +200,6 @@ void *alloc(size_t n)
return m;
}
#ifndef makedev /* Missing in sys/types.h */
#define minor(dev) (((dev) >> MINOR) & BYTE)
#define major(dev) (((dev) >> MAJOR) & BYTE)
#define makedev(major, minor) \
((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
#endif
typedef enum parttype { DUNNO, SUBPART, PRIMARY, FLOPPY } parttype_t;
typedef struct device {

View file

@ -36,13 +36,6 @@ void fatal(const char *label)
exit(1);
}
#ifndef makedev
#define minor(dev) (((dev) >> MINOR) & BYTE)
#define major(dev) (((dev) >> MAJOR) & BYTE)
#define makedev(major, minor) \
((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
#endif
int aflag; /* Add a new partition to the current table. */
int mflag; /* Minix rules, no need for alignment. */
int rflag; /* Report current partitions. */

View file

@ -44,13 +44,6 @@ void fatal(const char *label)
exit(1);
}
#ifndef makedev
#define minor(dev) (((dev) >> MINOR) & BYTE)
#define major(dev) (((dev) >> MAJOR) & BYTE)
#define makedev(major, minor) \
((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
#endif
#define MINOR_d0p0s0 128
void partsort(struct part_entry *pe)

View file

@ -307,7 +307,7 @@ static int parse_arguments(int argc, char **argv, u32_t *rss_flags)
print_usage(argv[ARG_NAME], "major already set");
exit(EINVAL);
}
req_major = (stat_buf.st_rdev >> MAJOR) & BYTE;
req_major = major(stat_buf.st_rdev);
if(req_dev_style == STYLE_NDEV) {
req_dev_style = STYLE_DEV;
}

View file

@ -275,8 +275,8 @@ struct inode *alloc_inode(dev_t dev, mode_t bits)
b = alloc_bit(sp, IMAP, sp->s_isearch);
if (b == NO_BIT) {
err_code = ENOSPC;
major = (int) (sp->s_dev >> MAJOR) & BYTE;
minor = (int) (sp->s_dev >> MINOR) & BYTE;
major = major(sp->s_dev);
minor = minor(sp->s_dev);
printf("Out of i-nodes on device %d/%d\n", major, minor);
return(NULL);
}

View file

@ -133,7 +133,6 @@ typedef uint32_t bitchunk_t; /* collection of bits in a bitmap */
*/
typedef unsigned long Ino_t;
#endif /* __minix */
#include <machine/endian.h>
@ -301,13 +300,13 @@ typedef int32_t __devmajor_t, __devminor_t;
#define devmajor_t __devmajor_t
#define devminor_t __devminor_t
#define NODEVMAJOR (-1)
/* Major, minor numbers, dev_t's. */
#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
#define minor(dev) ((devminor_t)(((dev) >> MINOR) & 0xff))
#define major(dev) ((devmajor_t)(((dev) >> MAJOR) & 0xff))
#define makedev(major, minor) \
((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
/* LSC Our major / minor numbering scheme is not the exactly the same, to be updated? */
#define major(x) ((devmajor_t)(((uint32_t)(x) & 0x0000ff00) >> 8))
#define minor(x) ((devminor_t)( \
(((uint32_t)(x) & 0x000000ff) >> 0)))
#define makedev(x,y) ((dev_t)((((x) << 8) & 0x0000ff00) | \
\
(((y) << 0) & 0x000000ff)))
#endif
#ifdef _BSD_CLOCK_T_