Replace all le16 usage of the '==' operation with "le16_eq(...)".
parent
48cb23265b
commit
347bdf21ec
|
@ -296,4 +296,6 @@
|
|||
#define const_cpu_to_sbe32(x) __constant_cpu_to_be32((u32) x)
|
||||
#define const_cpu_to_sbe64(x) __constant_cpu_to_be64((u64) x)
|
||||
|
||||
#define le16_eq(a, b) ((a) == (b))
|
||||
|
||||
#endif /* defined _NTFS_ENDIANS_H */
|
||||
|
|
|
@ -943,8 +943,8 @@ 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 ((na->data_flags & ATTR_COMPRESSION_MASK) && NAttrNonResident(na)) {
|
||||
if ((na->data_flags & ATTR_COMPRESSION_MASK)
|
||||
== ATTR_IS_COMPRESSED)
|
||||
if (le16_eq(na->data_flags & ATTR_COMPRESSION_MASK,
|
||||
ATTR_IS_COMPRESSED))
|
||||
return ntfs_compressed_attr_pread(na, pos, count, b);
|
||||
else {
|
||||
/* compression mode not supported */
|
||||
|
@ -4784,8 +4784,8 @@ int ntfs_attr_make_non_resident(ntfs_attr *na,
|
|||
- 1) & ~(vol->cluster_size - 1);
|
||||
|
||||
if (new_allocated_size > 0) {
|
||||
if ((a->flags & ATTR_COMPRESSION_MASK)
|
||||
== ATTR_IS_COMPRESSED) {
|
||||
if (le16_eq(a->flags & ATTR_COMPRESSION_MASK,
|
||||
ATTR_IS_COMPRESSED)) {
|
||||
/* must allocate full compression blocks */
|
||||
new_allocated_size = ((new_allocated_size - 1)
|
||||
| ((1L << (STANDARD_COMPRESSION_UNIT
|
||||
|
@ -4813,7 +4813,7 @@ int ntfs_attr_make_non_resident(ntfs_attr *na,
|
|||
*/
|
||||
NAttrClearSparse(na);
|
||||
NAttrClearEncrypted(na);
|
||||
if ((a->flags & ATTR_COMPRESSION_MASK) == ATTR_IS_COMPRESSED) {
|
||||
if (le16_eq(a->flags & ATTR_COMPRESSION_MASK, ATTR_IS_COMPRESSED)) {
|
||||
/* set compression writing parameters */
|
||||
na->compression_block_size
|
||||
= 1 << (STANDARD_COMPRESSION_UNIT + vol->cluster_size_bits);
|
||||
|
@ -4888,7 +4888,7 @@ int ntfs_attr_make_non_resident(ntfs_attr *na,
|
|||
* creating/recreating the stream, not when making non resident.
|
||||
*/
|
||||
a->flags &= ~(ATTR_IS_SPARSE | ATTR_IS_ENCRYPTED);
|
||||
if ((a->flags & ATTR_COMPRESSION_MASK) == ATTR_IS_COMPRESSED) {
|
||||
if (le16_eq(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);
|
||||
|
@ -5092,8 +5092,8 @@ static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize,
|
|||
tna->ni->allocated_size = tna->allocated_size;
|
||||
NInoFileNameSetDirty(tna->ni);
|
||||
}
|
||||
if (((tna->data_flags & ATTR_COMPRESSION_MASK)
|
||||
== ATTR_IS_COMPRESSED)
|
||||
if (le16_eq(tna->data_flags & ATTR_COMPRESSION_MASK,
|
||||
ATTR_IS_COMPRESSED)
|
||||
&& ntfs_attr_pclose(tna)) {
|
||||
err = errno;
|
||||
ntfs_attr_close(tna);
|
||||
|
|
|
@ -1544,7 +1544,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
|
|||
ni->flags |= FILE_ATTR_ARCHIVE;
|
||||
if (NVolHideDotFiles(dir_ni->vol)
|
||||
&& (name_len > 1)
|
||||
&& (name[0] == const_cpu_to_le16('.'))
|
||||
&& (le16_eq(name[0], const_cpu_to_le16('.')))
|
||||
&& (name[1] != const_cpu_to_le16('.')))
|
||||
ni->flags |= FILE_ATTR_HIDDEN;
|
||||
/*
|
||||
|
@ -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 == const_cpu_to_le16(1)) && !actx->base_ntfs_ino) {
|
||||
if (le16_eq(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 {
|
||||
|
@ -2165,7 +2165,7 @@ static int ntfs_link_i(ntfs_inode *ni, ntfs_inode *dir_ni, const ntfschar *name,
|
|||
if (NVolHideDotFiles(dir_ni->vol)) {
|
||||
/* Set hidden flag according to the latest name */
|
||||
if ((name_len > 1)
|
||||
&& (name[0] == const_cpu_to_le16('.'))
|
||||
&& (le16_eq(name[0], const_cpu_to_le16('.')))
|
||||
&& (name[1] != const_cpu_to_le16('.')))
|
||||
ni->flags |= FILE_ATTR_HIDDEN;
|
||||
else
|
||||
|
|
|
@ -311,15 +311,15 @@ static char *search_relative(ntfs_inode *ni, ntfschar *path, int count)
|
|||
*/
|
||||
while (curni && ok && !morelinks && (pos < (count - 1)) && --max) {
|
||||
if ((count >= (pos + 2))
|
||||
&& (path[pos] == const_cpu_to_le16('.'))
|
||||
&& (path[pos+1] == const_cpu_to_le16('\\'))) {
|
||||
&& le16_eq(path[pos], const_cpu_to_le16('.'))
|
||||
&& le16_eq(path[pos+1], const_cpu_to_le16('\\'))) {
|
||||
path[pos+1] = const_cpu_to_le16('/');
|
||||
pos += 2;
|
||||
} else {
|
||||
if ((count >= (pos + 3))
|
||||
&& (path[pos] == const_cpu_to_le16('.'))
|
||||
&&(path[pos+1] == const_cpu_to_le16('.'))
|
||||
&& (path[pos+2] == const_cpu_to_le16('\\'))) {
|
||||
&& le16_eq(path[pos], const_cpu_to_le16('.'))
|
||||
&& le16_eq(path[pos+1], const_cpu_to_le16('.'))
|
||||
&& le16_eq(path[pos+2], const_cpu_to_le16('\\'))) {
|
||||
path[pos+2] = const_cpu_to_le16('/');
|
||||
pos += 3;
|
||||
newni = ntfs_dir_parent_inode(curni);
|
||||
|
@ -508,8 +508,8 @@ static char *ntfs_get_fulllink(ntfs_volume *vol, ntfschar *junction,
|
|||
if ((count >= 7)
|
||||
&& !memcmp(junction,dir_junction_head,8)
|
||||
&& junction[4]
|
||||
&& (junction[5] == const_cpu_to_le16(':'))
|
||||
&& (junction[6] == const_cpu_to_le16('\\')))
|
||||
&& le16_eq(junction[5], const_cpu_to_le16(':'))
|
||||
&& le16_eq(junction[6], const_cpu_to_le16('\\')))
|
||||
kind = DIR_JUNCTION;
|
||||
else
|
||||
/*
|
||||
|
@ -518,7 +518,7 @@ static char *ntfs_get_fulllink(ntfs_volume *vol, ntfschar *junction,
|
|||
*/
|
||||
if ((count >= 12)
|
||||
&& !memcmp(junction,vol_junction_head,22)
|
||||
&& (junction[count-1] == const_cpu_to_le16('\\')))
|
||||
&& le16_eq(junction[count-1], const_cpu_to_le16('\\')))
|
||||
kind = VOL_JUNCTION;
|
||||
else
|
||||
kind = NO_JUNCTION;
|
||||
|
@ -610,15 +610,15 @@ static char *ntfs_get_abslink(ntfs_volume *vol, ntfschar *junction,
|
|||
*/
|
||||
if ((count >= 3)
|
||||
&& junction[0]
|
||||
&& (junction[1] == const_cpu_to_le16(':'))
|
||||
&& (junction[2] == const_cpu_to_le16('\\')))
|
||||
&& le16_eq(junction[1], const_cpu_to_le16(':'))
|
||||
&& le16_eq(junction[2], const_cpu_to_le16('\\')))
|
||||
kind = FULL_PATH;
|
||||
else
|
||||
/*
|
||||
* For an absolute path we want an initial \
|
||||
*/
|
||||
if ((count >= 0)
|
||||
&& (junction[0] == const_cpu_to_le16('\\')))
|
||||
&& le16_eq(junction[0], const_cpu_to_le16('\\')))
|
||||
kind = ABS_PATH;
|
||||
else
|
||||
kind = REJECTED_PATH;
|
||||
|
@ -761,14 +761,14 @@ char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point,
|
|||
* Predetermine the kind of target,
|
||||
* the called function has to make a full check
|
||||
*/
|
||||
if (*p++ == const_cpu_to_le16('\\')) {
|
||||
if ((*p == const_cpu_to_le16('?'))
|
||||
|| (*p == const_cpu_to_le16('\\')))
|
||||
if (le16_eq(*p++, const_cpu_to_le16('\\'))) {
|
||||
if ((le16_eq(*p, const_cpu_to_le16('?')))
|
||||
|| (le16_eq(*p, const_cpu_to_le16('\\'))))
|
||||
kind = FULL_TARGET;
|
||||
else
|
||||
kind = ABS_TARGET;
|
||||
} else
|
||||
if (*p == const_cpu_to_le16(':'))
|
||||
if (le16_eq(*p, const_cpu_to_le16(':')))
|
||||
kind = ABS_TARGET;
|
||||
else
|
||||
kind = REL_TARGET;
|
||||
|
|
|
@ -166,7 +166,7 @@ int ntfs_names_full_collate(const ntfschar *name1, const u32 name1_len,
|
|||
cnt = min(name1_len, name2_len);
|
||||
if (cnt > 0) {
|
||||
if (ic == CASE_SENSITIVE) {
|
||||
while (--cnt && (*name1 == *name2)) {
|
||||
while (--cnt && le16_eq(*name1, *name2)) {
|
||||
name1++;
|
||||
name2++;
|
||||
}
|
||||
|
@ -1376,8 +1376,8 @@ BOOL ntfs_forbidden_chars(const ntfschar *name, int len)
|
|||
| (1L << ('?' - 0x20));
|
||||
|
||||
forbidden = (len == 0)
|
||||
|| (name[len-1] == const_cpu_to_le16(' '))
|
||||
|| (name[len-1] == const_cpu_to_le16('.'));
|
||||
|| le16_eq(name[len-1], const_cpu_to_le16(' '))
|
||||
|| le16_eq(name[len-1], const_cpu_to_le16('.'));
|
||||
for (i=0; i<len; i++) {
|
||||
ch = le16_to_cpu(name[i]);
|
||||
if ((ch < 0x20)
|
||||
|
@ -1432,7 +1432,7 @@ BOOL ntfs_forbidden_names(ntfs_volume *vol, const ntfschar *name, int len)
|
|||
/* do a full check, depending on the third char */
|
||||
switch (le16_to_cpu(name[2]) & ~0x20) {
|
||||
case 'N' :
|
||||
if (((len == 3) || (name[3] == dot))
|
||||
if (((len == 3) || le16_eq(name[3], dot))
|
||||
&& (!ntfs_ucsncasecmp(name, con, 3,
|
||||
vol->upcase, vol->upcase_len)
|
||||
|| !ntfs_ucsncasecmp(name, prn, 3,
|
||||
|
@ -1440,13 +1440,13 @@ BOOL ntfs_forbidden_names(ntfs_volume *vol, const ntfschar *name, int len)
|
|||
forbidden = TRUE;
|
||||
break;
|
||||
case 'X' :
|
||||
if (((len == 3) || (name[3] == dot))
|
||||
if (((len == 3) || le16_eq(name[3], dot))
|
||||
&& !ntfs_ucsncasecmp(name, aux, 3,
|
||||
vol->upcase, vol->upcase_len))
|
||||
forbidden = TRUE;
|
||||
break;
|
||||
case 'L' :
|
||||
if (((len == 3) || (name[3] == dot))
|
||||
if (((len == 3) || le16_eq(name[3], dot))
|
||||
&& !ntfs_ucsncasecmp(name, nul, 3,
|
||||
vol->upcase, vol->upcase_len))
|
||||
forbidden = TRUE;
|
||||
|
@ -1455,7 +1455,7 @@ BOOL ntfs_forbidden_names(ntfs_volume *vol, const ntfschar *name, int len)
|
|||
if ((len > 3)
|
||||
&& (le16_to_cpu(name[3]) >= '1')
|
||||
&& (le16_to_cpu(name[3]) <= '9')
|
||||
&& ((len == 4) || (name[4] == dot))
|
||||
&& ((len == 4) || le16_eq(name[4], dot))
|
||||
&& !ntfs_ucsncasecmp(name, com, 3,
|
||||
vol->upcase, vol->upcase_len))
|
||||
forbidden = TRUE;
|
||||
|
@ -1464,7 +1464,7 @@ BOOL ntfs_forbidden_names(ntfs_volume *vol, const ntfschar *name, int len)
|
|||
if ((len > 3)
|
||||
&& (le16_to_cpu(name[3]) >= '1')
|
||||
&& (le16_to_cpu(name[3]) <= '9')
|
||||
&& ((len == 4) || (name[4] == dot))
|
||||
&& ((len == 4) || le16_eq(name[4], dot))
|
||||
&& !ntfs_ucsncasecmp(name, lpt, 3,
|
||||
vol->upcase, vol->upcase_len))
|
||||
forbidden = TRUE;
|
||||
|
|
Loading…
Reference in New Issue