diff options
Diffstat (limited to 'fs/ntfs/attrib.c')
-rw-r--r-- | fs/ntfs/attrib.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index 6708e1d68a9e..9f08e851cfb6 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c | |||
@@ -67,7 +67,7 @@ | |||
67 | * the attribute has zero allocated size, i.e. there simply is no runlist. | 67 | * the attribute has zero allocated size, i.e. there simply is no runlist. |
68 | * | 68 | * |
69 | * WARNING: If @ctx is supplied, regardless of whether success or failure is | 69 | * WARNING: If @ctx is supplied, regardless of whether success or failure is |
70 | * returned, you need to check IS_ERR(@ctx->mrec) and if TRUE the @ctx | 70 | * returned, you need to check IS_ERR(@ctx->mrec) and if 'true' the @ctx |
71 | * is no longer valid, i.e. you need to either call | 71 | * is no longer valid, i.e. you need to either call |
72 | * ntfs_attr_reinit_search_ctx() or ntfs_attr_put_search_ctx() on it. | 72 | * ntfs_attr_reinit_search_ctx() or ntfs_attr_put_search_ctx() on it. |
73 | * In that case PTR_ERR(@ctx->mrec) will give you the error code for | 73 | * In that case PTR_ERR(@ctx->mrec) will give you the error code for |
@@ -90,7 +90,7 @@ int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx) | |||
90 | runlist_element *rl; | 90 | runlist_element *rl; |
91 | struct page *put_this_page = NULL; | 91 | struct page *put_this_page = NULL; |
92 | int err = 0; | 92 | int err = 0; |
93 | BOOL ctx_is_temporary, ctx_needs_reset; | 93 | bool ctx_is_temporary, ctx_needs_reset; |
94 | ntfs_attr_search_ctx old_ctx = { NULL, }; | 94 | ntfs_attr_search_ctx old_ctx = { NULL, }; |
95 | 95 | ||
96 | ntfs_debug("Mapping runlist part containing vcn 0x%llx.", | 96 | ntfs_debug("Mapping runlist part containing vcn 0x%llx.", |
@@ -100,7 +100,7 @@ int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx) | |||
100 | else | 100 | else |
101 | base_ni = ni->ext.base_ntfs_ino; | 101 | base_ni = ni->ext.base_ntfs_ino; |
102 | if (!ctx) { | 102 | if (!ctx) { |
103 | ctx_is_temporary = ctx_needs_reset = TRUE; | 103 | ctx_is_temporary = ctx_needs_reset = true; |
104 | m = map_mft_record(base_ni); | 104 | m = map_mft_record(base_ni); |
105 | if (IS_ERR(m)) | 105 | if (IS_ERR(m)) |
106 | return PTR_ERR(m); | 106 | return PTR_ERR(m); |
@@ -115,7 +115,7 @@ int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx) | |||
115 | BUG_ON(IS_ERR(ctx->mrec)); | 115 | BUG_ON(IS_ERR(ctx->mrec)); |
116 | a = ctx->attr; | 116 | a = ctx->attr; |
117 | BUG_ON(!a->non_resident); | 117 | BUG_ON(!a->non_resident); |
118 | ctx_is_temporary = FALSE; | 118 | ctx_is_temporary = false; |
119 | end_vcn = sle64_to_cpu(a->data.non_resident.highest_vcn); | 119 | end_vcn = sle64_to_cpu(a->data.non_resident.highest_vcn); |
120 | read_lock_irqsave(&ni->size_lock, flags); | 120 | read_lock_irqsave(&ni->size_lock, flags); |
121 | allocated_size_vcn = ni->allocated_size >> | 121 | allocated_size_vcn = ni->allocated_size >> |
@@ -136,7 +136,7 @@ int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx) | |||
136 | ni->name, ni->name_len) && | 136 | ni->name, ni->name_len) && |
137 | sle64_to_cpu(a->data.non_resident.lowest_vcn) | 137 | sle64_to_cpu(a->data.non_resident.lowest_vcn) |
138 | <= vcn && end_vcn >= vcn)) | 138 | <= vcn && end_vcn >= vcn)) |
139 | ctx_needs_reset = FALSE; | 139 | ctx_needs_reset = false; |
140 | else { | 140 | else { |
141 | /* Save the old search context. */ | 141 | /* Save the old search context. */ |
142 | old_ctx = *ctx; | 142 | old_ctx = *ctx; |
@@ -158,7 +158,7 @@ int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx) | |||
158 | * needed attribute extent. | 158 | * needed attribute extent. |
159 | */ | 159 | */ |
160 | ntfs_attr_reinit_search_ctx(ctx); | 160 | ntfs_attr_reinit_search_ctx(ctx); |
161 | ctx_needs_reset = TRUE; | 161 | ctx_needs_reset = true; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | if (ctx_needs_reset) { | 164 | if (ctx_needs_reset) { |
@@ -336,16 +336,16 @@ int ntfs_map_runlist(ntfs_inode *ni, VCN vcn) | |||
336 | * LCN_EIO Critical error (runlist/file is corrupt, i/o error, etc). | 336 | * LCN_EIO Critical error (runlist/file is corrupt, i/o error, etc). |
337 | * | 337 | * |
338 | * Locking: - The runlist must be locked on entry and is left locked on return. | 338 | * Locking: - The runlist must be locked on entry and is left locked on return. |
339 | * - If @write_locked is FALSE, i.e. the runlist is locked for reading, | 339 | * - If @write_locked is 'false', i.e. the runlist is locked for reading, |
340 | * the lock may be dropped inside the function so you cannot rely on | 340 | * the lock may be dropped inside the function so you cannot rely on |
341 | * the runlist still being the same when this function returns. | 341 | * the runlist still being the same when this function returns. |
342 | */ | 342 | */ |
343 | LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn, | 343 | LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn, |
344 | const BOOL write_locked) | 344 | const bool write_locked) |
345 | { | 345 | { |
346 | LCN lcn; | 346 | LCN lcn; |
347 | unsigned long flags; | 347 | unsigned long flags; |
348 | BOOL is_retry = FALSE; | 348 | bool is_retry = false; |
349 | 349 | ||
350 | ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, %s_locked.", | 350 | ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, %s_locked.", |
351 | ni->mft_no, (unsigned long long)vcn, | 351 | ni->mft_no, (unsigned long long)vcn, |
@@ -390,7 +390,7 @@ retry_remap: | |||
390 | down_read(&ni->runlist.lock); | 390 | down_read(&ni->runlist.lock); |
391 | } | 391 | } |
392 | if (likely(!err)) { | 392 | if (likely(!err)) { |
393 | is_retry = TRUE; | 393 | is_retry = true; |
394 | goto retry_remap; | 394 | goto retry_remap; |
395 | } | 395 | } |
396 | if (err == -ENOENT) | 396 | if (err == -ENOENT) |
@@ -449,7 +449,7 @@ retry_remap: | |||
449 | * -EIO - Critical error (runlist/file is corrupt, i/o error, etc). | 449 | * -EIO - Critical error (runlist/file is corrupt, i/o error, etc). |
450 | * | 450 | * |
451 | * WARNING: If @ctx is supplied, regardless of whether success or failure is | 451 | * WARNING: If @ctx is supplied, regardless of whether success or failure is |
452 | * returned, you need to check IS_ERR(@ctx->mrec) and if TRUE the @ctx | 452 | * returned, you need to check IS_ERR(@ctx->mrec) and if 'true' the @ctx |
453 | * is no longer valid, i.e. you need to either call | 453 | * is no longer valid, i.e. you need to either call |
454 | * ntfs_attr_reinit_search_ctx() or ntfs_attr_put_search_ctx() on it. | 454 | * ntfs_attr_reinit_search_ctx() or ntfs_attr_put_search_ctx() on it. |
455 | * In that case PTR_ERR(@ctx->mrec) will give you the error code for | 455 | * In that case PTR_ERR(@ctx->mrec) will give you the error code for |
@@ -469,7 +469,7 @@ runlist_element *ntfs_attr_find_vcn_nolock(ntfs_inode *ni, const VCN vcn, | |||
469 | unsigned long flags; | 469 | unsigned long flags; |
470 | runlist_element *rl; | 470 | runlist_element *rl; |
471 | int err = 0; | 471 | int err = 0; |
472 | BOOL is_retry = FALSE; | 472 | bool is_retry = false; |
473 | 473 | ||
474 | ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, with%s ctx.", | 474 | ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, with%s ctx.", |
475 | ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out"); | 475 | ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out"); |
@@ -518,7 +518,7 @@ retry_remap: | |||
518 | */ | 518 | */ |
519 | err = ntfs_map_runlist_nolock(ni, vcn, ctx); | 519 | err = ntfs_map_runlist_nolock(ni, vcn, ctx); |
520 | if (likely(!err)) { | 520 | if (likely(!err)) { |
521 | is_retry = TRUE; | 521 | is_retry = true; |
522 | goto retry_remap; | 522 | goto retry_remap; |
523 | } | 523 | } |
524 | } | 524 | } |
@@ -558,8 +558,8 @@ retry_remap: | |||
558 | * On actual error, ntfs_attr_find() returns -EIO. In this case @ctx->attr is | 558 | * On actual error, ntfs_attr_find() returns -EIO. In this case @ctx->attr is |
559 | * undefined and in particular do not rely on it not changing. | 559 | * undefined and in particular do not rely on it not changing. |
560 | * | 560 | * |
561 | * If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it | 561 | * If @ctx->is_first is 'true', the search begins with @ctx->attr itself. If it |
562 | * is FALSE, the search begins after @ctx->attr. | 562 | * is 'false', the search begins after @ctx->attr. |
563 | * | 563 | * |
564 | * If @ic is IGNORE_CASE, the @name comparisson is not case sensitive and | 564 | * If @ic is IGNORE_CASE, the @name comparisson is not case sensitive and |
565 | * @ctx->ntfs_ino must be set to the ntfs inode to which the mft record | 565 | * @ctx->ntfs_ino must be set to the ntfs inode to which the mft record |
@@ -599,11 +599,11 @@ static int ntfs_attr_find(const ATTR_TYPE type, const ntfschar *name, | |||
599 | 599 | ||
600 | /* | 600 | /* |
601 | * Iterate over attributes in mft record starting at @ctx->attr, or the | 601 | * Iterate over attributes in mft record starting at @ctx->attr, or the |
602 | * attribute following that, if @ctx->is_first is TRUE. | 602 | * attribute following that, if @ctx->is_first is 'true'. |
603 | */ | 603 | */ |
604 | if (ctx->is_first) { | 604 | if (ctx->is_first) { |
605 | a = ctx->attr; | 605 | a = ctx->attr; |
606 | ctx->is_first = FALSE; | 606 | ctx->is_first = false; |
607 | } else | 607 | } else |
608 | a = (ATTR_RECORD*)((u8*)ctx->attr + | 608 | a = (ATTR_RECORD*)((u8*)ctx->attr + |
609 | le32_to_cpu(ctx->attr->length)); | 609 | le32_to_cpu(ctx->attr->length)); |
@@ -890,11 +890,11 @@ static int ntfs_external_attr_find(const ATTR_TYPE type, | |||
890 | ctx->al_entry = (ATTR_LIST_ENTRY*)al_start; | 890 | ctx->al_entry = (ATTR_LIST_ENTRY*)al_start; |
891 | /* | 891 | /* |
892 | * Iterate over entries in attribute list starting at @ctx->al_entry, | 892 | * Iterate over entries in attribute list starting at @ctx->al_entry, |
893 | * or the entry following that, if @ctx->is_first is TRUE. | 893 | * or the entry following that, if @ctx->is_first is 'true'. |
894 | */ | 894 | */ |
895 | if (ctx->is_first) { | 895 | if (ctx->is_first) { |
896 | al_entry = ctx->al_entry; | 896 | al_entry = ctx->al_entry; |
897 | ctx->is_first = FALSE; | 897 | ctx->is_first = false; |
898 | } else | 898 | } else |
899 | al_entry = (ATTR_LIST_ENTRY*)((u8*)ctx->al_entry + | 899 | al_entry = (ATTR_LIST_ENTRY*)((u8*)ctx->al_entry + |
900 | le16_to_cpu(ctx->al_entry->length)); | 900 | le16_to_cpu(ctx->al_entry->length)); |
@@ -1127,7 +1127,7 @@ not_found: | |||
1127 | ctx->mrec = ctx->base_mrec; | 1127 | ctx->mrec = ctx->base_mrec; |
1128 | ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec + | 1128 | ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec + |
1129 | le16_to_cpu(ctx->mrec->attrs_offset)); | 1129 | le16_to_cpu(ctx->mrec->attrs_offset)); |
1130 | ctx->is_first = TRUE; | 1130 | ctx->is_first = true; |
1131 | ctx->ntfs_ino = base_ni; | 1131 | ctx->ntfs_ino = base_ni; |
1132 | ctx->base_ntfs_ino = NULL; | 1132 | ctx->base_ntfs_ino = NULL; |
1133 | ctx->base_mrec = NULL; | 1133 | ctx->base_mrec = NULL; |
@@ -1224,7 +1224,7 @@ static inline void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx, | |||
1224 | /* Sanity checks are performed elsewhere. */ | 1224 | /* Sanity checks are performed elsewhere. */ |
1225 | .attr = (ATTR_RECORD*)((u8*)mrec + | 1225 | .attr = (ATTR_RECORD*)((u8*)mrec + |
1226 | le16_to_cpu(mrec->attrs_offset)), | 1226 | le16_to_cpu(mrec->attrs_offset)), |
1227 | .is_first = TRUE, | 1227 | .is_first = true, |
1228 | .ntfs_ino = ni, | 1228 | .ntfs_ino = ni, |
1229 | }; | 1229 | }; |
1230 | } | 1230 | } |
@@ -1243,7 +1243,7 @@ void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx) | |||
1243 | { | 1243 | { |
1244 | if (likely(!ctx->base_ntfs_ino)) { | 1244 | if (likely(!ctx->base_ntfs_ino)) { |
1245 | /* No attribute list. */ | 1245 | /* No attribute list. */ |
1246 | ctx->is_first = TRUE; | 1246 | ctx->is_first = true; |
1247 | /* Sanity checks are performed elsewhere. */ | 1247 | /* Sanity checks are performed elsewhere. */ |
1248 | ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec + | 1248 | ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec + |
1249 | le16_to_cpu(ctx->mrec->attrs_offset)); | 1249 | le16_to_cpu(ctx->mrec->attrs_offset)); |
@@ -1585,7 +1585,7 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni, const u32 data_size) | |||
1585 | return -ENOMEM; | 1585 | return -ENOMEM; |
1586 | /* Start by allocating clusters to hold the attribute value. */ | 1586 | /* Start by allocating clusters to hold the attribute value. */ |
1587 | rl = ntfs_cluster_alloc(vol, 0, new_size >> | 1587 | rl = ntfs_cluster_alloc(vol, 0, new_size >> |
1588 | vol->cluster_size_bits, -1, DATA_ZONE, TRUE); | 1588 | vol->cluster_size_bits, -1, DATA_ZONE, true); |
1589 | if (IS_ERR(rl)) { | 1589 | if (IS_ERR(rl)) { |
1590 | err = PTR_ERR(rl); | 1590 | err = PTR_ERR(rl); |
1591 | ntfs_debug("Failed to allocate cluster%s, error code " | 1591 | ntfs_debug("Failed to allocate cluster%s, error code " |
@@ -1919,7 +1919,7 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size, | |||
1919 | unsigned long flags; | 1919 | unsigned long flags; |
1920 | int err, mp_size; | 1920 | int err, mp_size; |
1921 | u32 attr_len = 0; /* Silence stupid gcc warning. */ | 1921 | u32 attr_len = 0; /* Silence stupid gcc warning. */ |
1922 | BOOL mp_rebuilt; | 1922 | bool mp_rebuilt; |
1923 | 1923 | ||
1924 | #ifdef NTFS_DEBUG | 1924 | #ifdef NTFS_DEBUG |
1925 | read_lock_irqsave(&ni->size_lock, flags); | 1925 | read_lock_irqsave(&ni->size_lock, flags); |
@@ -2222,7 +2222,7 @@ first_alloc: | |||
2222 | rl2 = ntfs_cluster_alloc(vol, allocated_size >> vol->cluster_size_bits, | 2222 | rl2 = ntfs_cluster_alloc(vol, allocated_size >> vol->cluster_size_bits, |
2223 | (new_alloc_size - allocated_size) >> | 2223 | (new_alloc_size - allocated_size) >> |
2224 | vol->cluster_size_bits, (rl && (rl->lcn >= 0)) ? | 2224 | vol->cluster_size_bits, (rl && (rl->lcn >= 0)) ? |
2225 | rl->lcn + rl->length : -1, DATA_ZONE, TRUE); | 2225 | rl->lcn + rl->length : -1, DATA_ZONE, true); |
2226 | if (IS_ERR(rl2)) { | 2226 | if (IS_ERR(rl2)) { |
2227 | err = PTR_ERR(rl2); | 2227 | err = PTR_ERR(rl2); |
2228 | if (start < 0 || start >= allocated_size) | 2228 | if (start < 0 || start >= allocated_size) |
@@ -2265,7 +2265,7 @@ first_alloc: | |||
2265 | BUG_ON(!rl2); | 2265 | BUG_ON(!rl2); |
2266 | BUG_ON(!rl2->length); | 2266 | BUG_ON(!rl2->length); |
2267 | BUG_ON(rl2->lcn < LCN_HOLE); | 2267 | BUG_ON(rl2->lcn < LCN_HOLE); |
2268 | mp_rebuilt = FALSE; | 2268 | mp_rebuilt = false; |
2269 | /* Get the size for the new mapping pairs array for this extent. */ | 2269 | /* Get the size for the new mapping pairs array for this extent. */ |
2270 | mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll, -1); | 2270 | mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll, -1); |
2271 | if (unlikely(mp_size <= 0)) { | 2271 | if (unlikely(mp_size <= 0)) { |
@@ -2300,7 +2300,7 @@ first_alloc: | |||
2300 | err = -EOPNOTSUPP; | 2300 | err = -EOPNOTSUPP; |
2301 | goto undo_alloc; | 2301 | goto undo_alloc; |
2302 | } | 2302 | } |
2303 | mp_rebuilt = TRUE; | 2303 | mp_rebuilt = true; |
2304 | /* Generate the mapping pairs array directly into the attr record. */ | 2304 | /* Generate the mapping pairs array directly into the attr record. */ |
2305 | err = ntfs_mapping_pairs_build(vol, (u8*)a + | 2305 | err = ntfs_mapping_pairs_build(vol, (u8*)a + |
2306 | le16_to_cpu(a->data.non_resident.mapping_pairs_offset), | 2306 | le16_to_cpu(a->data.non_resident.mapping_pairs_offset), |