Skip to content

Commit cb00ea3

Browse files
cyrillosLinus Torvalds
authored andcommitted
UDF: coding style conversion - lindent
This patch converts UDF coding style to kernel coding style using Lindent. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Jan Kara <jack@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 95a631e commit cb00ea3

23 files changed

Lines changed: 3801 additions & 3649 deletions

‎fs/udf/balloc.c‎

Lines changed: 363 additions & 346 deletions
Large diffs are not rendered by default.

‎fs/udf/crc.c‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ static uint16_t crc_table[256] = {
7979
* July 21, 1997 - Andrew E. Mileski
8080
* Adapted from OSTA-UDF(tm) 1.50 standard.
8181
*/
82-
uint16_t
83-
udf_crc(uint8_t *data, uint32_t size, uint16_t crc)
82+
uint16_t udf_crc(uint8_t * data, uint32_t size, uint16_t crc)
8483
{
8584
while (size--)
8685
crc = crc_table[(crc >> 8 ^ *(data++)) & 0xffU] ^ (crc << 8);
@@ -112,7 +111,7 @@ int main(void)
112111
return 0;
113112
}
114113

115-
#endif /* defined(TEST) */
114+
#endif /* defined(TEST) */
116115

117116
/****************************************************************************/
118117
#if defined(GENERATE)
@@ -138,7 +137,7 @@ int main(int argc, char **argv)
138137

139138
/* Get the polynomial */
140139
sscanf(argv[1], "%lo", &poly);
141-
if (poly & 0xffff0000U){
140+
if (poly & 0xffff0000U) {
142141
fprintf(stderr, "polynomial is too large\en");
143142
exit(1);
144143
}
@@ -147,27 +146,27 @@ int main(int argc, char **argv)
147146

148147
/* Create a table */
149148
printf("static unsigned short crc_table[256] = {\n");
150-
for (n = 0; n < 256; n++){
149+
for (n = 0; n < 256; n++) {
151150
if (n % 8 == 0)
152151
printf("\t");
153152
crc = n << 8;
154-
for (i = 0; i < 8; i++){
155-
if(crc & 0x8000U)
153+
for (i = 0; i < 8; i++) {
154+
if (crc & 0x8000U)
156155
crc = (crc << 1) ^ poly;
157156
else
158157
crc <<= 1;
159-
crc &= 0xFFFFU;
158+
crc &= 0xFFFFU;
160159
}
161160
if (n == 255)
162161
printf("0x%04xU ", crc);
163162
else
164163
printf("0x%04xU, ", crc);
165-
if(n % 8 == 7)
164+
if (n % 8 == 7)
166165
printf("\n");
167166
}
168167
printf("};\n");
169168

170169
return 0;
171170
}
172171

173-
#endif /* defined(GENERATE) */
172+
#endif /* defined(GENERATE) */

‎fs/udf/dir.c‎

Lines changed: 63 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ static int do_udf_readdir(struct inode *, struct file *, filldir_t, void *);
4343
/* readdir and lookup functions */
4444

4545
const struct file_operations udf_dir_operations = {
46-
.read = generic_read_dir,
47-
.readdir = udf_readdir,
48-
.ioctl = udf_ioctl,
49-
.fsync = udf_fsync_file,
46+
.read = generic_read_dir,
47+
.readdir = udf_readdir,
48+
.ioctl = udf_ioctl,
49+
.fsync = udf_fsync_file,
5050
};
5151

5252
/*
@@ -82,26 +82,26 @@ int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
8282

8383
lock_kernel();
8484

85-
if ( filp->f_pos == 0 )
86-
{
87-
if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) < 0)
88-
{
85+
if (filp->f_pos == 0) {
86+
if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) <
87+
0) {
8988
unlock_kernel();
9089
return 0;
9190
}
92-
filp->f_pos ++;
91+
filp->f_pos++;
9392
}
9493

9594
result = do_udf_readdir(dir, filp, filldir, dirent);
9695
unlock_kernel();
97-
return result;
96+
return result;
9897
}
9998

100-
static int
101-
do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *dirent)
99+
static int
100+
do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
101+
void *dirent)
102102
{
103103
struct udf_fileident_bh fibh;
104-
struct fileIdentDesc *fi=NULL;
104+
struct fileIdentDesc *fi = NULL;
105105
struct fileIdentDesc cfi;
106106
int block, iblock;
107107
loff_t nf_pos = filp->f_pos - 1;
@@ -117,73 +117,69 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
117117
sector_t offset;
118118
int i, num;
119119
unsigned int dt_type;
120-
struct extent_position epos = { NULL, 0, {0, 0}};
120+
struct extent_position epos = { NULL, 0, {0, 0} };
121121

122122
if (nf_pos >= size)
123123
return 0;
124124

125125
if (nf_pos == 0)
126126
nf_pos = (udf_ext0_offset(dir) >> 2);
127127

128-
fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
128+
fibh.soffset = fibh.eoffset =
129+
(nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
129130
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
130131
fibh.sbh = fibh.ebh = NULL;
131132
else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2),
132-
&epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30))
133-
{
133+
&epos, &eloc, &elen,
134+
&offset) == (EXT_RECORDED_ALLOCATED >> 30)) {
134135
block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
135-
if ((++offset << dir->i_sb->s_blocksize_bits) < elen)
136-
{
136+
if ((++offset << dir->i_sb->s_blocksize_bits) < elen) {
137137
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
138138
epos.offset -= sizeof(short_ad);
139139
else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
140140
epos.offset -= sizeof(long_ad);
141-
}
142-
else
141+
} else
143142
offset = 0;
144143

145-
if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block)))
146-
{
144+
if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block))) {
147145
brelse(epos.bh);
148146
return -EIO;
149147
}
150-
151-
if (!(offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9))-1)))
152-
{
148+
149+
if (!(offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1))) {
153150
i = 16 >> (dir->i_sb->s_blocksize_bits - 9);
154-
if (i+offset > (elen >> dir->i_sb->s_blocksize_bits))
155-
i = (elen >> dir->i_sb->s_blocksize_bits)-offset;
156-
for (num=0; i>0; i--)
157-
{
158-
block = udf_get_lb_pblock(dir->i_sb, eloc, offset+i);
151+
if (i + offset > (elen >> dir->i_sb->s_blocksize_bits))
152+
i = (elen >> dir->i_sb->s_blocksize_bits) -
153+
offset;
154+
for (num = 0; i > 0; i--) {
155+
block =
156+
udf_get_lb_pblock(dir->i_sb, eloc,
157+
offset + i);
159158
tmp = udf_tgetblk(dir->i_sb, block);
160-
if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp))
159+
if (tmp && !buffer_uptodate(tmp)
160+
&& !buffer_locked(tmp))
161161
bha[num++] = tmp;
162162
else
163163
brelse(tmp);
164164
}
165-
if (num)
166-
{
165+
if (num) {
167166
ll_rw_block(READA, num, bha);
168-
for (i=0; i<num; i++)
167+
for (i = 0; i < num; i++)
169168
brelse(bha[i]);
170169
}
171170
}
172-
}
173-
else
174-
{
171+
} else {
175172
brelse(epos.bh);
176173
return -ENOENT;
177174
}
178175

179-
while ( nf_pos < size )
180-
{
176+
while (nf_pos < size) {
181177
filp->f_pos = nf_pos + 1;
182178

183-
fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc, &elen, &offset);
179+
fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc,
180+
&elen, &offset);
184181

185-
if (!fi)
186-
{
182+
if (!fi) {
187183
if (fibh.sbh != fibh.ebh)
188184
brelse(fibh.ebh);
189185
brelse(fibh.sbh);
@@ -196,62 +192,60 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
196192

197193
if (fibh.sbh == fibh.ebh)
198194
nameptr = fi->fileIdent + liu;
199-
else
200-
{
195+
else {
201196
int poffset; /* Unpaded ending offset */
202197

203-
poffset = fibh.soffset + sizeof(struct fileIdentDesc) + liu + lfi;
198+
poffset =
199+
fibh.soffset + sizeof(struct fileIdentDesc) + liu +
200+
lfi;
204201

205202
if (poffset >= lfi)
206-
nameptr = (char *)(fibh.ebh->b_data + poffset - lfi);
207-
else
208-
{
203+
nameptr =
204+
(char *)(fibh.ebh->b_data + poffset - lfi);
205+
else {
209206
nameptr = fname;
210-
memcpy(nameptr, fi->fileIdent + liu, lfi - poffset);
211-
memcpy(nameptr + lfi - poffset, fibh.ebh->b_data, poffset);
207+
memcpy(nameptr, fi->fileIdent + liu,
208+
lfi - poffset);
209+
memcpy(nameptr + lfi - poffset,
210+
fibh.ebh->b_data, poffset);
212211
}
213212
}
214213

215-
if ( (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0 )
216-
{
217-
if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE) )
214+
if ((cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0) {
215+
if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE))
218216
continue;
219217
}
220-
221-
if ( (cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0 )
222-
{
223-
if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE) )
218+
219+
if ((cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0) {
220+
if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE))
224221
continue;
225222
}
226223

227-
if ( cfi.fileCharacteristics & FID_FILE_CHAR_PARENT )
228-
{
224+
if (cfi.fileCharacteristics & FID_FILE_CHAR_PARENT) {
229225
iblock = parent_ino(filp->f_path.dentry);
230226
flen = 2;
231227
memcpy(fname, "..", flen);
232228
dt_type = DT_DIR;
233-
}
234-
else
235-
{
229+
} else {
236230
kernel_lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation);
237231

238232
iblock = udf_get_lb_pblock(dir->i_sb, tloc, 0);
239233
flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
240234
dt_type = DT_UNKNOWN;
241235
}
242236

243-
if (flen)
244-
{
245-
if (filldir(dirent, fname, flen, filp->f_pos, iblock, dt_type) < 0)
246-
{
237+
if (flen) {
238+
if (filldir
239+
(dirent, fname, flen, filp->f_pos, iblock,
240+
dt_type) < 0) {
247241
if (fibh.sbh != fibh.ebh)
248242
brelse(fibh.ebh);
249243
brelse(fibh.sbh);
250244
brelse(epos.bh);
251-
return 0;
245+
return 0;
252246
}
253247
}
254-
} /* end while */
248+
} /* end while */
255249

256250
filp->f_pos = nf_pos + 1;
257251

0 commit comments

Comments
 (0)