Commit eba6d00d authored by Willy Tarreau's avatar Willy Tarreau Committed by Paul E. McKenney
Browse files

tools/nolibc/types: move makedev to types.h and make it a macro



The makedev() man page says it's supposed to be a macro and that some
OSes have it with the other ones in sys/types.h so it now makes sense
to move it to types.h as a macro. Let's also define major() and
minor() that perform the reverse operation.

Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 306c9fd4
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -116,13 +116,4 @@ const char *ltoa(long in)
	return pos + 1;
}

/* Here come a few helper functions */

/* WARNING, it only deals with the 4096 first majors and 256 first minors */
static __attribute__((unused))
dev_t makedev(unsigned int major, unsigned int minor)
{
	return ((major & 0xfff) << 8) | (minor & 0xff);
}

#endif /* _NOLIBC_H */
+5 −0
Original line number Diff line number Diff line
@@ -162,4 +162,9 @@ struct stat {
	time_t    st_ctime;   /* time of last status change */
};

/* WARNING, it only deals with the 4096 first majors and 256 first minors */
#define makedev(major, minor) ((dev_t)((((major) & 0xfff) << 8) | ((minor) & 0xff)))
#define major(dev) ((unsigned int)(((dev) >> 8) & 0xfff))
#define minor(dev) ((unsigned int)(((dev) & 0xff))

#endif /* _NOLIBC_TYPES_H */