Skip to content

Commit 945ffe5

Browse files
Christoph Hellwigtorvalds
authored andcommitted
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>
1 parent 8a9f47d commit 945ffe5

9 files changed

Lines changed: 2 additions & 368 deletions

File tree

‎fs/qnx4/Kconfig‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,9 @@ config QNX4FS_FS
66
QNX 4 and QNX 6 (the latter is also called QNX RTP).
77
Further information is available at <http://www.qnx.com/>.
88
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.
119

1210
To compile this file system support as a module, choose M here: the
1311
module will be called qnx4.
1412

1513
If you don't know whether you need it, then you don't need it:
1614
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-
answer N.

‎fs/qnx4/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
obj-$(CONFIG_QNX4FS_FS) += qnx4.o
66

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

‎fs/qnx4/bitmap.c‎

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -78,84 +78,3 @@ unsigned long qnx4_count_free_blocks(struct super_block *sb)
7878

7979
return total_free;
8080
}
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

‎fs/qnx4/dir.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,4 @@ const struct file_operations qnx4_dir_operations =
8585
const struct inode_operations qnx4_dir_inode_operations =
8686
{
8787
.lookup = qnx4_lookup,
88-
#ifdef CONFIG_QNX4FS_RW
89-
.create = qnx4_create,
90-
.unlink = qnx4_unlink,
91-
.rmdir = qnx4_rmdir,
92-
#endif
9388
};

‎fs/qnx4/file.c‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎fs/qnx4/inode.c‎

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -28,73 +28,6 @@
2828

2929
static 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-
9831
static void qnx4_put_super(struct super_block *sb);
9932
static struct inode *qnx4_alloc_inode(struct super_block *sb);
10033
static 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

11746
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)
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)) {

‎fs/qnx4/namei.c‎

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -134,108 +134,3 @@ struct dentry * qnx4_lookup(struct inode *dir, struct dentry *dentry, struct nam
134134

135135
return NULL;
136136
}
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

0 commit comments

Comments
 (0)