diff options
author | LaMont Jones <lamont@debian.org> | 2009-10-19 07:58:11 -0600 |
---|---|---|
committer | LaMont Jones <lamont@debian.org> | 2009-10-19 07:58:11 -0600 |
commit | 7bfb9ff5418b4cf9d98efe04c109eef18b7b73e8 (patch) | |
tree | 5ce9985e4f9e438592dc73da82e430eeda68c83c /include | |
parent | de6990bd06560c70f13a43a6d7556af8a557c52c (diff) | |
parent | 5e51568e144746ab5821b43d9991c208189fbbb8 (diff) | |
download | util-linux-old-7bfb9ff5418b4cf9d98efe04c109eef18b7b73e8.tar.gz |
Merge remote branch 'origin/master'
Conflicts:
mount/lomount.c
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 1 | ||||
-rw-r--r-- | include/bitops.h | 16 | ||||
-rw-r--r-- | include/blkdev.h | 8 | ||||
-rw-r--r-- | include/c.h | 49 | ||||
-rw-r--r-- | include/canonicalize.h | 5 | ||||
-rw-r--r-- | include/ismounted.h | 8 |
6 files changed, 83 insertions, 4 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 9f581fda..525e3d2e 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,6 +1,7 @@ include $(top_srcdir)/config/include-Makefile.am dist_noinst_HEADERS = \ + c.h \ bitops.h \ blkdev.h \ canonicalize.h \ diff --git a/include/bitops.h b/include/bitops.h index e6eaff18..e283b835 100644 --- a/include/bitops.h +++ b/include/bitops.h @@ -4,6 +4,22 @@ #include <stdint.h> #include <endian.h> +/* + * Bit map related macros. Usually provided by libc. + */ +#include <sys/param.h> + +#ifndef NBBY +# define NBBY CHAR_BIT +#endif + +#ifndef setbit +# define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) +# define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +# define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) +# define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) +#endif + #if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN) #error missing __BYTE_ORDER #endif diff --git a/include/blkdev.h b/include/blkdev.h index 9d9453bc..56a9c1f4 100644 --- a/include/blkdev.h +++ b/include/blkdev.h @@ -36,6 +36,14 @@ #endif /* BLKROSET */ +/* block device topology ioctls, introduced in 2.6.32 */ +#ifndef BLKIOMIN +#define BLKIOMIN _IO(0x12,120) +#define BLKIOOPT _IO(0x12,121) +#define BLKALIGNOFF _IO(0x12,122) +#define BLKPBSZGET _IO(0x12,123) +#endif + #ifndef HDIO_GETGEO # ifdef __linux__ # define HDIO_GETGEO 0x0301 diff --git a/include/c.h b/include/c.h new file mode 100644 index 00000000..413366b2 --- /dev/null +++ b/include/c.h @@ -0,0 +1,49 @@ +/* + * Fundamental C definitions. + */ + +#ifndef UTIL_LINUX_C_H +#define UTIL_LINUX_C_H + +#include <limits.h> + +/* + * Compiler specific stuff + */ +#ifdef __GNUC__ + +/* &a[0] degrades to a pointer: a different type from an array */ +# define __must_be_array(a) \ + BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) + +#else /* !__GNUC__ */ +# define __must_be_array(a) 0 +# define __attribute__(_arg_) +#endif /* !__GNUC__ */ + + +/* Force a compilation error if condition is true, but also produce a + * result (of value 0 and type size_t), so the expression can be used + * e.g. in a structure initializer (or where-ever else comma expressions + * aren't permitted). + */ +#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) +#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) + +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +#endif + +#ifndef PATH_MAX +# define PATH_MAX 4096 +#endif + +#ifndef TRUE +# define TRUE 1 +#endif + +#ifndef FALSE +# define FALSE 0 +#endif + +#endif /* UTIL_LINUX_C_H */ diff --git a/include/canonicalize.h b/include/canonicalize.h index b8906d43..b04510c7 100644 --- a/include/canonicalize.h +++ b/include/canonicalize.h @@ -1,10 +1,7 @@ #ifndef CANONICALIZE_H #define CANONICALIZE_H -#include <limits.h> -#ifndef PATH_MAX -# define PATH_MAX 4096 -#endif +#include "c.h" /* for PATH_MAX */ extern char *canonicalize_path(const char *path); diff --git a/include/ismounted.h b/include/ismounted.h index 2b7cca02..57918cb3 100644 --- a/include/ismounted.h +++ b/include/ismounted.h @@ -1,6 +1,14 @@ #ifndef IS_MOUNTED_H #define IS_MOUNTED_H +#define MF_MOUNTED 1 +#define MF_ISROOT 2 +#define MF_READONLY 4 +#define MF_SWAP 8 +#define MF_BUSY 16 + extern int is_mounted(const char *file); +extern int check_mount_point(const char *device, int *mount_flags, + char *mtpt, int mtlen); #endif /* IS_MOUNTED_H */ |