Skip to content

Commit c49c311

Browse files
Richard KnutssonLinus Torvalds
authored andcommitted
[PATCH] fs/ntfs: Conversion to generic boolean
Conversion of booleans to: generic-boolean.patch (2006-08-23) Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se> Signed-off-by: Anton Altaparmakov <aia21@cantab.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 6e21828 commit c49c311

28 files changed

Lines changed: 326 additions & 331 deletions

‎fs/ntfs/aops.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static int ntfs_read_block(struct page *page)
254254
bh->b_bdev = vol->sb->s_bdev;
255255
/* Is the block within the allowed limits? */
256256
if (iblock < lblock) {
257-
BOOL is_retry = FALSE;
257+
bool is_retry = false;
258258

259259
/* Convert iblock into corresponding vcn and offset. */
260260
vcn = (VCN)iblock << blocksize_bits >>
@@ -292,7 +292,7 @@ static int ntfs_read_block(struct page *page)
292292
goto handle_hole;
293293
/* If first try and runlist unmapped, map and retry. */
294294
if (!is_retry && lcn == LCN_RL_NOT_MAPPED) {
295-
is_retry = TRUE;
295+
is_retry = true;
296296
/*
297297
* Attempt to map runlist, dropping lock for
298298
* the duration.
@@ -558,7 +558,7 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc)
558558
unsigned long flags;
559559
unsigned int blocksize, vcn_ofs;
560560
int err;
561-
BOOL need_end_writeback;
561+
bool need_end_writeback;
562562
unsigned char blocksize_bits;
563563

564564
vi = page->mapping->host;
@@ -626,7 +626,7 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc)
626626
rl = NULL;
627627
err = 0;
628628
do {
629-
BOOL is_retry = FALSE;
629+
bool is_retry = false;
630630

631631
if (unlikely(block >= dblock)) {
632632
/*
@@ -768,7 +768,7 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc)
768768
}
769769
/* If first try and runlist unmapped, map and retry. */
770770
if (!is_retry && lcn == LCN_RL_NOT_MAPPED) {
771-
is_retry = TRUE;
771+
is_retry = true;
772772
/*
773773
* Attempt to map runlist, dropping lock for
774774
* the duration.
@@ -874,12 +874,12 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc)
874874
set_page_writeback(page); /* Keeps try_to_free_buffers() away. */
875875

876876
/* Submit the prepared buffers for i/o. */
877-
need_end_writeback = TRUE;
877+
need_end_writeback = true;
878878
do {
879879
struct buffer_head *next = bh->b_this_page;
880880
if (buffer_async_write(bh)) {
881881
submit_bh(WRITE, bh);
882-
need_end_writeback = FALSE;
882+
need_end_writeback = false;
883883
}
884884
bh = next;
885885
} while (bh != head);
@@ -932,7 +932,7 @@ static int ntfs_write_mst_block(struct page *page,
932932
runlist_element *rl;
933933
int i, nr_locked_nis, nr_recs, nr_bhs, max_bhs, bhs_per_rec, err, err2;
934934
unsigned bh_size, rec_size_bits;
935-
BOOL sync, is_mft, page_is_dirty, rec_is_dirty;
935+
bool sync, is_mft, page_is_dirty, rec_is_dirty;
936936
unsigned char bh_size_bits;
937937

938938
ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, page index "
@@ -975,10 +975,10 @@ static int ntfs_write_mst_block(struct page *page,
975975

976976
rl = NULL;
977977
err = err2 = nr_bhs = nr_recs = nr_locked_nis = 0;
978-
page_is_dirty = rec_is_dirty = FALSE;
978+
page_is_dirty = rec_is_dirty = false;
979979
rec_start_bh = NULL;
980980
do {
981-
BOOL is_retry = FALSE;
981+
bool is_retry = false;
982982

983983
if (likely(block < rec_block)) {
984984
if (unlikely(block >= dblock)) {
@@ -1009,10 +1009,10 @@ static int ntfs_write_mst_block(struct page *page,
10091009
}
10101010
if (!buffer_dirty(bh)) {
10111011
/* Clean records are not written out. */
1012-
rec_is_dirty = FALSE;
1012+
rec_is_dirty = false;
10131013
continue;
10141014
}
1015-
rec_is_dirty = TRUE;
1015+
rec_is_dirty = true;
10161016
rec_start_bh = bh;
10171017
}
10181018
/* Need to map the buffer if it is not mapped already. */
@@ -1053,7 +1053,7 @@ static int ntfs_write_mst_block(struct page *page,
10531053
*/
10541054
if (!is_mft && !is_retry &&
10551055
lcn == LCN_RL_NOT_MAPPED) {
1056-
is_retry = TRUE;
1056+
is_retry = true;
10571057
/*
10581058
* Attempt to map runlist, dropping
10591059
* lock for the duration.
@@ -1063,7 +1063,7 @@ static int ntfs_write_mst_block(struct page *page,
10631063
if (likely(!err2))
10641064
goto lock_retry_remap;
10651065
if (err2 == -ENOMEM)
1066-
page_is_dirty = TRUE;
1066+
page_is_dirty = true;
10671067
lcn = err2;
10681068
} else {
10691069
err2 = -EIO;
@@ -1145,7 +1145,7 @@ static int ntfs_write_mst_block(struct page *page,
11451145
* means we need to redirty the page before
11461146
* returning.
11471147
*/
1148-
page_is_dirty = TRUE;
1148+
page_is_dirty = true;
11491149
/*
11501150
* Remove the buffers in this mft record from
11511151
* the list of buffers to write.

‎fs/ntfs/aops.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static inline void ntfs_unmap_page(struct page *page)
8080
*
8181
* The unlocked and uptodate page is returned on success or an encoded error
8282
* on failure. Caller has to test for error using the IS_ERR() macro on the
83-
* return value. If that evaluates to TRUE, the negative error code can be
83+
* return value. If that evaluates to 'true', the negative error code can be
8484
* obtained using PTR_ERR() on the return value of ntfs_map_page().
8585
*/
8686
static inline struct page *ntfs_map_page(struct address_space *mapping,

‎fs/ntfs/attrib.c‎

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
* the attribute has zero allocated size, i.e. there simply is no runlist.
6868
*
6969
* 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
7171
* is no longer valid, i.e. you need to either call
7272
* ntfs_attr_reinit_search_ctx() or ntfs_attr_put_search_ctx() on it.
7373
* 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)
9090
runlist_element *rl;
9191
struct page *put_this_page = NULL;
9292
int err = 0;
93-
BOOL ctx_is_temporary, ctx_needs_reset;
93+
bool ctx_is_temporary, ctx_needs_reset;
9494
ntfs_attr_search_ctx old_ctx = { NULL, };
9595

9696
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)
100100
else
101101
base_ni = ni->ext.base_ntfs_ino;
102102
if (!ctx) {
103-
ctx_is_temporary = ctx_needs_reset = TRUE;
103+
ctx_is_temporary = ctx_needs_reset = true;
104104
m = map_mft_record(base_ni);
105105
if (IS_ERR(m))
106106
return PTR_ERR(m);
@@ -115,7 +115,7 @@ int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx)
115115
BUG_ON(IS_ERR(ctx->mrec));
116116
a = ctx->attr;
117117
BUG_ON(!a->non_resident);
118-
ctx_is_temporary = FALSE;
118+
ctx_is_temporary = false;
119119
end_vcn = sle64_to_cpu(a->data.non_resident.highest_vcn);
120120
read_lock_irqsave(&ni->size_lock, flags);
121121
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)
136136
ni->name, ni->name_len) &&
137137
sle64_to_cpu(a->data.non_resident.lowest_vcn)
138138
<= vcn && end_vcn >= vcn))
139-
ctx_needs_reset = FALSE;
139+
ctx_needs_reset = false;
140140
else {
141141
/* Save the old search context. */
142142
old_ctx = *ctx;
@@ -158,7 +158,7 @@ int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx)
158158
* needed attribute extent.
159159
*/
160160
ntfs_attr_reinit_search_ctx(ctx);
161-
ctx_needs_reset = TRUE;
161+
ctx_needs_reset = true;
162162
}
163163
}
164164
if (ctx_needs_reset) {
@@ -336,16 +336,16 @@ int ntfs_map_runlist(ntfs_inode *ni, VCN vcn)
336336
* LCN_EIO Critical error (runlist/file is corrupt, i/o error, etc).
337337
*
338338
* 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,
340340
* the lock may be dropped inside the function so you cannot rely on
341341
* the runlist still being the same when this function returns.
342342
*/
343343
LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn,
344-
const BOOL write_locked)
344+
const bool write_locked)
345345
{
346346
LCN lcn;
347347
unsigned long flags;
348-
BOOL is_retry = FALSE;
348+
bool is_retry = false;
349349

350350
ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, %s_locked.",
351351
ni->mft_no, (unsigned long long)vcn,
@@ -390,7 +390,7 @@ LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn,
390390
down_read(&ni->runlist.lock);
391391
}
392392
if (likely(!err)) {
393-
is_retry = TRUE;
393+
is_retry = true;
394394
goto retry_remap;
395395
}
396396
if (err == -ENOENT)
@@ -449,7 +449,7 @@ LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn,
449449
* -EIO - Critical error (runlist/file is corrupt, i/o error, etc).
450450
*
451451
* 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
453453
* is no longer valid, i.e. you need to either call
454454
* ntfs_attr_reinit_search_ctx() or ntfs_attr_put_search_ctx() on it.
455455
* 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,
469469
unsigned long flags;
470470
runlist_element *rl;
471471
int err = 0;
472-
BOOL is_retry = FALSE;
472+
bool is_retry = false;
473473

474474
ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, with%s ctx.",
475475
ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out");
@@ -518,7 +518,7 @@ runlist_element *ntfs_attr_find_vcn_nolock(ntfs_inode *ni, const VCN vcn,
518518
*/
519519
err = ntfs_map_runlist_nolock(ni, vcn, ctx);
520520
if (likely(!err)) {
521-
is_retry = TRUE;
521+
is_retry = true;
522522
goto retry_remap;
523523
}
524524
}
@@ -558,8 +558,8 @@ runlist_element *ntfs_attr_find_vcn_nolock(ntfs_inode *ni, const VCN vcn,
558558
* On actual error, ntfs_attr_find() returns -EIO. In this case @ctx->attr is
559559
* undefined and in particular do not rely on it not changing.
560560
*
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.
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.
563563
*
564564
* If @ic is IGNORE_CASE, the @name comparisson is not case sensitive and
565565
* @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,
599599

600600
/*
601601
* 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'.
603603
*/
604604
if (ctx->is_first) {
605605
a = ctx->attr;
606-
ctx->is_first = FALSE;
606+
ctx->is_first = false;
607607
} else
608608
a = (ATTR_RECORD*)((u8*)ctx->attr +
609609
le32_to_cpu(ctx->attr->length));
@@ -890,11 +890,11 @@ static int ntfs_external_attr_find(const ATTR_TYPE type,
890890
ctx->al_entry = (ATTR_LIST_ENTRY*)al_start;
891891
/*
892892
* 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'.
894894
*/
895895
if (ctx->is_first) {
896896
al_entry = ctx->al_entry;
897-
ctx->is_first = FALSE;
897+
ctx->is_first = false;
898898
} else
899899
al_entry = (ATTR_LIST_ENTRY*)((u8*)ctx->al_entry +
900900
le16_to_cpu(ctx->al_entry->length));
@@ -1127,7 +1127,7 @@ static int ntfs_external_attr_find(const ATTR_TYPE type,
11271127
ctx->mrec = ctx->base_mrec;
11281128
ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec +
11291129
le16_to_cpu(ctx->mrec->attrs_offset));
1130-
ctx->is_first = TRUE;
1130+
ctx->is_first = true;
11311131
ctx->ntfs_ino = base_ni;
11321132
ctx->base_ntfs_ino = NULL;
11331133
ctx->base_mrec = NULL;
@@ -1224,7 +1224,7 @@ static inline void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx,
12241224
/* Sanity checks are performed elsewhere. */
12251225
.attr = (ATTR_RECORD*)((u8*)mrec +
12261226
le16_to_cpu(mrec->attrs_offset)),
1227-
.is_first = TRUE,
1227+
.is_first = true,
12281228
.ntfs_ino = ni,
12291229
};
12301230
}
@@ -1243,7 +1243,7 @@ void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx)
12431243
{
12441244
if (likely(!ctx->base_ntfs_ino)) {
12451245
/* No attribute list. */
1246-
ctx->is_first = TRUE;
1246+
ctx->is_first = true;
12471247
/* Sanity checks are performed elsewhere. */
12481248
ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec +
12491249
le16_to_cpu(ctx->mrec->attrs_offset));
@@ -1585,7 +1585,7 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni, const u32 data_size)
15851585
return -ENOMEM;
15861586
/* Start by allocating clusters to hold the attribute value. */
15871587
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);
15891589
if (IS_ERR(rl)) {
15901590
err = PTR_ERR(rl);
15911591
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,
19191919
unsigned long flags;
19201920
int err, mp_size;
19211921
u32 attr_len = 0; /* Silence stupid gcc warning. */
1922-
BOOL mp_rebuilt;
1922+
bool mp_rebuilt;
19231923

19241924
#ifdef NTFS_DEBUG
19251925
read_lock_irqsave(&ni->size_lock, flags);
@@ -2222,7 +2222,7 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size,
22222222
rl2 = ntfs_cluster_alloc(vol, allocated_size >> vol->cluster_size_bits,
22232223
(new_alloc_size - allocated_size) >>
22242224
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);
22262226
if (IS_ERR(rl2)) {
22272227
err = PTR_ERR(rl2);
22282228
if (start < 0 || start >= allocated_size)
@@ -2265,7 +2265,7 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size,
22652265
BUG_ON(!rl2);
22662266
BUG_ON(!rl2->length);
22672267
BUG_ON(rl2->lcn < LCN_HOLE);
2268-
mp_rebuilt = FALSE;
2268+
mp_rebuilt = false;
22692269
/* Get the size for the new mapping pairs array for this extent. */
22702270
mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll, -1);
22712271
if (unlikely(mp_size <= 0)) {
@@ -2300,7 +2300,7 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size,
23002300
err = -EOPNOTSUPP;
23012301
goto undo_alloc;
23022302
}
2303-
mp_rebuilt = TRUE;
2303+
mp_rebuilt = true;
23042304
/* Generate the mapping pairs array directly into the attr record. */
23052305
err = ntfs_mapping_pairs_build(vol, (u8*)a +
23062306
le16_to_cpu(a->data.non_resident.mapping_pairs_offset),

‎fs/ntfs/attrib.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
* Structure must be initialized to zero before the first call to one of the
4141
* attribute search functions. Initialize @mrec to point to the mft record to
4242
* search, and @attr to point to the first attribute within @mrec (not necessary
43-
* if calling the _first() functions), and set @is_first to TRUE (not necessary
43+
* if calling the _first() functions), and set @is_first to 'true' (not necessary
4444
* if calling the _first() functions).
4545
*
46-
* If @is_first is TRUE, the search begins with @attr. If @is_first is FALSE,
46+
* If @is_first is 'true', the search begins with @attr. If @is_first is 'false',
4747
* the search begins after @attr. This is so that, after the first call to one
4848
* of the search attribute functions, we can call the function again, without
4949
* any modification of the search context, to automagically get the next
@@ -52,7 +52,7 @@
5252
typedef struct {
5353
MFT_RECORD *mrec;
5454
ATTR_RECORD *attr;
55-
BOOL is_first;
55+
bool is_first;
5656
ntfs_inode *ntfs_ino;
5757
ATTR_LIST_ENTRY *al_entry;
5858
ntfs_inode *base_ntfs_ino;
@@ -65,7 +65,7 @@ extern int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn,
6565
extern int ntfs_map_runlist(ntfs_inode *ni, VCN vcn);
6666

6767
extern LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn,
68-
const BOOL write_locked);
68+
const bool write_locked);
6969

7070
extern runlist_element *ntfs_attr_find_vcn_nolock(ntfs_inode *ni,
7171
const VCN vcn, ntfs_attr_search_ctx *ctx);

0 commit comments

Comments
 (0)