Fix code to use const_cpu_to_X/const_X_to_cpu macros for constants.

This enables the compiler to optimize this code in cases where compiler
support for endianness swapping is not present.
edge.strict_endians
Erik Larsson 2015-12-21 23:21:00 +01:00
parent 58bb59487c
commit 48cb23265b
4 changed files with 10 additions and 10 deletions

View File

@ -790,7 +790,7 @@ int ntfs_inherit_acl(const ACL *oldacl, ACL *newacl,
| FILE_READ
| FILE_WRITE
| FILE_EXEC
| cpu_to_le32(0x40);
| const_cpu_to_le32(0x40);
}
/* reencode GENERIC_READ (+ EXECUTE) */
if (pnewace->mask & GENERIC_READ) {

View File

@ -65,7 +65,7 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b)
ntfs_log_debug("Beginning bootsector check.\n");
ntfs_log_debug("Checking OEMid, NTFS signature.\n");
if (b->oem_id != cpu_to_le64(0x202020205346544eULL)) { /* "NTFS " */
if (b->oem_id != const_cpu_to_le64(0x202020205346544eULL)) { /* "NTFS " */
ntfs_log_error("NTFS signature is missing.\n");
goto not_ntfs;
}
@ -140,7 +140,7 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b)
}
}
if (b->end_of_sector_marker != cpu_to_le16(0xaa55))
if (b->end_of_sector_marker != const_cpu_to_le16(0xaa55))
ntfs_log_debug("Warning: Bootsector has invalid end of sector "
"marker.\n");

View File

@ -1599,11 +1599,11 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
ir->clusters_per_index_block =
ni->vol->indx_record_size >>
NTFS_BLOCK_SIZE_BITS;
ir->index.entries_offset = cpu_to_le32(sizeof(INDEX_HEADER));
ir->index.entries_offset = const_cpu_to_le32(sizeof(INDEX_HEADER));
ir->index.index_length = cpu_to_le32(index_len);
ir->index.allocated_size = cpu_to_le32(index_len);
ie = (INDEX_ENTRY*)((u8*)ir + sizeof(INDEX_ROOT));
ie->length = cpu_to_le16(sizeof(INDEX_ENTRY_HEADER));
ie->length = const_cpu_to_le16(sizeof(INDEX_ENTRY_HEADER));
ie->key_length = 0;
ie->ie_flags = INDEX_ENTRY_END;
/* Add INDEX_ROOT attribute to inode. */
@ -1970,7 +1970,7 @@ search:
* (Windows also does so), however delete the name if it were
* in an extent, to avoid leaving an attribute list.
*/
if ((ni->mrec->link_count == cpu_to_le16(1)) && !actx->base_ntfs_ino) {
if ((ni->mrec->link_count == const_cpu_to_le16(1)) && !actx->base_ntfs_ino) {
/* make sure to not loop to another search */
looking_for_dos_name = FALSE;
} else {

View File

@ -506,10 +506,10 @@ enum {
FILE_EXECUTE |\
SYNCHRONIZE)
#define GENERIC_READ cpu_to_le32(0x80000000L)
#define GENERIC_WRITE cpu_to_le32(0x40000000L)
#define GENERIC_EXECUTE cpu_to_le32(0x20000000L)
#define GENERIC_ALL cpu_to_le32(0x10000000L)
#define GENERIC_READ const_cpu_to_le32(0x80000000L)
#define GENERIC_WRITE const_cpu_to_le32(0x40000000L)
#define GENERIC_EXECUTE const_cpu_to_le32(0x20000000L)
#define GENERIC_ALL const_cpu_to_le32(0x10000000L)
#define OBJECT_INHERIT_ACE (0x1)