Replace all le32 zero "and" test conditions with le32_andz(...).

edge.strict_endians
Erik Larsson 2016-01-28 08:28:49 +01:00
parent 9f5ad52e5f
commit e970b57c74
7 changed files with 26 additions and 26 deletions

View File

@ -674,10 +674,10 @@ BOOL ntfs_valid_descr(const char *securattr, unsigned int attrsz)
&& (!offsacl
|| ((offsacl >= sizeof(SECURITY_DESCRIPTOR_RELATIVE))
&& (offsacl+sizeof(ACL) <= attrsz)))
&& !(phead->owner & const_cpu_to_le32(3))
&& !(phead->group & const_cpu_to_le32(3))
&& !(phead->dacl & const_cpu_to_le32(3))
&& !(phead->sacl & const_cpu_to_le32(3))
&& le32_andz(phead->owner, const_cpu_to_le32(3))
&& le32_andz(phead->group, const_cpu_to_le32(3))
&& le32_andz(phead->dacl, const_cpu_to_le32(3))
&& le32_andz(phead->sacl, const_cpu_to_le32(3))
&& (ntfs_attr_size(securattr) <= attrsz)
&& ntfs_valid_sid((const SID*)&securattr[offowner])
&& ntfs_valid_sid((const SID*)&securattr[offgroup])
@ -3223,7 +3223,7 @@ static int build_std_permissions(const char *securattr,
denyown |= pace->mask;
} else
if (ntfs_same_sid(gsid, &pace->sid)
&& !(pace->mask & WRITE_OWNER)) {
&& le32_andz(pace->mask, WRITE_OWNER)) {
if (pace->type == ACCESS_ALLOWED_ACE_TYPE)
allowgrp |= pace->mask;
else if (pace->type == ACCESS_DENIED_ACE_TYPE)
@ -3313,7 +3313,7 @@ static int build_owngrp_permissions(const char *securattr,
}
} else
if (ntfs_same_sid(usid, &pace->sid)
&& (!(pace->mask & WRITE_OWNER))) {
&& le32_andz(pace->mask, WRITE_OWNER)) {
if (pace->type == ACCESS_ALLOWED_ACE_TYPE) {
allowgrp |= pace->mask;
grppresent = TRUE;
@ -3494,7 +3494,7 @@ static int build_ownadmin_permissions(const char *securattr,
for (nace = 0; nace < acecnt; nace++) {
pace = (const ACCESS_ALLOWED_ACE*)&securattr[offace];
if (!(pace->flags & INHERIT_ONLY_ACE)
&& !(~pace->mask & (ROOT_OWNER_UNMARK | ROOT_GROUP_UNMARK))) {
&& le32_andz(~pace->mask, ROOT_OWNER_UNMARK | ROOT_GROUP_UNMARK)) {
if ((ntfs_same_sid(usid, &pace->sid)
|| ntfs_same_sid(ownersid, &pace->sid))
&& ((!le32_andz(pace->mask, WRITE_OWNER) && firstapply))) {
@ -3506,7 +3506,7 @@ static int build_ownadmin_permissions(const char *securattr,
denyown |= pace->mask;
} else
if (ntfs_same_sid(gsid, &pace->sid)
&& (!(pace->mask & WRITE_OWNER))) {
&& (le32_andz(pace->mask, WRITE_OWNER))) {
if (pace->type == ACCESS_ALLOWED_ACE_TYPE) {
allowgrp |= pace->mask;
isforeign &= ~2;

View File

@ -3645,7 +3645,7 @@ static int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE
if (!ad)
return -1;
/* Check the flags and return the result. */
allowed = !(ad->flags & ATTR_DEF_RESIDENT);
allowed = le32_andz(ad->flags, ATTR_DEF_RESIDENT);
}
if (!allowed) {
errno = EPERM;

View File

@ -887,7 +887,7 @@ static u32 ntfs_interix_types(ntfs_inode *ni)
/* Unrecognized patterns (eg HID + SYST) are plain files */
dt_type = NTFS_DT_REG;
if (na->data_size <= 1) {
if (!(ni->flags & FILE_ATTR_HIDDEN))
if (le32_andz(ni->flags, FILE_ATTR_HIDDEN))
dt_type = (na->data_size ?
NTFS_DT_SOCK : NTFS_DT_FIFO);
} else {
@ -930,7 +930,7 @@ static u32 ntfs_dir_entry_type(ntfs_inode *dir_ni, MFT_REF mref,
dt_type = NTFS_DT_LNK;
else
if (!le32_andz(attributes, FILE_ATTR_SYSTEM)
&& !(attributes & FILE_ATTR_I30_INDEX_PRESENT))
&& le32_andz(attributes, FILE_ATTR_I30_INDEX_PRESENT))
dt_type = ntfs_interix_types(ni);
else
dt_type = (!le32_andz(attributes,
@ -1000,7 +1000,7 @@ static int ntfs_filldir(ntfs_inode *dir_ni, s64 *pos, u8 ivcn_bits,
/* return metadata files and hidden files if requested */
if ((!metadata && (NVolShowHidFiles(dir_ni->vol)
|| !(fn->file_attributes & FILE_ATTR_HIDDEN)))
|| le32_andz(fn->file_attributes, FILE_ATTR_HIDDEN)))
|| (NVolShowSysFiles(dir_ni->vol) && (NVolShowHidFiles(dir_ni->vol)
|| metadata))) {
if (NVolCaseSensitive(dir_ni->vol)) {

View File

@ -253,7 +253,7 @@ static char *search_absolute(ntfs_volume *vol, ntfschar *path,
}
} while (ni
&& !le16_andz(ni->mrec->flags, MFT_RECORD_IS_DIRECTORY)
&& !(ni->flags & FILE_ATTR_REPARSE_POINT)
&& le32_andz(ni->flags, FILE_ATTR_REPARSE_POINT)
&& (start < count));
if (ni
&& ((!le16_andz(ni->mrec->flags, MFT_RECORD_IS_DIRECTORY) ? isdir : !isdir)
@ -776,8 +776,8 @@ char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point,
/* reparse data consistency has been checked */
switch (kind) {
case FULL_TARGET :
if (!(symlink_data->flags
& const_cpu_to_le32(1))) {
if (le32_andz(symlink_data->flags,
const_cpu_to_le32(1))) {
target = ntfs_get_fulllink(vol,
p, lth/2,
mnt_point, isdir);

View File

@ -1590,7 +1590,7 @@ static void dump_record(struct ufile *file)
ntfs_log_quiet("Compressed ");
if (!le32_andz(f->flags, FILE_ATTR_ENCRYPTED))
ntfs_log_quiet("Encrypted ");
if (!(f->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_DIRECTORY |
if (le32_andz(f->flags, (FILE_ATTR_SYSTEM | FILE_ATTR_DIRECTORY |
FILE_ATTR_SPARSE_FILE | FILE_ATTR_REPARSE_POINT |
FILE_ATTR_COMPRESSED | FILE_ATTR_ENCRYPTED))) {
ntfs_log_quiet("%s", NONE);

View File

@ -679,7 +679,7 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx,
goto nodata;
}
/* Check whether it's Interix FIFO or socket. */
if (!(ni->flags & FILE_ATTR_HIDDEN)) {
if (le32_andz(ni->flags, FILE_ATTR_HIDDEN)) {
/* FIFO. */
if (na->data_size == 0)
stbuf->st_mode = S_IFIFO;
@ -911,7 +911,7 @@ static void ntfs_fuse_readlink(fuse_req_t req, fuse_ino_t ino)
goto exit;
}
/* Sanity checks. */
if (!(ni->flags & FILE_ATTR_SYSTEM)) {
if (le32_andz(ni->flags, FILE_ATTR_SYSTEM)) {
res = -EINVAL;
goto exit;
}
@ -3276,7 +3276,7 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
res = -errno;
goto exit;
}
if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
if (le32_andz(ni->flags, FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}
@ -3313,7 +3313,7 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
}
if (!res) {
ntfs_fuse_update_times(ni, NTFS_UPDATE_CTIME);
if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
if (le32_andz(ni->flags, FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}
@ -3512,7 +3512,7 @@ static void ntfs_fuse_removexattr(fuse_req_t req, fuse_ino_t ino, const char *na
}
if (!res) {
ntfs_fuse_update_times(ni, NTFS_UPDATE_CTIME);
if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
if (le32_andz(ni->flags, FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}

View File

@ -777,7 +777,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
stbuf->st_blocks = na->allocated_size >> 9;
}
/* Check whether it's Interix FIFO or socket. */
if (!(ni->flags & FILE_ATTR_HIDDEN) &&
if (le32_andz(ni->flags, FILE_ATTR_HIDDEN) &&
!stream_name_len) {
/* FIFO. */
if (na->data_size == 0)
@ -943,7 +943,7 @@ static int ntfs_fuse_readlink(const char *org_path, char *buf, size_t buf_size)
goto exit;
}
/* Sanity checks. */
if (!(ni->flags & FILE_ATTR_SYSTEM)) {
if (le32_andz(ni->flags, FILE_ATTR_SYSTEM)) {
res = -EINVAL;
goto exit;
}
@ -3106,7 +3106,7 @@ static int ntfs_fuse_setxattr(const char *path, const char *name,
res = -errno;
goto exit;
}
if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
if (le32_andz(ni->flags, FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}
@ -3143,7 +3143,7 @@ static int ntfs_fuse_setxattr(const char *path, const char *name,
}
if (!res) {
ntfs_fuse_update_times(ni, NTFS_UPDATE_CTIME);
if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
if (le32_andz(ni->flags, FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}
@ -3334,7 +3334,7 @@ static int ntfs_fuse_removexattr(const char *path, const char *name)
}
if (!res) {
ntfs_fuse_update_times(ni, NTFS_UPDATE_CTIME);
if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
if (le32_andz(ni->flags, FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}