Skip to content

Commit 4b11111

Browse files
mslusarzLinus Torvalds
authored andcommitted
udf: fix coding style
fix coding style errors found by checkpatch: - assignments in if conditions - braces {} around single statement blocks - no spaces after commas - printks without KERN_* - lines longer than 80 characters - spaces between "type *" and variable name before: 192 errors, 561 warnings, 8987 lines checked after: 1 errors, 38 warnings, 9468 lines checked Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent bd45a42 commit 4b11111

14 files changed

Lines changed: 1306 additions & 830 deletions

File tree

‎fs/udf/balloc.c‎

Lines changed: 139 additions & 92 deletions
Large diffs are not rendered by default.

‎fs/udf/crc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +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 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)
8383
{
8484
while (size--)
8585
crc = crc_table[(crc >> 8 ^ *(data++)) & 0xffU] ^ (crc << 8);

‎fs/udf/directory.c‎

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <linux/buffer_head.h>
2020

2121
#if 0
22-
static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
22+
static uint8_t *udf_filead_read(struct inode *dir, uint8_t *tmpad,
2323
uint8_t ad_size, kernel_lb_addr fe_loc,
2424
int *pos, int *offset, struct buffer_head **bh,
2525
int *error)
@@ -45,7 +45,8 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
4545
block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
4646
if (!block)
4747
return NULL;
48-
if (!(*bh = udf_tread(dir->i_sb, block)))
48+
*bh = udf_tread(dir->i_sb, block);
49+
if (!*bh)
4950
return NULL;
5051
} else if (*offset > dir->i_sb->s_blocksize) {
5152
ad = tmpad;
@@ -57,23 +58,25 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
5758
block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
5859
if (!block)
5960
return NULL;
60-
if (!((*bh) = udf_tread(dir->i_sb, block)))
61+
(*bh) = udf_tread(dir->i_sb, block);
62+
if (!*bh)
6163
return NULL;
6264

63-
memcpy((uint8_t *)ad + remainder, (*bh)->b_data, ad_size - remainder);
65+
memcpy((uint8_t *)ad + remainder, (*bh)->b_data,
66+
ad_size - remainder);
6467
*offset = ad_size - remainder;
6568
}
6669

6770
return ad;
6871
}
6972
#endif
7073

71-
struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
74+
struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
7275
struct udf_fileident_bh *fibh,
7376
struct fileIdentDesc *cfi,
7477
struct extent_position *epos,
75-
kernel_lb_addr * eloc, uint32_t * elen,
76-
sector_t * offset)
78+
kernel_lb_addr *eloc, uint32_t *elen,
79+
sector_t *offset)
7780
{
7881
struct fileIdentDesc *fi;
7982
int i, num, block;
@@ -86,7 +89,8 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
8689
(UDF_I_EFE(dir) ?
8790
sizeof(struct extendedFileEntry) :
8891
sizeof(struct fileEntry)),
89-
dir->i_sb->s_blocksize, &(fibh->eoffset));
92+
dir->i_sb->s_blocksize,
93+
&(fibh->eoffset));
9094
if (!fi)
9195
return NULL;
9296

@@ -100,6 +104,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
100104

101105
if (fibh->eoffset == dir->i_sb->s_blocksize) {
102106
int lextoffset = epos->offset;
107+
unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits;
103108

104109
if (udf_next_aext(dir, epos, eloc, elen, 1) !=
105110
(EXT_RECORDED_ALLOCATED >> 30))
@@ -109,24 +114,27 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
109114

110115
(*offset)++;
111116

112-
if ((*offset << dir->i_sb->s_blocksize_bits) >= *elen)
117+
if ((*offset << blocksize_bits) >= *elen)
113118
*offset = 0;
114119
else
115120
epos->offset = lextoffset;
116121

117122
brelse(fibh->sbh);
118-
if (!(fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block)))
123+
fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block);
124+
if (!fibh->sbh)
119125
return NULL;
120126
fibh->soffset = fibh->eoffset = 0;
121127

