diff options
Diffstat (limited to 'e2fsprogs/chattr.c')
-rw-r--r-- | e2fsprogs/chattr.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c index db5437228..0f19af8e4 100644 --- a/e2fsprogs/chattr.c +++ b/e2fsprogs/chattr.c | |||
@@ -37,27 +37,9 @@ struct globals { | |||
37 | 37 | ||
38 | static unsigned long get_flag(char c) | 38 | static unsigned long get_flag(char c) |
39 | { | 39 | { |
40 | /* Two separate vectors take less space than vector of structs */ | 40 | const char *fp = strchr(e2attr_flags_sname_chattr, c); |
41 | static const char flags_letter[] ALIGN1 = "ASDacdijsutT"; | 41 | if (fp) |
42 | static const unsigned long flags_val[] = { | 42 | return e2attr_flags_value_chattr[fp - e2attr_flags_sname_chattr]; |
43 | /* A */ EXT2_NOATIME_FL, | ||
44 | /* S */ EXT2_SYNC_FL, | ||
45 | /* D */ EXT2_DIRSYNC_FL, | ||
46 | /* a */ EXT2_APPEND_FL, | ||
47 | /* c */ EXT2_COMPR_FL, | ||
48 | /* d */ EXT2_NODUMP_FL, | ||
49 | /* i */ EXT2_IMMUTABLE_FL, | ||
50 | /* j */ EXT3_JOURNAL_DATA_FL, | ||
51 | /* s */ EXT2_SECRM_FL, | ||
52 | /* u */ EXT2_UNRM_FL, | ||
53 | /* t */ EXT2_NOTAIL_FL, | ||
54 | /* T */ EXT2_TOPDIR_FL, | ||
55 | }; | ||
56 | const char *fp; | ||
57 | |||
58 | for (fp = flags_letter; *fp; fp++) | ||
59 | if (*fp == c) | ||
60 | return flags_val[fp - flags_letter]; | ||
61 | bb_show_usage(); | 43 | bb_show_usage(); |
62 | } | 44 | } |
63 | 45 | ||