From: Christoph Hellwig Date: Thu, 30 Jul 2015 23:19:58 +0000 (+1000) Subject: xfsprogs: remove the uchar_t typedef X-Git-Tag: v4.2.0-rc1~4^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02211695b4e8f575668a35f0e743e26b1ad13ae1;p=thirdparty%2Fxfsprogs-dev.git xfsprogs: remove the uchar_t typedef Signed-off-by: Christoph Hellwig Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/db/hash.c b/db/hash.c index 4c49a662e..e02857f12 100644 --- a/db/hash.c +++ b/db/hash.c @@ -52,7 +52,7 @@ hash_f( { xfs_dahash_t hashval; - hashval = libxfs_da_hashname((uchar_t *)argv[1], (int)strlen(argv[1])); + hashval = libxfs_da_hashname((unsigned char *)argv[1], (int)strlen(argv[1])); dbprintf("0x%x\n", hashval); return 0; } diff --git a/db/metadump.c b/db/metadump.c index 8ea947b4b..1474279a1 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -529,7 +529,7 @@ struct name_ent { struct name_ent *next; xfs_dahash_t hash; int namelen; - uchar_t name[1]; + unsigned char name[1]; }; #define NAME_TABLE_SIZE 4096 @@ -555,7 +555,7 @@ nametable_clear(void) * return a pointer to its entry, otherwise return a null pointer. */ static struct name_ent * -nametable_find(xfs_dahash_t hash, int namelen, uchar_t *name) +nametable_find(xfs_dahash_t hash, int namelen, unsigned char *name) { struct name_ent *ent; @@ -572,7 +572,7 @@ nametable_find(xfs_dahash_t hash, int namelen, uchar_t *name) * name's new entry, or a null pointer if an error occurs. */ static struct name_ent * -nametable_add(xfs_dahash_t hash, int namelen, uchar_t *name) +nametable_add(xfs_dahash_t hash, int namelen, unsigned char *name) { struct name_ent *ent; @@ -593,10 +593,10 @@ nametable_add(xfs_dahash_t hash, int namelen, uchar_t *name) #define is_invalid_char(c) ((c) == '/' || (c) == '\0') #define rol32(x,y) (((x) << (y)) | ((x) >> (32 - (y)))) -static inline uchar_t +static inline unsigned char random_filename_char(void) { - static uchar_t filename_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + static unsigned char filename_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789-_"; @@ -611,7 +611,7 @@ is_orphanage_dir( struct xfs_mount *mp, xfs_ino_t dir_ino, size_t name_len, - uchar_t *name) + unsigned char *name) { return dir_ino == mp->m_sb.sb_rootino && name_len == ORPHANAGE_LEN && @@ -630,7 +630,7 @@ static int in_lost_found( xfs_ino_t ino, int namelen, - uchar_t *name) + unsigned char *name) { static xfs_ino_t orphanage_ino = 0; char s[24]; /* 21 is enough (64 bits in decimal) */ @@ -671,13 +671,13 @@ static void obfuscate_name( xfs_dahash_t hash, size_t name_len, - uchar_t *name) + unsigned char *name) { - uchar_t *newp = name; + unsigned char *newp = name; int i; xfs_dahash_t new_hash = 0; - uchar_t *first; - uchar_t high_bit; + unsigned char *first; + unsigned char high_bit; int shift; /* @@ -826,16 +826,16 @@ obfuscate_name( static int flip_bit( size_t name_len, - uchar_t *name, + unsigned char *name, uint32_t bitseq) { int index; size_t offset; - uchar_t *p0, *p1; - uchar_t m0, m1; + unsigned char *p0, *p1; + unsigned char m0, m1; struct { int byte; /* Offset from start within name */ - uchar_t bit; /* Bit within that byte */ + unsigned char bit; /* Bit within that byte */ } bit_to_flip[][2] = { /* Sorted by second entry's byte */ { { 0, 0 }, { 1, 7 } }, /* Each row defines a pair */ { { 1, 0 }, { 2, 7 } }, /* of bytes and a bit within */ @@ -964,7 +964,7 @@ flip_bit( static int find_alternate( size_t name_len, - uchar_t *name, + unsigned char *name, uint32_t seq) { uint32_t bitseq = 0; @@ -1001,9 +1001,9 @@ find_alternate( * are already in the table. */ static int -handle_duplicate_name(xfs_dahash_t hash, size_t name_len, uchar_t *name) +handle_duplicate_name(xfs_dahash_t hash, size_t name_len, unsigned char *name) { - uchar_t new_name[name_len + 1]; + unsigned char new_name[name_len + 1]; uint32_t seq = 1; if (!nametable_find(hash, name_len, name)) @@ -1036,7 +1036,7 @@ static void generate_obfuscated_name( xfs_ino_t ino, int namelen, - uchar_t *name) + unsigned char *name) { xfs_dahash_t hash; @@ -1160,8 +1160,8 @@ obfuscate_path_components( char *buf, __uint64_t len) { - uchar_t *comp = (uchar_t *)buf; - uchar_t *end = comp + len; + unsigned char *comp = (unsigned char *)buf; + unsigned char *end = comp + len; xfs_dahash_t hash; while (comp < end) { diff --git a/include/darwin.h b/include/darwin.h index 95f865b7d..ca9f8f4f1 100644 --- a/include/darwin.h +++ b/include/darwin.h @@ -127,7 +127,6 @@ typedef u_int32_t xfs_dev_t; typedef int64_t xfs_daddr_t; typedef char* xfs_caddr_t; -typedef unsigned char uchar_t; #define stat64 stat #define fstat64 fstat #define lseek64 lseek diff --git a/include/freebsd.h b/include/freebsd.h index b51688b5e..d01c0c137 100644 --- a/include/freebsd.h +++ b/include/freebsd.h @@ -55,10 +55,6 @@ typedef __int64_t xfs_daddr_t; typedef char* xfs_caddr_t; typedef off_t loff_t; -#ifndef _UCHAR_T_DEFINED -typedef unsigned char uchar_t; -#define _UCHAR_T_DEFINED 1 -#endif typedef enum { B_FALSE,B_TRUE } boolean_t; #define O_LARGEFILE 0 diff --git a/include/gnukfreebsd.h b/include/gnukfreebsd.h index d39285925..914825ef5 100644 --- a/include/gnukfreebsd.h +++ b/include/gnukfreebsd.h @@ -45,10 +45,6 @@ typedef __int64_t xfs_daddr_t; typedef char* xfs_caddr_t; typedef off_t loff_t; -#ifndef _UCHAR_T_DEFINED -typedef unsigned char uchar_t; -#define _UCHAR_T_DEFINED 1 -#endif typedef enum { B_FALSE,B_TRUE } boolean_t; #define HAVE_FID 1 diff --git a/include/linux.h b/include/linux.h index 55862905a..da50421e3 100644 --- a/include/linux.h +++ b/include/linux.h @@ -144,11 +144,6 @@ typedef __uint32_t xfs_dev_t; typedef __int64_t xfs_daddr_t; typedef char* xfs_caddr_t; -#ifndef _UCHAR_T_DEFINED -typedef unsigned char uchar_t; -#define _UCHAR_T_DEFINED 1 -#endif - #ifndef _BOOLEAN_T_DEFINED typedef enum {B_FALSE, B_TRUE} boolean_t; #define _BOOLEAN_T_DEFINED 1 diff --git a/mkfs/proto.c b/mkfs/proto.c index 09325a4b6..17308bc89 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -443,7 +443,7 @@ parseproto( mode |= val; creds.cr_uid = (int)getnum(pp); creds.cr_gid = (int)getnum(pp); - xname.name = (uchar_t *)name; + xname.name = (unsigned char *)name; xname.len = name ? strlen(name) : 0; xname.type = 0; tp = libxfs_trans_alloc(mp, 0); diff --git a/repair/attr_repair.c b/repair/attr_repair.c index f9afce72c..e2bfd4495 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -1121,7 +1121,7 @@ process_leaf_attr_remote( if (remotep->namelen == 0 || namecheck((char *)&remotep->name[0], remotep->namelen) || be32_to_cpu(entry->hashval) != - libxfs_da_hashname((uchar_t *)&remotep->name[0], + libxfs_da_hashname((unsigned char *)&remotep->name[0], remotep->namelen) || be32_to_cpu(entry->hashval) < last_hashval || be32_to_cpu(remotep->valueblk) == 0) {