Date: Mon, 10 May 1999 22:17:50 +0400 From: Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru> To: Poul-Henning Kamp <phk@FreeBSD.org> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/file fsmagic.c Message-ID: <199905101817.WAA01570@tejblum.dnttm.rssi.ru> In-Reply-To: Your message of "Mon, 10 May 1999 11:06:39 PDT." <199905101806.LAA28487@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp wrote: > phk 1999/05/10 11:06:39 PDT > > Modified files: > usr.bin/file fsmagic.c > Log: > Don't go looking for weird #includes if major isn't a macro. > Try something like this instead: --- types.h Mon May 10 21:55:39 1999 +++ types.h Mon May 10 22:00:54 1999 @@ -119,26 +119,38 @@ * bits 16-31 for devices that don't use them. */ +#ifdef __GNUC__ + static __inline int -minor(dev_t dev) +__minor(dev_t _dev) { - return(dev & 0xffff00ff); + return(_dev & 0xffff00ff); } static __inline int -major(dev_t dev) +__major(dev_t _dev) { - return((dev & 0xff00) >> 8); + return((_dev & 0xff00) >> 8); } static __inline dev_t -makedev(int x, int y) +__makedev(int _x, int _y) { - return ((x << 8) | y); + return ((_x << 8) | _y); } -#endif +#define major(x) __major(x) +#define minor(x) __minor(x) +#define makedev(x,y) __makedev(x,y) + +#else +#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 */ + +#endif +#endif #include <machine/endian.h> #ifdef _BSD_CLOCK_T_ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905101817.WAA01570>