Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a71fc5d authored by Marcin Slusarz's avatar Marcin Slusarz Committed by Linus Torvalds
Browse files

udf: fix coding style of super.c



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
before: total: 50 errors, 207 warnings, 1835 lines checked
after:  total: 0 errors, 164 warnings, 1872 lines checked

all 164 warnings left are lines longer than 80 characters;
this file has too much indentation with really long expressions
to break all those lines now; will fix later

Signed-off-by: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
Cc: Ben Fennema <bfennema@falcon.csc.calpoly.edu>
Acked-by: default avatarJan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 74bedc4d
Loading
Loading
Loading
Loading
+166 −129
Original line number Diff line number Diff line
@@ -33,8 +33,8 @@
 *  10/17/98      added freespace count for "df"
 *  11/11/98 gr   added novrs option
 *  11/26/98 dgb  added fileset,anchor mount options
 *  12/06/98 blf  really hosed things royally. vat/sparing support. sequenced vol descs
 *                rewrote option handling based on isofs
 *  12/06/98 blf  really hosed things royally. vat/sparing support. sequenced
 *                vol descs. rewrote option handling based on isofs
 *  12/20/98      find the free space bitmap (if it exists)
 */

@@ -116,7 +116,7 @@ static struct kmem_cache *udf_inode_cachep;
static struct inode *udf_alloc_inode(struct super_block *sb)
{
	struct udf_inode_info *ei;
	ei = (struct udf_inode_info *)kmem_cache_alloc(udf_inode_cachep, GFP_KERNEL);
	ei = kmem_cache_alloc(udf_inode_cachep, GFP_KERNEL);
	if (!ei)
		return NULL;

@@ -566,42 +566,47 @@ static int udf_vrs(struct super_block *sb, int silent)
		if (vsd->stdIdent[0] == 0) {
			brelse(bh);
			break;
		} else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN)) {
		} else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001,
				    VSD_STD_ID_LEN)) {
			iso9660 = sector;
			switch (vsd->structType) {
			case 0:
				udf_debug("ISO9660 Boot Record found\n");
				break;
			case 1:
				udf_debug
				    ("ISO9660 Primary Volume Descriptor found\n");
				udf_debug("ISO9660 Primary Volume Descriptor "
					  "found\n");
				break;
			case 2:
				udf_debug
				    ("ISO9660 Supplementary Volume Descriptor found\n");
				udf_debug("ISO9660 Supplementary Volume "
					  "Descriptor found\n");
				break;
			case 3:
				udf_debug
				    ("ISO9660 Volume Partition Descriptor found\n");
				udf_debug("ISO9660 Volume Partition Descriptor "
					  "found\n");
				break;
			case 255:
				udf_debug
				    ("ISO9660 Volume Descriptor Set Terminator found\n");
				udf_debug("ISO9660 Volume Descriptor Set "
					  "Terminator found\n");
				break;
			default:
				udf_debug("ISO9660 VRS (%u) found\n",
					  vsd->structType);
				break;
			}
		} else if (!strncmp(vsd->stdIdent, VSD_STD_ID_BEA01, VSD_STD_ID_LEN)) {
		} else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01, VSD_STD_ID_LEN)) {
		} else if (!strncmp(vsd->stdIdent, VSD_STD_ID_BEA01,
				    VSD_STD_ID_LEN))
			; /* nothing */
		else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01,
				    VSD_STD_ID_LEN)) {
			brelse(bh);
			break;
		} else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN)) {
		} else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02,
				    VSD_STD_ID_LEN))
			nsr02 = sector;
		} else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR03, VSD_STD_ID_LEN)) {
		else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR03,
				    VSD_STD_ID_LEN))
			nsr03 = sector;
		}
		brelse(bh);
	}

