]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfsprogs: push down unsigned char casts xfs-unsigned-char
authorChristoph Hellwig <hch@lst.de>
Wed, 31 Jul 2024 16:31:39 +0000 (09:31 -0700)
committerChristoph Hellwig <hch@lst.de>
Wed, 31 Jul 2024 17:36:14 +0000 (10:36 -0700)
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 <hch@lst.de>
18 files changed:
db/attrset.c
db/check.c
db/hash.c
db/metadump.c
db/namei.c
db/obfuscate.c
db/obfuscate.h
libfrog/dahashselftest.h
libfrog/fsprops.c
libxfs/listxattr.c
libxfs/listxattr.h
mkfs/proto.c
repair/attr_repair.c
repair/phase6.c
repair/pptr.c
repair/pptr.h
repair/strblobs.c
repair/strblobs.h

index a33542fe2be043348f7349d0ae322a0e364e7238..f67210e84d6a19e0f506f107709638200cd8cc25 100644 (file)
@@ -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,
index bceaf318d75ed8a7dcaa9b5f25e45a768df197a8..37c006d5a73dd8d85e51c2fa030098958e6cc1ff 100644 (file)
@@ -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);
index 50f6da0b1a20b2fe44218410a8bddecb97b58123..5c13c0b87fd4c96713b5743f7209b721042aaf7d 100644 (file)
--- 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);
index 424544f9f032240c7b019fa6827d18eff83d78ef..ea21a3add574d730a3460a85965f5ab26f289b4a 100644 (file)
@@ -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));
                        }
index 8c7f4932fce4a3d86aabbcad6e295c36bd885717..e3d313fe2648d00ffcdb1737ad5698fde2ce9ed6 100644 (file)
@@ -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;
index cd950b4458156111170317477c5d2d4cfbbc50da..5517af1ec7aa1e0f197a8b3303d3f9cbf7ab5350 100644 (file)
@@ -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;
 
index afaaca37154cc299b1e1cee6251ac5e8c30ad0cb..2e29c9a184227e7d7bf6a89468949fb57766333e 100644 (file)
@@ -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__ */
index ea9d925bf2ab56df27812b27ca3d33025c4cb060..6152d9f032b3d4c76b0bb0e31ad64ccfdb99f742 100644 (file)
@@ -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)
index d6d143efe027b5b70022b8017ade3ca91497615e..68bcf2c7b1bf5c398e9c1266cc9c26250dff5321 100644 (file)
@@ -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)
index 34205682f022d5823be64963a92ee096d08ccc86..936b416fb75240fc07e763688e8c53ae4e1f3a0d 100644 (file)
@@ -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;
 
index 933e0f529ec4b33a49c4329ee47d5539bab44949..5bd54d85b0cd3bcc181dae102ce55271e0a2d413 100644 (file)
@@ -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,
index 06dfb9c1466a995dd57a084d856d3f0da1e4e19e..f0c0cea4bb4c2fc83a98aab108cfaf526fbf4a16 100644 (file)
@@ -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;
index 50159b9a533875a82b8e24f01131945703873ae9..cd79d54ce9764d2471d285a2c4b8016808f6660c 100644 (file)
@@ -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 ||
index ba28edaa41c24cbd128dcbc560defb6945320665..89c1a20cec769900dcf53288c3709dbc82f0c043 100644 (file)
@@ -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(
index ee29e47a87bd0730f76e9117e2aadd8c0c08109d..ceac50bd7f553a29f2d27602744291605e3e35c9 100644 (file)
@@ -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,
index 65acff963a3fe9f10a641db802cf3d1a769b828e..ef20b4295c4c9e6d7892af718374b38925621976 100644 (file)
@@ -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);
 
index 3cd678dbbab928697e6c615a4ec769ae1f5dbd93..bf7027404eba216bdb8c0b6938b006d57fb6a086 100644 (file)
@@ -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);
index 40cd6d8e91c0ef34f150c852863199428ee9c29e..7f86af9e756a857db539f94e220150a52a9c39c9 100644 (file)
@@ -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__ */