Replace all le16 usage of the '!=' operation with "!le16_eq(...)".

edge.strict_endians
Erik Larsson 2016-01-28 08:28:25 +01:00
parent 347bdf21ec
commit 59a05b5c34
9 changed files with 37 additions and 37 deletions

View File

@ -1809,8 +1809,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
goto errno_set;
}
vol = na->ni->vol;
compressed = (na->data_flags & ATTR_COMPRESSION_MASK)
!= const_cpu_to_le16(0);
compressed = !le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
const_cpu_to_le16(0));
na->unused_runs = 0; /* prepare overflow checks */
/*
* Encrypted attributes are only supported in raw mode. We return
@ -1839,8 +1839,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
*/
if (compressed
&& ((na->type != AT_DATA)
|| ((na->data_flags & ATTR_COMPRESSION_MASK)
!= ATTR_IS_COMPRESSED))) {
|| (!le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
ATTR_IS_COMPRESSED)))) {
errno = EOPNOTSUPP;
goto errno_set;
}
@ -1885,8 +1885,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
}
#endif
/* resizing may change the compression mode */
compressed = (na->data_flags & ATTR_COMPRESSION_MASK)
!= const_cpu_to_le16(0);
compressed = !le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
const_cpu_to_le16(0));
need_to.undo_data_size = 1;
}
/*
@ -2358,8 +2358,8 @@ int ntfs_attr_pclose(ntfs_attr *na)
}
vol = na->ni->vol;
na->unused_runs = 0;
compressed = (na->data_flags & ATTR_COMPRESSION_MASK)
!= const_cpu_to_le16(0);
compressed = !le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
const_cpu_to_le16(0));
/*
* Encrypted non-resident attributes are not supported. We return
* access denied, which is what Windows NT4 does, too.
@ -3184,7 +3184,7 @@ do_next_attr_loop:
continue;
if (!a->length)
break;
if (al_entry->instance != a->instance)
if (!le16_eq(al_entry->instance, a->instance))
goto do_next_attr;
/*
* If the type and/or the name are/is mismatched between the
@ -5434,7 +5434,7 @@ static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
/* Update sparse bit, unless this is an intermediate state */
if (holes == HOLES_DELAY)
sparse = (a->flags & ATTR_IS_SPARSE) != const_cpu_to_le16(0);
sparse = !le16_eq(a->flags & ATTR_IS_SPARSE, const_cpu_to_le16(0));
else {
sparse = ntfs_rl_sparse(na->rl);
if (sparse == -1) {
@ -6450,11 +6450,11 @@ static int ntfs_attr_truncate_i(ntfs_attr *na, const s64 newsize,
* for resident attributes when there is no open fuse context
* (important case : $INDEX_ROOT:$I30)
*/
compressed = (na->data_flags & ATTR_COMPRESSION_MASK)
!= const_cpu_to_le16(0);
compressed = !le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
const_cpu_to_le16(0));
if (compressed
&& NAttrNonResident(na)
&& ((na->data_flags & ATTR_COMPRESSION_MASK) != ATTR_IS_COMPRESSED)) {
&& (!le16_eq(na->data_flags & ATTR_COMPRESSION_MASK, ATTR_IS_COMPRESSED))) {
errno = EOPNOTSUPP;
ntfs_log_perror("Failed to truncate compressed attribute");
goto out;

View File

@ -140,7 +140,7 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b)
}
}
if (b->end_of_sector_marker != const_cpu_to_le16(0xaa55))
if (!le16_eq(b->end_of_sector_marker, const_cpu_to_le16(0xaa55)))
ntfs_log_debug("Warning: Bootsector has invalid end of sector "
"marker.\n");

View File

