提交 63cd8854 编写于 作者: H Harvey Harrison 提交者: Linus Torvalds

ntfs: remove private wrapper of endian helpers

The base versions handle constant folding now and are shorter than these
private wrappers, use them directly.
Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
Cc: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 311d0761
......@@ -32,8 +32,8 @@
/**
* The little endian Unicode string $I30 as a global constant.
*/
ntfschar I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'),
const_cpu_to_le16('3'), const_cpu_to_le16('0'), 0 };
ntfschar I30[5] = { cpu_to_le16('$'), cpu_to_le16('I'),
cpu_to_le16('3'), cpu_to_le16('0'), 0 };
/**
* ntfs_lookup_inode_by_name - find an inode in a directory given its name
......
......@@ -1975,8 +1975,7 @@ int ntfs_read_inode_mount(struct inode *vi)
goto em_put_err_out;
next_al_entry = (ATTR_LIST_ENTRY*)((u8*)al_entry +
le16_to_cpu(al_entry->length));
if (le32_to_cpu(al_entry->type) >
const_le32_to_cpu(AT_DATA))
if (le32_to_cpu(al_entry->type) > le32_to_cpu(AT_DATA))
goto em_put_err_out;
if (AT_DATA != al_entry->type)
continue;
......
此差异已折叠。
......@@ -104,7 +104,7 @@ typedef struct {
* in this particular client array. Also inside the client records themselves,
* this means that there are no client records preceding or following this one.
*/
#define LOGFILE_NO_CLIENT const_cpu_to_le16(0xffff)
#define LOGFILE_NO_CLIENT cpu_to_le16(0xffff)
#define LOGFILE_NO_CLIENT_CPU 0xffff
/*
......@@ -112,8 +112,8 @@ typedef struct {
* information about the log file in which they are present.
*/
enum {
RESTART_VOLUME_IS_CLEAN = const_cpu_to_le16(0x0002),
RESTART_SPACE_FILLER = const_cpu_to_le16(0xffff), /* gcc: Force enum bit width to 16. */
RESTART_VOLUME_IS_CLEAN = cpu_to_le16(0x0002),
RESTART_SPACE_FILLER = cpu_to_le16(0xffff), /* gcc: Force enum bit width to 16. */
} __attribute__ ((__packed__));
typedef le16 RESTART_AREA_FLAGS;
......
......@@ -2839,7 +2839,7 @@ int ntfs_extent_mft_record_free(ntfs_inode *ni, MFT_RECORD *m)
*/
/* Mark the mft record as not in use. */
m->flags &= const_cpu_to_le16(~const_le16_to_cpu(MFT_RECORD_IN_USE));
m->flags &= ~MFT_RECORD_IN_USE;
/* Increment the sequence number, skipping zero, if it is not zero. */
old_seq_no = m->sequence_number;
......
......@@ -618,7 +618,7 @@ static bool is_boot_sector_ntfs(const struct super_block *sb,
* many BIOSes will refuse to boot from a bootsector if the magic is
* incorrect, so we emit a warning.
*/
if (!silent && b->end_of_sector_marker != const_cpu_to_le16(0xaa55))
if (!silent && b->end_of_sector_marker != cpu_to_le16(0xaa55))
ntfs_warning(sb, "Invalid end of sector marker.");
return true;
not_ntfs:
......@@ -1242,13 +1242,13 @@ static int check_windows_hibernation_status(ntfs_volume *vol)
u32 *kaddr, *kend;
ntfs_name *name = NULL;
int ret = 1;
static const ntfschar hiberfil[13] = { const_cpu_to_le16('h'),
const_cpu_to_le16('i'), const_cpu_to_le16('b'),
const_cpu_to_le16('e'), const_cpu_to_le16('r'),
const_cpu_to_le16('f'), const_cpu_to_le16('i'),
const_cpu_to_le16('l'), const_cpu_to_le16('.'),
const_cpu_to_le16('s'), const_cpu_to_le16('y'),
const_cpu_to_le16('s'), 0 };
static const ntfschar hiberfil[13] = { cpu_to_le16('h'),
cpu_to_le16('i'), cpu_to_le16('b'),
cpu_to_le16('e'), cpu_to_le16('r'),
cpu_to_le16('f'), cpu_to_le16('i'),
cpu_to_le16('l'), cpu_to_le16('.'),
cpu_to_le16('s'), cpu_to_le16('y'),
cpu_to_le16('s'), 0 };
ntfs_debug("Entering.");
/*
......@@ -1296,7 +1296,7 @@ static int check_windows_hibernation_status(ntfs_volume *vol)
goto iput_out;
}
kaddr = (u32*)page_address(page);
if (*(le32*)kaddr == const_cpu_to_le32(0x72626968)/*'hibr'*/) {
if (*(le32*)kaddr == cpu_to_le32(0x72626968)/*'hibr'*/) {
ntfs_debug("Magic \"hibr\" found in hiberfil.sys. Windows is "
"hibernated on the volume. This is the "
"system volume.");
......@@ -1337,12 +1337,12 @@ static bool load_and_init_quota(ntfs_volume *vol)
MFT_REF mref;
struct inode *tmp_ino;
ntfs_name *name = NULL;
static const ntfschar Quota[7] = { const_cpu_to_le16('$'),
const_cpu_to_le16('Q'), const_cpu_to_le16('u'),
const_cpu_to_le16('o'), const_cpu_to_le16('t'),
const_cpu_to_le16('a'), 0 };
static ntfschar Q[3] = { const_cpu_to_le16('$'),
const_cpu_to_le16('Q'), 0 };
static const ntfschar Quota[7] = { cpu_to_le16('$'),
cpu_to_le16('Q'), cpu_to_le16('u'),
cpu_to_le16('o'), cpu_to_le16('t'),
cpu_to_le16('a'), 0 };
static ntfschar Q[3] = { cpu_to_le16('$'),
cpu_to_le16('Q'), 0 };
ntfs_debug("Entering.");
/*
......@@ -1416,16 +1416,16 @@ static bool load_and_init_usnjrnl(ntfs_volume *vol)
struct page *page;
ntfs_name *name = NULL;
USN_HEADER *uh;
static const ntfschar UsnJrnl[9] = { const_cpu_to_le16('$'),
const_cpu_to_le16('U'), const_cpu_to_le16('s'),
const_cpu_to_le16('n'), const_cpu_to_le16('J'),
const_cpu_to_le16('r'), const_cpu_to_le16('n'),
const_cpu_to_le16('l'), 0 };
static ntfschar Max[5] = { const_cpu_to_le16('$'),
const_cpu_to_le16('M'), const_cpu_to_le16('a'),
const_cpu_to_le16('x'), 0 };
static ntfschar J[3] = { const_cpu_to_le16('$'),
const_cpu_to_le16('J'), 0 };
static const ntfschar UsnJrnl[9] = { cpu_to_le16('$'),
cpu_to_le16('U'), cpu_to_le16('s'),
cpu_to_le16('n'), cpu_to_le16('J'),
cpu_to_le16('r'), cpu_to_le16('n'),
cpu_to_le16('l'), 0 };
static ntfschar Max[5] = { cpu_to_le16('$'),
cpu_to_le16('M'), cpu_to_le16('a'),
cpu_to_le16('x'), 0 };
static ntfschar J[3] = { cpu_to_le16('$'),
cpu_to_le16('J'), 0 };
ntfs_debug("Entering.");
/*
......
......@@ -116,27 +116,27 @@ typedef struct {
* documentation: http://www.linux-ntfs.org/
*/
enum {
USN_REASON_DATA_OVERWRITE = const_cpu_to_le32(0x00000001),
USN_REASON_DATA_EXTEND = const_cpu_to_le32(0x00000002),
USN_REASON_DATA_TRUNCATION = const_cpu_to_le32(0x00000004),
USN_REASON_NAMED_DATA_OVERWRITE = const_cpu_to_le32(0x00000010),
USN_REASON_NAMED_DATA_EXTEND = const_cpu_to_le32(0x00000020),
USN_REASON_NAMED_DATA_TRUNCATION= const_cpu_to_le32(0x00000040),
USN_REASON_FILE_CREATE = const_cpu_to_le32(0x00000100),
USN_REASON_FILE_DELETE = const_cpu_to_le32(0x00000200),
USN_REASON_EA_CHANGE = const_cpu_to_le32(0x00000400),
USN_REASON_SECURITY_CHANGE = const_cpu_to_le32(0x00000800),
USN_REASON_RENAME_OLD_NAME = const_cpu_to_le32(0x00001000),
USN_REASON_RENAME_NEW_NAME = const_cpu_to_le32(0x00002000),
USN_REASON_INDEXABLE_CHANGE = const_cpu_to_le32(0x00004000),
USN_REASON_BASIC_INFO_CHANGE = const_cpu_to_le32(0x00008000),
USN_REASON_HARD_LINK_CHANGE = const_cpu_to_le32(0x00010000),
USN_REASON_COMPRESSION_CHANGE = const_cpu_to_le32(0x00020000),
USN_REASON_ENCRYPTION_CHANGE = const_cpu_to_le32(0x00040000),
USN_REASON_OBJECT_ID_CHANGE = const_cpu_to_le32(0x00080000),
USN_REASON_REPARSE_POINT_CHANGE = const_cpu_to_le32(0x00100000),
USN_REASON_STREAM_CHANGE = const_cpu_to_le32(0x00200000),
USN_REASON_CLOSE = const_cpu_to_le32(0x80000000),
USN_REASON_DATA_OVERWRITE = cpu_to_le32(0x00000001),
USN_REASON_DATA_EXTEND = cpu_to_le32(0x00000002),
USN_REASON_DATA_TRUNCATION = cpu_to_le32(0x00000004),
USN_REASON_NAMED_DATA_OVERWRITE = cpu_to_le32(0x00000010),
USN_REASON_NAMED_DATA_EXTEND = cpu_to_le32(0x00000020),
USN_REASON_NAMED_DATA_TRUNCATION= cpu_to_le32(0x00000040),
USN_REASON_FILE_CREATE = cpu_to_le32(0x00000100),
USN_REASON_FILE_DELETE = cpu_to_le32(0x00000200),
USN_REASON_EA_CHANGE = cpu_to_le32(0x00000400),
USN_REASON_SECURITY_CHANGE = cpu_to_le32(0x00000800),
USN_REASON_RENAME_OLD_NAME = cpu_to_le32(0x00001000),
USN_REASON_RENAME_NEW_NAME = cpu_to_le32(0x00002000),
USN_REASON_INDEXABLE_CHANGE = cpu_to_le32(0x00004000),
USN_REASON_BASIC_INFO_CHANGE = cpu_to_le32(0x00008000),
USN_REASON_HARD_LINK_CHANGE = cpu_to_le32(0x00010000),
USN_REASON_COMPRESSION_CHANGE = cpu_to_le32(0x00020000),
USN_REASON_ENCRYPTION_CHANGE = cpu_to_le32(0x00040000),
USN_REASON_OBJECT_ID_CHANGE = cpu_to_le32(0x00080000),
USN_REASON_REPARSE_POINT_CHANGE = cpu_to_le32(0x00100000),
USN_REASON_STREAM_CHANGE = cpu_to_le32(0x00200000),
USN_REASON_CLOSE = cpu_to_le32(0x80000000),
};
typedef le32 USN_REASON_FLAGS;
......@@ -148,9 +148,9 @@ typedef le32 USN_REASON_FLAGS;
* http://www.linux-ntfs.org/
*/
enum {
USN_SOURCE_DATA_MANAGEMENT = const_cpu_to_le32(0x00000001),
USN_SOURCE_AUXILIARY_DATA = const_cpu_to_le32(0x00000002),
USN_SOURCE_REPLICATION_MANAGEMENT = const_cpu_to_le32(0x00000004),
USN_SOURCE_DATA_MANAGEMENT = cpu_to_le32(0x00000001),
USN_SOURCE_AUXILIARY_DATA = cpu_to_le32(0x00000002),
USN_SOURCE_REPLICATION_MANAGEMENT = cpu_to_le32(0x00000004),
};
typedef le32 USN_SOURCE_INFO_FLAGS;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册