15 #include <linux/module.h>
17 #include <linux/slab.h>
25 #define QNX4_VERSION 4
26 #define QNX4_BMNAME ".bitmap"
32 static void qnx4_destroy_inode(
struct inode *
inode);
38 .alloc_inode = qnx4_alloc_inode,
39 .destroy_inode = qnx4_destroy_inode,
40 .put_super = qnx4_put_super,
41 .statfs = qnx4_statfs,
42 .remount_fs = qnx4_remount,
64 map_bh(bh, inode->
i_sb, phys);
82 struct buffer_head *bh =
NULL;
95 while ( --nxtnt > 0 ) {
98 bh = sb_bread(inode->
i_sb, i_xblk - 1);
105 QNX4DEBUG((
KERN_ERR "qnx4: block at %ld is not a valid xtnt\n", qnx4_inode->i_xblk));
109 block = try_extent(&xblk->
xblk_xtnts[ix], &offset);
132 u64 id = huge_encode_dev(sb->
s_bdev->bd_dev);
151 static const char *qnx4_checkroot(
struct super_block *sb)
153 struct buffer_head *bh;
158 if (*(qnx4_sb(sb)->sb->RootDir.di_fname) !=
'/')
159 return "no qnx4 filesystem (no root dir).";
161 rd =
le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1;
162 rl =
le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size);
163 for (j = 0; j < rl; j++) {
164 bh = sb_bread(sb, rd + j);
166 return "unable to read root entry.";
172 qnx4_sb(sb)->BitMap =
kmemdup(rootdir,
176 if (!qnx4_sb(sb)->BitMap)
177 return "not enough memory for bitmap inode";
183 return "bitmap file not found.";
188 struct buffer_head *bh;
214 s->
s_op = &qnx4_sops;
217 qnx4_sb(s)->sb_buf = bh;
222 errmsg = qnx4_checkroot(s);
223 if (errmsg !=
NULL) {
274 .readpage = qnx4_readpage,
280 struct buffer_head *bh;
292 qnx4_inode = qnx4_raw_inode(inode);
301 return ERR_PTR(-
EIO);
305 if (!(bh = sb_bread(sb, block))) {
306 printk(
KERN_ERR "qnx4: major problem: unable to read inode from dev "
309 return ERR_PTR(-
EIO);
331 qnx4_i(inode)->mmu_private = inode->
i_size;
338 qnx4_i(inode)->mmu_private = inode->
i_size;
344 return ERR_PTR(-
EIO);
353 static struct inode *qnx4_alloc_inode(
struct super_block *sb)
368 static void qnx4_destroy_inode(
struct inode *inode)
373 static void init_once(
void *
foo)
380 static int init_inodecache(
void)
387 if (qnx4_inode_cachep ==
NULL)
392 static void destroy_inodecache(
void)
403 int flags,
const char *dev_name,
void *data)
405 return mount_bdev(fs_type, flags, dev_name, data, qnx4_fill_super);
416 static int __init init_qnx4_fs(
void)
420 err = init_inodecache();
426 destroy_inodecache();
434 static void __exit exit_qnx4_fs(
void)
437 destroy_inodecache();