@ -724,8 +724,8 @@ s64 ntfs_compressed_attr_pread(ntfs_attr *na, s64 pos, s64 count, void *b)
data_flags = na->data_flags;
compression = na->ni->flags & FILE_ATTR_COMPRESSED;
if (!na || !na->ni || !na->ni->vol || !b
|| ((data_flags & ATTR_COMPRESSION_MASK)
!= ATTR_IS_COMPRESSED)
|| !le16_eq(data_flags & ATTR_COMPRESSION_MASK,
ATTR_IS_COMPRESSED)
|| pos < 0 || count < 0) {
errno = EINVAL;
return -1;

View File

@ -1545,7 +1545,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
if (NVolHideDotFiles(dir_ni->vol)
&& (name_len > 1)
&& (le16_eq(name[0], const_cpu_to_le16('.')))
&& (name[1] != const_cpu_to_le16('.')))
&& (!le16_eq(name[1], const_cpu_to_le16('.'))))
ni->flags |= FILE_ATTR_HIDDEN;
/*
* Set compression flag according to parent directory
@ -2166,7 +2166,7 @@ static int ntfs_link_i(ntfs_inode *ni, ntfs_inode *dir_ni, const ntfschar *name,
/* Set hidden flag according to the latest name */
if ((name_len > 1)
&& (le16_eq(name[0], const_cpu_to_le16('.')))
&& (name[1] != const_cpu_to_le16('.')))
&& (!le16_eq(name[1], const_cpu_to_le16('.'))))
ni->flags |= FILE_ATTR_HIDDEN;
else
ni->flags &= ~FILE_ATTR_HIDDEN;

View File

