Replace all le16 "or" calculations with le16_or(...).

edge.strict_endians
Erik Larsson 2016-01-28 08:28:53 +01:00
parent 66d7b85573
commit b61e7ff449
17 changed files with 97 additions and 95 deletions

View File

@ -330,4 +330,6 @@
#define le64_and(a, b) ((a) & (b))
#define le16_or(a, b) ((a) | (b))
#endif /* defined _NTFS_ENDIANS_H */

View File

@ -2883,8 +2883,8 @@ char *ntfs_build_descr(mode_t mode,
* The flag SE_DACL_PROTECTED prevents the ACL
* to be changed in an inheritance after creation
*/
pnhead->control = SE_DACL_PRESENT | SE_DACL_PROTECTED
| SE_SELF_RELATIVE;
pnhead->control = le16_or(SE_DACL_PRESENT, le16_or(SE_DACL_PROTECTED,
SE_SELF_RELATIVE));
/*
* Windows prefers ACL first, do the same to
* get the same hash value and avoid duplication

View File

@ -472,10 +472,10 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
&& (ni->vol->major_ver >= 3)
&& NVolCompression(ni->vol)
&& (ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE))
a->flags |= ATTR_IS_COMPRESSED;
a->flags = le16_or(a->flags, ATTR_IS_COMPRESSED);
}
cs = le16_and(a->flags, ATTR_IS_COMPRESSED | ATTR_IS_SPARSE);
cs = le16_and(a->flags, le16_or(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 &&
@ -1358,7 +1358,7 @@ static int ntfs_attr_fill_hole(ntfs_attr *na, s64 count, s64 *ofs,
lcn_seek_from, DATA_ZONE);
if (!rlc)
goto err_out;
if (!le16_andz(na->data_flags, ATTR_COMPRESSION_MASK | ATTR_IS_SPARSE))
if (!le16_andz(na->data_flags, le16_or(ATTR_COMPRESSION_MASK, ATTR_IS_SPARSE)))
na->compressed_size += need << vol->cluster_size_bits;
*rl = ntfs_runlists_merge(na->rl, rlc);
@ -3950,7 +3950,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
dataruns_size = (dataruns_size + 7) & ~7;
length = offsetof(ATTR_RECORD, compressed_size) + ((sizeof(ntfschar) *
name_len + 7) & ~7) + dataruns_size +
(!le16_andz(flags, ATTR_IS_COMPRESSED | ATTR_IS_SPARSE) ?
(!le16_andz(flags, le16_or(ATTR_IS_COMPRESSED, ATTR_IS_SPARSE)) ?
sizeof(a->compressed_size) : 0);
if (ntfs_make_room_for_attr(ctx->mrec, (u8*) ctx->attr, length)) {
err = errno;
@ -3964,7 +3964,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
a->non_resident = 1;
a->name_length = name_len;
a->name_offset = cpu_to_le16(offsetof(ATTR_RECORD, compressed_size) +
(!le16_andz(flags, ATTR_IS_COMPRESSED | ATTR_IS_SPARSE) ?
(!le16_andz(flags, le16_or(ATTR_IS_COMPRESSED, ATTR_IS_SPARSE)) ?
sizeof(a->compressed_size) : 0));
a->flags = flags;
a->instance = m->next_attr_instance;
@ -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 = le16_and(ctx->attr->flags, ~mask)
| le16_and(flags, mask);
ctx->attr->flags = le16_or(le16_and(ctx->attr->flags, ~mask),
le16_and(flags, mask));
NInoSetDirty(ni);
res = 0;
}
@ -4887,7 +4887,7 @@ 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 = le16_and(a->flags, ~(ATTR_IS_SPARSE | ATTR_IS_ENCRYPTED));
a->flags = le16_and(a->flags, ~(le16_or(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;
@ -5350,7 +5350,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx)
&& NVolCompression(na->ni->vol)
&& (na->ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE)
&& !le32_andz(na->ni->flags, FILE_ATTR_COMPRESSED)) {
a->flags |= ATTR_IS_COMPRESSED;
a->flags = le16_or(a->flags, ATTR_IS_COMPRESSED);
na->data_flags = a->flags;
}
/*
@ -5446,7 +5446,7 @@ static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
/* Check whether attribute becomes sparse, unless check is delayed. */
if ((holes != HOLES_DELAY)
&& sparse
&& le16_andz(a->flags, ATTR_IS_SPARSE | ATTR_IS_COMPRESSED)) {
&& le16_andz(a->flags, le16_or(ATTR_IS_SPARSE, ATTR_IS_COMPRESSED))) {
/*
* Move attribute to another mft record, if attribute is too
* small to add compressed_size field to it and we have no
@ -5478,7 +5478,7 @@ static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
}
NAttrSetSparse(na);
a->flags |= ATTR_IS_SPARSE;
a->flags = le16_or(a->flags, ATTR_IS_SPARSE);
na->data_flags = a->flags;
a->compression_unit = STANDARD_COMPRESSION_UNIT; /* Windows
set it so, even if attribute is not actually compressed. */
@ -5818,7 +5818,7 @@ retry:
a = ctx->attr;
a->allocated_size = cpu_to_sle64(na->allocated_size);
spcomp = le16_and(na->data_flags,
ATTR_IS_COMPRESSED | ATTR_IS_SPARSE);
le16_or(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)) {

View File

@ -1713,7 +1713,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
/* Set hard links count and directory flag. */
ni->mrec->link_count = cpu_to_le16(1);
if (S_ISDIR(type))
ni->mrec->flags |= MFT_RECORD_IS_DIRECTORY;
ni->mrec->flags = le16_or(ni->mrec->flags, MFT_RECORD_IS_DIRECTORY);
ntfs_inode_mark_dirty(ni);
/* Done! */
free(fn);

View File

@ -423,7 +423,7 @@ int ntfs_efs_fixup_attribute(ntfs_attr_search_ctx *ctx, ntfs_attr *na)
ctx->attr->data_size = cpu_to_le64(newsize);
if (le64_to_cpu(ctx->attr->initialized_size) > newsize)
ctx->attr->initialized_size = ctx->attr->data_size;
ctx->attr->flags |= ATTR_IS_ENCRYPTED;
ctx->attr->flags = le16_or(ctx->attr->flags, ATTR_IS_ENCRYPTED);
if (close_ctx)
ntfs_attr_put_search_ctx(ctx);

View File

@ -1159,7 +1159,7 @@ retry :
ntfs_ir_nill(ir);
ie = ntfs_ie_get_first(&ir->index);
ie->ie_flags |= INDEX_ENTRY_NODE;
ie->ie_flags = le16_or(ie->ie_flags, INDEX_ENTRY_NODE);
ie->length = cpu_to_le16(sizeof(INDEX_ENTRY_HEADER) + sizeof(VCN));
ir->index.ih_flags = LARGE_INDEX;
@ -1283,7 +1283,7 @@ static int ntfs_ie_add_vcn(INDEX_ENTRY **ie)
if (!p)
return STATUS_ERROR;
p->ie_flags |= INDEX_ENTRY_NODE;
p->ie_flags = le16_or(p->ie_flags, INDEX_ENTRY_NODE);
*ie = p;
return STATUS_OK;

View File

@ -260,7 +260,7 @@ get_size:
if (ctx->attr->non_resident) {
ni->data_size = sle64_to_cpu(ctx->attr->data_size);
if (!le16_andz(ctx->attr->flags,
(ATTR_IS_COMPRESSED | ATTR_IS_SPARSE)))
le16_or(ATTR_IS_COMPRESSED, ATTR_IS_SPARSE)))
ni->allocated_size = sle64_to_cpu(
ctx->attr->compressed_size);
else

View File

@ -1463,7 +1463,7 @@ found_free_rec:
if (!le16_cmpz(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;
m->flags = le16_or(m->flags, MFT_RECORD_IN_USE);
/* Now need to open an ntfs inode for the mft record. */
ni = ntfs_inode_allocate(vol);
if (!ni) {
@ -1766,7 +1766,7 @@ found_free_rec:
if (!le16_cmpz(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;
m->flags = le16_or(m->flags, MFT_RECORD_IN_USE);
/* Now need to open an ntfs inode for the mft record. */
ni = ntfs_inode_allocate(vol);
if (!ni) {
@ -1913,7 +1913,7 @@ bitmap_rollback:
ntfs_log_debug("Eeek! Rollback failed in ntfs_mft_record_free(). "
"Leaving inconsistent metadata!\n");
sync_rollback:
ni->mrec->flags |= MFT_RECORD_IN_USE;
ni->mrec->flags = le16_or(ni->mrec->flags, MFT_RECORD_IN_USE);
ni->mrec->sequence_number = old_seq_no;
ntfs_inode_mark_dirty(ni);
errno = err;

View File

@ -3378,7 +3378,7 @@ int ntfs_sd_add_everyone(ntfs_inode *ni)
return -1;
sd->revision = SECURITY_DESCRIPTOR_REVISION;
sd->control = SE_DACL_PRESENT | SE_SELF_RELATIVE;
sd->control = le16_or(SE_DACL_PRESENT, SE_SELF_RELATIVE);
sid = (SID*)((u8*)sd + sizeof(SECURITY_DESCRIPTOR_ATTR));
sid->revision = SID_REVISION;
@ -3948,9 +3948,9 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
pnhead = (SECURITY_DESCRIPTOR_RELATIVE*)newattr;
pnhead->revision = SECURITY_DESCRIPTOR_REVISION;
pnhead->alignment = 0;
pnhead->control = le16_and(pphead->control,
(SE_DACL_AUTO_INHERITED | SE_SACL_AUTO_INHERITED))
| SE_SELF_RELATIVE;
pnhead->control = le16_or(le16_and(pphead->control,
le16_or(SE_DACL_AUTO_INHERITED, SE_SACL_AUTO_INHERITED)),
SE_SELF_RELATIVE);
pos = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
/*
* locate and inherit DACL
@ -3967,7 +3967,7 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
if (aclsz) {
pnhead->dacl = cpu_to_le32(pos);
pos += aclsz;
pnhead->control |= SE_DACL_PRESENT;
pnhead->control = le16_or(pnhead->control, SE_DACL_PRESENT);
}
}
/*
@ -3984,7 +3984,7 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
if (aclsz) {
pnhead->sacl = cpu_to_le32(pos);
pos += aclsz;
pnhead->control |= SE_SACL_PRESENT;
pnhead->control = le16_or(pnhead->control, SE_DACL_PRESENT);
}
}
/*
@ -4611,21 +4611,21 @@ static BOOL feedsecurityattr(const char *attr, u32 selection,
ok = FALSE;
} else {
if (selection & OWNER_SECURITY_INFORMATION)
control |= le16_and(phead->control, SE_OWNER_DEFAULTED);
control = le16_or(control, le16_and(phead->control, SE_OWNER_DEFAULTED));
if (selection & GROUP_SECURITY_INFORMATION)
control |= le16_and(phead->control, SE_GROUP_DEFAULTED);
control = le16_or(control, le16_and(phead->control, SE_GROUP_DEFAULTED));
if (selection & DACL_SECURITY_INFORMATION)
control |= le16_and(phead->control,
SE_DACL_PRESENT
| SE_DACL_DEFAULTED
| SE_DACL_AUTO_INHERITED
| SE_DACL_PROTECTED);
control = le16_or(control, le16_and(phead->control,
le16_or(SE_DACL_PRESENT,
le16_or(SE_DACL_DEFAULTED,
le16_or(SE_DACL_AUTO_INHERITED,
SE_DACL_PROTECTED)))));
if (selection & SACL_SECURITY_INFORMATION)
control |= le16_and(phead->control,
SE_SACL_PRESENT
| SE_SACL_DEFAULTED
| SE_SACL_AUTO_INHERITED
| SE_SACL_PROTECTED);
control = le16_or(control, le16_and(phead->control,
le16_or(SE_SACL_PRESENT,
le16_or(SE_SACL_DEFAULTED,
le16_or(SE_SACL_AUTO_INHERITED,
SE_SACL_PROTECTED)))));
/*
* copy header and feed new flags, even if no detailed data
*/
@ -4733,18 +4733,18 @@ static BOOL mergesecurityattr(ntfs_volume *vol, const char *oldattr,
} else
targhead->dacl = const_cpu_to_le32(0);
if (selection & DACL_SECURITY_INFORMATION) {
control |= le16_and(newhead->control,
SE_DACL_PRESENT
| SE_DACL_DEFAULTED
| SE_DACL_PROTECTED);
control = le16_or(control, le16_and(newhead->control,
le16_or(SE_DACL_PRESENT,
le16_or(SE_DACL_DEFAULTED,
SE_DACL_PROTECTED))));
if (!le16_andz(newhead->control, SE_DACL_AUTO_INHERIT_REQ))
control |= SE_DACL_AUTO_INHERITED;
control = le16_or(control, SE_DACL_AUTO_INHERITED);
} else
control |= le16_and(oldhead->control,
SE_DACL_PRESENT
| SE_DACL_DEFAULTED
| SE_DACL_AUTO_INHERITED
| SE_DACL_PROTECTED);
control = le16_or(control, le16_and(oldhead->control,
le16_or(SE_DACL_PRESENT,
le16_or(SE_DACL_DEFAULTED,
le16_or(SE_DACL_AUTO_INHERITED,
SE_DACL_PROTECTED)))));
/*
* copy new SACL if selected
* or keep old SACL if any
@ -4765,18 +4765,18 @@ static BOOL mergesecurityattr(ntfs_volume *vol, const char *oldattr,
} else
targhead->sacl = const_cpu_to_le32(0);
if (selection & SACL_SECURITY_INFORMATION) {
control |= le16_and(newhead->control,
SE_SACL_PRESENT
| SE_SACL_DEFAULTED
| SE_SACL_PROTECTED);
control = le16_or(control, le16_and(newhead->control,
le16_or(SE_SACL_PRESENT,
le16_or(SE_SACL_DEFAULTED,
SE_SACL_PROTECTED))));
if (!le16_andz(newhead->control, SE_SACL_AUTO_INHERIT_REQ))
control |= SE_SACL_AUTO_INHERITED;
control = le16_or(control, SE_SACL_AUTO_INHERITED);
} else
control |= le16_and(oldhead->control,
SE_SACL_PRESENT
| SE_SACL_DEFAULTED
| SE_SACL_AUTO_INHERITED
| SE_SACL_PROTECTED);
control = le16_or(control, le16_and(oldhead->control,
le16_or(SE_SACL_PRESENT,
le16_or(SE_SACL_DEFAULTED,
le16_or(SE_SACL_AUTO_INHERITED,
SE_SACL_PROTECTED)))));
/*
* copy new OWNER if selected
* or keep old OWNER if any
@ -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 |= le16_and(newhead->control, SE_OWNER_DEFAULTED);
control = le16_or(control, le16_and(newhead->control, SE_OWNER_DEFAULTED));
else
control |= le16_and(oldhead->control, SE_OWNER_DEFAULTED);
control = le16_or(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 |= le16_and(newhead->control,
SE_GROUP_DEFAULTED);
control = le16_or(control, le16_and(newhead->control,
SE_GROUP_DEFAULTED));
} else {
offgroup = le32_to_cpu(oldhead->group);
pgroup = (const SID*)&oldattr[offgroup];
control |= le16_and(oldhead->control,
SE_GROUP_DEFAULTED);
control = le16_or(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 |= le16_and(newhead->control, SE_GROUP_DEFAULTED);
control = le16_or(control, le16_and(newhead->control, SE_GROUP_DEFAULTED));
else
control |= le16_and(oldhead->control, SE_GROUP_DEFAULTED);
control = le16_or(control, le16_and(oldhead->control, SE_GROUP_DEFAULTED));
targhead->revision = SECURITY_DESCRIPTOR_REVISION;
targhead->alignment = 0;
targhead->control = control;

View File

@ -1477,7 +1477,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m,
err = -EOPNOTSUPP;
goto err_out;
}
if (!le16_andz(flags, ATTR_IS_ENCRYPTED | ATTR_IS_SPARSE)) {
if (!le16_andz(flags, le16_or(ATTR_IS_ENCRYPTED, ATTR_IS_SPARSE))) {
ntfs_log_error("Encrypted/sparse attributes not supported.\n");
err = -EOPNOTSUPP;
goto err_out;
@ -1566,7 +1566,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m,
ntfs_log_error("Unknown compression format. Reverting "
"to standard compression.\n");
a->flags = le16_and(a->flags, ~ATTR_COMPRESSION_MASK);
a->flags |= ATTR_IS_COMPRESSED;
a->flags = le16_or(a->flags, ATTR_IS_COMPRESSED);
}
a->compression_unit = 4;
inited_size = val_len;
@ -1668,7 +1668,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m,
err = -EOPNOTSUPP;
goto err_out;
}
if (!le16_andz(flags, ATTR_IS_ENCRYPTED | ATTR_IS_SPARSE)) {
if (!le16_andz(flags, le16_or(ATTR_IS_ENCRYPTED, ATTR_IS_SPARSE))) {
ntfs_log_error("Encrypted/sparse attributes not supported.\n");
err = -EOPNOTSUPP;
goto err_out;
@ -1763,7 +1763,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m,
ntfs_log_error("Unknown compression format. Reverting "
"to standard compression.\n");
a->flags = le16_and(a->flags, ~ATTR_COMPRESSION_MASK);
a->flags |= ATTR_IS_COMPRESSED;
a->flags = le16_or(a->flags, ATTR_IS_COMPRESSED);
}
a->compression_unit = 4;
/* FIXME: Set the compressed size. */
@ -2524,7 +2524,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name,
}
/* Now fixup empty index root with pointer to index allocation VCN 0. */
r->index.ih_flags = LARGE_INDEX;
re->ie_flags |= INDEX_ENTRY_NODE;
re->ie_flags = le16_or(re->ie_flags, INDEX_ENTRY_NODE);
if (le16_to_cpu(re->length) < sizeof(INDEX_ENTRY_HEADER) + sizeof(VCN))
re->length = cpu_to_le16(le16_to_cpu(re->length) + sizeof(VCN));
r->index.index_length = cpu_to_le32(le32_to_cpu(r->index.entries_offset)
@ -4437,7 +4437,7 @@ static BOOL mkntfs_create_root_structures(void)
m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size);
if (i < 16 || i > 23) {
m->mft_record_number = cpu_to_le32(i);
m->flags |= MFT_RECORD_IN_USE;
m->flags = le16_or(m->flags, MFT_RECORD_IN_USE);
ntfs_bit_set(g_mft_bitmap, 0LL + i, 1);
}
file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM;
@ -4476,7 +4476,7 @@ static BOOL mkntfs_create_root_structures(void)
extend_ref = MK_LE_MREF(11,11);
ntfs_log_verbose("Creating root directory (mft record 5)\n");
m = (MFT_RECORD*)(g_buf + 5 * g_vol->mft_record_size);
m->flags |= MFT_RECORD_IS_DIRECTORY;
m->flags = le16_or(m->flags, MFT_RECORD_IS_DIRECTORY);
m->link_count = cpu_to_le16(le16_to_cpu(m->link_count) + 1);
err = add_attr_file_name(m, root_ref, 0LL, 0LL,
FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM |
@ -4724,7 +4724,7 @@ static BOOL mkntfs_create_root_structures(void)
* odd and we failed to set the device block size to the sector
* size, hence we schedule chkdsk to create it.
*/
volume_flags |= VOLUME_IS_DIRTY;
volume_flags = le16_or(volume_flags, VOLUME_IS_DIRTY);
}
free(bs);
/*
@ -4768,7 +4768,7 @@ static BOOL mkntfs_create_root_structures(void)
/* create $Secure (NTFS 3.0+) */
ntfs_log_verbose("Creating $Secure (mft record 9)\n");
m = (MFT_RECORD*)(g_buf + 9 * g_vol->mft_record_size);
m->flags |= MFT_RECORD_IS_VIEW_INDEX;
m->flags = le16_or(m->flags, MFT_RECORD_IS_VIEW_INDEX);
if (!err)
err = create_hardlink(g_index_block, root_ref, m,
MK_LE_MREF(9, 9), 0LL, 0LL,
@ -4840,7 +4840,7 @@ static BOOL mkntfs_create_root_structures(void)
* volume as corrupt. (ERSO)
*/
m = (MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size);
m->flags |= MFT_RECORD_IS_DIRECTORY;
m->flags = le16_or(m->flags, MFT_RECORD_IS_DIRECTORY);
if (!err)
err = create_hardlink(g_index_block, root_ref, m,
MK_LE_MREF(11, 11), 0LL, 0LL,
@ -4879,8 +4879,8 @@ static BOOL mkntfs_create_root_structures(void)
FILE_ATTR_ARCHIVE | FILE_ATTR_VIEW_INDEX_PRESENT;
ntfs_log_verbose("Creating $Quota (mft record 24)\n");
m = (MFT_RECORD*)(g_buf + 24 * g_vol->mft_record_size);
m->flags |= MFT_RECORD_IS_4;
m->flags |= MFT_RECORD_IS_VIEW_INDEX;
m->flags = le16_or(m->flags, MFT_RECORD_IS_4);
m->flags = le16_or(m->flags, MFT_RECORD_IS_VIEW_INDEX);
if (!err)
err = create_hardlink_res((MFT_RECORD*)(g_buf +
11 * g_vol->mft_record_size), extend_ref, m,
@ -4902,8 +4902,8 @@ static BOOL mkntfs_create_root_structures(void)
}
ntfs_log_verbose("Creating $ObjId (mft record 25)\n");
m = (MFT_RECORD*)(g_buf + 25 * g_vol->mft_record_size);
m->flags |= MFT_RECORD_IS_4;
m->flags |= MFT_RECORD_IS_VIEW_INDEX;
m->flags = le16_or(m->flags, MFT_RECORD_IS_4);
m->flags = le16_or(m->flags, MFT_RECORD_IS_VIEW_INDEX);
if (!err)
err = create_hardlink_res((MFT_RECORD*)(g_buf +
11 * g_vol->mft_record_size), extend_ref,
@ -4926,8 +4926,8 @@ static BOOL mkntfs_create_root_structures(void)
}
ntfs_log_verbose("Creating $Reparse (mft record 26)\n");
m = (MFT_RECORD*)(g_buf + 26 * g_vol->mft_record_size);
m->flags |= MFT_RECORD_IS_4;
m->flags |= MFT_RECORD_IS_VIEW_INDEX;
m->flags = le16_or(m->flags, MFT_RECORD_IS_4);
m->flags = le16_or(m->flags, MFT_RECORD_IS_VIEW_INDEX);
if (!err)
err = create_hardlink_res((MFT_RECORD*)(g_buf +
11 * g_vol->mft_record_size),

View File

@ -791,7 +791,7 @@ static int reset_dirty(ntfs_volume *vol)
{
u16 flags;
if (le16_cmpz(vol->flags | VOLUME_IS_DIRTY))
if (le16_cmpz(le16_or(vol->flags, VOLUME_IS_DIRTY)))
return 0;
ntfs_log_verbose("Resetting dirty flag.\n");

View File

@ -305,7 +305,7 @@ static int set_dirty_flag(ntfs_volume *vol)
* Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run
* and fix it for us.
*/
flags = vol->flags | VOLUME_IS_DIRTY;
flags = le16_or(vol->flags, VOLUME_IS_DIRTY);
if (!opt.no_action && OLD_ntfs_volume_set_flags(vol, flags)) {
ntfs_log_info(FAILED);
ntfs_log_error("Error setting volume flags.\n");
@ -1614,7 +1614,7 @@ int main(int argc, char **argv)
if (opt.clear_dirty)
vol->flags = le16_and(vol->flags, ~VOLUME_IS_DIRTY);
else
vol->flags |= VOLUME_IS_DIRTY;
vol->flags = le16_or(vol->flags, VOLUME_IS_DIRTY);
if (!opt.no_action && ntfs_volume_write_flags(vol, vol->flags)) {
ntfs_log_error("Error: Failed to set volume dirty flag (%d "
"(%s))!\n", errno, strerror(errno));

View File

@ -902,7 +902,7 @@ int main(int argc, char *argv[])
* should be set. So we explicitly set it with a call to
* ntfs_volume_write_flags. */
if(le16_andz(vol->flags, VOLUME_IS_DIRTY) && ntfs_volume_write_flags(
vol, vol->flags | VOLUME_IS_DIRTY)) {
vol, le16_or(vol->flags, VOLUME_IS_DIRTY))) {
ntfs_log_error("Error: Failed to set volume dirty "
"flag (%d (%s))!\n", errno, strerror(errno));
}

View File

@ -2818,7 +2818,7 @@ static void prepare_volume_fixup(ntfs_volume *vol)
{
printf("Schedule chkdsk for NTFS consistency check at Windows boot "
"time ...\n");
vol->flags |= VOLUME_IS_DIRTY;
vol->flags = le16_or(vol->flags, VOLUME_IS_DIRTY);
if (ntfs_volume_write_flags(vol, vol->flags))
perr_exit("Failed to set the volume dirty");

View File

@ -37,7 +37,7 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len)
sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array;
sd->revision = 1;
sd->alignment = 0;
sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT;
sd->control = le16_or(SE_SELF_RELATIVE, SE_DACL_PRESENT);
*sd_val_len = 0x64;
sd->owner = const_cpu_to_le32(0x48);
sd->group = const_cpu_to_le32(0x54);
@ -184,7 +184,7 @@ void init_root_sd(u8 **sd_val, int *sd_val_len)
sd = (SECURITY_DESCRIPTOR_RELATIVE*)sd_array;
sd->revision = SECURITY_DESCRIPTOR_REVISION;
sd->alignment = 0;
sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT;
sd->control = le16_or(SE_SELF_RELATIVE, SE_DACL_PRESENT);
sd->owner = const_cpu_to_le32(0x1014);
sd->group = const_cpu_to_le32(0x1020);
sd->sacl = 0;
@ -424,7 +424,7 @@ void init_secure_sds(char *sd_val)
sizeof(SECURITY_DESCRIPTOR_HEADER));
sd->revision = 0x01;
sd->alignment = 0x00;
sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT;
sd->control = le16_or(SE_SELF_RELATIVE, SE_DACL_PRESENT);
sd->owner = const_cpu_to_le32(0x48);
sd->group = const_cpu_to_le32(0x58);
sd->sacl = const_cpu_to_le32(0x00);
@ -520,7 +520,7 @@ void init_secure_sds(char *sd_val)
sizeof(SECURITY_DESCRIPTOR_HEADER));
sd->revision = 0x01;
sd->alignment = 0x00;
sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT;
sd->control = le16_or(SE_SELF_RELATIVE, SE_DACL_PRESENT);
sd->owner = const_cpu_to_le32(0x48);
sd->group = const_cpu_to_le32(0x58);
sd->sacl = const_cpu_to_le32(0x00);

View File

@ -2677,7 +2677,7 @@ static void ntfs_fuse_bmap(fuse_req_t req, fuse_ino_t ino, size_t blocksize,
goto close_inode;
}
if (!le16_andz(na->data_flags, ATTR_COMPRESSION_MASK | ATTR_IS_ENCRYPTED)
if (!le16_andz(na->data_flags, le16_or(ATTR_COMPRESSION_MASK, ATTR_IS_ENCRYPTED))
|| !NAttrNonResident(na)) {
ret = -EINVAL;
goto close_attr;

View File

@ -2494,7 +2494,7 @@ static int ntfs_fuse_bmap(const char *path, size_t blocksize, uint64_t *idx)
goto close_inode;
}
if (!le16_andz(na->data_flags, ATTR_COMPRESSION_MASK | ATTR_IS_ENCRYPTED)
if (!le16_andz(na->data_flags, le16_or(ATTR_COMPRESSION_MASK, ATTR_IS_ENCRYPTED))
|| !NAttrNonResident(na)) {
ret = -EINVAL;
goto close_attr;