mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
isofs: fix up CodingStyle
fs/isofs/* had a bunch of CodingStyle issues. * Indentation was a mix of spaces and tabs * "int * foo" instead of "int *foo" * "while ( foo )" instead of "while (foo)" * if (foo) blah; on one line instead of two * Missing printk KERN_ levels * lots of trailing whitespace * lines >80 columns changed to wrap. * Unnecessary prototype removed by shuffling code order in C file. Should be no functional changes other than slight size increase due to printk changes. Further improvement possible, but this is a start.. Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
1b28f22a87
commit
c3ed85a36f
4 changed files with 277 additions and 261 deletions
|
@ -13,22 +13,6 @@
|
|||
#include <linux/smp_lock.h>
|
||||
#include "isofs.h"
|
||||
|
||||
static int isofs_readdir(struct file *, void *, filldir_t);
|
||||
|
||||
const struct file_operations isofs_dir_operations =
|
||||
{
|
||||
.read = generic_read_dir,
|
||||
.readdir = isofs_readdir,
|
||||
};
|
||||
|
||||
/*
|
||||
* directories can handle most operations...
|
||||
*/
|
||||
const struct inode_operations isofs_dir_inode_operations =
|
||||
{
|
||||
.lookup = isofs_lookup,
|
||||
};
|
||||
|
||||
int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode)
|
||||
{
|
||||
char * old = de->name;
|
||||
|
@ -68,16 +52,21 @@ int get_acorn_filename(struct iso_directory_record * de,
|
|||
int std;
|
||||
unsigned char *chr;
|
||||
int retnamlen = isofs_name_translate(de, retname, inode);
|
||||
if (retnamlen == 0) return 0;
|
||||
|
||||
if (retnamlen == 0)
|
||||
return 0;
|
||||
std = sizeof(struct iso_directory_record) + de->name_len[0];
|
||||
if (std & 1) std++;
|
||||
if ((*((unsigned char *) de) - std) != 32) return retnamlen;
|
||||
if (std & 1)
|
||||
std++;
|
||||
if ((*((unsigned char *) de) - std) != 32)
|
||||
return retnamlen;
|
||||
chr = ((unsigned char *) de) + std;
|
||||
if (strncmp(chr, "ARCHIMEDES", 10)) return retnamlen;
|
||||
if ((*retname == '_') && ((chr[19] & 1) == 1)) *retname = '!';
|
||||
if (strncmp(chr, "ARCHIMEDES", 10))
|
||||
return retnamlen;
|
||||
if ((*retname == '_') && ((chr[19] & 1) == 1))
|
||||
*retname = '!';
|
||||
if (((de->flags[0] & 2) == 0) && (chr[13] == 0xff)
|
||||
&& ((chr[12] & 0xf0) == 0xf0))
|
||||
{
|
||||
&& ((chr[12] & 0xf0) == 0xf0)) {
|
||||
retname[retnamlen] = ',';
|
||||
sprintf(retname+retnamlen+1, "%3.3x",
|
||||
((chr[12] & 0xf) << 8) | chr[11]);
|
||||
|
@ -121,9 +110,11 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
|
|||
|
||||
de_len = *(unsigned char *) de;
|
||||
|
||||
/* If the length byte is zero, we should move on to the next
|
||||
CDROM sector. If we are at the end of the directory, we
|
||||
kick out of the while loop. */
|
||||
/*
|
||||
* If the length byte is zero, we should move on to the next
|
||||
* CDROM sector. If we are at the end of the directory, we
|
||||
* kick out of the while loop.
|
||||
*/
|
||||
|
||||
if (de_len == 0) {
|
||||
brelse(bh);
|
||||
|
@ -160,8 +151,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
|
|||
&block_saved,
|
||||
&offset_saved);
|
||||
inode_number = isofs_get_ino(block_saved,
|
||||
offset_saved,
|
||||
bufbits);
|
||||
offset_saved, bufbits);
|
||||
}
|
||||
|
||||
if (de->flags[-sbi->s_high_sierra] & 0x80) {
|
||||
|
@ -240,7 +230,8 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
|
|||
|
||||
continue;
|
||||
}
|
||||
if (bh) brelse(bh);
|
||||
if (bh)
|
||||
brelse(bh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -270,3 +261,19 @@ static int isofs_readdir(struct file *filp,
|
|||
unlock_kernel();
|
||||
return result;
|
||||
}
|
||||
|
||||
const struct file_operations isofs_dir_operations =
|
||||
{
|
||||
.read = generic_read_dir,
|
||||
.readdir = isofs_readdir,
|
||||
};
|
||||
|
||||
/*
|
||||
* directories can handle most operations...
|
||||
*/
|
||||
const struct inode_operations isofs_dir_inode_operations =
|
||||
{
|
||||
.lookup = isofs_lookup,
|
||||
};
|
||||
|
||||
|
||||
|
|
141
fs/isofs/inode.c
141
fs/isofs/inode.c
|
@ -360,10 +360,12 @@ static int parse_options(char *options, struct iso9660_options *popt)
|
|||
popt->check = 'u'; /* unset */
|
||||
popt->nocompress = 0;
|
||||
popt->blocksize = 1024;
|
||||
popt->mode = S_IRUGO | S_IXUGO; /* r-x for all. The disc could
|
||||
be shared with DOS machines so
|
||||
virtually anything could be
|
||||
a valid executable. */
|
||||
popt->mode = S_IRUGO | S_IXUGO; /*
|
||||
* r-x for all. The disc could
|
||||
* be shared with DOS machines so
|
||||
* virtually anything could be
|
||||
* a valid executable.
|
||||
*/
|
||||
popt->gid = 0;
|
||||
popt->uid = 0;
|
||||
popt->iocharset = NULL;
|
||||
|
@ -503,23 +505,23 @@ static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
|
|||
Te.cdte_format=CDROM_LBA;
|
||||
i = ioctl_by_bdev(bdev, CDROMREADTOCENTRY, (unsigned long) &Te);
|
||||
if (!i) {
|
||||
printk(KERN_DEBUG "Session %d start %d type %d\n",
|
||||
printk(KERN_DEBUG "ISOFS: Session %d start %d type %d\n",
|
||||
session, Te.cdte_addr.lba,
|
||||
Te.cdte_ctrl&CDROM_DATA_TRACK);
|
||||
if ((Te.cdte_ctrl&CDROM_DATA_TRACK) == 4)
|
||||
return Te.cdte_addr.lba;
|
||||
}
|
||||
|
||||
printk(KERN_ERR "Invalid session number or type of track\n");
|
||||
printk(KERN_ERR "ISOFS: Invalid session number or type of track\n");
|
||||
}
|
||||
i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info);
|
||||
if (session > 0)
|
||||
printk(KERN_ERR "Invalid session number\n");
|
||||
printk(KERN_ERR "ISOFS: Invalid session number\n");
|
||||
#if 0
|
||||
printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i);
|
||||
printk(KERN_DEBUG "isofs.inode: CDROMMULTISESSION: rc=%d\n",i);
|
||||
if (i==0) {
|
||||
printk("isofs.inode: XA disk: %s\n",ms_info.xa_flag?"yes":"no");
|
||||
printk("isofs.inode: vol_desc_start = %d\n", ms_info.addr.lba);
|
||||
printk(KERN_DEBUG "isofs.inode: XA disk: %s\n",ms_info.xa_flag?"yes":"no");
|
||||
printk(KERN_DEBUG "isofs.inode: vol_desc_start = %d\n", ms_info.addr.lba);
|
||||
}
|
||||
#endif
|
||||
if (i==0)
|
||||
|
@ -543,15 +545,15 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
|
|||
struct iso_primary_descriptor *pri = NULL;
|
||||
struct iso_supplementary_descriptor *sec = NULL;
|
||||
struct iso_directory_record *rootp;
|
||||
struct inode *inode;
|
||||
struct iso9660_options opt;
|
||||
struct isofs_sb_info *sbi;
|
||||
unsigned long first_data_zone;
|
||||
int joliet_level = 0;
|
||||
int iso_blknum, block;
|
||||
int orig_zonesize;
|
||||
int table;
|
||||
unsigned int vol_desc_start;
|
||||
unsigned long first_data_zone;
|
||||
struct inode * inode;
|
||||
struct iso9660_options opt;
|
||||
struct isofs_sb_info * sbi;
|
||||
|
||||
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
|
||||
if (!sbi)
|
||||
|
@ -578,8 +580,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
|
|||
opt.sbsector : isofs_get_last_session(s,opt.session);
|
||||
|
||||
for (iso_blknum = vol_desc_start+16;
|
||||
iso_blknum < vol_desc_start+100; iso_blknum++)
|
||||
{
|
||||
iso_blknum < vol_desc_start+100; iso_blknum++) {
|
||||
struct hs_volume_descriptor *hdp;
|
||||
struct iso_volume_descriptor *vdp;
|
||||
|
||||
|
@ -590,7 +591,8 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
|
|||
vdp = (struct iso_volume_descriptor *)bh->b_data;
|
||||
hdp = (struct hs_volume_descriptor *)bh->b_data;
|
||||
|
||||
/* Due to the overlapping physical location of the descriptors,
|
||||
/*
|
||||
* Due to the overlapping physical location of the descriptors,
|
||||
* ISO CDs can match hdp->id==HS_STANDARD_ID as well. To ensure
|
||||
* proper identification in this case, we first check for ISO.
|
||||
*/
|
||||
|
@ -610,14 +612,15 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
|
|||
sec = (struct iso_supplementary_descriptor *)vdp;
|
||||
if (sec->escape[0] == 0x25 && sec->escape[1] == 0x2f) {
|
||||
if (opt.joliet == 'y') {
|
||||
if (sec->escape[2] == 0x40) {
|
||||
if (sec->escape[2] == 0x40)
|
||||
joliet_level = 1;
|
||||
} else if (sec->escape[2] == 0x43) {
|
||||
else if (sec->escape[2] == 0x43)
|
||||
joliet_level = 2;
|
||||
} else if (sec->escape[2] == 0x45) {
|
||||
else if (sec->escape[2] == 0x45)
|
||||
joliet_level = 3;
|
||||
}
|
||||
printk(KERN_DEBUG"ISO 9660 Extensions: Microsoft Joliet Level %d\n",
|
||||
|
||||
printk(KERN_DEBUG "ISO 9660 Extensions: "
|
||||
"Microsoft Joliet Level %d\n",
|
||||
joliet_level);
|
||||
}
|
||||
goto root_found;
|
||||
|
@ -691,8 +694,8 @@ root_found:
|
|||
goto out_bad_size;
|
||||
|
||||
/* RDE: convert log zone size to bit shift */
|
||||
switch (sbi->s_log_zone_size)
|
||||
{ case 512: sbi->s_log_zone_size = 9; break;
|
||||
switch (sbi->s_log_zone_size) {
|
||||
case 512: sbi->s_log_zone_size = 9; break;
|
||||
case 1024: sbi->s_log_zone_size = 10; break;
|
||||
case 2048: sbi->s_log_zone_size = 11; break;
|
||||
|
||||
|
@ -703,10 +706,12 @@ root_found:
|
|||
s->s_magic = ISOFS_SUPER_MAGIC;
|
||||
s->s_maxbytes = 0xffffffff; /* We can handle files up to 4 GB */
|
||||
|
||||
/* The CDROM is read-only, has no nodes (devices) on it, and since
|
||||
all of the files appear to be owned by root, we really do not want
|
||||
to allow suid. (suid or devices will not show up unless we have
|
||||
Rock Ridge extensions) */
|
||||
/*
|
||||
* The CDROM is read-only, has no nodes (devices) on it, and since
|
||||
* all of the files appear to be owned by root, we really do not want
|
||||
* to allow suid. (suid or devices will not show up unless we have
|
||||
* Rock Ridge extensions)
|
||||
*/
|
||||
|
||||
s->s_flags |= MS_RDONLY /* | MS_NODEV | MS_NOSUID */;
|
||||
|
||||
|
@ -717,12 +722,11 @@ root_found:
|
|||
isonum_711(rootp->ext_attr_length);
|
||||
sbi->s_firstdatazone = first_data_zone;
|
||||
#ifndef BEQUIET
|
||||
printk(KERN_DEBUG "Max size:%ld Log zone size:%ld\n",
|
||||
sbi->s_max_size,
|
||||
1UL << sbi->s_log_zone_size);
|
||||
printk(KERN_DEBUG "First datazone:%ld\n", sbi->s_firstdatazone);
|
||||
printk(KERN_DEBUG "ISOFS: Max size:%ld Log zone size:%ld\n",
|
||||
sbi->s_max_size, 1UL << sbi->s_log_zone_size);
|
||||
printk(KERN_DEBUG "ISOFS: First datazone:%ld\n", sbi->s_firstdatazone);
|
||||
if(sbi->s_high_sierra)
|
||||
printk(KERN_DEBUG "Disc in High Sierra format.\n");
|
||||
printk(KERN_DEBUG "ISOFS: Disc in High Sierra format.\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -830,8 +834,10 @@ root_found:
|
|||
|
||||
if (opt.check == 'u') {
|
||||
/* Only Joliet is case insensitive by default */
|
||||
if (joliet_level) opt.check = 'r';
|
||||
else opt.check = 's';
|
||||
if (joliet_level)
|
||||
opt.check = 'r';
|
||||
else
|
||||
opt.check = 's';
|
||||
}
|
||||
sbi->s_joliet_level = joliet_level;
|
||||
|
||||
|
@ -846,8 +852,10 @@ root_found:
|
|||
goto out_no_root;
|
||||
|
||||
table = 0;
|
||||
if (joliet_level) table += 2;
|
||||
if (opt.check == 'r') table++;
|
||||
if (joliet_level)
|
||||
table += 2;
|
||||
if (opt.check == 'r')
|
||||
table++;
|
||||
s->s_root->d_op = &isofs_dentry_ops[table];
|
||||
|
||||
kfree(opt.iocharset);
|
||||
|
@ -858,10 +866,10 @@ root_found:
|
|||
* Display error messages and free resources.
|
||||
*/
|
||||
out_bad_root:
|
||||
printk(KERN_WARNING "isofs_fill_super: root inode not initialized\n");
|
||||
printk(KERN_WARNING "%s: root inode not initialized\n", __func__);
|
||||
goto out_iput;
|
||||
out_no_root:
|
||||
printk(KERN_WARNING "isofs_fill_super: get root inode failed\n");
|
||||
printk(KERN_WARNING "%s: get root inode failed\n", __func__);
|
||||
out_iput:
|
||||
iput(inode);
|
||||
#ifdef CONFIG_JOLIET
|
||||
|
@ -870,21 +878,20 @@ out_iput:
|
|||
#endif
|
||||
goto out_freesbi;
|
||||
out_no_read:
|
||||
printk(KERN_WARNING "isofs_fill_super: "
|
||||
"bread failed, dev=%s, iso_blknum=%d, block=%d\n",
|
||||
s->s_id, iso_blknum, block);
|
||||
printk(KERN_WARNING "%s: bread failed, dev=%s, iso_blknum=%d, block=%d\n",
|
||||
__func__, s->s_id, iso_blknum, block);
|
||||
goto out_freesbi;
|
||||
out_bad_zone_size:
|
||||
printk(KERN_WARNING "Bad logical zone size %ld\n",
|
||||
printk(KERN_WARNING "ISOFS: Bad logical zone size %ld\n",
|
||||
sbi->s_log_zone_size);
|
||||
goto out_freebh;
|
||||
out_bad_size:
|
||||
printk(KERN_WARNING "Logical zone size(%d) < hardware blocksize(%u)\n",
|
||||
printk(KERN_WARNING "ISOFS: Logical zone size(%d) < hardware blocksize(%u)\n",
|
||||
orig_zonesize, opt.blocksize);
|
||||
goto out_freebh;
|
||||
out_unknown_format:
|
||||
if (!silent)
|
||||
printk(KERN_WARNING "Unable to identify CD-ROM format.\n");
|
||||
printk(KERN_WARNING "ISOFS: Unable to identify CD-ROM format.\n");
|
||||
|
||||
out_freebh:
|
||||
brelse(bh);
|
||||
|
@ -931,7 +938,7 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
|
|||
|
||||
rv = 0;
|
||||
if (iblock < 0 || iblock != iblock_s) {
|
||||
printk("isofs_get_blocks: block number too large\n");
|
||||
printk(KERN_DEBUG "%s: block number too large\n", __func__);
|
||||
goto abort;
|
||||
}
|
||||
|
||||
|
@ -953,8 +960,8 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
|
|||
* I/O errors.
|
||||
*/
|
||||
if (b_off > ((inode->i_size + PAGE_CACHE_SIZE - 1) >> ISOFS_BUFFER_BITS(inode))) {
|
||||
printk("isofs_get_blocks: block >= EOF (%ld, %ld)\n",
|
||||
iblock, (unsigned long) inode->i_size);
|
||||
printk(KERN_DEBUG "%s: block >= EOF (%ld, %ld)\n",
|
||||
__func__, iblock, (unsigned long) inode->i_size);
|
||||
goto abort;
|
||||
}
|
||||
|
||||
|
@ -976,9 +983,10 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
|
|||
iput(ninode);
|
||||
|
||||
if (++section > 100) {
|
||||
printk("isofs_get_blocks: More than 100 file sections ?!?, aborting...\n");
|
||||
printk("isofs_get_blocks: block=%ld firstext=%u sect_size=%u "
|
||||
"nextblk=%lu nextoff=%lu\n",
|
||||
printk(KERN_DEBUG "%s: More than 100 file sections ?!?"
|
||||
" aborting...\n", __func__);
|
||||
printk(KERN_DEBUG "%s: block=%ld firstext=%u sect_size=%u "
|
||||
"nextblk=%lu nextoff=%lu\n", __func__,
|
||||
iblock, firstext, (unsigned) sect_size,
|
||||
nextblk, nextoff);
|
||||
goto abort;
|
||||
|
@ -1010,7 +1018,7 @@ static int isofs_get_block(struct inode *inode, sector_t iblock,
|
|||
struct buffer_head *bh_result, int create)
|
||||
{
|
||||
if (create) {
|
||||
printk("isofs_get_block: Kernel tries to allocate a block\n");
|
||||
printk(KERN_DEBUG "%s: Kernel tries to allocate a block\n", __func__);
|
||||
return -EROFS;
|
||||
}
|
||||
|
||||
|
@ -1163,10 +1171,9 @@ out_noread:
|
|||
return -EIO;
|
||||
|
||||
out_toomany:
|
||||
printk(KERN_INFO "isofs_read_level3_size: "
|
||||
"More than 100 file sections ?!?, aborting...\n"
|
||||
printk(KERN_INFO "%s: More than 100 file sections ?!?, aborting...\n"
|
||||
"isofs_read_level3_size: inode=%lu\n",
|
||||
inode->i_ino);
|
||||
__func__, inode->i_ino);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -1199,7 +1206,7 @@ static void isofs_read_inode(struct inode *inode)
|
|||
|
||||
tmpde = kmalloc(de_len, GFP_KERNEL);
|
||||
if (tmpde == NULL) {
|
||||
printk(KERN_INFO "isofs_read_inode: out of memory\n");
|
||||
printk(KERN_INFO "%s: out of memory\n", __func__);
|
||||
goto fail;
|
||||
}
|
||||
memcpy(tmpde, bh->b_data + offset, frag1);
|
||||
|
@ -1220,11 +1227,13 @@ static void isofs_read_inode(struct inode *inode)
|
|||
|
||||
if (de->flags[-high_sierra] & 2) {
|
||||
inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR;
|
||||
inode->i_nlink = 1; /* Set to 1. We know there are 2, but
|
||||
the find utility tries to optimize
|
||||
if it is 2, and it screws up. It is
|
||||
easier to give 1 which tells find to
|
||||
do it the hard way. */
|
||||
inode->i_nlink = 1; /*
|
||||
* Set to 1. We know there are 2, but
|
||||
* the find utility tries to optimize
|
||||
* if it is 2, and it screws up. It is
|
||||
* easier to give 1 which tells find to
|
||||
* do it the hard way.
|
||||
*/
|
||||
} else {
|
||||
/* Everybody gets to read the file. */
|
||||
inode->i_mode = sbi->s_mode;
|
||||
|
@ -1241,7 +1250,8 @@ static void isofs_read_inode(struct inode *inode)
|
|||
|
||||
ei->i_section_size = isonum_733(de->size);
|
||||
if (de->flags[-high_sierra] & 0x80) {
|
||||
if(isofs_read_level3_size(inode)) goto fail;
|
||||
if(isofs_read_level3_size(inode))
|
||||
goto fail;
|
||||
} else {
|
||||
ei->i_next_section_block = 0;
|
||||
ei->i_next_section_offset = 0;
|
||||
|
@ -1258,14 +1268,14 @@ static void isofs_read_inode(struct inode *inode)
|
|||
inode->i_size &= 0x00ffffff;
|
||||
|
||||
if (de->interleave[0]) {
|
||||
printk("Interleaved files not (yet) supported.\n");
|
||||
printk(KERN_DEBUG "ISOFS: Interleaved files not (yet) supported.\n");
|
||||
inode->i_size = 0;
|
||||
}
|
||||
|
||||
/* I have no idea what file_unit_size is used for, so
|
||||
we will flag it for now */
|
||||
if (de->file_unit_size[0] != 0) {
|
||||
printk("File unit size != 0 for ISO file (%ld).\n",
|
||||
printk(KERN_DEBUG "ISOFS: File unit size != 0 for ISO file (%ld).\n",
|
||||
inode->i_ino);
|
||||
}
|
||||
|
||||
|
@ -1273,7 +1283,8 @@ static void isofs_read_inode(struct inode *inode)
|
|||
we will flag it for now */
|
||||
#ifdef DEBUG
|
||||
if((de->flags[-high_sierra] & ~2)!= 0){
|
||||
printk("Unusual flag settings for ISO file (%ld %x).\n",
|
||||
printk(KERN_DEBUG "ISOFS: Unusual flag settings for ISO file "
|
||||
"(%ld %x).\n",
|
||||
inode->i_ino, de->flags[-high_sierra]);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -85,17 +85,15 @@ get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, st
|
|||
len = uni16_to_x8(outname, (__be16 *) de->name,
|
||||
de->name_len[0] >> 1, nls);
|
||||
}
|
||||
if ((len > 2) && (outname[len-2] == ';') && (outname[len-1] == '1')) {
|
||||
if ((len > 2) && (outname[len-2] == ';') && (outname[len-1] == '1'))
|
||||
len -= 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Windows doesn't like periods at the end of a name,
|
||||
* so neither do we
|
||||
*/
|
||||
while (len >= 2 && (outname[len-1] == '.')) {
|
||||
while (len >= 2 && (outname[len-1] == '.'))
|
||||
len--;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue