diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-02-08 04:20:36 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 09:22:35 -0800 |
commit | 4b11111aba6c80cc2969fd1806d2a869bfc9f357 (patch) | |
tree | 57b72a1ca58859dc6a9e47d647f29cebb9bcf7e0 /fs/udf/partition.c | |
parent | bd45a420f93d18c91115f3f0568dd6a2555aa15a (diff) |
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>
Diffstat (limited to 'fs/udf/partition.c')
-rw-r--r-- | fs/udf/partition.c | 160 |
1 files changed, 104 insertions, 56 deletions
diff --git a/fs/udf/partition.c b/fs/udf/partition.c index eeb4714b3641..027c879969f1 100644 --- a/fs/udf/partition.c +++ b/fs/udf/partition.c @@ -34,8 +34,8 @@ inline uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, struct udf_sb_info *sbi = UDF_SB(sb); struct udf_part_map *map; if (partition >= sbi->s_partitions) { - udf_debug("block=%d, partition=%d, offset=%d: invalid partition\n", - block, partition, offset); + udf_debug("block=%d, partition=%d, offset=%d: " + "invalid partition\n", block, partition, offset); return 0xFFFFFFFF; } map = &sbi->s_partmaps[partition]; @@ -54,13 +54,15 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, uint32_t loc; struct udf_sb_info *sbi = UDF_SB(sb); struct udf_part_map *map; + struct udf_virtual_data *vdata; map = &sbi->s_partmaps[partition]; - index = (sb->s_blocksize - map->s_type_specific.s_virtual.s_start_offset) / sizeof(uint32_t); + vdata = &map->s_type_specific.s_virtual; + index = (sb->s_blocksize - vdata->s_start_offset) / sizeof(uint32_t); - if (block > map->s_type_specific.s_virtual.s_num_entries) { - udf_debug("Trying to access block beyond end of VAT (%d max %d)\n", - block, map->s_type_specific.s_virtual.s_num_entries); + if (block > vdata->s_num_entries) { + udf_debug("Trying to access block beyond end of VAT " + "(%d max %d)\n", block, vdata->s_num_entries); return 0xFFFFFFFF; } @@ -70,12 +72,13 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, index = block % (sb->s_blocksize / sizeof(uint32_t)); } else { newblock = 0; - index = map->s_type_specific.s_virtual.s_start_offset / sizeof(uint32_t) + block; + index = vdata->s_start_offset / sizeof(uint32_t) + block; } loc = udf_block_map(sbi->s_vat_inode, newblock); - if (!(bh = sb_bread(sb, loc))) { + bh = sb_bread(sb, loc); + if (!bh) { udf_debug("get_pblock(UDF_VIRTUAL_MAP:%p,%d,%d) VAT: %d[%d]\n", sb, block, partition, loc, index); return 0xFFFFFFFF; @@ -85,17 +88,19 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, brelse(bh); - if (UDF_I_LOCATION(sbi->s_vat_inode).partitionReferenceNum == partition) { + if (UDF_I_LOCATION(sbi->s_vat_inode).partitionReferenceNum == + partition) { udf_debug("recursive call to udf_get_pblock!\n"); return 0xFFFFFFFF; } return udf_get_pblock(sb, loc, - UDF_I_LOCATION(sbi->s_vat_inode).partitionReferenceNum, + UDF_I_LOCATION(sbi->s_vat_inode). + partitionReferenceNum, offset); } -inline uint32_t udf_get_pblock_virt20(struct super_block * sb, uint32_t block, +inline uint32_t udf_get_pblock_virt20(struct super_block *sb, uint32_t block, uint16_t partition, uint32_t offset) { return udf_get_pblock_virt15(sb, block, partition, offset); @@ -109,27 +114,32 @@ uint32_t udf_get_pblock_spar15(struct super_block *sb, uint32_t block, struct udf_sb_info *sbi = UDF_SB(sb); struct udf_part_map *map; uint32_t packet; + struct udf_sparing_data *sdata; map = &sbi->s_partmaps[partition]; - packet = (block + offset) & ~(map->s_type_specific.s_sparing.s_packet_len - 1); + sdata = &map->s_type_specific.s_sparing; + packet = (block + offset) & ~(sdata->s_packet_len - 1); for (i = 0; i < 4; i++) { - if (map->s_type_specific.s_sparing.s_spar_map[i] != NULL) { - st = (struct sparingTable *)map->s_type_specific.s_sparing.s_spar_map[i]->b_data; + if (sdata->s_spar_map[i] != NULL) { + st = (struct sparingTable *) + sdata->s_spar_map[i]->b_data; break; } } if (st) { for (i = 0; i < le16_to_cpu(st->reallocationTableLen); i++) { - if (le32_to_cpu(st->mapEntry[i].origLocation) >= 0xFFFFFFF0) { + struct sparingEntry *entry = &st->mapEntry[i]; + u32 origLoc = le32_to_cpu(entry->origLocation); + if (origLoc >= 0xFFFFFFF0) break; - } else if (le32_to_cpu(st->mapEntry[i].origLocation) == packet) { - return le32_to_cpu(st->mapEntry[i].mappedLocation) + - ((block + offset) & (map->s_type_specific.s_sparing.s_packet_len - 1)); - } else if (le32_to_cpu(st->mapEntry[i].origLocation) > packet) { + else if (origLoc == packet) + return le32_to_cpu(entry->mappedLocation) + + ((block + offset) & + (sdata->s_packet_len - 1)); + else if (origLoc > packet) break; - } } } @@ -144,63 +154,101 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) uint32_t packet; int i, j, k, l; struct udf_sb_info *sbi = UDF_SB(sb); + u16 reallocationTableLen; + struct buffer_head *bh; for (i = 0; i < sbi->s_partitions; i++) { struct udf_part_map *map = &sbi->s_partmaps[i]; if (old_block > map->s_partition_root && old_block < map->s_partition_root + map->s_partition_len) { sdata = &map->s_type_specific.s_sparing; - packet = (old_block - map->s_partition_root) & ~(sdata->s_packet_len - 1); + packet = (old_block - map->s_partition_root) & + ~(sdata->s_packet_len - 1); - for (j = 0; j < 4; j++) { - if (map->s_type_specific.s_sparing.s_spar_map[j] != NULL) { - st = (struct sparingTable *)sdata->s_spar_map[j]->b_data; + for (j = 0; j < 4; j++) + if (sdata->s_spar_map[j] != NULL) { + st = (struct sparingTable *) + sdata->s_spar_map[j]->b_data; break; } - } if (!st) return 1; - for (k = 0; k < le16_to_cpu(st->reallocationTableLen); k++) { - if (le32_to_cpu(st->mapEntry[k].origLocation) == 0xFFFFFFFF) { + reallocationTableLen = + le16_to_cpu(st->reallocationTableLen); + for (k = 0; k < reallocationTableLen; k++) { + struct sparingEntry *entry = &st->mapEntry[k]; + u32 origLoc = le32_to_cpu(entry->origLocation); + + if (origLoc == 0xFFFFFFFF) { for (; j < 4; j++) { - if (sdata->s_spar_map[j]) { - st = (struct sparingTable *)sdata->s_spar_map[j]->b_data; - st->mapEntry[k].origLocation = cpu_to_le32(packet); - udf_update_tag((char *)st, sizeof(struct sparingTable) + le16_to_cpu(st->reallocationTableLen) * sizeof(struct sparingEntry)); - mark_buffer_dirty(sdata->s_spar_map[j]); - } + int len; + bh = sdata->s_spar_map[j]; + if (!bh) + continue; + + st = (struct sparingTable *) + bh->b_data; + entry->origLocation = + cpu_to_le32(packet); + len = + sizeof(struct sparingTable) + + reallocationTableLen * + sizeof(struct sparingEntry); + udf_update_tag((char *)st, len); + mark_buffer_dirty(bh); } - *new_block = le32_to_cpu(st->mapEntry[k].mappedLocation) + - ((old_block - map->s_partition_root) & (sdata->s_packet_len - 1)); + *new_block = le32_to_cpu( + entry->mappedLocation) + + ((old_block - + map->s_partition_root) & + (sdata->s_packet_len - 1)); return 0; - } else if (le32_to_cpu(st->mapEntry[k].origLocation) == packet) { - *new_block = le32_to_cpu(st->mapEntry[k].mappedLocation) + - ((old_block - map->s_partition_root) & (sdata->s_packet_len - 1)); + } else if (origLoc == packet) { + *new_block = le32_to_cpu( + entry->mappedLocation) + + ((old_block - + map->s_partition_root) & + (sdata->s_packet_len - 1)); return 0; - } else if (le32_to_cpu(st->mapEntry[k].origLocation) > packet) { + } else if (origLoc > packet) break; - } } - for (l = k; l < le16_to_cpu(st->reallocationTableLen); l++) { - if (le32_to_cpu(st->mapEntry[l].origLocation) == 0xFFFFFFFF) { - for (; j < 4; j++) { - if (sdata->s_spar_map[j]) { - st = (struct sparingTable *)sdata->s_spar_map[j]->b_data; - mapEntry = st->mapEntry[l]; - mapEntry.origLocation = cpu_to_le32(packet); - memmove(&st->mapEntry[k + 1], &st->mapEntry[k], (l - k) * sizeof(struct sparingEntry)); - st->mapEntry[k] = mapEntry; - udf_update_tag((char *)st, sizeof(struct sparingTable) + le16_to_cpu(st->reallocationTableLen) * sizeof(struct sparingEntry)); - mark_buffer_dirty(sdata->s_spar_map[j]); - } - } - *new_block = le32_to_cpu(st->mapEntry[k].mappedLocation) + - ((old_block - map->s_partition_root) & (sdata->s_packet_len - 1)); - return 0; + for (l = k; l < reallocationTableLen; l++) { + struct sparingEntry *entry = &st->mapEntry[l]; + u32 origLoc = le32_to_cpu(entry->origLocation); + + if (origLoc != 0xFFFFFFFF) + continue; + + for (; j < 4; j++) { + bh = sdata->s_spar_map[j]; + if (!bh) + continue; + + st = (struct sparingTable *)bh->b_data; + mapEntry = st->mapEntry[l]; + mapEntry.origLocation = + cpu_to_le32(packet); + memmove(&st->mapEntry[k + 1], + &st->mapEntry[k], + (l - k) * + sizeof(struct sparingEntry)); + st->mapEntry[k] = mapEntry; + udf_update_tag((char *)st, + sizeof(struct sparingTable) + + reallocationTableLen * + sizeof(struct sparingEntry)); + mark_buffer_dirty(bh); } + *new_block = + le32_to_cpu( + st->mapEntry[k].mappedLocation) + + ((old_block - map->s_partition_root) & + (sdata->s_packet_len - 1)); + return 0; } return 1; |