X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=compat%2Finclude%2Fbsdcompat.h;h=3e9895b57c65a15eb44e818e7b21f83bf687fc88;hb=75654eee803efe8bf930f640b029ced0e7ec9b89;hp=8b8737877ef8605b02d7a40093f8d6353e62a75e;hpb=9ca70cf6a082bb146eaaa0b09361643feca38875;p=dump.git diff --git a/compat/include/bsdcompat.h b/compat/include/bsdcompat.h index 8b87378..3e9895b 100644 --- a/compat/include/bsdcompat.h +++ b/compat/include/bsdcompat.h @@ -5,7 +5,7 @@ * Stelian Pop , 1999-2000 * Stelian Pop - AlcĂ´ve , 2000-2002 * - * $Id: bsdcompat.h,v 1.18 2002/07/17 10:18:52 stelian Exp $ + * $Id: bsdcompat.h,v 1.22 2004/01/27 10:15:37 stelian Exp $ */ #include @@ -13,6 +13,7 @@ #include #define __dead volatile +#define UNUSED(x) x __attribute__ ((unused)) #ifndef NBBY #define NBBY 8 @@ -25,17 +26,27 @@ #define WINO 1 #define DEV_BSIZE 512 #define DEV_BSHIFT 9 + +#ifndef sunos #define MAXBSIZE EXT2_MAX_BLOCK_SIZE #define ROOTINO EXT2_ROOT_INO +#else +#define ROOTINO 2 +#endif #ifdef EXT2_NODUMP_FL #define UF_NODUMP EXT2_NODUMP_FL #endif +#ifndef howmany #define howmany(x,y) (((x)+((y)-1))/(y)) +#endif +#ifndef roundup #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#endif +#ifndef powerof2 #define powerof2(x) ((((x)-1)&(x))==0) +#endif -#define dbtob(b) ((unsigned)(b) << DEV_BSHIFT) #define fsbtodb(sb,b) ((int)(((long long)(b) * EXT2_BLOCK_SIZE((sb)->super)) / DEV_BSIZE)) #define dbtofsb(sb,b) ((int)(((long long)(b) * DEV_BSIZE) / EXT2_BLOCK_SIZE((sb)->super))) @@ -74,6 +85,25 @@ typedef __u64 u_quad_t; #define NINDIR(fs) EXT2_ADDR_PER_BLOCK(fs->super) +#ifdef sunos +typedef uint8_t __u8; +typedef uint16_t __u16; +typedef uint32_t __u32; +typedef int8_t __s8; +typedef int16_t __s16; +typedef int32_t __s32; +#ifndef u_int +typedef unsigned int u_int; +#endif +#ifndef u_int16_t +typedef unsigned short u_int16_t; +#endif +#ifndef u_char +typedef unsigned char u_char; +#endif +typedef int64_t quad_t; +#endif /* sunos */ + struct dinode { __u16 di_mode; __u16 di_uid; @@ -117,6 +147,10 @@ struct dinode { #define MAXNAMLEN 255 #endif +#ifdef sunos +#define MAXNAMLEN 255 +#endif + /* * For old libc. */ @@ -129,6 +163,10 @@ struct dinode { #define DT_REG 8 #define DT_LNK 10 #define DT_SOCK 12 + +#ifdef sunos +#define DT_WHT 14 +#endif #endif #ifndef d_fileno @@ -157,20 +195,23 @@ struct direct { * without the d_name field, plus enough space for the name with a terminating * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. */ +#ifdef __linux__ #if 0 #if (BYTE_ORDER == LITTLE_ENDIAN) #define DIRSIZ(oldfmt, dp) \ ((oldfmt) ? \ ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_type+1 + 3) &~ 3)) : \ ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))) -#else +#else /* BYTE_ORDER */ #define DIRSIZ(oldfmt, dp) \ ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) #endif -#else - +#else /* 0 */ #define DIRSIZ(oldfmt,dp) EXT2_DIR_REC_LEN(((dp)->d_namlen & 0xff) + 1) - +#endif +#else /* __linux__ */ +#define DIRSIZ(oldfmt, dp) \ + ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) #endif /*