Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19483
Modified Files:
super.c
Log Message:
- Move assignment and check out of if ().
- Fix return values of ods2_read_ibitmap ().
Index: super.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- super.c 22 Sep 2004 07:14:35 -0000 1.12
+++ super.c 23 Sep 2004 00:59:34 -0000 1.13
@@ -137,7 +137,7 @@
* and copy data from the INDEXF.SYS file. At the same time the
* number of free file headers are counted.
*/
-int
+static int
ods2_read_ibitmap (struct super_block *sb)
{
struct ods2sb *ods2p = ODS2_SB (sb);
@@ -145,27 +145,30 @@
struct buffer_head *bh;
ods2p->kstatfs.f_ffree = 0;
- if ((ods2p->ibitmap = kmalloc(ods2p->hm2.hm2_w_ibmapsize << 9, GFP_KERNEL)) != NULL) {
- memset(ods2p->ibitmap, 0, (ods2p->hm2.hm2_w_ibmapsize << 9));
- for (idx = 0 ; idx < ods2p->hm2.hm2_w_ibmapsize ; idx++) {
- if ((bh = sb_bread(sb, GETBLKNO(sb, ods2p->hm2.hm2_l_ibmaplbn + idx))) != NULL && bh->b_data != NULL) {
- u8 *bp = (GETBLKP(sb, ods2p->hm2.hm2_l_ibmaplbn + idx, bh->b_data));
+
+ ods2p->ibitmap = kmalloc (ods2p->hm2.hm2_w_ibmapsize << 9, GFP_KERNEL);
+ if (ods2p->ibitmap) {
+ memset (ods2p->ibitmap, 0, ods2p->hm2.hm2_w_ibmapsize << 9);
+ for (idx = 0; idx < ods2p->hm2.hm2_w_ibmapsize; idx++) {
+ bh = sb_bread (sb, GETBLKNO (sb, ods2p->hm2.hm2_l_ibmaplbn + idx));
+ if (bh && bh->b_data) {
+ u8 *bp = GETBLKP (sb, ods2p->hm2.hm2_l_ibmaplbn + idx, bh->b_data);
int cnt;
- memcpy((ods2p->ibitmap + (idx << 9)), GETBLKP(sb, ods2p->hm2.hm2_l_ibmaplbn + idx, bh->b_data), 512);
- for (cnt = 0; cnt < 512; cnt++, bp++) {
+ memcpy (ods2p->ibitmap + (idx << 9), GETBLKP (sb, ods2p->hm2.hm2_l_ibmaplbn + idx, bh->b_data), 512);
+ for (cnt = 0; cnt < 512; cnt++, bp++)
ods2p->kstatfs.f_ffree += (nibble2bits[(*bp & 0x0f) ^ 0xf] + nibble2bits[(*bp >> 4) ^ 0xf]);
- }
bforget(bh);
}
}
- return 1;
+
+ return 0;
}
+
printk("ODS2-fs error when allocating memory for index file header bitmap\n");
- return 0;
+ return -ENOMEM;
}
-
/*
* Parse options that can be supplied (mount -o xxxxxxx)
*/
@@ -214,7 +217,7 @@
if (!options)
return 0;
- while ((p = strsep(&options, ",")) != NULL) {
+ while ((p = strsep (&options, ",")) != NULL) {
if (!*p)
continue;
@@ -267,10 +270,8 @@
return 0;
}
-
/*
- * This is the routine that is invoked when an ODS2 file system
- * is mounted.
+ * This is the routine that is invoked when an ODS2 file system is mounted.
*/
static int
ods2_fill_super (struct super_block *sb, void *data, int silent)
@@ -355,7 +356,7 @@
/*
* We need to be able to read the index file header bitmap.
*/
- if (ods2_read_ibitmap(sb)) {
+ if (ods2_read_ibitmap (sb) == 0) {
/*
* We need to be able to read BITMAP.SYS as
* it contains the bitmap for allocated
@@ -389,13 +390,13 @@
volname[12] = 0;
memcpy(volowner, ods2p->hm2.hm2_t_ownername, 12);
volowner[12] = 0;
- printk(KERN_NOTICE "ODS2-fs This is a valid ODS2 file system with format /%s/ and volume name /%s/ and owner /%s/\n", format, volname, volowner);
+ printk (KERN_NOTICE "ODS2-fs This is a valid ODS2 file system with format /%s/ and volume name /%s/ and owner /%s/\n", format, volname, volowner);
return 0;
}
- kfree(ods2p->ibitmap);
+ kfree (ods2p->ibitmap);
}
}
- kfree(ODS2_SB(sb));
+ kfree (ODS2_SB (sb));
}
return -EINVAL;
}
|