Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

qnx4: remove write support

qnx4 wrte support has never been fully implement, is broken since the dawn
of time and hasn't been actively developed since before git history
started.

Instead of letting it further bitrot and complicate API transition (like
the new truncate code) remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Anders Larsen <al@alarsen.net>
Cc: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Christoph Hellwig and committed by
Linus Torvalds
945ffe54 8a9f47dd

+2 -368
-11
fs/qnx4/Kconfig
··· 6 6 QNX 4 and QNX 6 (the latter is also called QNX RTP). 7 7 Further information is available at <http://www.qnx.com/>. 8 8 Say Y if you intend to mount QNX hard disks or floppies. 9 - Unless you say Y to "QNX4FS read-write support" below, you will 10 - only be able to read these file systems. 11 9 12 10 To compile this file system support as a module, choose M here: the 13 11 module will be called qnx4. 14 12 15 13 If you don't know whether you need it, then you don't need it: 16 - answer N. 17 - 18 - config QNX4FS_RW 19 - bool "QNX4FS write support (DANGEROUS)" 20 - depends on QNX4FS_FS && EXPERIMENTAL && BROKEN 21 - help 22 - Say Y if you want to test write support for QNX4 file systems. 23 - 24 - It's currently broken, so for now: 25 14 answer N.
+1 -1
fs/qnx4/Makefile
··· 4 4 5 5 obj-$(CONFIG_QNX4FS_FS) += qnx4.o 6 6 7 - qnx4-objs := inode.o dir.o namei.o file.o bitmap.o truncate.o 7 + qnx4-objs := inode.o dir.o namei.o bitmap.o
-81
fs/qnx4/bitmap.c
··· 78 78 79 79 return total_free; 80 80 } 81 - 82 - #ifdef CONFIG_QNX4FS_RW 83 - 84 - int qnx4_is_free(struct super_block *sb, long block) 85 - { 86 - int start = le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1; 87 - int size = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size); 88 - struct buffer_head *bh; 89 - const char *g; 90 - int ret = -EIO; 91 - 92 - start += block / (QNX4_BLOCK_SIZE * 8); 93 - QNX4DEBUG(("qnx4: is_free requesting block [%lu], bitmap in block [%lu]\n", 94 - (unsigned long) block, (unsigned long) start)); 95 - (void) size; /* CHECKME */ 96 - bh = sb_bread(sb, start); 97 - if (bh == NULL) { 98 - return -EIO; 99 - } 100 - g = bh->b_data + (block % QNX4_BLOCK_SIZE); 101 - if (((*g) & (1 << (block % 8))) == 0) { 102 - QNX4DEBUG(("qnx4: is_free -> block is free\n")); 103 - ret = 1; 104 - } else { 105 - QNX4DEBUG(("qnx4: is_free -> block is busy\n")); 106 - ret = 0; 107 - } 108 - brelse(bh); 109 - 110 - return ret; 111 - } 112 - 113 - int qnx4_set_bitmap(struct super_block *sb, long block, int busy) 114 - { 115 - int start = le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1; 116 - int size = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size); 117 - struct buffer_head *bh; 118 - char *g; 119 - 120 - start += block / (QNX4_BLOCK_SIZE * 8); 121 - QNX4DEBUG(("qnx4: set_bitmap requesting block [%lu], bitmap in block [%lu]\n", 122 - (unsigned long) block, (unsigned long) start)); 123 - (void) size; /* CHECKME */ 124 - bh = sb_bread(sb, start); 125 - if (bh == NULL) { 126 - return -EIO; 127 - } 128 - g = bh->b_data + (block % QNX4_BLOCK_SIZE); 129 - if (busy == 0) { 130 - (*g) &= ~(1 << (block % 8)); 131 - } else { 132 - (*g) |= (1 << (block % 8)); 133 - } 134 - mark_buffer_dirty(bh); 135 - brelse(bh); 136 - 137 - return 0; 138 - } 139 - 140 - static void qnx4_clear_inode(struct inode *inode) 141 - { 142 - struct qnx4_inode_entry *qnx4_ino = qnx4_raw_inode(inode); 143 - /* What for? */ 144 - memset(qnx4_ino->di_fname, 0, sizeof qnx4_ino->di_fname); 145 - qnx4_ino->di_size = 0; 146 - qnx4_ino->di_num_xtnts = 0; 147 - qnx4_ino->di_mode = 0; 148 - qnx4_ino->di_status = 0; 149 - } 150 - 151 - void qnx4_free_inode(struct inode *inode) 152 - { 153 - if (inode->i_ino < 1) { 154 - printk("free_inode: inode 0 or nonexistent inode\n"); 155 - return; 156 - } 157 - qnx4_clear_inode(inode); 158 - clear_inode(inode); 159 - } 160 - 161 - #endif
-5
fs/qnx4/dir.c
··· 85 85 const struct inode_operations qnx4_dir_inode_operations = 86 86 { 87 87 .lookup = qnx4_lookup, 88 - #ifdef CONFIG_QNX4FS_RW 89 - .create = qnx4_create, 90 - .unlink = qnx4_unlink, 91 - .rmdir = qnx4_rmdir, 92 - #endif 93 88 };
-40
fs/qnx4/file.c
··· 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 - * 25-05-1998 by Richard Frowijn : first release. 11 - * 21-06-1998 by Frank Denis : wrote qnx4_readpage to use generic_file_read. 12 - * 27-06-1998 by Frank Denis : file overwriting. 13 - */ 14 - 15 - #include "qnx4.h" 16 - 17 - /* 18 - * We have mostly NULL's here: the current defaults are ok for 19 - * the qnx4 filesystem. 20 - */ 21 - const struct file_operations qnx4_file_operations = 22 - { 23 - .llseek = generic_file_llseek, 24 - .read = do_sync_read, 25 - .aio_read = generic_file_aio_read, 26 - .mmap = generic_file_mmap, 27 - .splice_read = generic_file_splice_read, 28 - #ifdef CONFIG_QNX4FS_RW 29 - .write = do_sync_write, 30 - .aio_write = generic_file_aio_write, 31 - .fsync = simple_fsync, 32 - #endif 33 - }; 34 - 35 - const struct inode_operations qnx4_file_inode_operations = 36 - { 37 - #ifdef CONFIG_QNX4FS_RW 38 - .truncate = qnx4_truncate, 39 - #endif 40 - };
+1 -83
fs/qnx4/inode.c
··· 28 28 29 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 31 static void qnx4_put_super(struct super_block *sb); 99 32 static struct inode *qnx4_alloc_inode(struct super_block *sb); 100 33 static void qnx4_destroy_inode(struct inode *inode); ··· 41 108 .put_super = qnx4_put_super, 42 109 .statfs = qnx4_statfs, 43 110 .remount_fs = qnx4_remount, 44 - #ifdef CONFIG_QNX4FS_RW 45 - .write_inode = qnx4_write_inode, 46 - .delete_inode = qnx4_delete_inode, 47 - #endif 48 111 }; 49 112 50 113 static int qnx4_remount(struct super_block *sb, int *flags, char *data) ··· 49 120 50 121 qs = qnx4_sb(sb); 51 122 qs->Version = QNX4_VERSION; 52 - #ifndef CONFIG_QNX4FS_RW 53 123 *flags |= MS_RDONLY; 54 - #endif 55 - if (*flags & MS_RDONLY) { 56 - return 0; 57 - } 58 - 59 - mark_buffer_dirty(qs->sb_buf); 60 - 61 124 return 0; 62 125 } 63 126 ··· 275 354 } 276 355 s->s_op = &qnx4_sops; 277 356 s->s_magic = QNX4_SUPER_MAGIC; 278 - #ifndef CONFIG_QNX4FS_RW 279 357 s->s_flags |= MS_RDONLY; /* Yup, read-only yet */ 280 - #endif 281 358 qnx4_sb(s)->sb_buf = bh; 282 359 qnx4_sb(s)->sb = (struct qnx4_super_block *) bh->b_data; 283 360 ··· 408 489 409 490 memcpy(qnx4_inode, raw_inode, QNX4_DIR_ENTRY_SIZE); 410 491 if (S_ISREG(inode->i_mode)) { 411 - inode->i_op = &qnx4_file_inode_operations; 412 - inode->i_fop = &qnx4_file_operations; 492 + inode->i_fop = &generic_ro_fops; 413 493 inode->i_mapping->a_ops = &qnx4_aops; 414 494 qnx4_i(inode)->mmu_private = inode->i_size; 415 495 } else if (S_ISDIR(inode->i_mode)) {
-105
fs/qnx4/namei.c
··· 134 134 135 135 return NULL; 136 136 } 137 - 138 - #ifdef CONFIG_QNX4FS_RW 139 - int qnx4_create(struct inode *dir, struct dentry *dentry, int mode, 140 - struct nameidata *nd) 141 - { 142 - QNX4DEBUG(("qnx4: qnx4_create\n")); 143 - if (dir == NULL) { 144 - return -ENOENT; 145 - } 146 - return -ENOSPC; 147 - } 148 - 149 - int qnx4_rmdir(struct inode *dir, struct dentry *dentry) 150 - { 151 - struct buffer_head *bh; 152 - struct qnx4_inode_entry *de; 153 - struct inode *inode; 154 - int retval; 155 - int ino; 156 - 157 - QNX4DEBUG(("qnx4: qnx4_rmdir [%s]\n", dentry->d_name.name)); 158 - lock_kernel(); 159 - bh = qnx4_find_entry(dentry->d_name.len, dir, dentry->d_name.name, 160 - &de, &ino); 161 - if (bh == NULL) { 162 - unlock_kernel(); 163 - return -ENOENT; 164 - } 165 - inode = dentry->d_inode; 166 - if (inode->i_ino != ino) { 167 - retval = -EIO; 168 - goto end_rmdir; 169 - } 170 - #if 0 171 - if (!empty_dir(inode)) { 172 - retval = -ENOTEMPTY; 173 - goto end_rmdir; 174 - } 175 - #endif 176 - if (inode->i_nlink != 2) { 177 - QNX4DEBUG(("empty directory has nlink!=2 (%d)\n", inode->i_nlink)); 178 - } 179 - QNX4DEBUG(("qnx4: deleting directory\n")); 180 - de->di_status = 0; 181 - memset(de->di_fname, 0, sizeof de->di_fname); 182 - de->di_mode = 0; 183 - mark_buffer_dirty_inode(bh, dir); 184 - clear_nlink(inode); 185 - mark_inode_dirty(inode); 186 - inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 187 - inode_dec_link_count(dir); 188 - retval = 0; 189 - 190 - end_rmdir: 191 - brelse(bh); 192 - 193 - unlock_kernel(); 194 - return retval; 195 - } 196 - 197 - int qnx4_unlink(struct inode *dir, struct dentry *dentry) 198 - { 199 - struct buffer_head *bh; 200 - struct qnx4_inode_entry *de; 201 - struct inode *inode; 202 - int retval; 203 - int ino; 204 - 205 - QNX4DEBUG(("qnx4: qnx4_unlink [%s]\n", dentry->d_name.name)); 206 - lock_kernel(); 207 - bh = qnx4_find_entry(dentry->d_name.len, dir, dentry->d_name.name, 208 - &de, &ino); 209 - if (bh == NULL) { 210 - unlock_kernel(); 211 - return -ENOENT; 212 - } 213 - inode = dentry->d_inode; 214 - if (inode->i_ino != ino) { 215 - retval = -EIO; 216 - goto end_unlink; 217 - } 218 - retval = -EPERM; 219 - if (!inode->i_nlink) { 220 - QNX4DEBUG(("Deleting nonexistent file (%s:%lu), %d\n", 221 - inode->i_sb->s_id, 222 - inode->i_ino, inode->i_nlink)); 223 - inode->i_nlink = 1; 224 - } 225 - de->di_status = 0; 226 - memset(de->di_fname, 0, sizeof de->di_fname); 227 - de->di_mode = 0; 228 - mark_buffer_dirty_inode(bh, dir); 229 - dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 230 - mark_inode_dirty(dir); 231 - inode->i_ctime = dir->i_ctime; 232 - inode_dec_link_count(inode); 233 - retval = 0; 234 - 235 - end_unlink: 236 - unlock_kernel(); 237 - brelse(bh); 238 - 239 - return retval; 240 - } 241 - #endif
-8
fs/qnx4/qnx4.h
··· 29 29 30 30 extern struct buffer_head *qnx4_bread(struct inode *, int, int); 31 31 32 - extern const struct inode_operations qnx4_file_inode_operations; 33 32 extern const struct inode_operations qnx4_dir_inode_operations; 34 - extern const struct file_operations qnx4_file_operations; 35 33 extern const struct file_operations qnx4_dir_operations; 36 34 extern int qnx4_is_free(struct super_block *sb, long block); 37 - extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy); 38 - extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd); 39 - extern void qnx4_truncate(struct inode *inode); 40 - extern void qnx4_free_inode(struct inode *inode); 41 - extern int qnx4_unlink(struct inode *dir, struct dentry *dentry); 42 - extern int qnx4_rmdir(struct inode *dir, struct dentry *dentry); 43 35 44 36 static inline struct qnx4_sb_info *qnx4_sb(struct super_block *sb) 45 37 {
-34
fs/qnx4/truncate.c
··· 1 - /* 2 - * QNX4 file system, Linux implementation. 3 - * 4 - * Version : 0.1 5 - * 6 - * Using parts of the xiafs filesystem. 7 - * 8 - * History : 9 - * 10 - * 30-06-1998 by Frank DENIS : ugly filler. 11 - */ 12 - 13 - #include <linux/smp_lock.h> 14 - #include "qnx4.h" 15 - 16 - #ifdef CONFIG_QNX4FS_RW 17 - 18 - void qnx4_truncate(struct inode *inode) 19 - { 20 - if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 21 - S_ISLNK(inode->i_mode))) { 22 - return; 23 - } 24 - lock_kernel(); 25 - if (!(S_ISDIR(inode->i_mode))) { 26 - /* TODO */ 27 - } 28 - QNX4DEBUG(("qnx4: qnx4_truncate called\n")); 29 - inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 30 - mark_inode_dirty(inode); 31 - unlock_kernel(); 32 - } 33 - 34 - #endif