param.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Copyright (C) 1996 Robert de Bath <rdebath@cix.compulink.co.uk>
  2. * This file is part of the Linux-8086 C library and is distributed
  3. * under the GNU Library General Public License.
  4. */
  5. #ifndef _PARAM_H
  6. #define _PARAM_H
  7. #include <features.h>
  8. #include <limits.h>
  9. #include <linux/limits.h>
  10. #include <linux/param.h>
  11. #include <sys/types.h>
  12. #define MAXPATHLEN PATH_MAX
  13. #ifndef NR_OPEN
  14. #define NR_OPEN 32
  15. #endif
  16. #ifndef NR_FILE
  17. #define NR_FILE 32
  18. #endif
  19. /* Number of Bits per BYte */
  20. #define NBBY CHAR_BIT
  21. /* Bit map related macros. */
  22. #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
  23. #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
  24. #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
  25. #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
  26. /* Macros for counting and rounding. */
  27. #ifndef howmany
  28. #define howmany(x, y) (((x)+((y)-1))/(y))
  29. #endif
  30. #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
  31. #define powerof2(x) ((((x)-1)&(x))==0)
  32. /* Macros for min/max. */
  33. #define MIN(a,b) (((a)<(b))?(a):(b))
  34. #define MAX(a,b) (((a)>(b))?(a):(b))
  35. /* Unit of `st_blocks'. */
  36. #define DEV_BSIZE 512
  37. #endif /* _PARAM_H */