From: Christoph Hellwig Date: Wed, 31 Jul 2024 16:31:39 +0000 (-0700) Subject: xfsprogs: push down unsigned char casts X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fxfs-unsigned-char;p=users%2Fhch%2Fxfsprogs.git xfsprogs: push down unsigned char casts To get us of casting hell, push down the casts to the unsigned char to the low-level hash code and the on-disk format definitions. The hash code is the only place that actually cares about the signedness. The on-disk format would be cleaner by not using it, but using it is a correct headsup to worry about the signedness. Signed-off-by: Christoph Hellwig --- diff --git a/db/attrset.c b/db/attrset.c index a33542fe2..f67210e84 100644 --- a/db/attrset.c +++ b/db/attrset.c @@ -119,14 +119,14 @@ attrset_init(void) add_command(&attr_remove_cmd); } -static unsigned char * +static char * get_buf_from_file( const char *fname, size_t bufsize, int *namelen) { FILE *fp; - unsigned char *buf; + char *buf; size_t sz; buf = malloc(bufsize + 1); @@ -333,7 +333,7 @@ attr_set_f( return 0; } - args.name = (const unsigned char *)argv[optind]; + args.name = argv[optind]; if (!args.name) { dbprintf(_("invalid name\n")); return 0; @@ -502,7 +502,7 @@ attr_remove_f( return 0; } - args.name = (const unsigned char *)argv[optind]; + args.name = argv[optind]; if (!args.name) { dbprintf(_("invalid name\n")); return 0; @@ -530,8 +530,7 @@ attr_remove_f( error = -libxfs_attr_set(&args, XFS_ATTRUPDATE_REMOVE, false); if (error) { dbprintf(_("failed to remove attr %s from inode %llu: %s\n"), - (unsigned char *)args.name, - (unsigned long long)iocur_top->ino, + args.name, (unsigned long long)iocur_top->ino, strerror(error)); goto out; } @@ -624,7 +623,7 @@ attr_get_f( return 0; } - args.name = (const unsigned char *)argv[optind]; + args.name = argv[optind]; if (!args.name) { dbprintf(_("invalid name\n")); return 0; @@ -688,7 +687,7 @@ attrlist_print( struct xfs_trans *tp, struct xfs_inode *ip, unsigned int attr_flags, - const unsigned char *name, + const char *name, unsigned int namelen, const void *value, unsigned int valuelen, diff --git a/db/check.c b/db/check.c index bceaf318d..37c006d5a 100644 --- a/db/check.c +++ b/db/check.c @@ -2497,7 +2497,7 @@ process_data_dir_v2( tag_err += be16_to_cpu(*tagp) != (char *)dep - (char *)data; addr = xfs_dir2_db_off_to_dataptr(mp->m_dir_geo, db, (char *)dep - (char *)data); - xname.name = dep->name; + xname.name = (char *)dep->name; xname.len = dep->namelen; dir_hash_add(libxfs_dir2_hashname(mp, &xname), addr); ptr += libxfs_dir2_data_entsize(mp, dep->namelen); diff --git a/db/hash.c b/db/hash.c index 50f6da0b1..5c13c0b87 100644 --- a/db/hash.c +++ b/db/hash.c @@ -82,7 +82,7 @@ hash_f( for (c = optind; c < argc; c++) { struct xfs_name xname = { - .name = (uint8_t *)argv[c], + .name = argv[c], .len = strlen(argv[c]), }; @@ -232,7 +232,7 @@ dup_table_store( int ret; do { - ret = find_alternate(namelen, (uint8_t *)name, seq++); + ret = find_alternate(namelen, name, seq++); } while (ret == 0); if (ret < 0) return EEXIST; @@ -259,7 +259,7 @@ collide_dirents( int fd) { struct xfs_name dname = { - .name = (uint8_t *)name, + .name = name, .len = namelen, }; char direntname[MAXNAMELEN + 1]; @@ -291,10 +291,10 @@ collide_dirents( return error; } - dname.name = (uint8_t *)direntname; + dname.name = direntname; for (i = 0; i < nr; i++) { strncpy(direntname, name, MAXNAMELEN); - obfuscate_name(old_hash, namelen, (uint8_t *)direntname, true); + obfuscate_name(old_hash, namelen, direntname, true); ASSERT(old_hash == libxfs_dir2_hashname(mp, &dname)); if (fd >= 0) { @@ -330,7 +330,7 @@ collide_xattrs( unsigned long i; int error = 0; - old_hash = libxfs_attr_hashname((uint8_t *)name, namelen); + old_hash = libxfs_attr_hashname(name, namelen); if (fd >= 0) { /* @@ -353,10 +353,10 @@ collide_xattrs( for (i = 0; i < nr; i++) { snprintf(xattrname, MAXNAMELEN + 5, "user.%s", name); - obfuscate_name(old_hash, namelen, (uint8_t *)xattrname + 5, + obfuscate_name(old_hash, namelen, xattrname + 5, false); ASSERT(old_hash == libxfs_attr_hashname( - (uint8_t *)xattrname + 5, namelen)); + xattrname + 5, namelen)); if (fd >= 0) { error = fsetxattr(fd, xattrname, "1", 1, 0); diff --git a/db/metadump.c b/db/metadump.c index 424544f9f..ea21a3add 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -666,7 +666,7 @@ struct name_ent { struct name_ent *next; xfs_dahash_t hash; int namelen; - unsigned char name[1]; + char name[1]; }; #define NAME_TABLE_SIZE 4096 @@ -692,7 +692,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, unsigned char *name) +nametable_find(xfs_dahash_t hash, int namelen, char *name) { struct name_ent *ent; @@ -709,7 +709,7 @@ nametable_find(xfs_dahash_t hash, int namelen, unsigned char *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, unsigned char *name) +nametable_add(xfs_dahash_t hash, int namelen, char *name) { struct name_ent *ent; @@ -778,7 +778,7 @@ static struct remap_ent * remaptable_find( xfs_ino_t dir_ino, xfs_dahash_t namehash, - const unsigned char *name, + const char *name, unsigned int namelen) { struct remap_ent *ent = remaptable[namehash % REMAP_TABLE_SIZE]; @@ -807,9 +807,9 @@ static struct remap_ent * remaptable_add( xfs_ino_t dir_ino, xfs_dahash_t namehash, - const unsigned char *old_name, + const char *old_name, unsigned int namelen, - const unsigned char *new_name) + const char *new_name) { struct remap_ent *ent; @@ -840,7 +840,7 @@ is_orphanage_dir( struct xfs_mount *mp, xfs_ino_t dir_ino, size_t name_len, - unsigned char *name) + char *name) { return dir_ino == mp->m_sb.sb_rootino && name_len == ORPHANAGE_LEN && @@ -859,7 +859,7 @@ static int in_lost_found( xfs_ino_t ino, int namelen, - unsigned char *name) + char *name) { static xfs_ino_t orphanage_ino = 0; char s[24]; /* 21 is enough (64 bits in decimal) */ @@ -902,9 +902,9 @@ in_lost_found( * are already in the table. */ static int -handle_duplicate_name(xfs_dahash_t hash, size_t name_len, unsigned char *name) +handle_duplicate_name(xfs_dahash_t hash, size_t name_len, char *name) { - unsigned char new_name[name_len + 1]; + char new_name[name_len + 1]; uint32_t seq = 1; if (!nametable_find(hash, name_len, name)) @@ -936,7 +936,7 @@ handle_duplicate_name(xfs_dahash_t hash, size_t name_len, unsigned char *name) static inline xfs_dahash_t dirattr_hashname( bool is_dirent, - const uint8_t *name, + const char *name, int namelen) { if (is_dirent) { @@ -955,9 +955,9 @@ static void generate_obfuscated_name( xfs_ino_t ino, int namelen, - unsigned char *name) + char *name) { - unsigned char *orig_name = NULL; + char *orig_name = NULL; xfs_dahash_t hash; /* @@ -1108,7 +1108,7 @@ process_sf_dir( if (metadump.obfuscate) generate_obfuscated_name( libxfs_dir2_sf_get_ino(mp, sfp, sfep), - namelen, &sfep->name[0]); + namelen, (char *)&sfep->name[0]); sfep = (xfs_dir2_sf_entry_t *)((char *)sfep + libxfs_dir2_sf_entsize(mp, sfp, namelen)); @@ -1129,11 +1129,10 @@ process_sf_dir( */ static void obfuscate_path_components( - char *buf, + char *comp, uint64_t len) { - unsigned char *comp = (unsigned char *)buf; - unsigned char *end = comp + len; + char *end = comp + len; xfs_dahash_t hash; while (comp < end) { @@ -1198,12 +1197,12 @@ process_sf_symlink( static void maybe_obfuscate_pptr( unsigned int attr_flags, - uint8_t *name, + char *name, int namelen, const void *value, int valuelen) { - unsigned char old_name[MAXNAMELEN]; + char old_name[MAXNAMELEN]; struct remap_ent *remap; xfs_dahash_t hash; xfs_ino_t child_ino = metadump.cur_ino; @@ -1551,7 +1550,7 @@ process_dir_data_block( if (metadump.obfuscate) generate_obfuscated_name(be64_to_cpu(dep->inumber), - dep->namelen, &dep->name[0]); + dep->namelen, (char *)&dep->name[0]); dir_offset += length; ptr += length; /* Zero the unused space after name, up to the tag */ @@ -1761,7 +1760,7 @@ process_attr_block( be32_to_cpu(remote->valuelen)); } else if (metadump.obfuscate) { generate_obfuscated_name(0, remote->namelen, - &remote->name[0]); + (char *)&remote->name[0]); add_remote_vals(be32_to_cpu(remote->valueblk), be32_to_cpu(remote->valuelen)); } diff --git a/db/namei.c b/db/namei.c index 8c7f4932f..e3d313fe2 100644 --- a/db/namei.c +++ b/db/namei.c @@ -98,7 +98,7 @@ path_navigate( for (i = 0; i < dirpath->depth; i++) { struct xfs_name xname = { - .name = (unsigned char *)dirpath->path[i], + .name = dirpath->path[i], .len = strlen(dirpath->path[i]), }; @@ -250,7 +250,7 @@ dir_emit( uint8_t dtype) { char *display_name; - struct xfs_name xname = { .name = (unsigned char *)name }; + struct xfs_name xname = { .name = name }; const char *dstr = get_dstr(mp, dtype); xfs_dahash_t hash; bool good; @@ -600,7 +600,7 @@ static void pptr_emit( struct xfs_inode *ip, unsigned int attr_flags, - const uint8_t *name, + const char *name, unsigned int namelen, const void *value, unsigned int valuelen) @@ -632,7 +632,7 @@ list_sf_pptrs( sfe = libxfs_attr_sf_firstentry(hdr); for (i = 0; i < hdr->count; i++) { - pptr_emit(ip, sfe->flags, sfe->nameval, sfe->namelen, + pptr_emit(ip, sfe->flags, (char *)sfe->nameval, sfe->namelen, sfe->nameval + sfe->valuelen, sfe->valuelen); sfe = xfs_attr_sf_nextentry(sfe); @@ -666,7 +666,7 @@ list_leaf_pptr_entries( continue; name_loc = xfs_attr3_leaf_name_local(leaf, i); - pptr_emit(ip, entry->flags, name_loc->nameval, + pptr_emit(ip, entry->flags, (char *)name_loc->nameval, name_loc->namelen, name_loc->nameval + name_loc->namelen, be16_to_cpu(name_loc->valuelen)); @@ -941,7 +941,7 @@ create_child( xfs_ino_t child_ino) { struct xfs_name xname = { - .name = (const unsigned char *)name, + .name = name, .len = strlen(name), .type = ftype, }; @@ -1149,7 +1149,7 @@ remove_child( const char *name) { struct xfs_name xname = { - .name = (const unsigned char *)name, + .name = name, .len = strlen(name), }; struct xfs_parent_args *ppargs; diff --git a/db/obfuscate.c b/db/obfuscate.c index cd950b445..5517af1ec 100644 --- a/db/obfuscate.c +++ b/db/obfuscate.c @@ -28,9 +28,10 @@ void obfuscate_name( xfs_dahash_t hash, size_t name_len, - unsigned char *name, + char *_name, bool is_dirent) { + unsigned char *name = (unsigned char *)_name; unsigned char *oldname = NULL; unsigned char *newp; int i; @@ -365,9 +366,10 @@ flip_bit( int find_alternate( size_t name_len, - unsigned char *name, + char *_name, uint32_t seq) { + unsigned char *name = (unsigned char *)_name; uint32_t bitseq = 0; uint32_t bits = seq; diff --git a/db/obfuscate.h b/db/obfuscate.h index afaaca371..2e29c9a18 100644 --- a/db/obfuscate.h +++ b/db/obfuscate.h @@ -10,8 +10,8 @@ #define is_invalid_char(c) ((c) == '/' || (c) == '\0') -void obfuscate_name(xfs_dahash_t hash, size_t name_len, unsigned char *name, +void obfuscate_name(xfs_dahash_t hash, size_t name_len, char *name, bool is_dirent); -int find_alternate(size_t name_len, unsigned char *name, uint32_t seq); +int find_alternate(size_t name_len, char *name, uint32_t seq); #endif /* __DB_OBFUSCATE_H__ */ diff --git a/libfrog/dahashselftest.h b/libfrog/dahashselftest.h index ea9d925bf..6152d9f03 100644 --- a/libfrog/dahashselftest.h +++ b/libfrog/dahashselftest.h @@ -141,19 +141,22 @@ dahash_test( bytes += 2 * dahash_tests[i].length; hash ^= libxfs_da_hashname( - randbytes_test_buf + dahash_tests[i].start, + (char *)randbytes_test_buf + + dahash_tests[i].start, dahash_tests[i].length); } gettimeofday(&start, NULL); for (i = 0; i < ARRAY_SIZE(dahash_tests); i++) { hash = libxfs_da_hashname( - randbytes_test_buf + dahash_tests[i].start, + (char *)randbytes_test_buf + + dahash_tests[i].start, dahash_tests[i].length); if (hash != dahash_tests[i].dahash) errors++; - xname.name = randbytes_test_buf + dahash_tests[i].start; + xname.name = (char *)randbytes_test_buf + + dahash_tests[i].start; xname.len = dahash_tests[i].length; hash = libxfs_ascii_ci_hashname(&xname); if (hash != dahash_tests[i].ascii_ci_dahash) diff --git a/libfrog/fsprops.c b/libfrog/fsprops.c index d6d143efe..68bcf2c7b 100644 --- a/libfrog/fsprops.c +++ b/libfrog/fsprops.c @@ -94,9 +94,9 @@ fsprops_walk_names( for (i = 0; i < attrlist->al_count; i++) { struct attrlist_ent *ent = ATTR_ENTRY(attrlist, i); - const char *p = - attr_name_to_fsprop_name(ent->a_name); + const char *p; + p = attr_name_to_fsprop_name(ent->a_name); if (p) { ret = walk_fn(fph, p, ent->a_valuelen, priv); if (ret) diff --git a/libxfs/listxattr.c b/libxfs/listxattr.c index 34205682f..936b416fb 100644 --- a/libxfs/listxattr.c +++ b/libxfs/listxattr.c @@ -23,7 +23,8 @@ xattr_walk_sf( sfe = libxfs_attr_sf_firstentry(hdr); for (i = 0; i < hdr->count; i++) { - error = attr_fn(tp, ip, sfe->flags, sfe->nameval, sfe->namelen, + error = attr_fn(tp, ip, sfe->flags, + (char *)sfe->nameval, sfe->namelen, &sfe->nameval[sfe->namelen], sfe->valuelen, priv); if (error) @@ -77,8 +78,8 @@ xattr_walk_leaf_entries( valuelen = be32_to_cpu(name_rmt->valuelen); } - error = attr_fn(tp, ip, entry->flags, name, namelen, value, - valuelen, priv); + error = attr_fn(tp, ip, entry->flags, (char *)name, namelen, + value, valuelen, priv); if (error) return error; diff --git a/libxfs/listxattr.h b/libxfs/listxattr.h index 933e0f529..5bd54d85b 100644 --- a/libxfs/listxattr.h +++ b/libxfs/listxattr.h @@ -7,8 +7,7 @@ #define __LIBXFS_LISTXATTR_H__ typedef int (*xattr_walk_fn)(struct xfs_trans *tp, struct xfs_inode *ip, - unsigned int attr_flags, - const unsigned char *name, unsigned int namelen, + unsigned int attr_flags, const char *name, unsigned int namelen, const void *value, unsigned int valuelen, void *priv); int xattr_walk(struct xfs_trans *tp, struct xfs_inode *ip, diff --git a/mkfs/proto.c b/mkfs/proto.c index 06dfb9c14..f0c0cea4b 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -573,7 +573,7 @@ parseproto( mode |= val; creds.cr_uid = (int)getnum(getstr(pp), 0, 0, false); creds.cr_gid = (int)getnum(getstr(pp), 0, 0, false); - xname.name = (unsigned char *)name; + xname.name = name; xname.len = name ? strlen(name) : 0; xname.type = 0; flags = XFS_ILOG_CORE; diff --git a/repair/attr_repair.c b/repair/attr_repair.c index 50159b9a5..cd79d54ce 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -512,7 +512,7 @@ process_leaf_attr_local( * ordering anyway in case both the name value and the * hashvalue were wrong but matched. Unlikely, however. */ - computed = libxfs_attr_hashval(mp, entry->flags, local->nameval, + computed = libxfs_attr_hashval(mp, entry->flags, (char *)local->nameval, local->namelen, local->nameval + local->namelen, be16_to_cpu(local->valuelen)); @@ -564,7 +564,7 @@ process_leaf_attr_remote( remotep = xfs_attr3_leaf_name_remote(leaf, i); - computed = libxfs_attr_hashval(mp, entry->flags, remotep->name, + computed = libxfs_attr_hashval(mp, entry->flags, (char *)remotep->name, remotep->namelen, NULL, be32_to_cpu(remotep->valuelen)); if (remotep->namelen == 0 || diff --git a/repair/phase6.c b/repair/phase6.c index ba28edaa4..89c1a20ce 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -70,7 +70,7 @@ struct dir_hash_ent { short junkit; /* name starts with / */ short seen; /* have seen leaf entry */ struct xfs_name name; - unsigned char namebuf[]; + char namebuf[]; }; struct dir_hash_tab { @@ -156,7 +156,7 @@ dir_hash_add( uint32_t addr, xfs_ino_t inum, int namelen, - unsigned char *name, + char *name, uint8_t ftype) { xfs_dahash_t hash = 0; @@ -827,7 +827,7 @@ mk_orphanage( .mode = S_IFDIR | 0755, }; struct xfs_name xname = { - .name = (unsigned char *)ORPHANAGE, + .name = ORPHANAGE, .len = strlen(ORPHANAGE), .type = XFS_DIR3_FT_DIR, }; @@ -926,7 +926,7 @@ mk_orphanage( do_error( _("can't make %s, createname error %d\n"), ORPHANAGE, error); - add_parent_ptr(du.ip->i_ino, (unsigned char *)ORPHANAGE, du.dp, false); + add_parent_ptr(du.ip->i_ino, ORPHANAGE, du.dp, false); /* * We bumped up the link count in the root directory to account @@ -1006,7 +1006,7 @@ mv_orphanage( xfs_inode_t *ino_p; xfs_trans_t *tp; int err; - unsigned char fname[MAXPATHLEN + 1]; + char fname[MAXPATHLEN + 1]; int nres; int incr; ino_tree_node_t *irec; @@ -1752,7 +1752,8 @@ longform_dir2_entry_check_data( * check for duplicate names in directory. */ dup_inum = dir_hash_add(mp, hashtab, addr, inum, dep->namelen, - dep->name, libxfs_dir2_data_get_ftype(mp, dep)); + (char *)dep->name, + libxfs_dir2_data_get_ftype(mp, dep)); if (dup_inum != NULLFSINO) { nbad++; if (entry_junked( @@ -2663,7 +2664,7 @@ shortform_dir2_entry_check( diroffset = xfs_dir2_byte_to_dataptr( xfs_dir2_sf_get_offset(sfep)); dup_inum = dir_hash_add(mp, hashtab, diroffset, - lino, sfep->namelen, sfep->name, + lino, sfep->namelen, (char *)sfep->name, libxfs_dir2_sf_get_ftype(mp, sfep)); if (dup_inum != NULLFSINO) { do_warn( diff --git a/repair/pptr.c b/repair/pptr.c index ee29e47a8..ceac50bd7 100644 --- a/repair/pptr.c +++ b/repair/pptr.c @@ -361,14 +361,14 @@ parent_ptr_init( void add_parent_ptr( xfs_ino_t ino, - const unsigned char *fname, + const char *fname, struct xfs_inode *dp, bool possible_dup) { struct xfs_mount *mp = dp->i_mount; struct xfs_name dname = { .name = fname, - .len = strlen((char *)fname), + .len = strlen(fname), }; struct ag_pptr ag_pptr = { .child_agino = XFS_INO_TO_AGINO(mp, ino), @@ -497,7 +497,7 @@ record_garbage_xattr( struct xfs_inode *ip, struct file_scan *fscan, unsigned int attr_filter, - const unsigned char *name, + const char *name, unsigned int namelen, const void *value, unsigned int valuelen) @@ -596,7 +596,7 @@ examine_xattr( struct xfs_trans *tp, struct xfs_inode *ip, unsigned int attr_flags, - const unsigned char *name, + const char *name, unsigned int namelen, const void *value, unsigned int valuelen, @@ -664,7 +664,7 @@ static int load_file_pptr_name( struct file_scan *fscan, const struct file_pptr *file_pptr, - unsigned char *name) + char *name) { if (file_pptr->name_in_nameblobs) return strblobs_load(nameblobs, file_pptr->name_cookie, @@ -679,7 +679,7 @@ static int add_file_pptr( struct xfs_inode *ip, const struct ag_pptr *ag_pptr, - const unsigned char *name) + const char *name) { struct xfs_name xname = { .name = name, @@ -698,7 +698,7 @@ static int remove_file_pptr( struct xfs_inode *ip, const struct file_pptr *file_pptr, - const unsigned char *name) + const char *name) { struct xfs_name xname = { .name = name, @@ -738,7 +738,7 @@ clear_all_pptrs( strerror(error)); while ((file_pptr = pop_slab_cursor(cur)) != NULL) { - unsigned char name[MAXNAMELEN]; + char name[MAXNAMELEN]; error = load_file_pptr_name(fscan, file_pptr, name); if (error) @@ -770,7 +770,7 @@ add_missing_parent_ptr( struct file_scan *fscan, const struct ag_pptr *ag_pptr) { - unsigned char name[MAXNAMELEN]; + char name[MAXNAMELEN]; int error; error = strblobs_load(nameblobs, ag_pptr->name_cookie, name, @@ -822,7 +822,7 @@ remove_incorrect_parent_ptr( struct file_scan *fscan, const struct file_pptr *file_pptr) { - unsigned char name[MAXNAMELEN] = { }; + char name[MAXNAMELEN] = { }; int error; error = load_file_pptr_name(fscan, file_pptr, name); @@ -877,8 +877,8 @@ compare_parent_ptrs( const struct ag_pptr *ag_pptr, const struct file_pptr *file_pptr) { - unsigned char name1[MAXNAMELEN] = { }; - unsigned char name2[MAXNAMELEN] = { }; + char name1[MAXNAMELEN] = { }; + char name2[MAXNAMELEN] = { }; int error; error = strblobs_load(nameblobs, ag_pptr->name_cookie, name1, diff --git a/repair/pptr.h b/repair/pptr.h index 65acff963..ef20b4295 100644 --- a/repair/pptr.h +++ b/repair/pptr.h @@ -9,8 +9,8 @@ void parent_ptr_free(struct xfs_mount *mp); void parent_ptr_init(struct xfs_mount *mp); -void add_parent_ptr(xfs_ino_t ino, const unsigned char *fname, - struct xfs_inode *dp, bool possible_dup); +void add_parent_ptr(xfs_ino_t ino, const char *fname, struct xfs_inode *dp, + bool possible_dup); void check_parent_ptrs(struct xfs_mount *mp); diff --git a/repair/strblobs.c b/repair/strblobs.c index 3cd678dbb..bf7027404 100644 --- a/repair/strblobs.c +++ b/repair/strblobs.c @@ -96,12 +96,12 @@ static int __strblobs_lookup( struct strblobs *sblobs, xfblob_cookie *str_cookie, - const unsigned char *str, + const char *str, unsigned int str_len, xfs_dahash_t str_hash) { struct strblob_hashent *ent; - unsigned char *buf = NULL; + char *buf = NULL; unsigned int bucket; int error; @@ -143,7 +143,7 @@ int strblobs_lookup( struct strblobs *sblobs, xfblob_cookie *str_cookie, - const unsigned char *str, + const char *str, unsigned int str_len, xfs_dahash_t str_hash) { @@ -155,7 +155,7 @@ static int strblobs_hash( struct strblobs *sblobs, xfblob_cookie str_cookie, - const unsigned char *str, + const char *str, unsigned int str_len, xfs_dahash_t str_hash) { @@ -182,7 +182,7 @@ int strblobs_store( struct strblobs *sblobs, xfblob_cookie *str_cookie, - const unsigned char *str, + const char *str, unsigned int str_len, xfs_dahash_t str_hash) { @@ -204,7 +204,7 @@ int strblobs_load( struct strblobs *sblobs, xfblob_cookie str_cookie, - unsigned char *str, + char *str, unsigned int str_len) { return -xfblob_load(sblobs->strings, str_cookie, str, str_len); diff --git a/repair/strblobs.h b/repair/strblobs.h index 40cd6d8e9..7f86af9e7 100644 --- a/repair/strblobs.h +++ b/repair/strblobs.h @@ -13,12 +13,11 @@ int strblobs_init(const char *descr, unsigned int hash_buckets, void strblobs_destroy(struct strblobs **sblobs); int strblobs_store(struct strblobs *sblobs, xfblob_cookie *str_cookie, - const unsigned char *str, unsigned int str_len, - xfs_dahash_t hash); + const char *str, unsigned int str_len, xfs_dahash_t hash); int strblobs_load(struct strblobs *sblobs, xfblob_cookie str_cookie, - unsigned char *str, unsigned int str_len); + char *str, unsigned int str_len); int strblobs_lookup(struct strblobs *sblobs, xfblob_cookie *str_cookie, - const unsigned char *str, unsigned int str_len, + const char *str, unsigned int str_len, xfs_dahash_t hash); #endif /* __REPAIR_STRBLOBS_H__ */