2818 reboot function
[firefly-linux-kernel-4.4.55.git] / fs / qnx4 / inode.c
index 681df5fcd161402485e5768696897728450b705c..d2cd1798d8c4993fd773e18d7c516c72cb324ffb 100644 (file)
 
 static const struct super_operations qnx4_sops;
 
-#ifdef CONFIG_QNX4FS_RW
-
-static void qnx4_delete_inode(struct inode *inode)
-{
-       QNX4DEBUG(("qnx4: deleting inode [%lu]\n", (unsigned long) inode->i_ino));
-       truncate_inode_pages(&inode->i_data, 0);
-       inode->i_size = 0;
-       qnx4_truncate(inode);
-       lock_kernel();
-       qnx4_free_inode(inode);
-       unlock_kernel();
-}
-
-static int qnx4_write_inode(struct inode *inode, int do_sync)
-{
-       struct qnx4_inode_entry *raw_inode;
-       int block, ino;
-       struct buffer_head *bh;
-       ino = inode->i_ino;
-
-       QNX4DEBUG(("qnx4: write inode 1.\n"));
-       if (inode->i_nlink == 0) {
-               return 0;
-       }
-       if (!ino) {
-               printk("qnx4: bad inode number on dev %s: %d is out of range\n",
-                      inode->i_sb->s_id, ino);
-               return -EIO;
-       }
-       QNX4DEBUG(("qnx4: write inode 2.\n"));
-       block = ino / QNX4_INODES_PER_BLOCK;
-       lock_kernel();
-       if (!(bh = sb_bread(inode->i_sb, block))) {
-               printk("qnx4: major problem: unable to read inode from dev "
-                      "%s\n", inode->i_sb->s_id);
-               unlock_kernel();
-               return -EIO;
-       }
-       raw_inode = ((struct qnx4_inode_entry *) bh->b_data) +
-           (ino % QNX4_INODES_PER_BLOCK);
-       raw_inode->di_mode  = cpu_to_le16(inode->i_mode);
-       raw_inode->di_uid   = cpu_to_le16(fs_high2lowuid(inode->i_uid));
-       raw_inode->di_gid   = cpu_to_le16(fs_high2lowgid(inode->i_gid));
-       raw_inode->di_nlink = cpu_to_le16(inode->i_nlink);
-       raw_inode->di_size  = cpu_to_le32(inode->i_size);
-       raw_inode->di_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
-       raw_inode->di_atime = cpu_to_le32(inode->i_atime.tv_sec);
-       raw_inode->di_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
-       raw_inode->di_first_xtnt.xtnt_size = cpu_to_le32(inode->i_blocks);
-       mark_buffer_dirty(bh);
-       if (do_sync) {
-               sync_dirty_buffer(bh);
-               if (buffer_req(bh) && !buffer_uptodate(bh)) {
-                       printk("qnx4: IO error syncing inode [%s:%08x]\n",
-                                       inode->i_sb->s_id, ino);
-                       brelse(bh);
-                       unlock_kernel();
-                       return -EIO;
-               }
-       }
-       brelse(bh);
-       unlock_kernel();
-       return 0;
-}
-
-#endif
-
 static void qnx4_put_super(struct super_block *sb);
 static struct inode *qnx4_alloc_inode(struct super_block *sb);
 static void qnx4_destroy_inode(struct inode *inode);
@@ -108,10 +41,6 @@ static const struct super_operations qnx4_sops =
        .put_super      = qnx4_put_super,
        .statfs         = qnx4_statfs,
        .remount_fs     = qnx4_remount,
-#ifdef CONFIG_QNX4FS_RW
-       .write_inode    = qnx4_write_inode,
-       .delete_inode   = qnx4_delete_inode,
-#endif
 };
 
 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)
 
        qs = qnx4_sb(sb);
        qs->Version = QNX4_VERSION;
-#ifndef CONFIG_QNX4FS_RW
        *flags |= MS_RDONLY;
-#endif
-       if (*flags & MS_RDONLY) {
-               return 0;
-       }
-
-       mark_buffer_dirty(qs->sb_buf);
-
        return 0;
 }
 
@@ -354,9 +275,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
        }
        s->s_op = &qnx4_sops;
        s->s_magic = QNX4_SUPER_MAGIC;
-#ifndef CONFIG_QNX4FS_RW
        s->s_flags |= MS_RDONLY;        /* Yup, read-only yet */
-#endif
        qnx4_sb(s)->sb_buf = bh;
        qnx4_sb(s)->sb = (struct qnx4_super_block *) bh->b_data;
 
@@ -489,8 +408,7 @@ struct inode *qnx4_iget(struct super_block *sb, unsigned long ino)
 
        memcpy(qnx4_inode, raw_inode, QNX4_DIR_ENTRY_SIZE);
        if (S_ISREG(inode->i_mode)) {
-               inode->i_op = &qnx4_file_inode_operations;
-               inode->i_fop = &qnx4_file_operations;
+               inode->i_fop = &generic_ro_fops;
                inode->i_mapping->a_ops = &qnx4_aops;
                qnx4_i(inode)->mmu_private = inode->i_size;
        } else if (S_ISDIR(inode->i_mode)) {