Replace all le16 "and" calculations with le16_and(...).

edge.strict_endians
Erik Larsson 2016-01-28 08:28:50 +01:00
parent e970b57c74
commit 2b4c3a618c
14 changed files with 78 additions and 76 deletions

View File

@ -324,4 +324,6 @@
#define le32_andz(a, b) (!((a) & (b)))
#define le16_and(a, b) ((a) & (b))
#endif /* defined _NTFS_ENDIANS_H */

View File

@ -467,7 +467,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
* Also prevent compression on NTFS version < 3.0
* or cluster size > 4K or compression is disabled
*/
a->flags &= ~ATTR_COMPRESSION_MASK;
a->flags = le16_and(a->flags, ~ATTR_COMPRESSION_MASK);
if (!le32_andz(ni->flags, FILE_ATTR_COMPRESSED)
&& (ni->vol->major_ver >= 3)
&& NVolCompression(ni->vol)
@ -475,7 +475,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
a->flags |= ATTR_IS_COMPRESSED;
}
cs = a->flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE);
cs = le16_and(a->flags, ATTR_IS_COMPRESSED | ATTR_IS_SPARSE);
/* a file may be sparse though its unnamed data is not (cf $UsnJrnl) */
if (le32_eq(na->type, AT_DATA) && na->name == AT_UNNAMED &&
@ -943,7 +943,7 @@ static s64 ntfs_attr_pread_i(ntfs_attr *na, const s64 pos, s64 count, void *b)
/* Sanity checking arguments is done in ntfs_attr_pread(). */
if (!le16_andz(na->data_flags, ATTR_COMPRESSION_MASK) && NAttrNonResident(na)) {
if (le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
if (le16_eq(le16_and(na->data_flags, ATTR_COMPRESSION_MASK),
ATTR_IS_COMPRESSED))
return ntfs_compressed_attr_pread(na, pos, count, b);
else {
@ -1809,7 +1809,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
goto errno_set;
}
vol = na->ni->vol;
compressed = !le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
compressed = !le16_eq(le16_and(na->data_flags, ATTR_COMPRESSION_MASK),
const_cpu_to_le16(0));
na->unused_runs = 0; /* prepare overflow checks */
/*
@ -1839,7 +1839,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
*/
if (compressed
&& (!le32_eq(na->type, AT_DATA)
|| (!le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
|| (!le16_eq(le16_and(na->data_flags, ATTR_COMPRESSION_MASK),
ATTR_IS_COMPRESSED)))) {
errno = EOPNOTSUPP;
goto errno_set;
@ -1885,7 +1885,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
}
#endif
/* resizing may change the compression mode */
compressed = !le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
compressed = !le16_eq(le16_and(na->data_flags, ATTR_COMPRESSION_MASK),
const_cpu_to_le16(0));
need_to.undo_data_size = 1;
}
@ -2358,7 +2358,7 @@ int ntfs_attr_pclose(ntfs_attr *na)
}
vol = na->ni->vol;
na->unused_runs = 0;
compressed = !le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
compressed = !le16_eq(le16_and(na->data_flags, ATTR_COMPRESSION_MASK),
const_cpu_to_le16(0));
/*
* Encrypted non-resident attributes are not supported. We return
@ -4386,8 +4386,8 @@ int ntfs_attr_set_flags(ntfs_inode *ni, ATTR_TYPES type, const ntfschar *name,
if (!ntfs_attr_lookup(type, name, name_len,
CASE_SENSITIVE, 0, NULL, 0, ctx)) {
/* do the requested change (all small endian le16) */
ctx->attr->flags = (ctx->attr->flags & ~mask)
| (flags & mask);
ctx->attr->flags = le16_and(ctx->attr->flags, ~mask)
| le16_and(flags, mask);
NInoSetDirty(ni);
res = 0;
}
@ -4784,7 +4784,7 @@ int ntfs_attr_make_non_resident(ntfs_attr *na,
- 1) & ~(vol->cluster_size - 1);
if (new_allocated_size > 0) {
if (le16_eq(a->flags & ATTR_COMPRESSION_MASK,
if (le16_eq(le16_and(a->flags, ATTR_COMPRESSION_MASK),
ATTR_IS_COMPRESSED)) {
/* must allocate full compression blocks */
new_allocated_size = ((new_allocated_size - 1)
@ -4813,7 +4813,7 @@ int ntfs_attr_make_non_resident(ntfs_attr *na,
*/
NAttrClearSparse(na);
NAttrClearEncrypted(na);
if (le16_eq(a->flags & ATTR_COMPRESSION_MASK, ATTR_IS_COMPRESSED)) {
if (le16_eq(le16_and(a->flags, ATTR_COMPRESSION_MASK), ATTR_IS_COMPRESSED)) {
/* set compression writing parameters */
na->compression_block_size
= 1 << (STANDARD_COMPRESSION_UNIT + vol->cluster_size_bits);
@ -4887,14 +4887,14 @@ int ntfs_attr_make_non_resident(ntfs_attr *na,
* The decisions about compression can only be made when
* creating/recreating the stream, not when making non resident.
*/
a->flags &= ~(ATTR_IS_SPARSE | ATTR_IS_ENCRYPTED);
if (le16_eq(a->flags & ATTR_COMPRESSION_MASK, ATTR_IS_COMPRESSED)) {
a->flags = le16_and(a->flags, ~(ATTR_IS_SPARSE | ATTR_IS_ENCRYPTED));
if (le16_eq(le16_and(a->flags, ATTR_COMPRESSION_MASK), ATTR_IS_COMPRESSED)) {
/* support only ATTR_IS_COMPRESSED compression mode */
a->compression_unit = STANDARD_COMPRESSION_UNIT;
a->compressed_size = const_cpu_to_le64(0);
} else {
a->compression_unit = 0;
a->flags &= ~ATTR_COMPRESSION_MASK;
a->flags = le16_and(a->flags, ~ATTR_COMPRESSION_MASK);
na->data_flags = a->flags;
}
@ -5092,7 +5092,7 @@ static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize,
tna->ni->allocated_size = tna->allocated_size;
NInoFileNameSetDirty(tna->ni);
}
if (le16_eq(tna->data_flags & ATTR_COMPRESSION_MASK,
if (le16_eq(le16_and(tna->data_flags, ATTR_COMPRESSION_MASK),
ATTR_IS_COMPRESSED)
&& ntfs_attr_pclose(tna)) {
err = errno;
@ -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 = !le16_eq(a->flags & ATTR_IS_SPARSE, const_cpu_to_le16(0));
sparse = !le16_eq(le16_and(a->flags, ATTR_IS_SPARSE), const_cpu_to_le16(0));
else {
sparse = ntfs_rl_sparse(na->rl);
if (sparse == -1) {
@ -5498,7 +5498,7 @@ static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
le16_andz(a->flags, ATTR_IS_COMPRESSED)) {
NAttrClearSparse(na);
a->flags &= ~ATTR_IS_SPARSE;
a->flags = le16_and(a->flags, ~ATTR_IS_SPARSE);
na->data_flags = a->flags;
a->compression_unit = 0;
@ -5817,8 +5817,8 @@ retry:
CASE_SENSITIVE, 0, NULL, 0, ctx)) {
a = ctx->attr;
a->allocated_size = cpu_to_sle64(na->allocated_size);
spcomp = na->data_flags
& (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE);
spcomp = le16_and(na->data_flags,
ATTR_IS_COMPRESSED | ATTR_IS_SPARSE);
if (!le16_cmpz(spcomp))
a->compressed_size = cpu_to_sle64(na->compressed_size);
if (le32_eq(na->type, AT_DATA) && (na->name == AT_UNNAMED)) {
@ -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 = !le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
compressed = !le16_eq(le16_and(na->data_flags, ATTR_COMPRESSION_MASK),
const_cpu_to_le16(0));
if (compressed
&& NAttrNonResident(na)
&& (!le16_eq(na->data_flags & ATTR_COMPRESSION_MASK, ATTR_IS_COMPRESSED))) {
&& (!le16_eq(le16_and(na->data_flags, ATTR_COMPRESSION_MASK), ATTR_IS_COMPRESSED))) {
errno = EOPNOTSUPP;
ntfs_log_perror("Failed to truncate compressed attribute");
goto out;

View File

@ -724,7 +724,7 @@ 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
|| !le16_eq(data_flags & ATTR_COMPRESSION_MASK,
|| !le16_eq(le16_and(data_flags, ATTR_COMPRESSION_MASK),
ATTR_IS_COMPRESSED)
|| pos < 0 || count < 0) {
errno = EINVAL;
@ -838,7 +838,7 @@ do_next_cb:
to_read = min(count, cb_size - ofs);
ofs += vcn << vol->cluster_size_bits;
NAttrClearCompressed(na);
na->data_flags &= ~ATTR_COMPRESSION_MASK;
na->data_flags = le16_and(na->data_flags, ~ATTR_COMPRESSION_MASK);
tdata_size = na->data_size;
tinitialized_size = na->initialized_size;
na->data_size = na->initialized_size = na->allocated_size;
@ -896,7 +896,7 @@ do_next_cb:
*/
to_read = cb_size;
NAttrClearCompressed(na);
na->data_flags &= ~ATTR_COMPRESSION_MASK;
na->data_flags = le16_and(na->data_flags, ~ATTR_COMPRESSION_MASK);
tdata_size = na->data_size;
tinitialized_size = na->initialized_size;
na->data_size = na->initialized_size = na->allocated_size;

View File

@ -382,7 +382,7 @@ static INDEX_ENTRY *ntfs_ie_dup_novcn(INDEX_ENTRY *ie)
dup = ntfs_malloc(size);
if (dup) {
memcpy(dup, ie, size);
dup->ie_flags &= ~INDEX_ENTRY_NODE;
dup->ie_flags = le16_and(dup->ie_flags, ~INDEX_ENTRY_NODE);
dup->length = cpu_to_le16(size);
}
return dup;
@ -1597,7 +1597,7 @@ static void ntfs_ir_leafify(ntfs_index_context *icx, INDEX_HEADER *ih)
ntfs_log_trace("Entering\n");
ie = ntfs_ie_get_first(ih);
ie->ie_flags &= ~INDEX_ENTRY_NODE;
ie->ie_flags = le16_and(ie->ie_flags, ~INDEX_ENTRY_NODE);
ie->length = cpu_to_le16(le16_to_cpu(ie->length) - sizeof(VCN));
ih->index_length = cpu_to_le32(le32_to_cpu(ih->index_length) - sizeof(VCN));

View File

@ -1870,7 +1870,7 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni)
mft_no = ni->mft_no;
/* Mark the mft record as not in use. */
ni->mrec->flags &= ~MFT_RECORD_IN_USE;
ni->mrec->flags = le16_and(ni->mrec->flags, ~MFT_RECORD_IN_USE);
/* Increment the sequence number, skipping zero, if it is not zero. */
old_seq_no = ni->mrec->sequence_number;

View File

@ -731,7 +731,7 @@ char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point,
target = (char*)NULL;
bad = TRUE;
isdir = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY,
isdir = !le16_eq(le16_and(ni->mrec->flags, MFT_RECORD_IS_DIRECTORY),
const_cpu_to_le16(0));
vol = ni->vol;
reparse_attr = (REPARSE_POINT*)ntfs_attr_readall(ni,

View File

@ -2325,7 +2325,7 @@ static int ntfs_get_perm(struct SECURITY_CONTEXT *scx,
gid = cached->gid;
} else {
perm = 0; /* default to no permission */
isdir = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY,
isdir = !le16_eq(le16_and(ni->mrec->flags, MFT_RECORD_IS_DIRECTORY),
const_cpu_to_le16(0));
securattr = getsecurityattr(scx->vol, ni);
if (securattr) {
@ -2470,7 +2470,7 @@ int ntfs_get_owner_mode(struct SECURITY_CONTEXT *scx,
stbuf->st_mode = (stbuf->st_mode & ~07777) + perm;
} else {
perm = -1; /* default to error */
isdir = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY,
isdir = !le16_eq(le16_and(ni->mrec->flags, MFT_RECORD_IS_DIRECTORY),
const_cpu_to_le16(0));
securattr = getsecurityattr(scx->vol, ni);
if (securattr) {
@ -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 = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY, const_cpu_to_le16(0));
isdir = !le16_eq(le16_and(ni->mrec->flags, MFT_RECORD_IS_DIRECTORY), const_cpu_to_le16(0));
wanted.uid = uid;
wanted.gid = gid;
wanted.dmode = mode & 07777;
@ -3660,7 +3660,7 @@ int ntfs_set_owner(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
mode = 0;
oldattr = getsecurityattr(scx->vol, ni);
if (oldattr) {
isdir = !le16_eq(ni->mrec->flags & MFT_RECORD_IS_DIRECTORY,
isdir = !le16_eq(le16_and(ni->mrec->flags, MFT_RECORD_IS_DIRECTORY),
const_cpu_to_le16(0));
phead = (const SECURITY_DESCRIPTOR_RELATIVE*)
oldattr;
@ -3948,8 +3948,8 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
pnhead = (SECURITY_DESCRIPTOR_RELATIVE*)newattr;
pnhead->revision = SECURITY_DESCRIPTOR_REVISION;
pnhead->alignment = 0;
pnhead->control = (pphead->control
& (SE_DACL_AUTO_INHERITED | SE_SACL_AUTO_INHERITED))
pnhead->control = le16_and(pphead->control,
(SE_DACL_AUTO_INHERITED | SE_SACL_AUTO_INHERITED))
| SE_SELF_RELATIVE;
pos = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
/*
@ -3962,8 +3962,8 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
ppacl = (const ACL*)&parentattr[offpacl];
pnacl = (ACL*)&newattr[pos];
aclsz = ntfs_inherit_acl(ppacl, pnacl, usid, gsid,
fordir, pphead->control
& SE_DACL_AUTO_INHERITED);
fordir, le16_and(pphead->control,
SE_DACL_AUTO_INHERITED));
if (aclsz) {
pnhead->dacl = cpu_to_le32(pos);
pos += aclsz;
@ -3979,8 +3979,8 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
ppacl = (const ACL*)&parentattr[offpacl];
pnacl = (ACL*)&newattr[pos];
aclsz = ntfs_inherit_acl(ppacl, pnacl, usid, gsid,
fordir, pphead->control
& SE_SACL_AUTO_INHERITED);
fordir, le16_and(pphead->control,
SE_SACL_AUTO_INHERITED));
if (aclsz) {
pnhead->sacl = cpu_to_le32(pos);
pos += aclsz;
@ -4611,18 +4611,18 @@ static BOOL feedsecurityattr(const char *attr, u32 selection,
ok = FALSE;
} else {
if (selection & OWNER_SECURITY_INFORMATION)
control |= phead->control & SE_OWNER_DEFAULTED;
control |= le16_and(phead->control, SE_OWNER_DEFAULTED);
if (selection & GROUP_SECURITY_INFORMATION)
control |= phead->control & SE_GROUP_DEFAULTED;
control |= le16_and(phead->control, SE_GROUP_DEFAULTED);
if (selection & DACL_SECURITY_INFORMATION)
control |= phead->control
& (SE_DACL_PRESENT
control |= le16_and(phead->control,
SE_DACL_PRESENT
| SE_DACL_DEFAULTED
| SE_DACL_AUTO_INHERITED
| SE_DACL_PROTECTED);
if (selection & SACL_SECURITY_INFORMATION)
control |= phead->control
& (SE_SACL_PRESENT
control |= le16_and(phead->control,
SE_SACL_PRESENT
| SE_SACL_DEFAULTED
| SE_SACL_AUTO_INHERITED
| SE_SACL_PROTECTED);
@ -4733,15 +4733,15 @@ static BOOL mergesecurityattr(ntfs_volume *vol, const char *oldattr,
} else
targhead->dacl = const_cpu_to_le32(0);
if (selection & DACL_SECURITY_INFORMATION) {
control |= newhead->control
& (SE_DACL_PRESENT
control |= le16_and(newhead->control,
SE_DACL_PRESENT
| SE_DACL_DEFAULTED
| SE_DACL_PROTECTED);
if (!le16_andz(newhead->control, SE_DACL_AUTO_INHERIT_REQ))
control |= SE_DACL_AUTO_INHERITED;
} else
control |= oldhead->control
& (SE_DACL_PRESENT
control |= le16_and(oldhead->control,
SE_DACL_PRESENT
| SE_DACL_DEFAULTED
| SE_DACL_AUTO_INHERITED
| SE_DACL_PROTECTED);
@ -4765,15 +4765,15 @@ static BOOL mergesecurityattr(ntfs_volume *vol, const char *oldattr,
} else
targhead->sacl = const_cpu_to_le32(0);
if (selection & SACL_SECURITY_INFORMATION) {
control |= newhead->control
& (SE_SACL_PRESENT
control |= le16_and(newhead->control,
SE_SACL_PRESENT
| SE_SACL_DEFAULTED
| SE_SACL_PROTECTED);
if (!le16_andz(newhead->control, SE_SACL_AUTO_INHERIT_REQ))
control |= SE_SACL_AUTO_INHERITED;
} else
control |= oldhead->control
& (SE_SACL_PRESENT
control |= le16_and(oldhead->control,
SE_SACL_PRESENT
| SE_SACL_DEFAULTED
| SE_SACL_AUTO_INHERITED
| SE_SACL_PROTECTED);
@ -4797,9 +4797,9 @@ static BOOL mergesecurityattr(ntfs_volume *vol, const char *oldattr,
} else
targhead->owner = const_cpu_to_le32(0);
if (selection & OWNER_SECURITY_INFORMATION)
control |= newhead->control & SE_OWNER_DEFAULTED;
control |= le16_and(newhead->control, SE_OWNER_DEFAULTED);
else
control |= oldhead->control & SE_OWNER_DEFAULTED;
control |= le16_and(oldhead->control, SE_OWNER_DEFAULTED);
/*
* copy new GROUP if selected
* or keep old GROUP if any
@ -4809,13 +4809,13 @@ static BOOL mergesecurityattr(ntfs_volume *vol, const char *oldattr,
if (selection & GROUP_SECURITY_INFORMATION) {
offgroup = le32_to_cpu(newhead->group);
pgroup = (const SID*)&newattr[offgroup];
control |= newhead->control
& SE_GROUP_DEFAULTED;
control |= le16_and(newhead->control,
SE_GROUP_DEFAULTED);
} else {
offgroup = le32_to_cpu(oldhead->group);
pgroup = (const SID*)&oldattr[offgroup];
control |= oldhead->control
& SE_GROUP_DEFAULTED;
control |= le16_and(oldhead->control,
SE_GROUP_DEFAULTED);
}
size = ntfs_sid_size(pgroup);
memcpy(&target[pos], pgroup, size);
@ -4824,9 +4824,9 @@ static BOOL mergesecurityattr(ntfs_volume *vol, const char *oldattr,
} else
targhead->group = const_cpu_to_le32(0);
if (selection & GROUP_SECURITY_INFORMATION)
control |= newhead->control & SE_GROUP_DEFAULTED;
control |= le16_and(newhead->control, SE_GROUP_DEFAULTED);
else
control |= oldhead->control & SE_GROUP_DEFAULTED;
control |= le16_and(oldhead->control, SE_GROUP_DEFAULTED);
targhead->revision = SECURITY_DESCRIPTOR_REVISION;
targhead->alignment = 0;
targhead->control = control;

View File

@ -1703,7 +1703,7 @@ int ntfs_volume_write_flags(ntfs_volume *vol, const le16 flags)
goto err_out;
}
/* Set the volume flags. */
vol->flags = c->flags = flags & VOLUME_FLAGS_MASK;
vol->flags = c->flags = le16_and(flags, VOLUME_FLAGS_MASK);
/* Write them to disk. */
ntfs_inode_mark_dirty(vol->vol_ni);
if (ntfs_inode_sync(vol->vol_ni))

View File

@ -1562,10 +1562,10 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m,
if (name_len)
memcpy((char*)a + hdr_size, uname, name_len << 1);
if (!le16_andz(flags, ATTR_COMPRESSION_MASK)) {
if (!le16_andz(flags, ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED)) {
if (!le16_andz(flags, le16_and(ATTR_COMPRESSION_MASK, ~ATTR_IS_COMPRESSED))) {
ntfs_log_error("Unknown compression format. Reverting "
"to standard compression.\n");
a->flags &= ~ATTR_COMPRESSION_MASK;
a->flags = le16_and(a->flags, ~ATTR_COMPRESSION_MASK);
a->flags |= ATTR_IS_COMPRESSED;
}
a->compression_unit = 4;
@ -1759,10 +1759,10 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m,
if (name_len)
memcpy((char*)a + hdr_size, uname, name_len << 1);
if (!le16_andz(flags, ATTR_COMPRESSION_MASK)) {
if (!le16_andz(flags, ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED)) {
if (!le16_andz(flags, le16_and(ATTR_COMPRESSION_MASK, ~ATTR_IS_COMPRESSED))) {
ntfs_log_error("Unknown compression format. Reverting "
"to standard compression.\n");
a->flags &= ~ATTR_COMPRESSION_MASK;
a->flags = le16_and(a->flags, ~ATTR_COMPRESSION_MASK);
a->flags |= ATTR_IS_COMPRESSED;
}
a->compression_unit = 4;
@ -2248,7 +2248,7 @@ static int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags,
memset(&vi, 0, sizeof(vi));
vi.major_ver = major_ver;
vi.minor_ver = minor_ver;
vi.flags = flags & VOLUME_FLAGS_MASK;
vi.flags = le16_and(flags, VOLUME_FLAGS_MASK);
err = insert_resident_attr_in_mft_record(m, AT_VOLUME_INFORMATION, NULL,
0, CASE_SENSITIVE, const_cpu_to_le16(0),
0, (u8*)&vi, sizeof(vi));

View File

@ -796,7 +796,7 @@ static int reset_dirty(ntfs_volume *vol)
ntfs_log_verbose("Resetting dirty flag.\n");
flags = vol->flags & ~VOLUME_IS_DIRTY;
flags = le16_and(vol->flags, ~VOLUME_IS_DIRTY);
if (ntfs_volume_write_flags(vol, flags)) {
ntfs_log_error("Error setting volume flags.\n");

View File

@ -548,7 +548,7 @@ static int ntfs_merge_allocation(ntfs_attr *na, runlist_element *rl,
if (!le16_andz(na->data_flags, ATTR_IS_SPARSE)) {
na->compressed_size += size;
if (na->compressed_size >= na->allocated_size) {
na->data_flags &= ~ATTR_IS_SPARSE;
na->data_flags = le16_and(na->data_flags, ~ATTR_IS_SPARSE);
if (na->compressed_size > na->allocated_size) {
ntfs_log_error("File size error : "
"apparent %lld, "

View File

@ -1612,7 +1612,7 @@ int main(int argc, char **argv)
* mounting was successful.
*/
if (opt.clear_dirty)
vol->flags &= ~VOLUME_IS_DIRTY;
vol->flags = le16_and(vol->flags, ~VOLUME_IS_DIRTY);
else
vol->flags |= VOLUME_IS_DIRTY;
if (!opt.no_action && ntfs_volume_write_flags(vol, vol->flags)) {

View File

@ -1154,8 +1154,8 @@ static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr)
printf("none set (0x0000)\n");
if (!le16_andz(vol_information->flags, ~VOLUME_FLAGS_MASK))
printf("\t\t\t\t Unknown Flags: 0x%04x\n",
le16_to_cpu(vol_information->flags &
(~VOLUME_FLAGS_MASK)));
le16_to_cpu(le16_and(vol_information->flags,
(~VOLUME_FLAGS_MASK))));
}
static ntfschar NTFS_DATA_SDS[5] = { const_cpu_to_le16('$'),
@ -2191,20 +2191,20 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode)
if (!le16_cmpz(inode_flags)) {
if (!le16_andz(MFT_RECORD_IN_USE, inode_flags)) {
printf("IN_USE ");
inode_flags &= ~MFT_RECORD_IN_USE;
inode_flags = le16_and(inode_flags, ~MFT_RECORD_IN_USE);
}
if (!le16_andz(MFT_RECORD_IS_DIRECTORY, inode_flags)) {
printf("DIRECTORY ");
inode_flags &= ~MFT_RECORD_IS_DIRECTORY;
inode_flags = le16_and(inode_flags, ~MFT_RECORD_IS_DIRECTORY);
}
/* The meaning of IS_4 is illusive but not its existence. */
if (!le16_andz(MFT_RECORD_IS_4, inode_flags)) {
printf("IS_4 ");
inode_flags &= ~MFT_RECORD_IS_4;
inode_flags = le16_and(inode_flags, ~MFT_RECORD_IS_4);
}
if (!le16_andz(MFT_RECORD_IS_VIEW_INDEX, inode_flags)) {
printf("VIEW_INDEX ");
inode_flags &= ~MFT_RECORD_IS_VIEW_INDEX;
inode_flags = le16_and(inode_flags, ~MFT_RECORD_IS_VIEW_INDEX);
}
if (!le16_cmpz(inode_flags))
printf("UNKNOWN: 0x%04x", (unsigned)le16_to_cpu(

View File

@ -589,7 +589,7 @@ static void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a)
printf("ATTR_IS_COMPRESSED");
first = FALSE;
}
if (!le16_andz(u & ATTR_COMPRESSION_MASK, ~ATTR_IS_COMPRESSED)) {
if (!le16_andz(le16_and(u, ATTR_COMPRESSION_MASK), ~ATTR_IS_COMPRESSED)) {
if (!first)
printf(" | ");
else