From 5dd371944e1dba09861f3ea57a49ae2067687d73 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 2 Aug 2017 10:14:17 +0000 Subject: [PATCH] Change major()/minor() to work with 64bit dev_t. Since traditional types for the macros values are int, remove the cookie trick and just split the dev_t at the word boundary. Reported by: Victor Stinner PR: 221048 Sponsored by: The FreeBSD Foundation --- sys/sys/types.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/sys/types.h b/sys/sys/types.h index 8d0af5713b4c..fce57e412ed7 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -364,14 +364,9 @@ __bitcount64(__uint64_t _x) #include -/* - * minor() gives a cookie instead of an index since we don't want to - * change the meanings of bits 0-15 or waste time and space shifting - * bits 16-31 for devices that don't use them. - */ -#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ -#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ -#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */ +#define major(x) ((int)((dev_t)(x) >> 32)) /* major number */ +#define minor(x) ((int)((x) & 0xffffffff)) /* minor number */ +#define makedev(x, y) (((dev_t)(x) << 32) | (y)) /* create dev_t */ /* * These declarations belong elsewhere, but are repeated here and in