122-
if (!(*offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1))) {
123-
i = 16 >> (dir->i_sb->s_blocksize_bits - 9);
124-
if (i + *offset > (*elen >> dir->i_sb->s_blocksize_bits))
125-
i = (*elen >> dir->i_sb->s_blocksize_bits)-*offset;
128+
if (!(*offset & ((16 >> (blocksize_bits - 9)) - 1))) {
129+
i = 16 >> (blocksize_bits - 9);
130+
if (i + *offset > (*elen >> blocksize_bits))
131+
i = (*elen >> blocksize_bits)-*offset;
126132
for (num = 0; i > 0; i--) {
127-
block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset + i);
133+
block = udf_get_lb_pblock(dir->i_sb, *eloc,
134+
*offset + i);
128135
tmp = udf_tgetblk(dir->i_sb, block);
129-
if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp))
136+
if (tmp && !buffer_uptodate(tmp) &&
137+
!buffer_locked(tmp))
130138
bha[num++] = tmp;
131139
else
132140
brelse(tmp);
@@ -172,20 +180,24 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
172180
fibh->soffset -= dir->i_sb->s_blocksize;
173181
fibh->eoffset -= dir->i_sb->s_blocksize;
174182

175-
if (!(fibh->ebh = udf_tread(dir->i_sb, block)))
183+
fibh->ebh = udf_tread(dir->i_sb, block);
184+
if (!fibh->ebh)
176185
return NULL;
177186

178187
if (sizeof(struct fileIdentDesc) > -fibh->soffset) {
179188
int fi_len;
180189

181190
memcpy((uint8_t *)cfi, (uint8_t *)fi, -fibh->soffset);
182-
memcpy((uint8_t *)cfi - fibh->soffset, fibh->ebh->b_data,
191+
memcpy((uint8_t *)cfi - fibh->soffset,
192+
fibh->ebh->b_data,
183193
sizeof(struct fileIdentDesc) + fibh->soffset);
184194

185-
fi_len = (sizeof(struct fileIdentDesc) + cfi->lengthFileIdent +
195+
fi_len = (sizeof(struct fileIdentDesc) +
196+
cfi->lengthFileIdent +
186197
le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3;
187198

188-
*nf_pos += ((fi_len - (fibh->eoffset - fibh->soffset)) >> 2);
199+
*nf_pos += (fi_len - (fibh->eoffset - fibh->soffset))
200+
>> 2;
189201
fibh->eoffset = fibh->soffset + fi_len;
190202
} else {
191203
memcpy((uint8_t *)cfi, (uint8_t *)fi,
@@ -210,9 +222,8 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
210222

211223
ptr = buffer;
212224

213-
if ((*offset > 0) && (*offset < bufsize)) {
225+
if ((*offset > 0) && (*offset < bufsize))
214226
ptr += *offset;
215-
}
216227
fi = (struct fileIdentDesc *)ptr;
217228
if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID) {
218229
udf_debug("0x%x != TAG_IDENT_FID\n",
@@ -222,12 +233,11 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
222233
bufsize);
223234
return NULL;
224235
}
225-
if ((*offset + sizeof(struct fileIdentDesc)) > bufsize) {
236+
if ((*offset + sizeof(struct fileIdentDesc)) > bufsize)
226237
lengthThisIdent = sizeof(struct fileIdentDesc);
227-
} else {
238+
else
228239
lengthThisIdent = sizeof(struct fileIdentDesc) +
229240
fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse);
230-
}
231241

232242
/* we need to figure padding, too! */
233243
padlen = lengthThisIdent % UDF_NAME_PAD;
@@ -258,11 +268,11 @@ static extent_ad *udf_get_fileextent(void *buffer, int bufsize, int *offset)
258268
return NULL;
259269
}
260270

261-
ptr = (uint8_t *)(fe->extendedAttr) + le32_to_cpu(fe->lengthExtendedAttr);
271+
ptr = (uint8_t *)(fe->extendedAttr) +
272+
le32_to_cpu(fe->lengthExtendedAttr);
262273

263-
if ((*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs))) {
274+
if ((*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs)))
264275
ptr += *offset;
265-
}
266276

267277
ext = (extent_ad *)ptr;
268278

@@ -283,8 +293,11 @@ short_ad *udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset,
283293

284294
if ((*offset < 0) || ((*offset + sizeof(short_ad)) > maxoffset))
285295
return NULL;
286-
else if ((sa = (short_ad *)ptr)->extLength == 0)
287-
return NULL;
296+
else {
297+
sa = (short_ad *)ptr;
298+
if (sa->extLength == 0)
299+
return NULL;
300+
}
288301

289302
if (inc)
290303
*offset += sizeof(short_ad);
@@ -302,8 +315,11 @@ long_ad *udf_get_filelongad(uint8_t *ptr, int maxoffset, int *offset, int inc)
302315

303316
if ((*offset < 0) || ((*offset + sizeof(long_ad)) > maxoffset))
304317
return NULL;
305-
else if ((la = (long_ad *)ptr)->extLength == 0)
306-
return NULL;
318+
else {
319+
la = (long_ad *)ptr;
320+
if (la->extLength == 0)
321+
return NULL;
322+
}
307323

