compat.h (1352B)
1 /* aruu replacements for NetBSD userspace interfaces. */ 2 #include "util.h" 3 4 #include <dirent.h> 5 #include <stdint.h> 6 #include <sys/param.h> 7 #include <sys/stat.h> 8 9 #define daddr_t int64_t 10 #define IFMT S_IFMT 11 #define IFIFO S_IFIFO 12 #define IFCHR S_IFCHR 13 #define IFDIR S_IFDIR 14 #define IFBLK S_IFBLK 15 #define IFREG S_IFREG 16 #define IFLNK S_IFLNK 17 #define IFSOCK S_IFSOCK 18 19 #ifndef __RCSID 20 #define __RCSID(s) typedef char rcsid[sizeof(s)] 21 #endif 22 #ifndef __KERNEL_RCSID 23 #define __KERNEL_RCSID(n, s) __RCSID(s) 24 #endif 25 #ifndef __dead 26 #define __dead __attribute__((__noreturn__)) 27 #endif 28 #ifndef __unused 29 #define __unused __attribute__((__unused__)) 30 #endif 31 #ifndef __printflike 32 #define __printflike(f, a) __attribute__((__format__(__printf__, f, a))) 33 #endif 34 #ifndef __UNCONST 35 #define __UNCONST(p) ((void *)(uintptr_t)(const void *)(p)) 36 #endif 37 38 #define getprogname() argv0 39 40 #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 41 #define fsck_little_endian 1 42 #else 43 #define bswap16 __builtin_bswap16 44 #define bswap32 __builtin_bswap32 45 #define bswap64 __builtin_bswap64 46 #endif 47 48 #ifndef __COPYRIGHT 49 #define __COPYRIGHT(s) typedef char upstream_copyright[sizeof(s)] 50 #endif 51 #ifndef roundup2 52 #define roundup2(x, y) (((x) + (y) - 1) & ~((y) - 1)) 53 #endif 54 #ifndef btodb 55 #define btodb(bytes) ((bytes) / DEV_BSIZE) 56 #endif 57 #define UFS_DIRBLKSIZ 512