aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-09-22 19:43:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:30 -0400
commit945ffe54bbd56ceed62de3b908800fd7c6ffb284 (patch)
tree1791ac5df7967107d4413f16f94ba9aae29e8df7 /fs
parent8a9f47ddb1d5cc3cda2d1f26f8da74e059fa7b87 (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/qnx4/Kconfig11
-rw-r--r--fs/qnx4/Makefile2
-rw-r--r--fs/qnx4/bitmap.c81
-rw-r--r--fs/qnx4/dir.c5
-rw-r--r--fs/qnx4/file.c40
-rw-r--r--fs/qnx4/inode.c84
-rw-r--r--fs/qnx4/namei.c105
-rw-r--r--fs/qnx4/qnx4.h8
-rw-r--r--fs/qnx4/truncate.c34
9 files changed, 2 insertions, 368 deletions
diff --git a/fs/qnx4/Kconfig b/fs/qnx4/Kconfig
index be8e0e1445b6..5f6089994042 100644
--- a/fs/qnx4/Kconfig
+++ b/fs/qnx4/Kconfig
@@ -6,20 +6,9 @@ config QNX4FS_FS
6 QNX 4 and QNX 6 (the latter is also called QNX RTP). 6 QNX 4 and QNX 6 (the latter is also called QNX RTP).
7 Further information is available at <http://www.qnx.com/>. 7 Further information is available at <http://www.qnx.com/>.
8 Say Y if you intend to mount QNX hard disks or floppies. 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 To compile this file system support as a module, choose M here: the 10 To compile this file system support as a module, choose M here: the
13 module will be called qnx4. 11 module will be called qnx4.
14 12
15 If you don't know whether you need it, then you don't need it: 13 If you don't know whether you need it, then you don't need it:
16 answer N. 14 answer N.
17
18config 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 answer N.
diff --git a/fs/qnx4/Makefile b/fs/qnx4/Makefile
index e4d408cc5473..4a283b3f87f8 100644
--- a/fs/qnx4/Makefile
+++ b/fs/qnx4/Makefile
@@ -4,4 +4,4 @@
4 4
5obj-$(CONFIG_QNX4FS_FS) += qnx4.o 5obj-$(CONFIG_QNX4FS_FS) += qnx4.o
6 6
7qnx4-objs := inode.o dir.o namei.o file.o bitmap.o truncate.o 7qnx4-objs := inode.o dir.o namei.o bitmap.o
diff --git a/fs/qnx4/bitmap.c b/fs/qnx4/bitmap.c
index e1cd061a25f7..0afba069d567 100644
--- a/fs/qnx4/bitmap.c
+++ b/fs/qnx4/bitmap.c
@@ -78,84 +78,3 @@ unsigned long qnx4_count_free_blocks(struct super_block *sb)
78 78
79 return total_free; 79 return total_free;
80} 80}
81
82#ifdef CONFIG_QNX4FS_RW
83
84int 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
113int 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
140static 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
151void 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
diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c
index 003c68f3238b..86cc39cb1398 100644
--- a/fs/qnx4/dir.c
+++ b/fs/qnx4/dir.c
@@ -85,9 +85,4 @@ const struct file_operations qnx4_dir_operations =
85const struct inode_operations qnx4_dir_inode_operations = 85const struct inode_operations qnx4_dir_inode_operations =
86{ 86{
87 .lookup = qnx4_lookup, 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};
diff --git a/fs/qnx4/file.c b/fs/qnx4/file.c
deleted file mode 100644
index 09b170ac936c..000000000000
--- a/fs/qnx4/file.c
+++ /dev/null
@@ -1,40 +0,0 @@
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 */
21const 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
35const struct inode_operations qnx4_file_inode_operations =
36{
37#ifdef CONFIG_QNX4FS_RW
38 .truncate = qnx4_truncate,
39#endif
40};
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
29static const struct super_operations qnx4_sops; 29static const struct super_operations qnx4_sops;
30 30
31#ifdef CONFIG_QNX4FS_RW
32
33static 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
44static 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
98static void qnx4_put_super(struct super_block *sb); 31static void qnx4_put_super(struct super_block *sb);
99static struct inode *qnx4_alloc_inode(struct super_block *sb); 32static struct inode *qnx4_alloc_inode(struct super_block *sb);
100static void qnx4_destroy_inode(struct inode *inode); 33static 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
117static int qnx4_remount(struct super_block *sb, int *flags, char *data) 46static 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)) {
diff --git a/fs/qnx4/namei.c b/fs/qnx4/namei.c
index 5972ed214937..ae1e7edbacd6 100644
--- a/fs/qnx4/namei.c
+++ b/fs/qnx4/namei.c
@@ -134,108 +134,3 @@ out:
134 134
135 return NULL; 135 return NULL;
136} 136}
137
138#ifdef CONFIG_QNX4FS_RW
139int 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
149int 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
197int 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
235end_unlink:
236 unlock_kernel();
237 brelse(bh);
238
239 return retval;
240}
241#endif
diff --git a/fs/qnx4/qnx4.h b/fs/qnx4/qnx4.h
index 9efc089454f6..33a60858203b 100644
--- a/fs/qnx4/qnx4.h
+++ b/fs/qnx4/qnx4.h
@@ -29,17 +29,9 @@ extern unsigned long qnx4_block_map(struct inode *inode, long iblock);
29 29
30extern struct buffer_head *qnx4_bread(struct inode *, int, int); 30extern struct buffer_head *qnx4_bread(struct inode *, int, int);
31 31
32extern const struct inode_operations qnx4_file_inode_operations;
33extern const struct inode_operations qnx4_dir_inode_operations; 32extern const struct inode_operations qnx4_dir_inode_operations;
34extern const struct file_operations qnx4_file_operations;
35extern const struct file_operations qnx4_dir_operations; 33extern const struct file_operations qnx4_dir_operations;
36extern int qnx4_is_free(struct super_block *sb, long block); 34extern int qnx4_is_free(struct super_block *sb, long block);
37extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy);
38extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd);
39extern void qnx4_truncate(struct inode *inode);
40extern void qnx4_free_inode(struct inode *inode);
41extern int qnx4_unlink(struct inode *dir, struct dentry *dentry);
42extern int qnx4_rmdir(struct inode *dir, struct dentry *dentry);
43 35
44static inline struct qnx4_sb_info *qnx4_sb(struct super_block *sb) 36static inline struct qnx4_sb_info *qnx4_sb(struct super_block *sb)
45{ 37{
diff --git a/fs/qnx4/truncate.c b/fs/qnx4/truncate.c
deleted file mode 100644
index d94d9ee241fe..000000000000
--- a/fs/qnx4/truncate.c
+++ /dev/null
@@ -1,34 +0,0 @@
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
18void 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