From f61719cf4796d45a3fb986d3cf974d0552acb09c Mon Sep 17 00:00:00 2001 From: Gabriel Krisman Bertazi Date: Sun, 28 Apr 2019 16:52:12 -0400 Subject: [PATCH] ext2fs: drop ASCII NLS support As agreed on the kernel side, ext4 will only support utf8 for now, and not plain ASCII, so we don't need this anymore. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Theodore Ts'o --- lib/e2p/encoding.c | 5 ----- lib/ext2fs/Makefile.in | 5 ++--- lib/ext2fs/ext2_fs.h | 1 - lib/ext2fs/nls.h | 2 -- lib/ext2fs/nls_ascii.c | 48 ------------------------------------------------ 5 files changed, 2 insertions(+), 59 deletions(-) delete mode 100644 lib/ext2fs/nls_ascii.c diff --git a/lib/e2p/encoding.c b/lib/e2p/encoding.c index 569d289..69fa6e4 100644 --- a/lib/e2p/encoding.c +++ b/lib/e2p/encoding.c @@ -29,11 +29,6 @@ static const struct { } ext4_encoding_map[] = { { - .encoding_magic = EXT4_ENC_ASCII, - .name = "ascii", - .default_flags = 0 - }, - { .encoding_magic = EXT4_ENC_UTF8_12_1, .name = "utf8", .default_flags = 0, diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in index 06c2394..4b3fc18 100644 --- a/lib/ext2fs/Makefile.in +++ b/lib/ext2fs/Makefile.in @@ -20,8 +20,8 @@ COMPILE_ET= _ET_DIR_OVERRIDE=$(srcdir)/../et ../et/compile_et @TEST_IO_CMT@TEST_IO_LIB_OBJS = test_io.o @IMAGER_CMT@E2IMAGE_LIB_OBJS = imager.o -NLS_OBJS=nls_ascii.o nls_utf8-norm.o nls_utf8.o -NLS_SRCS=$(srcdir)/nls_ascii.c $(srcdir)/nls_utf8-norm.c $(srcdir)/nls_utf8.c +NLS_OBJS=nls_utf8-norm.o nls_utf8.o +NLS_SRCS=$(srcdir)/nls_utf8-norm.c $(srcdir)/nls_utf8.c DEBUG_OBJS= debug_cmds.o extent_cmds.o tst_cmds.o debugfs.o util.o \ ncheck.o icheck.o ls.o lsdel.o dump.o set_fields.o logdump.o \ @@ -1328,7 +1328,6 @@ do_journal.o: $(top_srcdir)/debugfs/do_journal.c $(top_builddir)/lib/config.h \ $(top_srcdir)/lib/support/quotaio_tree.h $(srcdir)/kernel-jbd.h \ $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h \ $(top_srcdir)/debugfs/journal.h $(srcdir)/../../e2fsck/jfs_user.h -nls_ascii.o: $(srcdir)/nls_ascii.c $(srcdir)/nls.h $(srcdir)/ext2_fs.h nls_utf8-norm.o: $(srcdir)/nls_utf8-norm.c $(srcdir)/utf8n.h \ $(srcdir)/utf8data.h nls_utf8.o: $(srcdir)/nls_utf8.c $(srcdir)/nls.h $(srcdir)/ext2_fs.h \ diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index 97189d8..ffcacaf 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -1128,7 +1128,6 @@ struct mmp_struct { */ #define EXT4_INLINE_DATA_DOTDOT_SIZE (4) -#define EXT4_ENC_ASCII 0 #define EXT4_ENC_UTF8_12_1 1 #define EXT4_ENC_STRICT_MODE_FL (1 << 0) /* Reject invalid sequences */ diff --git a/lib/ext2fs/nls.h b/lib/ext2fs/nls.h index ce92f81..1d55ee4 100644 --- a/lib/ext2fs/nls.h +++ b/lib/ext2fs/nls.h @@ -43,14 +43,12 @@ struct nls_table { const struct nls_ops *ops; }; -extern const struct nls_table nls_ascii; extern const struct nls_table nls_utf8_12_1; static const struct { int encoding_magic; const struct nls_table *tbl; } nls_map[] = { - { EXT4_ENC_ASCII, &nls_ascii }, { EXT4_ENC_UTF8_12_1, &nls_utf8_12_1 }, }; diff --git a/lib/ext2fs/nls_ascii.c b/lib/ext2fs/nls_ascii.c deleted file mode 100644 index cc03fea..0000000 --- a/lib/ext2fs/nls_ascii.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "nls.h" - -#include -#include - - -static unsigned char charset_tolower(const struct nls_table *table, - unsigned int c) -{ - if (c >= 'A' && c <= 'Z') - return (c | 0x20); - return c; -} - -static unsigned char charset_toupper(const struct nls_table *table, - unsigned int c) -{ - if (c >= 'a' && c <= 'z') - return (c & ~0x20); - return c; -} - -static int ascii_casefold(const struct nls_table *table, - const unsigned char *str, size_t len, - unsigned char *dest, size_t dlen) -{ - int i; - - if (dlen < len) - return -ENAMETOOLONG; - - for (i = 0; i < len; i++) { - if (str[i] & 0x80) - return -EINVAL; - - dest[i] = charset_toupper(table, str[i]); - } - - return len; -} - -const static struct nls_ops ascii_ops = { - .casefold = ascii_casefold, -}; - -const struct nls_table nls_ascii = { - .ops = &ascii_ops, -}; -- 1.8.3.1