Seperates qnx4_sb_info from struct super_block.
unsigned long qnx4_count_free_blocks(struct super_block *sb)
{
- int start = le32_to_cpu(sb->u.qnx4_sb.BitMap->di_first_xtnt.xtnt_blk) - 1;
+ int start = le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1;
int total = 0;
int total_free = 0;
int offset = 0;
- int size = le32_to_cpu(sb->u.qnx4_sb.BitMap->di_size);
+ int size = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size);
struct buffer_head *bh;
while (total < size) {
int qnx4_is_free(struct super_block *sb, long block)
{
- int start = le32_to_cpu(sb->u.qnx4_sb.BitMap->di_first_xtnt.xtnt_blk) - 1;
- int size = le32_to_cpu(sb->u.qnx4_sb.BitMap->di_size);
+ int start = le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1;
+ int size = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size);
struct buffer_head *bh;
const char *g;
int ret = -EIO;
int qnx4_set_bitmap(struct super_block *sb, long block, int busy)
{
- int start = le32_to_cpu(sb->u.qnx4_sb.BitMap->di_first_xtnt.xtnt_blk) - 1;
- int size = le32_to_cpu(sb->u.qnx4_sb.BitMap->di_size);
+ int start = le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1;
+ int size = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size);
struct buffer_head *bh;
char *g;
{
struct qnx4_sb_info *qs;
- qs = &sb->u.qnx4_sb;
+ qs = qnx4_sb(sb);
qs->Version = QNX4_VERSION;
if (*flags & MS_RDONLY) {
return 0;
{
buf->f_type = sb->s_magic;
buf->f_bsize = sb->s_blocksize;
- buf->f_blocks = le32_to_cpu(sb->u.qnx4_sb.BitMap->di_size) * 8;
+ buf->f_blocks = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size) * 8;
buf->f_bfree = qnx4_count_free_blocks(sb);
buf->f_bavail = buf->f_bfree;
buf->f_namelen = QNX4_NAME_MAX;
int i, j;
int found = 0;
- if (*(sb->u.qnx4_sb.sb->RootDir.di_fname) != '/') {
+ if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/') {
return "no qnx4 filesystem (no root dir).";
} else {
QNX4DEBUG(("QNX4 filesystem found on dev %s.\n", sb->s_id));
- rd = le32_to_cpu(sb->u.qnx4_sb.sb->RootDir.di_first_xtnt.xtnt_blk) - 1;
- rl = le32_to_cpu(sb->u.qnx4_sb.sb->RootDir.di_first_xtnt.xtnt_size);
+ rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1;
+ rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size);
for (j = 0; j < rl; j++) {
bh = sb_bread(sb, rd + j); /* root dir, first block */
if (bh == NULL) {
QNX4DEBUG(("Rootdir entry found : [%s]\n", rootdir->di_fname));
if (!strncmp(rootdir->di_fname, QNX4_BMNAME, sizeof QNX4_BMNAME)) {
found = 1;
- sb->u.qnx4_sb.BitMap = kmalloc( sizeof( struct qnx4_inode_entry ), GFP_KERNEL );
- memcpy( sb->u.qnx4_sb.BitMap, rootdir, sizeof( struct qnx4_inode_entry ) ); /* keep bitmap inode known */
+ qnx4_sb(sb)->BitMap = kmalloc( sizeof( struct qnx4_inode_entry ), GFP_KERNEL );
+ memcpy( qnx4_sb(sb)->BitMap, rootdir, sizeof( struct qnx4_inode_entry ) ); /* keep bitmap inode known */
break;
}
}
struct buffer_head *bh;
struct inode *root;
const char *errmsg;
+ struct qnx4_sb_info *qs;
+
+ qs = kmalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL);
+ if (!qs)
+ return -ENOMEM;
+ s->u.generic_sbp = qs;
+ memset(qs, 0, sizeof(struct qnx4_sb_info));
sb_set_blocksize(s, QNX4_BLOCK_SIZE);
#ifndef CONFIG_QNX4FS_RW
s->s_flags |= MS_RDONLY; /* Yup, read-only yet */
#endif
- s->u.qnx4_sb.sb_buf = bh;
- s->u.qnx4_sb.sb = (struct qnx4_super_block *) bh->b_data;
+ qnx4_sb(s)->sb_buf = bh;
+ qnx4_sb(s)->sb = (struct qnx4_super_block *) bh->b_data;
/* check before allocating dentries, inodes, .. */
out:
brelse(bh);
outnobh:
-
+ kfree(qs);
+ s->u.generic_sbp = NULL;
return -EINVAL;
}
static void qnx4_put_super(struct super_block *sb)
{
- kfree( sb->u.qnx4_sb.BitMap );
+ struct qnx4_sb_info *qs = qnx4_sb(sb);
+ kfree( qs->BitMap );
+ kfree( qs );
+ sb->u.generic_sbp = NULL;
return;
}
#include <linux/romfs_fs_sb.h>
#include <linux/hfs_fs_sb.h>
#include <linux/adfs_fs_sb.h>
-#include <linux/qnx4_fs_sb.h>
#include <linux/reiserfs_fs_sb.h>
#include <linux/bfs_fs_sb.h>
#include <linux/udf_fs_sb.h>
struct romfs_sb_info romfs_sb;
struct hfs_sb_info hfs_sb;
struct adfs_sb_info adfs_sb;
- struct qnx4_sb_info qnx4_sb;
struct reiserfs_sb_info reiserfs_sb;
struct bfs_sb_info bfs_sb;
struct udf_sb_info udf_sb;
#define QNX4DEBUG(X) (void) 0
#endif
+struct qnx4_sb_info {
+ struct buffer_head *sb_buf; /* superblock buffer */
+ struct qnx4_super_block *sb; /* our superblock */
+ unsigned int Version; /* may be useful */
+ struct qnx4_inode_entry *BitMap; /* useful */
+};
+
struct qnx4_inode_info {
struct qnx4_inode_entry raw;
unsigned long mmu_private;
extern int qnx4_sync_inode(struct inode *inode);
extern int qnx4_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh, int create);
+static inline struct qnx4_sb_info *qnx4_sb(struct super_block *sb)
+{
+ return sb->u.generic_sbp;
+}
+
static inline struct qnx4_inode_info *qnx4_i(struct inode *inode)
{
return list_entry(inode, struct qnx4_inode_info, vfs_inode);
+++ /dev/null
-/*
- * Name : qnx4_fs_sb.h
- * Author : Richard Frowijn
- * Function : qnx4 superblock definitions
- * Version : 1.0.2
- * Last modified : 2000-01-06
- *
- * History : 23-03-1998 created
- *
- */
-#ifndef _QNX4_FS_SB
-#define _QNX4_FS_SB
-
-#include <linux/qnx4_fs.h>
-
-/*
- * qnx4 super-block data in memory
- */
-
-struct qnx4_sb_info {
- struct buffer_head *sb_buf; /* superblock buffer */
- struct qnx4_super_block *sb; /* our superblock */
- unsigned int Version; /* may be useful */
- struct qnx4_inode_entry *BitMap; /* useful */
-};
-
-#endif