From 201aff895afe7f338dc113b2503ba765a39ed112 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 3 May 2019 16:42:36 -0400 Subject: [PATCH] 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 --- lib/ext2fs/dirhash.c | 6 ++++-- lib/ext2fs/ext2fs.h | 14 -------------- lib/ext2fs/ext2fsP.h | 14 ++++++++++++++ lib/ext2fs/nls_utf8.c | 1 + 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/ext2fs/dirhash.c b/lib/ext2fs/dirhash.c index 6f5cdc4..d560e20 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 c3be2c5..7d7c346 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -178,20 +178,6 @@ typedef struct ext2_file *ext2_file_t; #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() */ #define EXT2_FLAG_RW 0x01 diff --git a/lib/ext2fs/ext2fsP.h b/lib/ext2fs/ext2fsP.h index fd5b4b1..ad8b7d5 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 9cb6a78..4214809 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) -- 1.8.3.1