Commit 7d42ccf3 authored by Brian Gerst's avatar Brian Gerst Committed by Linus Torvalds

[PATCH] struct super_block cleanup - isofs

Seperates isofs_sb_info from struct super_block.
parent b286bd16
...@@ -110,14 +110,13 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -110,14 +110,13 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
int len; int len;
int map; int map;
int high_sierra;
int first_de = 1; int first_de = 1;
char *p = NULL; /* Quiet GCC */ char *p = NULL; /* Quiet GCC */
struct iso_directory_record *de; struct iso_directory_record *de;
struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
offset = filp->f_pos & (bufsize - 1); offset = filp->f_pos & (bufsize - 1);
block = filp->f_pos >> bufbits; block = filp->f_pos >> bufbits;
high_sierra = inode->i_sb->u.isofs_sb.s_high_sierra;
while (filp->f_pos < inode->i_size) { while (filp->f_pos < inode->i_size) {
int de_len; int de_len;
...@@ -166,7 +165,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -166,7 +165,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
de = tmpde; de = tmpde;
} }
if (de->flags[-high_sierra] & 0x80) { if (de->flags[-sbi->s_high_sierra] & 0x80) {
first_de = 0; first_de = 0;
filp->f_pos += de_len; filp->f_pos += de_len;
continue; continue;
...@@ -194,16 +193,16 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -194,16 +193,16 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
/* Handle everything else. Do name translation if there /* Handle everything else. Do name translation if there
is no Rock Ridge NM field. */ is no Rock Ridge NM field. */
if (inode->i_sb->u.isofs_sb.s_unhide == 'n') { if (sbi->s_unhide == 'n') {
/* Do not report hidden or associated files */ /* Do not report hidden or associated files */
if (de->flags[-high_sierra] & 5) { if (de->flags[-sbi->s_high_sierra] & 5) {
filp->f_pos += de_len; filp->f_pos += de_len;
continue; continue;
} }
} }
map = 1; map = 1;
if (inode->i_sb->u.isofs_sb.s_rock) { if (sbi->s_rock) {
len = get_rock_ridge_filename(de, tmpname, inode); len = get_rock_ridge_filename(de, tmpname, inode);
if (len != 0) { /* may be -1 */ if (len != 0) { /* may be -1 */
p = tmpname; p = tmpname;
...@@ -212,16 +211,16 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, ...@@ -212,16 +211,16 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
} }
if (map) { if (map) {
#ifdef CONFIG_JOLIET #ifdef CONFIG_JOLIET
if (inode->i_sb->u.isofs_sb.s_joliet_level) { if (sbi->s_joliet_level) {
len = get_joliet_filename(de, tmpname, inode); len = get_joliet_filename(de, tmpname, inode);
p = tmpname; p = tmpname;
} else } else
#endif #endif
if (inode->i_sb->u.isofs_sb.s_mapping == 'a') { if (sbi->s_mapping == 'a') {
len = get_acorn_filename(de, tmpname, inode); len = get_acorn_filename(de, tmpname, inode);
p = tmpname; p = tmpname;
} else } else
if (inode->i_sb->u.isofs_sb.s_mapping == 'n') { if (sbi->s_mapping == 'n') {
len = isofs_name_translate(de, tmpname, inode); len = isofs_name_translate(de, tmpname, inode);
p = tmpname; p = tmpname;
} else { } else {
......
This diff is collapsed.
...@@ -77,8 +77,8 @@ get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, st ...@@ -77,8 +77,8 @@ get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, st
struct nls_table *nls; struct nls_table *nls;
unsigned char len = 0; unsigned char len = 0;
utf8 = inode->i_sb->u.isofs_sb.s_utf8; utf8 = ISOFS_SB(inode->i_sb)->s_utf8;
nls = inode->i_sb->u.isofs_sb.s_nls_iocharset; nls = ISOFS_SB(inode->i_sb)->s_nls_iocharset;
if (utf8) { if (utf8) {
len = wcsntombs_be(outname, de->name, len = wcsntombs_be(outname, de->name,
......
...@@ -65,6 +65,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, ...@@ -65,6 +65,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
unsigned char bufbits = ISOFS_BUFFER_BITS(dir); unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
unsigned int block, f_pos, offset; unsigned int block, f_pos, offset;
struct buffer_head * bh = NULL; struct buffer_head * bh = NULL;
struct isofs_sb_info *sbi = ISOFS_SB(dir->i_sb);
if (!ISOFS_I(dir)->i_first_extent) if (!ISOFS_I(dir)->i_first_extent)
return 0; return 0;
...@@ -120,19 +121,19 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, ...@@ -120,19 +121,19 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
dlen = de->name_len[0]; dlen = de->name_len[0];
dpnt = de->name; dpnt = de->name;
if (dir->i_sb->u.isofs_sb.s_rock && if (sbi->s_rock &&
((i = get_rock_ridge_filename(de, tmpname, dir)))) { ((i = get_rock_ridge_filename(de, tmpname, dir)))) {
dlen = i; /* possibly -1 */ dlen = i; /* possibly -1 */
dpnt = tmpname; dpnt = tmpname;
#ifdef CONFIG_JOLIET #ifdef CONFIG_JOLIET
} else if (dir->i_sb->u.isofs_sb.s_joliet_level) { } else if (sbi->s_joliet_level) {
dlen = get_joliet_filename(de, tmpname, dir); dlen = get_joliet_filename(de, tmpname, dir);
dpnt = tmpname; dpnt = tmpname;
#endif #endif
} else if (dir->i_sb->u.isofs_sb.s_mapping == 'a') { } else if (sbi->s_mapping == 'a') {
dlen = get_acorn_filename(de, tmpname, dir); dlen = get_acorn_filename(de, tmpname, dir);
dpnt = tmpname; dpnt = tmpname;
} else if (dir->i_sb->u.isofs_sb.s_mapping == 'n') { } else if (sbi->s_mapping == 'n') {
dlen = isofs_name_translate(de, tmpname, dir); dlen = isofs_name_translate(de, tmpname, dir);
dpnt = tmpname; dpnt = tmpname;
} }
...@@ -142,8 +143,8 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, ...@@ -142,8 +143,8 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
*/ */
match = 0; match = 0;
if (dlen > 0 && if (dlen > 0 &&
(!(de->flags[-dir->i_sb->u.isofs_sb.s_high_sierra] & 5) (!(de->flags[-sbi->s_high_sierra] & 5)
|| dir->i_sb->u.isofs_sb.s_unhide == 'y')) || sbi->s_unhide == 'y'))
{ {
match = (isofs_cmp(dentry,dpnt,dlen) == 0); match = (isofs_cmp(dentry,dpnt,dlen) == 0);
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define CHECK_SP(FAIL) \ #define CHECK_SP(FAIL) \
if(rr->u.SP.magic[0] != 0xbe) FAIL; \ if(rr->u.SP.magic[0] != 0xbe) FAIL; \
if(rr->u.SP.magic[1] != 0xef) FAIL; \ if(rr->u.SP.magic[1] != 0xef) FAIL; \
inode->i_sb->u.isofs_sb.s_rock_offset=rr->u.SP.skip; ISOFS_SB(inode->i_sb)->s_rock_offset=rr->u.SP.skip;
/* We define a series of macros because each function must do exactly the /* We define a series of macros because each function must do exactly the
same thing in certain places. We use the macros to ensure that everything same thing in certain places. We use the macros to ensure that everything
is done correctly */ is done correctly */
...@@ -51,10 +51,10 @@ ...@@ -51,10 +51,10 @@
if(LEN & 1) LEN++; \ if(LEN & 1) LEN++; \
CHR = ((unsigned char *) DE) + LEN; \ CHR = ((unsigned char *) DE) + LEN; \
LEN = *((unsigned char *) DE) - LEN; \ LEN = *((unsigned char *) DE) - LEN; \
if (inode->i_sb->u.isofs_sb.s_rock_offset!=-1) \ if (ISOFS_SB(inode->i_sb)->s_rock_offset!=-1) \
{ \ { \
LEN-=inode->i_sb->u.isofs_sb.s_rock_offset; \ LEN-=ISOFS_SB(inode->i_sb)->s_rock_offset; \
CHR+=inode->i_sb->u.isofs_sb.s_rock_offset; \ CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \
if (LEN<0) LEN=0; \ if (LEN<0) LEN=0; \
} \ } \
} }
...@@ -102,7 +102,7 @@ int find_rock_ridge_relocation(struct iso_directory_record * de, ...@@ -102,7 +102,7 @@ int find_rock_ridge_relocation(struct iso_directory_record * de,
/* Return value if we do not find appropriate record. */ /* Return value if we do not find appropriate record. */
retval = isonum_733 (de->extent); retval = isonum_733 (de->extent);
if (!inode->i_sb->u.isofs_sb.s_rock) return retval; if (!ISOFS_SB(inode->i_sb)->s_rock) return retval;
SETUP_ROCK_RIDGE(de, chr, len); SETUP_ROCK_RIDGE(de, chr, len);
repeat: repeat:
...@@ -162,7 +162,7 @@ int get_rock_ridge_filename(struct iso_directory_record * de, ...@@ -162,7 +162,7 @@ int get_rock_ridge_filename(struct iso_directory_record * de,
CONTINUE_DECLS; CONTINUE_DECLS;
int retnamlen = 0, truncate=0; int retnamlen = 0, truncate=0;
if (!inode->i_sb->u.isofs_sb.s_rock) return 0; if (!ISOFS_SB(inode->i_sb)->s_rock) return 0;
*retname = 0; *retname = 0;
SETUP_ROCK_RIDGE(de, chr, len); SETUP_ROCK_RIDGE(de, chr, len);
...@@ -234,7 +234,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de, ...@@ -234,7 +234,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de,
int symlink_len = 0; int symlink_len = 0;
CONTINUE_DECLS; CONTINUE_DECLS;
if (!inode->i_sb->u.isofs_sb.s_rock) return 0; if (!ISOFS_SB(inode->i_sb)->s_rock) return 0;
SETUP_ROCK_RIDGE(de, chr, len); SETUP_ROCK_RIDGE(de, chr, len);
if (regard_xa) if (regard_xa)
...@@ -272,7 +272,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de, ...@@ -272,7 +272,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de,
CHECK_CE; CHECK_CE;
break; break;
case SIG('E','R'): case SIG('E','R'):
inode->i_sb->u.isofs_sb.s_rock = 1; ISOFS_SB(inode->i_sb)->s_rock = 1;
printk(KERN_DEBUG "ISO 9660 Extensions: "); printk(KERN_DEBUG "ISO 9660 Extensions: ");
{ int p; { int p;
for(p=0;p<rr->u.ER.len_id;p++) printk("%c",rr->u.ER.data[p]); for(p=0;p<rr->u.ER.len_id;p++) printk("%c",rr->u.ER.data[p]);
...@@ -368,7 +368,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de, ...@@ -368,7 +368,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de,
ISOFS_I(inode)->i_first_extent = isonum_733(rr->u.CL.location); ISOFS_I(inode)->i_first_extent = isonum_733(rr->u.CL.location);
reloc = iget(inode->i_sb, reloc = iget(inode->i_sb,
(ISOFS_I(inode)->i_first_extent << (ISOFS_I(inode)->i_first_extent <<
inode -> i_sb -> u.isofs_sb.s_log_zone_size)); ISOFS_SB(inode->i_sb)->s_log_zone_size));
if (!reloc) if (!reloc)
goto out; goto out;
inode->i_mode = reloc->i_mode; inode->i_mode = reloc->i_mode;
...@@ -385,7 +385,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de, ...@@ -385,7 +385,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de,
break; break;
#ifdef CONFIG_ZISOFS #ifdef CONFIG_ZISOFS
case SIG('Z','F'): case SIG('Z','F'):
if ( !inode->i_sb->u.isofs_sb.s_nocompress ) { if ( !ISOFS_SB(inode->i_sb)->s_nocompress ) {
int algo; int algo;
algo = isonum_721(rr->u.ZF.algorithm); algo = isonum_721(rr->u.ZF.algorithm);
if ( algo == SIG('p','z') ) { if ( algo == SIG('p','z') ) {
...@@ -478,8 +478,8 @@ int parse_rock_ridge_inode(struct iso_directory_record * de, ...@@ -478,8 +478,8 @@ int parse_rock_ridge_inode(struct iso_directory_record * de,
int result=parse_rock_ridge_inode_internal(de,inode,0); int result=parse_rock_ridge_inode_internal(de,inode,0);
/* if rockridge flag was reset and we didn't look for attributes /* if rockridge flag was reset and we didn't look for attributes
* behind eventual XA attributes, have a look there */ * behind eventual XA attributes, have a look there */
if ((inode->i_sb->u.isofs_sb.s_rock_offset==-1) if ((ISOFS_SB(inode->i_sb)->s_rock_offset==-1)
&&(inode->i_sb->u.isofs_sb.s_rock==2)) &&(ISOFS_SB(inode->i_sb)->s_rock==2))
{ {
result=parse_rock_ridge_inode_internal(de,inode,14); result=parse_rock_ridge_inode_internal(de,inode,14);
}; };
...@@ -506,7 +506,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) ...@@ -506,7 +506,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
unsigned char *chr; unsigned char *chr;
struct rock_ridge *rr; struct rock_ridge *rr;
if (!inode->i_sb->u.isofs_sb.s_rock) if (!ISOFS_SB(inode->i_sb)->s_rock)
panic ("Cannot have symlink with high sierra variant of iso filesystem\n"); panic ("Cannot have symlink with high sierra variant of iso filesystem\n");
block = inode->i_ino >> bufbits; block = inode->i_ino >> bufbits;
......
...@@ -648,7 +648,6 @@ struct quota_mount_options ...@@ -648,7 +648,6 @@ struct quota_mount_options
#include <linux/ext3_fs_sb.h> #include <linux/ext3_fs_sb.h>
#include <linux/hpfs_fs_sb.h> #include <linux/hpfs_fs_sb.h>
#include <linux/ntfs_fs_sb.h> #include <linux/ntfs_fs_sb.h>
#include <linux/iso_fs_sb.h>
#include <linux/sysv_fs_sb.h> #include <linux/sysv_fs_sb.h>
#include <linux/affs_fs_sb.h> #include <linux/affs_fs_sb.h>
#include <linux/ufs_fs_sb.h> #include <linux/ufs_fs_sb.h>
...@@ -697,7 +696,6 @@ struct super_block { ...@@ -697,7 +696,6 @@ struct super_block {
struct ext3_sb_info ext3_sb; struct ext3_sb_info ext3_sb;
struct hpfs_sb_info hpfs_sb; struct hpfs_sb_info hpfs_sb;
struct ntfs_sb_info ntfs_sb; struct ntfs_sb_info ntfs_sb;
struct isofs_sb_info isofs_sb;
struct sysv_sb_info sysv_sb; struct sysv_sb_info sysv_sb;
struct affs_sb_info affs_sb; struct affs_sb_info affs_sb;
struct ufs_sb_info ufs_sb; struct ufs_sb_info ufs_sb;
......
...@@ -160,7 +160,6 @@ struct iso_directory_record { ...@@ -160,7 +160,6 @@ struct iso_directory_record {
#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
#define ISOFS_ZONE_BITS(INODE) ((INODE)->i_sb->u.isofs_sb.s_log_zone_size)
#define ISOFS_SUPER_MAGIC 0x9660 #define ISOFS_SUPER_MAGIC 0x9660
...@@ -171,6 +170,12 @@ struct iso_directory_record { ...@@ -171,6 +170,12 @@ struct iso_directory_record {
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <linux/iso_fs_i.h> #include <linux/iso_fs_i.h>
#include <linux/iso_fs_sb.h>
static inline struct isofs_sb_info *ISOFS_SB(struct super_block *sb)
{
return sb->u.generic_sbp;
}
static inline struct iso_inode_info *ISOFS_I(struct inode *inode) static inline struct iso_inode_info *ISOFS_I(struct inode *inode)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment