inode.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /*
  2. * QNX4 file system, Linux implementation.
  3. *
  4. * Version : 0.2.1
  5. *
  6. * Using parts of the xiafs filesystem.
  7. *
  8. * History :
  9. *
  10. * 01-06-1998 by Richard Frowijn : first release.
  11. * 20-06-1998 by Frank Denis : Linux 2.1.99+ support, boot signature, misc.
  12. * 30-06-1998 by Frank Denis : first step to write inodes.
  13. */
  14. #include <linux/module.h>
  15. #include <linux/types.h>
  16. #include <linux/string.h>
  17. #include <linux/errno.h>
  18. #include <linux/slab.h>
  19. #include <linux/fs.h>
  20. #include <linux/qnx4_fs.h>
  21. #include <linux/init.h>
  22. #include <linux/highuid.h>
  23. #include <linux/smp_lock.h>
  24. #include <linux/pagemap.h>
  25. #include <linux/buffer_head.h>
  26. #include <linux/vfs.h>
  27. #include <asm/uaccess.h>
  28. #define QNX4_VERSION 4
  29. #define QNX4_BMNAME ".bitmap"
  30. static const struct super_operations qnx4_sops;
  31. #ifdef CONFIG_QNX4FS_RW
  32. int qnx4_sync_inode(struct inode *inode)
  33. {
  34. int err = 0;
  35. # if 0
  36. struct buffer_head *bh;
  37. bh = qnx4_update_inode(inode);
  38. if (bh && buffer_dirty(bh))
  39. {
  40. sync_dirty_buffer(bh);
  41. if (buffer_req(bh) && !buffer_uptodate(bh))
  42. {
  43. printk ("IO error syncing qnx4 inode [%s:%08lx]\n",
  44. inode->i_sb->s_id, inode->i_ino);
  45. err = -1;
  46. }
  47. brelse (bh);
  48. } else if (!bh) {
  49. err = -1;
  50. }
  51. # endif
  52. return err;
  53. }
  54. static void qnx4_delete_inode(struct inode *inode)
  55. {
  56. QNX4DEBUG(("qnx4: deleting inode [%lu]\n", (unsigned long) inode->i_ino));
  57. truncate_inode_pages(&inode->i_data, 0);
  58. inode->i_size = 0;
  59. qnx4_truncate(inode);
  60. lock_kernel();
  61. qnx4_free_inode(inode);
  62. unlock_kernel();
  63. }
  64. static void qnx4_write_super(struct super_block *sb)
  65. {
  66. lock_kernel();
  67. QNX4DEBUG(("qnx4: write_super\n"));
  68. sb->s_dirt = 0;
  69. unlock_kernel();
  70. }
  71. static int qnx4_write_inode(struct inode *inode, int unused)
  72. {
  73. struct qnx4_inode_entry *raw_inode;
  74. int block, ino;
  75. struct buffer_head *bh;
  76. ino = inode->i_ino;
  77. QNX4DEBUG(("qnx4: write inode 1.\n"));
  78. if (inode->i_nlink == 0) {
  79. return 0;
  80. }
  81. if (!ino) {
  82. printk("qnx4: bad inode number on dev %s: %d is out of range\n",
  83. inode->i_sb->s_id, ino);
  84. return -EIO;
  85. }
  86. QNX4DEBUG(("qnx4: write inode 2.\n"));
  87. block = ino / QNX4_INODES_PER_BLOCK;
  88. lock_kernel();
  89. if (!(bh = sb_bread(inode->i_sb, block))) {
  90. printk("qnx4: major problem: unable to read inode from dev "
  91. "%s\n", inode->i_sb->s_id);
  92. unlock_kernel();
  93. return -EIO;
  94. }
  95. raw_inode = ((struct qnx4_inode_entry *) bh->b_data) +
  96. (ino % QNX4_INODES_PER_BLOCK);
  97. raw_inode->di_mode = cpu_to_le16(inode->i_mode);
  98. raw_inode->di_uid = cpu_to_le16(fs_high2lowuid(inode->i_uid));
  99. raw_inode->di_gid = cpu_to_le16(fs_high2lowgid(inode->i_gid));
  100. raw_inode->di_nlink = cpu_to_le16(inode->i_nlink);
  101. raw_inode->di_size = cpu_to_le32(inode->i_size);
  102. raw_inode->di_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
  103. raw_inode->di_atime = cpu_to_le32(inode->i_atime.tv_sec);
  104. raw_inode->di_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
  105. raw_inode->di_first_xtnt.xtnt_size = cpu_to_le32(inode->i_blocks);
  106. mark_buffer_dirty(bh);
  107. brelse(bh);
  108. unlock_kernel();
  109. return 0;
  110. }
  111. #endif
  112. static void qnx4_put_super(struct super_block *sb);
  113. static struct inode *qnx4_alloc_inode(struct super_block *sb);
  114. static void qnx4_destroy_inode(struct inode *inode);
  115. static int qnx4_remount(struct super_block *sb, int *flags, char *data);
  116. static int qnx4_statfs(struct dentry *, struct kstatfs *);
  117. static const struct super_operations qnx4_sops =
  118. {
  119. .alloc_inode = qnx4_alloc_inode,
  120. .destroy_inode = qnx4_destroy_inode,
  121. .put_super = qnx4_put_super,
  122. .statfs = qnx4_statfs,
  123. .remount_fs = qnx4_remount,
  124. #ifdef CONFIG_QNX4FS_RW
  125. .write_inode = qnx4_write_inode,
  126. .delete_inode = qnx4_delete_inode,
  127. .write_super = qnx4_write_super,
  128. #endif
  129. };
  130. static int qnx4_remount(struct super_block *sb, int *flags, char *data)
  131. {
  132. struct qnx4_sb_info *qs;
  133. qs = qnx4_sb(sb);
  134. qs->Version = QNX4_VERSION;
  135. #ifndef CONFIG_QNX4FS_RW
  136. *flags |= MS_RDONLY;
  137. #endif
  138. if (*flags & MS_RDONLY) {
  139. return 0;
  140. }
  141. mark_buffer_dirty(qs->sb_buf);
  142. return 0;
  143. }
  144. static struct buffer_head *qnx4_getblk(struct inode *inode, int nr,
  145. int create)
  146. {
  147. struct buffer_head *result = NULL;
  148. if ( nr >= 0 )
  149. nr = qnx4_block_map( inode, nr );
  150. if (nr) {
  151. result = sb_getblk(inode->i_sb, nr);
  152. return result;
  153. }
  154. if (!create) {
  155. return NULL;
  156. }
  157. #if 0
  158. tmp = qnx4_new_block(inode->i_sb);
  159. if (!tmp) {
  160. return NULL;
  161. }
  162. result = sb_getblk(inode->i_sb, tmp);
  163. if (tst) {
  164. qnx4_free_block(inode->i_sb, tmp);
  165. brelse(result);
  166. goto repeat;
  167. }
  168. tst = tmp;
  169. #endif
  170. inode->i_ctime = CURRENT_TIME_SEC;
  171. mark_inode_dirty(inode);
  172. return result;
  173. }
  174. struct buffer_head *qnx4_bread(struct inode *inode, int block, int create)
  175. {
  176. struct buffer_head *bh;
  177. bh = qnx4_getblk(inode, block, create);
  178. if (!bh || buffer_uptodate(bh)) {
  179. return bh;
  180. }
  181. ll_rw_block(READ, 1, &bh);
  182. wait_on_buffer(bh);
  183. if (buffer_uptodate(bh)) {
  184. return bh;
  185. }
  186. brelse(bh);
  187. return NULL;
  188. }
  189. static int qnx4_get_block( struct inode *inode, sector_t iblock, struct buffer_head *bh, int create )
  190. {
  191. unsigned long phys;
  192. QNX4DEBUG(("qnx4: qnx4_get_block inode=[%ld] iblock=[%ld]\n",inode->i_ino,iblock));
  193. phys = qnx4_block_map( inode, iblock );
  194. if ( phys ) {
  195. // logical block is before EOF
  196. map_bh(bh, inode->i_sb, phys);
  197. } else if ( create ) {
  198. // to be done.
  199. }
  200. return 0;
  201. }
  202. unsigned long qnx4_block_map( struct inode *inode, long iblock )
  203. {
  204. int ix;
  205. long offset, i_xblk;
  206. unsigned long block = 0;
  207. struct buffer_head *bh = NULL;
  208. struct qnx4_xblk *xblk = NULL;
  209. struct qnx4_inode_entry *qnx4_inode = qnx4_raw_inode(inode);
  210. u16 nxtnt = le16_to_cpu(qnx4_inode->di_num_xtnts);
  211. if ( iblock < le32_to_cpu(qnx4_inode->di_first_xtnt.xtnt_size) ) {
  212. // iblock is in the first extent. This is easy.
  213. block = le32_to_cpu(qnx4_inode->di_first_xtnt.xtnt_blk) + iblock - 1;
  214. } else {
  215. // iblock is beyond first extent. We have to follow the extent chain.
  216. i_xblk = le32_to_cpu(qnx4_inode->di_xblk);
  217. offset = iblock - le32_to_cpu(qnx4_inode->di_first_xtnt.xtnt_size);
  218. ix = 0;
  219. while ( --nxtnt > 0 ) {
  220. if ( ix == 0 ) {
  221. // read next xtnt block.
  222. bh = sb_bread(inode->i_sb, i_xblk - 1);
  223. if ( !bh ) {
  224. QNX4DEBUG(("qnx4: I/O error reading xtnt block [%ld])\n", i_xblk - 1));
  225. return -EIO;
  226. }
  227. xblk = (struct qnx4_xblk*)bh->b_data;
  228. if ( memcmp( xblk->xblk_signature, "IamXblk", 7 ) ) {
  229. QNX4DEBUG(("qnx4: block at %ld is not a valid xtnt\n", qnx4_inode->i_xblk));
  230. return -EIO;
  231. }
  232. }
  233. if ( offset < le32_to_cpu(xblk->xblk_xtnts[ix].xtnt_size) ) {
  234. // got it!
  235. block = le32_to_cpu(xblk->xblk_xtnts[ix].xtnt_blk) + offset - 1;
  236. break;
  237. }
  238. offset -= le32_to_cpu(xblk->xblk_xtnts[ix].xtnt_size);
  239. if ( ++ix >= xblk->xblk_num_xtnts ) {
  240. i_xblk = le32_to_cpu(xblk->xblk_next_xblk);
  241. ix = 0;
  242. brelse( bh );
  243. bh = NULL;
  244. }
  245. }
  246. if ( bh )
  247. brelse( bh );
  248. }
  249. QNX4DEBUG(("qnx4: mapping block %ld of inode %ld = %ld\n",iblock,inode->i_ino,block));
  250. return block;
  251. }
  252. static int qnx4_statfs(struct dentry *dentry, struct kstatfs *buf)
  253. {
  254. struct super_block *sb = dentry->d_sb;
  255. u64 id = huge_encode_dev(sb->s_bdev->bd_dev);
  256. lock_kernel();
  257. buf->f_type = sb->s_magic;
  258. buf->f_bsize = sb->s_blocksize;
  259. buf->f_blocks = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size) * 8;
  260. buf->f_bfree = qnx4_count_free_blocks(sb);
  261. buf->f_bavail = buf->f_bfree;
  262. buf->f_namelen = QNX4_NAME_MAX;
  263. buf->f_fsid.val[0] = (u32)id;
  264. buf->f_fsid.val[1] = (u32)(id >> 32);
  265. unlock_kernel();
  266. return 0;
  267. }
  268. /*
  269. * Check the root directory of the filesystem to make sure
  270. * it really _is_ a qnx4 filesystem, and to check the size
  271. * of the directory entry.
  272. */
  273. static const char *qnx4_checkroot(struct super_block *sb)
  274. {
  275. struct buffer_head *bh;
  276. struct qnx4_inode_entry *rootdir;
  277. int rd, rl;
  278. int i, j;
  279. int found = 0;
  280. if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/') {
  281. return "no qnx4 filesystem (no root dir).";
  282. } else {
  283. QNX4DEBUG(("QNX4 filesystem found on dev %s.\n", sb->s_id));
  284. rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1;
  285. rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size);
  286. for (j = 0; j < rl; j++) {
  287. bh = sb_bread(sb, rd + j); /* root dir, first block */
  288. if (bh == NULL) {
  289. return "unable to read root entry.";
  290. }
  291. for (i = 0; i < QNX4_INODES_PER_BLOCK; i++) {
  292. rootdir = (struct qnx4_inode_entry *) (bh->b_data + i * QNX4_DIR_ENTRY_SIZE);
  293. if (rootdir->di_fname != NULL) {
  294. QNX4DEBUG(("Rootdir entry found : [%s]\n", rootdir->di_fname));
  295. if (!strncmp(rootdir->di_fname, QNX4_BMNAME, sizeof QNX4_BMNAME)) {
  296. found = 1;
  297. qnx4_sb(sb)->BitMap = kmalloc( sizeof( struct qnx4_inode_entry ), GFP_KERNEL );
  298. if (!qnx4_sb(sb)->BitMap) {
  299. brelse (bh);
  300. return "not enough memory for bitmap inode";
  301. }
  302. memcpy( qnx4_sb(sb)->BitMap, rootdir, sizeof( struct qnx4_inode_entry ) ); /* keep bitmap inode known */
  303. break;
  304. }
  305. }
  306. }
  307. brelse(bh);
  308. if (found != 0) {
  309. break;
  310. }
  311. }
  312. if (found == 0) {
  313. return "bitmap file not found.";
  314. }
  315. }
  316. return NULL;
  317. }
  318. static int qnx4_fill_super(struct super_block *s, void *data, int silent)
  319. {
  320. struct buffer_head *bh;
  321. struct inode *root;
  322. const char *errmsg;
  323. struct qnx4_sb_info *qs;
  324. int ret = -EINVAL;
  325. qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL);
  326. if (!qs)
  327. return -ENOMEM;
  328. s->s_fs_info = qs;
  329. sb_set_blocksize(s, QNX4_BLOCK_SIZE);
  330. /* Check the superblock signature. Since the qnx4 code is
  331. dangerous, we should leave as quickly as possible
  332. if we don't belong here... */
  333. bh = sb_bread(s, 1);
  334. if (!bh) {
  335. printk("qnx4: unable to read the superblock\n");
  336. goto outnobh;
  337. }
  338. if ( le32_to_cpup((__le32*) bh->b_data) != QNX4_SUPER_MAGIC ) {
  339. if (!silent)
  340. printk("qnx4: wrong fsid in superblock.\n");
  341. goto out;
  342. }
  343. s->s_op = &qnx4_sops;
  344. s->s_magic = QNX4_SUPER_MAGIC;
  345. #ifndef CONFIG_QNX4FS_RW
  346. s->s_flags |= MS_RDONLY; /* Yup, read-only yet */
  347. #endif
  348. qnx4_sb(s)->sb_buf = bh;
  349. qnx4_sb(s)->sb = (struct qnx4_super_block *) bh->b_data;
  350. /* check before allocating dentries, inodes, .. */
  351. errmsg = qnx4_checkroot(s);
  352. if (errmsg != NULL) {
  353. if (!silent)
  354. printk("qnx4: %s\n", errmsg);
  355. goto out;
  356. }
  357. /* does root not have inode number QNX4_ROOT_INO ?? */
  358. root = qnx4_iget(s, QNX4_ROOT_INO * QNX4_INODES_PER_BLOCK);
  359. if (IS_ERR(root)) {
  360. printk("qnx4: get inode failed\n");
  361. ret = PTR_ERR(root);
  362. goto out;
  363. }
  364. ret = -ENOMEM;
  365. s->s_root = d_alloc_root(root);
  366. if (s->s_root == NULL)
  367. goto outi;
  368. brelse(bh);
  369. return 0;
  370. outi:
  371. iput(root);
  372. out:
  373. brelse(bh);
  374. outnobh:
  375. kfree(qs);
  376. s->s_fs_info = NULL;
  377. return ret;
  378. }
  379. static void qnx4_put_super(struct super_block *sb)
  380. {
  381. struct qnx4_sb_info *qs = qnx4_sb(sb);
  382. kfree( qs->BitMap );
  383. kfree( qs );
  384. sb->s_fs_info = NULL;
  385. return;
  386. }
  387. static int qnx4_writepage(struct page *page, struct writeback_control *wbc)
  388. {
  389. return block_write_full_page(page,qnx4_get_block, wbc);
  390. }
  391. static int qnx4_readpage(struct file *file, struct page *page)
  392. {
  393. return block_read_full_page(page,qnx4_get_block);
  394. }
  395. static int qnx4_write_begin(struct file *file, struct address_space *mapping,
  396. loff_t pos, unsigned len, unsigned flags,
  397. struct page **pagep, void **fsdata)
  398. {
  399. struct qnx4_inode_info *qnx4_inode = qnx4_i(mapping->host);
  400. *pagep = NULL;
  401. return cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
  402. qnx4_get_block,
  403. &qnx4_inode->mmu_private);
  404. }
  405. static sector_t qnx4_bmap(struct address_space *mapping, sector_t block)
  406. {
  407. return generic_block_bmap(mapping,block,qnx4_get_block);
  408. }
  409. static const struct address_space_operations qnx4_aops = {
  410. .readpage = qnx4_readpage,
  411. .writepage = qnx4_writepage,
  412. .sync_page = block_sync_page,
  413. .write_begin = qnx4_write_begin,
  414. .write_end = generic_write_end,
  415. .bmap = qnx4_bmap
  416. };
  417. struct inode *qnx4_iget(struct super_block *sb, unsigned long ino)
  418. {
  419. struct buffer_head *bh;
  420. struct qnx4_inode_entry *raw_inode;
  421. int block;
  422. struct qnx4_inode_entry *qnx4_inode;
  423. struct inode *inode;
  424. inode = iget_locked(sb, ino);
  425. if (!inode)
  426. return ERR_PTR(-ENOMEM);
  427. if (!(inode->i_state & I_NEW))
  428. return inode;
  429. qnx4_inode = qnx4_raw_inode(inode);
  430. inode->i_mode = 0;
  431. QNX4DEBUG(("Reading inode : [%d]\n", ino));
  432. if (!ino) {
  433. printk(KERN_ERR "qnx4: bad inode number on dev %s: %lu is "
  434. "out of range\n",
  435. sb->s_id, ino);
  436. iget_failed(inode);
  437. return ERR_PTR(-EIO);
  438. }
  439. block = ino / QNX4_INODES_PER_BLOCK;
  440. if (!(bh = sb_bread(sb, block))) {
  441. printk("qnx4: major problem: unable to read inode from dev "
  442. "%s\n", sb->s_id);
  443. iget_failed(inode);
  444. return ERR_PTR(-EIO);
  445. }
  446. raw_inode = ((struct qnx4_inode_entry *) bh->b_data) +
  447. (ino % QNX4_INODES_PER_BLOCK);
  448. inode->i_mode = le16_to_cpu(raw_inode->di_mode);
  449. inode->i_uid = (uid_t)le16_to_cpu(raw_inode->di_uid);
  450. inode->i_gid = (gid_t)le16_to_cpu(raw_inode->di_gid);
  451. inode->i_nlink = le16_to_cpu(raw_inode->di_nlink);
  452. inode->i_size = le32_to_cpu(raw_inode->di_size);
  453. inode->i_mtime.tv_sec = le32_to_cpu(raw_inode->di_mtime);
  454. inode->i_mtime.tv_nsec = 0;
  455. inode->i_atime.tv_sec = le32_to_cpu(raw_inode->di_atime);
  456. inode->i_atime.tv_nsec = 0;
  457. inode->i_ctime.tv_sec = le32_to_cpu(raw_inode->di_ctime);
  458. inode->i_ctime.tv_nsec = 0;
  459. inode->i_blocks = le32_to_cpu(raw_inode->di_first_xtnt.xtnt_size);
  460. memcpy(qnx4_inode, raw_inode, QNX4_DIR_ENTRY_SIZE);
  461. if (S_ISREG(inode->i_mode)) {
  462. inode->i_op = &qnx4_file_inode_operations;
  463. inode->i_fop = &qnx4_file_operations;
  464. inode->i_mapping->a_ops = &qnx4_aops;
  465. qnx4_i(inode)->mmu_private = inode->i_size;
  466. } else if (S_ISDIR(inode->i_mode)) {
  467. inode->i_op = &qnx4_dir_inode_operations;
  468. inode->i_fop = &qnx4_dir_operations;
  469. } else if (S_ISLNK(inode->i_mode)) {
  470. inode->i_op = &page_symlink_inode_operations;
  471. inode->i_mapping->a_ops = &qnx4_aops;
  472. qnx4_i(inode)->mmu_private = inode->i_size;
  473. } else {
  474. printk(KERN_ERR "qnx4: bad inode %lu on dev %s\n",
  475. ino, sb->s_id);
  476. iget_failed(inode);
  477. brelse(bh);
  478. return ERR_PTR(-EIO);
  479. }
  480. brelse(bh);
  481. unlock_new_inode(inode);
  482. return inode;
  483. }
  484. static struct kmem_cache *qnx4_inode_cachep;
  485. static struct inode *qnx4_alloc_inode(struct super_block *sb)
  486. {
  487. struct qnx4_inode_info *ei;
  488. ei = kmem_cache_alloc(qnx4_inode_cachep, GFP_KERNEL);
  489. if (!ei)
  490. return NULL;
  491. return &ei->vfs_inode;
  492. }
  493. static void qnx4_destroy_inode(struct inode *inode)
  494. {
  495. kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode));
  496. }
  497. static void init_once(void *foo)
  498. {
  499. struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo;
  500. inode_init_once(&ei->vfs_inode);
  501. }
  502. static int init_inodecache(void)
  503. {
  504. qnx4_inode_cachep = kmem_cache_create("qnx4_inode_cache",
  505. sizeof(struct qnx4_inode_info),
  506. 0, (SLAB_RECLAIM_ACCOUNT|
  507. SLAB_MEM_SPREAD),
  508. init_once);
  509. if (qnx4_inode_cachep == NULL)
  510. return -ENOMEM;
  511. return 0;
  512. }
  513. static void destroy_inodecache(void)
  514. {
  515. kmem_cache_destroy(qnx4_inode_cachep);
  516. }
  517. static int qnx4_get_sb(struct file_system_type *fs_type,
  518. int flags, const char *dev_name, void *data, struct vfsmount *mnt)
  519. {
  520. return get_sb_bdev(fs_type, flags, dev_name, data, qnx4_fill_super,
  521. mnt);
  522. }
  523. static struct file_system_type qnx4_fs_type = {
  524. .owner = THIS_MODULE,
  525. .name = "qnx4",
  526. .get_sb = qnx4_get_sb,
  527. .kill_sb = kill_block_super,
  528. .fs_flags = FS_REQUIRES_DEV,
  529. };
  530. static int __init init_qnx4_fs(void)
  531. {
  532. int err;
  533. err = init_inodecache();
  534. if (err)
  535. return err;
  536. err = register_filesystem(&qnx4_fs_type);
  537. if (err) {
  538. destroy_inodecache();
  539. return err;
  540. }
  541. printk("QNX4 filesystem 0.2.3 registered.\n");
  542. return 0;
  543. }
  544. static void __exit exit_qnx4_fs(void)
  545. {
  546. unregister_filesystem(&qnx4_fs_type);
  547. destroy_inodecache();
  548. }
  549. module_init(init_qnx4_fs)
  550. module_exit(exit_qnx4_fs)
  551. MODULE_LICENSE("GPL");