From: Theodore Ts'o Date: Fri, 3 May 2019 20:42:36 +0000 (-0400) Subject: libext2fs: move struct ext2fs_nls_table to the private ext2fsP.h header X-Git-Tag: v1.45.1-rc1~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=201aff895afe7f338dc113b2503ba765a39ed112;p=thirdparty%2Fe2fsprogs.git libext2fs: move struct ext2fs_nls_table to the private ext2fsP.h header Callers of libext2fs don't need to use this structure, and this gives us the ability to change it later on without worrying about changing public ABI's. Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/dirhash.c b/lib/ext2fs/dirhash.c index 6f5cdc45d..d560e20b3 100644 --- a/lib/ext2fs/dirhash.c +++ b/lib/ext2fs/dirhash.c @@ -18,6 +18,7 @@ #include "ext2_fs.h" #include "ext2fs.h" +#include "ext2fsP.h" /* * Keyed 32-bit hash function using TEA in a Davis-Meyer function @@ -282,8 +283,9 @@ errcode_t ext2fs_dirhash2(int version, const char *name, int len, if (len && charset && (hash_flags & EXT4_CASEFOLD_FL)) { char buff[PATH_MAX]; - dlen = charset->ops->casefold(charset, name, len, buff, - sizeof(buff)); + dlen = charset->ops->casefold(charset, + (const unsigned char *) name, len, + (unsigned char *) buff, sizeof(buff)); if (dlen < 0) { if (dlen == -EINVAL) goto opaque_seq; diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h index c3be2c5c8..7d7c346df 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -177,20 +177,6 @@ typedef struct ext2_file *ext2_file_t; #define EXT2_SEEK_CUR 1 #define EXT2_SEEK_END 2 -/* - * NLS defintions - */ -struct ext2fs_nls_table { - int version; - const struct ext2fs_nls_ops *ops; -}; - -struct ext2fs_nls_ops { - int (*casefold)(const struct ext2fs_nls_table *charset, - const unsigned char *str, size_t len, - unsigned char *dest, size_t dlen); -}; - /* * Flags for the ext2_filsys structure and for ext2fs_open() */ diff --git a/lib/ext2fs/ext2fsP.h b/lib/ext2fs/ext2fsP.h index fd5b4b1a8..ad8b7d52d 100644 --- a/lib/ext2fs/ext2fsP.h +++ b/lib/ext2fs/ext2fsP.h @@ -92,6 +92,20 @@ struct ext2_inode_cache_ent { struct ext2_inode *inode; }; +/* + * NLS defintions + */ +struct ext2fs_nls_table { + int version; + const struct ext2fs_nls_ops *ops; +}; + +struct ext2fs_nls_ops { + int (*casefold)(const struct ext2fs_nls_table *charset, + const unsigned char *str, size_t len, + unsigned char *dest, size_t dlen); +}; + /* Function prototypes */ extern int ext2fs_process_dir_block(ext2_filsys fs, diff --git a/lib/ext2fs/nls_utf8.c b/lib/ext2fs/nls_utf8.c index 9cb6a78f1..42148099a 100644 --- a/lib/ext2fs/nls_utf8.c +++ b/lib/ext2fs/nls_utf8.c @@ -29,6 +29,7 @@ #include "ext2_fs.h" #include "ext2fs.h" +#include "ext2fsP.h" /* Encoding a unicode version number as a single unsigned int. */ #define UNICODE_MAJ_SHIFT (16)