@ -224,10 +224,10 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp)
* LOGFILE_NO_CLIENT or less than ra->log_clients or they are
* overflowing the client array.
*/
if ((ra->client_free_list != LOGFILE_NO_CLIENT &&
if ((!le16_eq(ra->client_free_list, LOGFILE_NO_CLIENT) &&
le16_to_cpu(ra->client_free_list) >=
le16_to_cpu(ra->log_clients)) ||
(ra->client_in_use_list != LOGFILE_NO_CLIENT &&
(!le16_eq(ra->client_in_use_list, LOGFILE_NO_CLIENT) &&
le16_to_cpu(ra->client_in_use_list) >=
le16_to_cpu(ra->log_clients))) {
ntfs_log_error("$LogFile restart area specifies "
@ -312,7 +312,7 @@ check_list:
cr = ca + idx;
/* The first log client record must not have a prev_client. */
if (idx_is_first) {
if (cr->prev_client != LOGFILE_NO_CLIENT)
if (!le16_eq(cr->prev_client, LOGFILE_NO_CLIENT))
goto err_out;
idx_is_first = FALSE;
}
@ -429,7 +429,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na,
*/
err = 0;
if (ntfs_is_rstr_record(rp->magic) &&
ra->client_in_use_list != LOGFILE_NO_CLIENT) {
!le16_eq(ra->client_in_use_list, LOGFILE_NO_CLIENT)) {
if (!ntfs_check_log_client_array(trp)) {
err = EINVAL;
goto err_out;
@ -681,7 +681,7 @@ BOOL ntfs_is_logfile_clean(ntfs_attr *log_na, RESTART_PAGE_HEADER *rp)
* have the RESTART_VOLUME_IS_CLEAN bit set in the restart area flags,
* we assume there was an unclean shutdown.
*/
if (ra->client_in_use_list != LOGFILE_NO_CLIENT &&
if (!le16_eq(ra->client_in_use_list, LOGFILE_NO_CLIENT) &&
!(ra->flags & RESTART_VOLUME_IS_CLEAN)) {
ntfs_log_error("The disk contains an unclean file system (%d, "
"%d).\n", le16_to_cpu(ra->client_in_use_list),

View File

@ -1460,7 +1460,7 @@ found_free_rec:
if (seq_no)
m->sequence_number = seq_no;
seq_no = usn;
if (seq_no && seq_no != const_cpu_to_le16(0xffff))
if (seq_no && !le16_eq(seq_no, const_cpu_to_le16(0xffff)))
*(le16*)((u8*)m + le16_to_cpu(m->usa_ofs)) = usn;
/* Set the mft record itself in use. */
m->flags |= MFT_RECORD_IN_USE;
@ -1763,7 +1763,7 @@ found_free_rec:
if (seq_no)
m->sequence_number = seq_no;
seq_no = usn;
if (seq_no && seq_no != const_cpu_to_le16(0xffff))
if (seq_no && !le16_eq(seq_no, const_cpu_to_le16(0xffff)))
*(le16*)((u8*)m + le16_to_cpu(m->usa_ofs)) = usn;
/* Set the mft record itself in use. */
m->flags |= MFT_RECORD_IN_USE;

View File

@ -239,7 +239,7 @@ static char *search_absolute(ntfs_volume *vol, ntfschar *path,
do {
len = 0;
while (((start + len) < count)
&& (path[start + len] != const_cpu_to_le16('\\')))
&& !le16_eq(path[start + len], const_cpu_to_le16('\\')))
len++;
inum = ntfs_fix_file_name(ni, &path[start], len);
ntfs_inode_close(ni);
@ -331,7 +331,7 @@ static char *search_relative(ntfs_inode *ni, ntfschar *path, int count)
} else {
lth = 0;
while (((pos + lth) < count)
&& (path[pos + lth] != const_cpu_to_le16('\\')))
&& !le16_eq(path[pos + lth], const_cpu_to_le16('\\')))
lth++;
if (lth > 0)
inum = ntfs_fix_file_name(curni,&path[pos],lth);
@ -731,8 +731,8 @@ char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point,
target = (char*)NULL;
bad = TRUE;
isdir = (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)
!= const_cpu_to_le16(0);
isdir = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY,
const_cpu_to_le16(0));
vol = ni->vol;
reparse_attr = (REPARSE_POINT*)ntfs_attr_readall(ni,
AT_REPARSE_POINT,(ntfschar*)NULL, 0, &attr_size);

View File

@ -2325,8 +2325,8 @@ static int ntfs_get_perm(struct SECURITY_CONTEXT *scx,
gid = cached->gid;
} else {
perm = 0; /* default to no permission */
isdir = (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)
!= const_cpu_to_le16(0);
isdir = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY,
const_cpu_to_le16(0));
securattr = getsecurityattr(scx->vol, ni);
if (securattr) {
phead = (const SECURITY_DESCRIPTOR_RELATIVE*)
@ -2470,8 +2470,8 @@ int ntfs_get_owner_mode(struct SECURITY_CONTEXT *scx,
stbuf->st_mode = (stbuf->st_mode & ~07777) + perm;
} else {
perm = -1; /* default to error */
isdir = (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)
!= const_cpu_to_le16(0);
isdir = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY,
const_cpu_to_le16(0));
securattr = getsecurityattr(scx->vol, ni);
if (securattr) {
phead =
@ -2892,7 +2892,7 @@ int ntfs_set_owner_mode(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
/* check whether target securid is known in cache */
isdir = (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) != const_cpu_to_le16(0);
isdir = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY, const_cpu_to_le16(0));
wanted.uid = uid;
wanted.gid = gid;
wanted.dmode = mode & 07777;
@ -3660,8 +3660,8 @@ int ntfs_set_owner(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
mode = 0;
oldattr = getsecurityattr(scx->vol, ni);
if (oldattr) {
isdir = (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)
!= const_cpu_to_le16(0);
isdir = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY,
const_cpu_to_le16(0));
phead = (const SECURITY_DESCRIPTOR_RELATIVE*)
oldattr;
gsid = (const SID*)

View File

@ -1502,7 +1502,7 @@ BOOL ntfs_collapsible_chars(ntfs_volume *vol,
if ((cs != ch)
&& ((ch >= vol->upcase_len)
|| (cs >= vol->upcase_len)
|| (vol->upcase[cs] != vol->upcase[ch])))
|| !le16_eq(vol->upcase[cs], vol->upcase[ch])))
collapsible = FALSE;
}
return (collapsible);