2828
2929static const struct super_operations qnx4_sops ;
3030
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-
9831static void qnx4_put_super (struct super_block * sb );
9932static struct inode * qnx4_alloc_inode (struct super_block * sb );
10033static void qnx4_destroy_inode (struct inode * inode );
@@ -108,10 +41,6 @@ static const struct super_operations qnx4_sops =
10841 .put_super = qnx4_put_super ,
10942 .statfs = qnx4_statfs ,
11043 .remount_fs = qnx4_remount ,
111- #ifdef CONFIG_QNX4FS_RW
112- .write_inode = qnx4_write_inode ,
113- .delete_inode = qnx4_delete_inode ,
114- #endif
11544};
11645
11746static 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)
12049
12150 qs = qnx4_sb (sb );
12251 qs -> Version = QNX4_VERSION ;
123- #ifndef CONFIG_QNX4FS_RW
12452 * flags |= MS_RDONLY ;
125- #endif
126- if (* flags & MS_RDONLY ) {
127- return 0 ;
128- }
129-
130- mark_buffer_dirty (qs -> sb_buf );
131-
13253 return 0 ;
13354}
13455
@@ -354,9 +275,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
354275 }
355276 s -> s_op = & qnx4_sops ;
356277 s -> s_magic = QNX4_SUPER_MAGIC ;
357- #ifndef CONFIG_QNX4FS_RW
358278 s -> s_flags |= MS_RDONLY ; /* Yup, read-only yet */
359- #endif
360279 qnx4_sb (s )-> sb_buf = bh ;
361280 qnx4_sb (s )-> sb = (struct qnx4_super_block * ) bh -> b_data ;
362281
@@ -489,8 +408,7 @@ struct inode *qnx4_iget(struct super_block *sb, unsigned long ino)
489408
490409 memcpy (qnx4_inode , raw_inode , QNX4_DIR_ENTRY_SIZE );
491410 if (S_ISREG (inode -> i_mode )) {
492- inode -> i_op = & qnx4_file_inode_operations ;
493- inode -> i_fop = & qnx4_file_operations ;
411+ inode -> i_fop = & generic_ro_fops ;
494412 inode -> i_mapping -> a_ops = & qnx4_aops ;
495413 qnx4_i (inode )-> mmu_private = inode -> i_size ;
496414 } else if (S_ISDIR (inode -> i_mode )) {
0 commit comments