Skip to content

Commit

Permalink
qnx4: remove write support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Linus Torvalds committed Sep 23, 2009
1 parent 8a9f47d commit 945ffe5
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 368 deletions.
11 changes: 0 additions & 11 deletions fs/qnx4/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,9 @@ config QNX4FS_FS
QNX 4 and QNX 6 (the latter is also called QNX RTP).
Further information is available at <http://www.qnx.com/>.
Say Y if you intend to mount QNX hard disks or floppies.
Unless you say Y to "QNX4FS read-write support" below, you will
only be able to read these file systems.

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

If you don't know whether you need it, then you don't need it:
answer N.

config QNX4FS_RW
bool "QNX4FS write support (DANGEROUS)"
depends on QNX4FS_FS && EXPERIMENTAL && BROKEN
help
Say Y if you want to test write support for QNX4 file systems.

It's currently broken, so for now:
answer N.
2 changes: 1 addition & 1 deletion fs/qnx4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

obj-$(CONFIG_QNX4FS_FS) += qnx4.o

qnx4-objs := inode.o dir.o namei.o file.o bitmap.o truncate.o
qnx4-objs := inode.o dir.o namei.o bitmap.o
81 changes: 0 additions & 81 deletions fs/qnx4/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,84 +78,3 @@ unsigned long qnx4_count_free_blocks(struct super_block *sb)

return total_free;
}

#ifdef CONFIG_QNX4FS_RW

int qnx4_is_free(struct super_block *sb, long block)
{
int start = le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1;
int size = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size);
struct buffer_head *bh;
const char *g;
int ret = -EIO;

start += block / (QNX4_BLOCK_SIZE * 8);
QNX4DEBUG(("qnx4: is_free requesting block [%lu], bitmap in block [%lu]\n",
(unsigned long) block, (unsigned long) start));
(void) size; /* CHECKME */
bh = sb_bread(sb, start);
if (bh == NULL) {
return -EIO;
}
g = bh->b_data + (block % QNX4_BLOCK_SIZE);
if (((*g) & (1 << (block % 8))) == 0) {
QNX4DEBUG(("qnx4: is_free -> block is free\n"));
ret = 1;
} else {
QNX4DEBUG(("qnx4: is_free -> block is busy\n"));
ret = 0;
}
brelse(bh);

return ret;
}

int qnx4_set_bitmap(struct super_block *sb, long block, int busy)
{
int start = le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1;
int size = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size);
struct buffer_head *bh;
char *g;

start += block / (QNX4_BLOCK_SIZE * 8);
QNX4DEBUG(("qnx4: set_bitmap requesting block [%lu], bitmap in block [%lu]\n",
(unsigned long) block, (unsigned long) start));
(void) size; /* CHECKME */
bh = sb_bread(sb, start);
if (bh == NULL) {
return -EIO;
}
g = bh->b_data + (block % QNX4_BLOCK_SIZE);
if (busy == 0) {
(*g) &= ~(1 << (block % 8));
} else {
(*g) |= (1 << (block % 8));
}
mark_buffer_dirty(bh);
brelse(bh);

return 0;
}

static void qnx4_clear_inode(struct inode *inode)
{
struct qnx4_inode_entry *qnx4_ino = qnx4_raw_inode(inode);
/* What for? */
memset(qnx4_ino->di_fname, 0, sizeof qnx4_ino->di_fname);
qnx4_ino->di_size = 0;
qnx4_ino->di_num_xtnts = 0;
qnx4_ino->di_mode = 0;
qnx4_ino->di_status = 0;
}

void qnx4_free_inode(struct inode *inode)
{
if (inode->i_ino < 1) {
printk("free_inode: inode 0 or nonexistent inode\n");
return;
}
qnx4_clear_inode(inode);
clear_inode(inode);
}

#endif
5 changes: 0 additions & 5 deletions fs/qnx4/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,4 @@ const struct file_operations qnx4_dir_operations =
const struct inode_operations qnx4_dir_inode_operations =
{
.lookup = qnx4_lookup,
#ifdef CONFIG_QNX4FS_RW
.create = qnx4_create,
.unlink = qnx4_unlink,
.rmdir = qnx4_rmdir,
#endif
};
40 changes: 0 additions & 40 deletions fs/qnx4/file.c

This file was deleted.

84 changes: 1 addition & 83 deletions fs/qnx4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,73 +28,6 @@

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);
Expand All @@ -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)
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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)) {
Expand Down
105 changes: 0 additions & 105 deletions fs/qnx4/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,108 +134,3 @@ struct dentry * qnx4_lookup(struct inode *dir, struct dentry *dentry, struct nam

return NULL;
}

#ifdef CONFIG_QNX4FS_RW
int qnx4_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
{
QNX4DEBUG(("qnx4: qnx4_create\n"));
if (dir == NULL) {
return -ENOENT;
}
return -ENOSPC;
}

int qnx4_rmdir(struct inode *dir, struct dentry *dentry)
{
struct buffer_head *bh;
struct qnx4_inode_entry *de;
struct inode *inode;
int retval;
int ino;

QNX4DEBUG(("qnx4: qnx4_rmdir [%s]\n", dentry->d_name.name));
lock_kernel();
bh = qnx4_find_entry(dentry->d_name.len, dir, dentry->d_name.name,
&de, &ino);
if (bh == NULL) {
unlock_kernel();
return -ENOENT;
}
inode = dentry->d_inode;
if (inode->i_ino != ino) {
retval = -EIO;
goto end_rmdir;
}
#if 0
if (!empty_dir(inode)) {
retval = -ENOTEMPTY;
goto end_rmdir;
}
#endif
if (inode->i_nlink != 2) {
QNX4DEBUG(("empty directory has nlink!=2 (%d)\n", inode->i_nlink));
}
QNX4DEBUG(("qnx4: deleting directory\n"));
de->di_status = 0;
memset(de->di_fname, 0, sizeof de->di_fname);
de->di_mode = 0;
mark_buffer_dirty_inode(bh, dir);
clear_nlink(inode);
mark_inode_dirty(inode);
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
inode_dec_link_count(dir);
retval = 0;

end_rmdir:
brelse(bh);

unlock_kernel();
return retval;
}

int qnx4_unlink(struct inode *dir, struct dentry *dentry)
{
struct buffer_head *bh;
struct qnx4_inode_entry *de;
struct inode *inode;
int retval;
int ino;

QNX4DEBUG(("qnx4: qnx4_unlink [%s]\n", dentry->d_name.name));
lock_kernel();
bh = qnx4_find_entry(dentry->d_name.len, dir, dentry->d_name.name,
&de, &ino);
if (bh == NULL) {
unlock_kernel();
return -ENOENT;
}
inode = dentry->d_inode;
if (inode->i_ino != ino) {
retval = -EIO;
goto end_unlink;
}
retval = -EPERM;
if (!inode->i_nlink) {
QNX4DEBUG(("Deleting nonexistent file (%s:%lu), %d\n",
inode->i_sb->s_id,
inode->i_ino, inode->i_nlink));
inode->i_nlink = 1;
}
de->di_status = 0;
memset(de->di_fname, 0, sizeof de->di_fname);
de->di_mode = 0;
mark_buffer_dirty_inode(bh, dir);
dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
mark_inode_dirty(dir);
inode->i_ctime = dir->i_ctime;
inode_dec_link_count(inode);
retval = 0;

end_unlink:
unlock_kernel();
brelse(bh);

return retval;
}
#endif
Loading

0 comments on commit 945ffe5

Please sign in to comment.