@@ -658,21 +663,26 @@ static void udf_find_anchor(struct super_block *sb)
		 *  however, if the disc isn't closed, it could be 512 */

		for (i = 0; !lastblock && i < ARRAY_SIZE(last); i++) {
			if (last[i] < 0 || !(bh = sb_bread(sb, last[i]))) {
			ident = location = 0;
			} else {
				ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
				location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
			if (last[i] >= 0) {
				bh = sb_bread(sb, last[i]);
				if (bh) {
					tag *t = (tag *)bh->b_data;
					ident = le16_to_cpu(t->tagIdent);
					location = le32_to_cpu(t->tagLocation);
					brelse(bh);
				}
			}

			if (ident == TAG_IDENT_AVDP) {
				if (location == last[i] - UDF_SB_SESSION(sb)) {
					lastblock = UDF_SB_ANCHOR(sb)[0] = last[i] - UDF_SB_SESSION(sb);
					UDF_SB_ANCHOR(sb)[1] = last[i] - 256 - UDF_SB_SESSION(sb);
					lastblock = last[i] - UDF_SB_SESSION(sb);
					UDF_SB_ANCHOR(sb)[0] = lastblock;
					UDF_SB_ANCHOR(sb)[1] = lastblock - 256;
				} else if (location == udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb)) {
					UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
					lastblock = UDF_SB_ANCHOR(sb)[0] = udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb);
					lastblock = udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb);
					UDF_SB_ANCHOR(sb)[0] = lastblock;
					UDF_SB_ANCHOR(sb)[1] = lastblock - 256 - UDF_SB_SESSION(sb);
				} else {
					udf_debug("Anchor found at block %d, location mismatch %d.\n",
@@ -682,27 +692,32 @@ static void udf_find_anchor(struct super_block *sb)
				lastblock = last[i];
				UDF_SB_ANCHOR(sb)[3] = 512;
			} else {
				if (last[i] < 256 || !(bh = sb_bread(sb, last[i] - 256))) {
				ident = location = 0;
				} else {
					ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
					location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
				if (last[i] >= 256) {
					bh = sb_bread(sb, last[i] - 256);
					if (bh) {
						tag *t = (tag *)bh->b_data;
						ident = le16_to_cpu(t->tagIdent);
						location = le32_to_cpu(t->tagLocation);
						brelse(bh);
					}
				}

				if (ident == TAG_IDENT_AVDP &&
				    location == last[i] - 256 - UDF_SB_SESSION(sb)) {
					lastblock = last[i];
					UDF_SB_ANCHOR(sb)[1] = last[i] - 256;
				} else {
					if (last[i] < 312 + UDF_SB_SESSION(sb) ||
					    !(bh = sb_bread(sb, last[i] - 312 - UDF_SB_SESSION(sb)))) {
					ident = location = 0;
					} else {
						ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
						location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
					if (last[i] >= 312 + UDF_SB_SESSION(sb)) {
						bh = sb_bread(sb, last[i] - 312 - UDF_SB_SESSION(sb));
						if (bh) {
							tag *t = (tag *)bh->b_data;
							ident = le16_to_cpu(t->tagIdent);
							location = le32_to_cpu(t->tagLocation);
							brelse(bh);
						}
					}

					if (ident == TAG_IDENT_AVDP &&
					    location == udf_variable_to_fixed(last[i]) - 256) {
@@ -716,10 +731,12 @@ static void udf_find_anchor(struct super_block *sb)
	}

	if (!lastblock) {
		/* We havn't found the lastblock. check 312 */
		if ((bh = sb_bread(sb, 312 + UDF_SB_SESSION(sb)))) {
			ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
			location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
		/* We haven't found the lastblock. check 312 */
		bh = sb_bread(sb, 312 + UDF_SB_SESSION(sb));
		if (bh) {
			tag *t = (tag *)bh->b_data;
			ident = le16_to_cpu(t->tagIdent);
			location = le32_to_cpu(t->tagLocation);
			brelse(bh);

			if (ident == TAG_IDENT_AVDP && location == 256)
@@ -729,23 +746,25 @@ static void udf_find_anchor(struct super_block *sb)

	for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) {
		if (UDF_SB_ANCHOR(sb)[i]) {
			if (!(bh = udf_read_tagged(sb, UDF_SB_ANCHOR(sb)[i],
						   UDF_SB_ANCHOR(sb)[i], &ident))) {
			bh = udf_read_tagged(sb, UDF_SB_ANCHOR(sb)[i],
					     UDF_SB_ANCHOR(sb)[i], &ident);
			if (!bh)
				UDF_SB_ANCHOR(sb)[i] = 0;
			} else {
			else {
				brelse(bh);
				if ((ident != TAG_IDENT_AVDP) &&
				    (i || (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE))) {
				    (i || (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE)))
					UDF_SB_ANCHOR(sb)[i] = 0;
			}
		}
	}
	}

	UDF_SB_LASTBLOCK(sb) = lastblock;
}

static int udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr *root)
static int udf_find_fileset(struct super_block *sb,
			    kernel_lb_addr *fileset,
			    kernel_lb_addr *root)
{
	struct buffer_head *bh = NULL;
	long lastblock;
@@ -764,7 +783,8 @@ static int udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, ker

	}

	if (!bh) { /* Search backwards through the partitions */
	if (!bh) {
		/* Search backwards through the partitions */
		kernel_lb_addr newfileset;

/* --> cvg: FIXME - is it reasonable? */
@@ -775,11 +795,13 @@ static int udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, ker
		      fileset->logicalBlockNum == 0xFFFFFFFF &&
		      fileset->partitionReferenceNum == 0xFFFF);
		     newfileset.partitionReferenceNum--) {
			lastblock = UDF_SB_PARTLEN(sb, newfileset.partitionReferenceNum);
			lastblock = UDF_SB_PARTLEN(sb,
					newfileset.partitionReferenceNum);
			newfileset.logicalBlockNum = 0;

			do {
				bh = udf_read_ptagged(sb, newfileset, 0, &ident);
				bh = udf_read_ptagged(sb, newfileset, 0,
						      &ident);
				if (!bh) {
					newfileset.logicalBlockNum++;
					continue;
@@ -840,7 +862,8 @@ static void udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh)
			      lets_to_cpu(pvoldesc->recordingDateAndTime))) {
		kernel_timestamp ts;
		ts = lets_to_cpu(pvoldesc->recordingDateAndTime);
		udf_debug("recording time %ld/%ld, %04u/%02u/%02u %02u:%02u (%x)\n",
		udf_debug("recording time %ld/%ld, %04u/%02u/%02u"
			  " %02u:%02u (%x)\n",
			  recording, recording_usec,
			  ts.year, ts.month, ts.day, ts.hour,
			  ts.minute, ts.typeAndTimezone);
@@ -899,8 +922,10 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
			if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_OVERWRITABLE)
				UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_OVERWRITABLE;

			if (!strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR02) ||
			    !strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR03)) {
			if (!strcmp(p->partitionContents.ident,
				    PD_PARTITION_CONTENTS_NSR02) ||
			    !strcmp(p->partitionContents.ident,
				    PD_PARTITION_CONTENTS_NSR03)) {
				struct partitionHeaderDesc *phd;

				phd = (struct partitionHeaderDesc *)(p->partitionContentsUse);
@@ -970,9 +995,11 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
		udf_debug("Partition (%d) not found in partition map\n",
			  le16_to_cpu(p->partitionNumber));
	} else {
		udf_debug("Partition (%d:%d type %x) starts at physical %d, block length %d\n",
			  le16_to_cpu(p->partitionNumber), i, UDF_SB_PARTTYPE(sb,i),
			  UDF_SB_PARTROOT(sb,i), UDF_SB_PARTLEN(sb,i));
		udf_debug("Partition (%d:%d type %x) starts at physical %d, "
			  "block length %d\n",
			  le16_to_cpu(p->partitionNumber), i,
			  UDF_SB_PARTTYPE(sb, i), UDF_SB_PARTROOT(sb, i),
			  UDF_SB_PARTLEN(sb, i));
	}
	return 0;
}
@@ -1031,22 +1058,24 @@ static int udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh,
				}
				UDF_SB_PARTFUNC(sb, i) = udf_get_pblock_spar15;
			} else {
				udf_debug("Unknown ident: %s\n", upm2->partIdent.ident);
				udf_debug("Unknown ident: %s\n",
					  upm2->partIdent.ident);
				continue;
			}
			UDF_SB_PARTVSN(sb, i) = le16_to_cpu(upm2->volSeqNum);
			UDF_SB_PARTNUM(sb, i) = le16_to_cpu(upm2->partitionNum);
		}
		udf_debug("Partition (%d:%d) type %d on volume %d\n",
			  i, UDF_SB_PARTNUM(sb,i), type, UDF_SB_PARTVSN(sb,i));
			  i, UDF_SB_PARTNUM(sb, i), type,
			  UDF_SB_PARTVSN(sb, i));
	}

	if (fileset) {
		long_ad *la = (long_ad *)&(lvd->logicalVolContentsUse[0]);

		*fileset = lelb_to_cpu(la->extLocation);
		udf_debug("FileSet found in LogicalVolDesc at block=%d, partition=%d\n",
			  fileset->logicalBlockNum,
		udf_debug("FileSet found in LogicalVolDesc at block=%d, "
			  "partition=%d\n", fileset->logicalBlockNum,
			  fileset->partitionReferenceNum);
	}
	if (lvd->integritySeqExt.extLength)
@@ -1071,7 +1100,8 @@ static void udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc)
		UDF_SB_LVIDBH(sb) = bh;

		if (UDF_SB_LVID(sb)->nextIntegrityExt.extLength)
			udf_load_logicalvolint(sb, leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt));
			udf_load_logicalvolint(sb,
				leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt));

		if (UDF_SB_LVIDBH(sb) != bh)
			brelse(bh);