308324
if (inc)
309325
*offset += sizeof(long_ad);

‎fs/udf/file.c‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ static int udf_adinicb_readpage(struct file *file, struct page *page)
5959
return 0;
6060
}
6161

62-
static int udf_adinicb_writepage(struct page *page, struct writeback_control *wbc)
62+
static int udf_adinicb_writepage(struct page *page,
63+
struct writeback_control *wbc)
6364
{
6465
struct inode *inode = page->mapping->host;
6566
char *kaddr;
@@ -116,7 +117,8 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
116117
else
117118
pos = ppos;
118119

119-
if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) +
120+
if (inode->i_sb->s_blocksize <
121+
(udf_file_entry_alloc_offset(inode) +
120122
pos + count)) {
121123
udf_expand_file_adinicb(inode, pos + count, &err);
122124
if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) {
@@ -191,15 +193,19 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
191193

192194
switch (cmd) {
193195
case UDF_GETVOLIDENT:
194-
return copy_to_user((char __user *)arg,
195-
UDF_SB(inode->i_sb)->s_volume_ident, 32) ? -EFAULT : 0;
196+
if (copy_to_user((char __user *)arg,
197+
UDF_SB(inode->i_sb)->s_volume_ident, 32))
198+
return -EFAULT;
199+
else
200+
return 0;
196201
case UDF_RELOCATE_BLOCKS:
197202
if (!capable(CAP_SYS_ADMIN))
198203
return -EACCES;
199204
if (get_user(old_block, (long __user *)arg))
200205
return -EFAULT;
201-
if ((result = udf_relocate_blocks(inode->i_sb,
202-
old_block, &new_block)) == 0)
206+
result = udf_relocate_blocks(inode->i_sb,
207+
old_block, &new_block);
208+
if (result == 0)
203209
result = put_user(new_block, (long __user *)arg);
204210
return result;
205211
case UDF_GETEASIZE:

‎fs/udf/ialloc.c‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
8282
UDF_I_NEXT_ALLOC_GOAL(inode) = 0;
8383
UDF_I_STRAT4096(inode) = 0;
8484

85-
block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum,
85+
block = udf_new_block(dir->i_sb, NULL,
86+
UDF_I_LOCATION(dir).partitionReferenceNum,
8687
start, err);
8788
if (*err) {
8889
iput(inode);
@@ -91,11 +92,15 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
9192

9293
mutex_lock(&sbi->s_alloc_mutex);
9394
if (sbi->s_lvid_bh) {
94-
struct logicalVolIntegrityDesc *lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data;
95-
struct logicalVolIntegrityDescImpUse *lvidiu = udf_sb_lvidiu(sbi);
95+
struct logicalVolIntegrityDesc *lvid =
96+
(struct logicalVolIntegrityDesc *)
97+
sbi->s_lvid_bh->b_data;
98+
struct logicalVolIntegrityDescImpUse *lvidiu =
99+
udf_sb_lvidiu(sbi);
96100
struct logicalVolHeaderDesc *lvhd;
97101
uint64_t uniqueID;
98-
lvhd = (struct logicalVolHeaderDesc *)(lvid->logicalVolContentsUse);
102+
lvhd = (struct logicalVolHeaderDesc *)
103+
(lvid->logicalVolContentsUse);
99104
if (S_ISDIR(mode))
100105
lvidiu->numDirs =
101106
cpu_to_le32(le32_to_cpu(lvidiu->numDirs) + 1);
@@ -119,7 +124,8 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
119124
}
120125

121126
UDF_I_LOCATION(inode).logicalBlockNum = block;
122-
UDF_I_LOCATION(inode).partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum;
127+
UDF_I_LOCATION(inode).partitionReferenceNum =
128+
UDF_I_LOCATION(dir).partitionReferenceNum;
123129
inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0);
124130
inode->i_blocks = 0;
125131
UDF_I_LENEATTR(inode) = 0;
@@ -129,10 +135,14 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
129135
UDF_I_EFE(inode) = 1;
130136
if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev)
131137
sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE;
132-
UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL);
138+
UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize -
139+
sizeof(struct extendedFileEntry),
140+
GFP_KERNEL);
133141
} else {
134142
UDF_I_EFE(inode) = 0;
135-
UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL);
143+
UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize -
144+
sizeof(struct fileEntry),
145+
GFP_KERNEL);
136146
}
137147
if (!UDF_I_DATA(inode)) {
138148
iput(inode);

0 commit comments

Comments
 (0)