diff options
Diffstat (limited to 'fs/qnx4/inode.c')
| -rw-r--r-- | fs/qnx4/inode.c | 84 |
1 files changed, 1 insertions, 83 deletions
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 681df5fcd161..d2cd1798d8c4 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c | |||
| @@ -28,73 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | static const struct super_operations qnx4_sops; | 29 | static const struct super_operations qnx4_sops; |
| 30 | 30 | ||
| 31 | #ifdef CONFIG_QNX4FS_RW | ||
| 32 | |||
| 33 | static void qnx4_delete_inode(struct inode *inode) | ||
| 34 | { | ||
| 35 | QNX4DEBUG(("qnx4: deleting inode [%lu]\n", (unsigned long) inode->i_ino)); | ||
| 36 | truncate_inode_pages(&inode->i_data, 0); | ||
| 37 | inode->i_size = 0; | ||
| 38 | qnx4_truncate(inode); | ||
| 39 | lock_kernel(); | ||
| 40 | qnx4_free_inode(inode); | ||
| 41 | unlock_kernel(); | ||
| 42 | } | ||
| 43 | |||
| 44 | static int qnx4_write_inode(struct inode *inode, int do_sync) | ||
| 45 | { | ||
| 46 | struct qnx4_inode_entry *raw_inode; | ||
| 47 | int block, ino; | ||
| 48 | struct buffer_head *bh; | ||
| 49 | ino = inode->i_ino; | ||
| 50 | |||
| 51 | QNX4DEBUG(("qnx4: write inode 1.\n")); | ||
| 52 | if (inode->i_nlink == 0) { | ||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | if (!ino) { | ||
| 56 | printk("qnx4: bad inode number on dev %s: %d is out of range\n", | ||
| 57 | inode->i_sb->s_id, ino); | ||
| 58 | return -EIO; | ||
| 59 | } | ||
| 60 | QNX4DEBUG(("qnx4: write inode 2.\n")); | ||
| 61 | block = ino / QNX4_INODES_PER_BLOCK; | ||
| 62 | lock_kernel(); | ||
| 63 | if (!(bh = sb_bread(inode->i_sb, block))) { | ||
| 64 | printk("qnx4: major problem: unable to read inode from dev " | ||
| 65 | "%s\n", inode->i_sb->s_id); | ||
| 66 | unlock_kernel(); | ||
| 67 | return -EIO; | ||
| 68 | } | ||
| 69 | raw_inode = ((struct qnx4_inode_entry *) bh->b_data) + | ||
| 70 | (ino % QNX4_INODES_PER_BLOCK); | ||
| 71 | raw_inode->di_mode = cpu_to_le16(inode->i_mode); | ||
| 72 | raw_inode->di_uid = cpu_to_le16(fs_high2lowuid(inode->i_uid)); | ||
| 73 | raw_inode->di_gid = cpu_to_le16(fs_high2lowgid(inode->i_gid)); | ||
| 74 | raw_inode->di_nlink = cpu_to_le16(inode->i_nlink); | ||
| 75 | raw_inode->di_size = cpu_to_le32(inode->i_size); | ||
| 76 | raw_inode->di_mtime = cpu_to_le32(inode->i_mtime.tv_sec); | ||
| 77 | raw_inode->di_atime = cpu_to_le32(inode->i_atime.tv_sec); | ||
| 78 | raw_inode->di_ctime = cpu_to_le32(inode->i_ctime.tv_sec); | ||
| 79 | raw_inode->di_first_xtnt.xtnt_size = cpu_to_le32(inode->i_blocks); | ||
| 80 | mark_buffer_dirty(bh); | ||
| 81 | if (do_sync) { | ||
| 82 | sync_dirty_buffer(bh); | ||
| 83 | if (buffer_req(bh) && !buffer_uptodate(bh)) { | ||
| 84 | printk("qnx4: IO error syncing inode [%s:%08x]\n", | ||
| 85 | inode->i_sb->s_id, ino); | ||
| 86 | brelse(bh); | ||
| 87 | unlock_kernel(); | ||
| 88 | return -EIO; | ||
| 89 | } | ||
| 90 | } | ||
| 91 | brelse(bh); | ||
| 92 | unlock_kernel(); | ||
| 93 | return 0; | ||
| 94 | } | ||
| 95 | |||
| 96 | #endif | ||
| 97 | |||
| 98 | static void qnx4_put_super(struct super_block *sb); | 31 | static void qnx4_put_super(struct super_block *sb); |
| 99 | static struct inode *qnx4_alloc_inode(struct super_block *sb); | 32 | static struct inode *qnx4_alloc_inode(struct super_block *sb); |
| 100 | static void qnx4_destroy_inode(struct inode *inode); | 33 | static void qnx4_destroy_inode(struct inode *inode); |
| @@ -108,10 +41,6 @@ static const struct super_operations qnx4_sops = | |||
| 108 | .put_super = qnx4_put_super, | 41 | .put_super = qnx4_put_super, |
| 109 | .statfs = qnx4_statfs, | 42 | .statfs = qnx4_statfs, |
| 110 | .remount_fs = qnx4_remount, | 43 | .remount_fs = qnx4_remount, |
| 111 | #ifdef CONFIG_QNX4FS_RW | ||
| 112 | .write_inode = qnx4_write_inode, | ||
| 113 | .delete_inode = qnx4_delete_inode, | ||
| 114 | #endif | ||
| 115 | }; | 44 | }; |
| 116 | 45 | ||
| 117 | static int qnx4_remount(struct super_block *sb, int *flags, char *data) | 46 | static int qnx4_remount(struct super_block *sb, int *flags, char *data) |
| @@ -120,15 +49,7 @@ static int qnx4_remount(struct super_block *sb, int *flags, char *data) | |||
| 120 | 49 | ||
| 121 | qs = qnx4_sb(sb); | 50 | qs = qnx4_sb(sb); |
| 122 | qs->Version = QNX4_VERSION; | 51 | qs->Version = QNX4_VERSION; |
| 123 | #ifndef CONFIG_QNX4FS_RW | ||
| 124 | *flags |= MS_RDONLY; | 52 | *flags |= MS_RDONLY; |
| 125 | #endif | ||
| 126 | if (*flags & MS_RDONLY) { | ||
| 127 | return 0; | ||
| 128 | } | ||
| 129 | |||
| 130 | mark_buffer_dirty(qs->sb_buf); | ||
| 131 | |||
| 132 | return 0; | 53 | return 0; |
| 133 | } | 54 | } |
| 134 | 55 | ||
| @@ -354,9 +275,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) | |||
| 354 | } | 275 | } |
| 355 | s->s_op = &qnx4_sops; | 276 | s->s_op = &qnx4_sops; |
| 356 | s->s_magic = QNX4_SUPER_MAGIC; | 277 | s->s_magic = QNX4_SUPER_MAGIC; |
| 357 | #ifndef CONFIG_QNX4FS_RW | ||
| 358 | s->s_flags |= MS_RDONLY; /* Yup, read-only yet */ | 278 | s->s_flags |= MS_RDONLY; /* Yup, read-only yet */ |
| 359 | #endif | ||
| 360 | qnx4_sb(s)->sb_buf = bh; | 279 | qnx4_sb(s)->sb_buf = bh; |
| 361 | qnx4_sb(s)->sb = (struct qnx4_super_block *) bh->b_data; | 280 | qnx4_sb(s)->sb = (struct qnx4_super_block *) bh->b_data; |
| 362 | 281 | ||
| @@ -489,8 +408,7 @@ struct inode *qnx4_iget(struct super_block *sb, unsigned long ino) | |||
| 489 | 408 | ||
| 490 | memcpy(qnx4_inode, raw_inode, QNX4_DIR_ENTRY_SIZE); | 409 | memcpy(qnx4_inode, raw_inode, QNX4_DIR_ENTRY_SIZE); |
| 491 | if (S_ISREG(inode->i_mode)) { | 410 | if (S_ISREG(inode->i_mode)) { |
| 492 | inode->i_op = &qnx4_file_inode_operations; | 411 | inode->i_fop = &generic_ro_fops; |
| 493 | inode->i_fop = &qnx4_file_operations; | ||
| 494 | inode->i_mapping->a_ops = &qnx4_aops; | 412 | inode->i_mapping->a_ops = &qnx4_aops; |
| 495 | qnx4_i(inode)->mmu_private = inode->i_size; | 413 | qnx4_i(inode)->mmu_private = inode->i_size; |
| 496 | } else if (S_ISDIR(inode->i_mode)) { | 414 | } else if (S_ISDIR(inode->i_mode)) { |