@@ -1097,8 +1127,8 @@ static void udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc)
 *	July 1, 1997 - Andrew E. Mileski
 *	Written, tested, and released.
 */
static int udf_process_sequence(struct super_block *sb, long block, long lastblock,
				 kernel_lb_addr *fileset)
static int udf_process_sequence(struct super_block *sb, long block,
				long lastblock, kernel_lb_addr *fileset)
{
	struct buffer_head *bh = NULL;
	struct udf_vds_record vds[VDS_POS_LENGTH];
@@ -1178,7 +1208,8 @@ static int udf_process_sequence(struct super_block *sb, long block, long lastblo
	}
	for (i = 0; i < VDS_POS_LENGTH; i++) {
		if (vds[i].block) {
			bh = udf_read_tagged(sb, vds[i].block, vds[i].block, &ident);
			bh = udf_read_tagged(sb, vds[i].block, vds[i].block,
					     &ident);

			if (i == VDS_POS_PRIMARY_VOL_DESC) {
				udf_load_pvoldesc(sb, bh);
@@ -1190,11 +1221,14 @@ static int udf_process_sequence(struct super_block *sb, long block, long lastblo
					brelse(bh);
					return 1;
				}
				for (j = vds[i].block + 1; j <  vds[VDS_POS_TERMINATING_DESC].block; j++) {
				for (j = vds[i].block + 1;
				     j <  vds[VDS_POS_TERMINATING_DESC].block;
				     j++) {
					bh2 = udf_read_tagged(sb, j, j, &ident);
					gd = (struct generic_desc *)bh2->b_data;
					if (ident == TAG_IDENT_PD)
						if (udf_load_partdesc(sb, bh2)) {
						if (udf_load_partdesc(sb,
								      bh2)) {
							brelse(bh);
							brelse(bh2);
							return 1;
@@ -1222,13 +1256,15 @@ static int udf_check_valid(struct super_block *sb, int novrs, int silent)
	}
	/* Check that it is NSR02 compliant */
	/* Process any "CD-ROM Volume Descriptor Set" (ECMA 167 2/8.3.1) */
	else if ((block = udf_vrs(sb, silent)) == -1) {
		udf_debug("Failed to read byte 32768. Assuming open disc. "
			  "Skipping validity check\n");
	else {
		block = udf_vrs(sb, silent);
		if (block == -1) {
			udf_debug("Failed to read byte 32768. Assuming open "
				  "disc. Skipping validity check\n");
			if (!UDF_SB_LASTBLOCK(sb))
				UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb);
			return 0;
	} else {
		} else
			return !block;
	}
}
@@ -1267,11 +1303,10 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
			/* Process the main & reserve sequences */
			/* responsible for finding the PartitionDesc(s) */
			if (!(udf_process_sequence(sb, main_s, main_e, fileset) &&
			      udf_process_sequence(sb, reserve_s, reserve_e, fileset))) {
			      udf_process_sequence(sb, reserve_s, reserve_e, fileset)))
				break;
		}
	}
	}

	if (i == ARRAY_SIZE(UDF_SB_ANCHOR(sb))) {
		udf_debug("No Anchor block found\n");
@@ -1308,7 +1343,8 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
			if (j == UDF_SB_NUMPARTS(sb))
				return 1;

			if (!(UDF_SB_VAT(sb) = udf_iget(sb, ino)))
			UDF_SB_VAT(sb) = udf_iget(sb, ino);
			if (!UDF_SB_VAT(sb))
				return 1;

			if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) {
@@ -1481,8 +1517,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
	UDF_SB_ANCHOR(sb)[2] = uopt.anchor;
	UDF_SB_ANCHOR(sb)[3] = 256;

	if (udf_check_valid(sb, uopt.novrs, silent)) { /* read volume recognition sequences */
		printk("UDF-fs: No VRS found\n");
	if (udf_check_valid(sb, uopt.novrs, silent)) {
		/* read volume recognition sequences */
		printk(KERN_WARNING "UDF-fs: No VRS found\n");
		goto error_out;
	}

@@ -1496,7 +1533,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
	sb->s_time_gran = 1000;

	if (udf_load_partition(sb, &fileset)) {
		printk("UDF-fs: No partition found (1)\n");
		printk(KERN_WARNING "UDF-fs: No partition found (1)\n");
		goto error_out;
	}

@@ -1508,7 +1545,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
		/* uint16_t maxUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev); */

		if (minUDFReadRev > UDF_MAX_READ_VERSION) {
			printk("UDF-fs: minUDFReadRev=%x (max is %x)\n",
			printk(KERN_ERR "UDF-fs: minUDFReadRev=%x (max is %x)\n",
			       le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev),
			       UDF_MAX_READ_VERSION);
			goto error_out;
@@ -1525,17 +1562,17 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
	}

	if (!UDF_SB_NUMPARTS(sb)) {
		printk("UDF-fs: No partition found (2)\n");
		printk(KERN_WARNING "UDF-fs: No partition found (2)\n");
		goto error_out;
	}

	if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_READ_ONLY) {
		printk("UDF-fs: Partition marked readonly; forcing readonly mount\n");
		printk(KERN_NOTICE "UDF-fs: Partition marked readonly; forcing readonly mount\n");
		sb->s_flags |= MS_RDONLY;
	}

	if (udf_find_fileset(sb, &fileset, &rootdir)) {
		printk("UDF-fs: No fileset found\n");
		printk(KERN_WARNING "UDF-fs: No fileset found\n");
		goto error_out;
	}

@@ -1556,7 +1593,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
	/* perhaps it's not extensible enough, but for now ... */
	inode = udf_iget(sb, rootdir);
	if (!inode) {
		printk("UDF-fs: Error in udf_iget, block=%d, partition=%d\n",
		printk(KERN_ERR "UDF-fs: Error in udf_iget, block=%d, partition=%d\n",
		       rootdir.logicalBlockNum, rootdir.partitionReferenceNum);
		goto error_out;
	}
@@ -1564,7 +1601,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
	/* Allocate a dentry for the root inode */
	sb->s_root = d_alloc_root(inode);
	if (!sb->s_root) {
		printk("UDF-fs: Couldn't allocate root dentry\n");
		printk(KERN_ERR "UDF-fs: Couldn't allocate root dentry\n");
		iput(inode);
		goto error_out;
	}
@@ -1786,9 +1823,9 @@ static unsigned int udf_count_free_table(struct super_block *sb, struct inode *t
	epos.offset = sizeof(struct unallocSpaceEntry);
	epos.bh = NULL;

	while ((etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) {
	while ((etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1)
		accum += (elen >> table->i_sb->s_blocksize_bits);
	}

	brelse(epos.bh);

	unlock_kernel();