summaryrefslogtreecommitdiffstats
path: root/fs/minix
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-23 00:40:54 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-23 00:40:54 +0000
commit529c593ece216e4aaffd36bd940cb94f1fa63129 (patch)
tree78f1c0b805f5656aa7b0417a043c5346f700a2cf /fs/minix
parent0bd079751d25808d1972baee5c4eaa1db2227257 (diff)
Merge with 2.3.43. I did ignore all modifications to the qlogicisp.c
driver due to the Origin A64 hacks.
Diffstat (limited to 'fs/minix')
-rw-r--r--fs/minix/Makefile2
-rw-r--r--fs/minix/dir.c22
-rw-r--r--fs/minix/file.c51
-rw-r--r--fs/minix/fsync.c17
-rw-r--r--fs/minix/inode.c50
-rw-r--r--fs/minix/namei.c4
-rw-r--r--fs/minix/symlink.c22
7 files changed, 61 insertions, 107 deletions
diff --git a/fs/minix/Makefile b/fs/minix/Makefile
index 537127b2d..c3aee4fe3 100644
--- a/fs/minix/Makefile
+++ b/fs/minix/Makefile
@@ -8,7 +8,7 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := minix.o
-O_OBJS := bitmap.o truncate.o namei.o inode.o file.o dir.o symlink.o fsync.o
+O_OBJS := bitmap.o truncate.o namei.o inode.o file.o dir.o fsync.o
M_OBJS := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 52c0e0cee..02bde162d 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -23,17 +23,9 @@ static ssize_t minix_dir_read(struct file * filp, char * buf,
static int minix_readdir(struct file *, void *, filldir_t);
static struct file_operations minix_dir_operations = {
- NULL, /* lseek - default */
- minix_dir_read, /* read */
- NULL, /* write - bad */
- minix_readdir, /* readdir */
- NULL, /* poll - default */
- NULL, /* ioctl - default */
- NULL, /* mmap */
- NULL, /* no special open code */
- NULL, /* flush */
- NULL, /* no special release code */
- file_fsync /* default fsync */
+ read: minix_dir_read,
+ readdir: minix_readdir,
+ fsync: file_fsync,
};
/*
@@ -50,14 +42,6 @@ struct inode_operations minix_dir_inode_operations = {
minix_rmdir, /* rmdir */
minix_mknod, /* mknod */
minix_rename, /* rename */
- NULL, /* readlink */
- NULL, /* follow_link */
- NULL, /* get_block */
- NULL, /* readpage */
- NULL, /* writepage */
- NULL, /* truncate */
- NULL, /* permission */
- NULL /* revalidate */
};
static int minix_readdir(struct file * filp,
diff --git a/fs/minix/file.c b/fs/minix/file.c
index 6445c225c..61d0e3f02 100644
--- a/fs/minix/file.c
+++ b/fs/minix/file.c
@@ -18,60 +18,21 @@
#include <asm/uaccess.h>
#include <asm/system.h>
-#define NBUF 32
-
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
-
#include <linux/fs.h>
#include <linux/minix_fs.h>
/*
- * Write to a file (through the page cache).
- */
-static ssize_t
-minix_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
-{
- return generic_file_write(file, buf, count,
- ppos, block_write_partial_page);
-}
-
-/*
* We have mostly NULLs here: the current defaults are OK for
* the minix filesystem.
*/
static struct file_operations minix_file_operations = {
- NULL, /* lseek - default */
- generic_file_read, /* read */
- minix_file_write, /* write */
- NULL, /* readdir - bad */
- NULL, /* poll - default */
- NULL, /* ioctl - default */
- generic_file_mmap, /* mmap */
- NULL, /* no special open is needed */
- NULL, /* flush */
- NULL, /* release */
- minix_sync_file, /* fsync */
- NULL, /* fasync */
+ read: generic_file_read,
+ write: generic_file_write,
+ mmap: generic_file_mmap,
+ fsync: minix_sync_file,
};
struct inode_operations minix_file_inode_operations = {
- &minix_file_operations, /* default file operations */
- NULL, /* create */
- NULL, /* lookup */
- NULL, /* link */
- NULL, /* unlink */
- NULL, /* symlink */
- NULL, /* mkdir */
- NULL, /* rmdir */
- NULL, /* mknod */
- NULL, /* rename */
- NULL, /* readlink */
- NULL, /* follow_link */
- minix_get_block, /* get_block */
- block_read_full_page, /* readpage */
- block_write_full_page, /* writepage */
- minix_truncate, /* truncate */
- NULL, /* permission */
- NULL, /* revalidate */
+ &minix_file_operations,
+ truncate: minix_truncate,
};
diff --git a/fs/minix/fsync.c b/fs/minix/fsync.c
index 2fcdddf15..30794d27a 100644
--- a/fs/minix/fsync.c
+++ b/fs/minix/fsync.c
@@ -16,6 +16,7 @@
#include <linux/stat.h>
#include <linux/fcntl.h>
#include <linux/locks.h>
+#include <linux/smp_lock.h>
#include <linux/fs.h>
#include <linux/minix_fs.h>
@@ -148,10 +149,7 @@ static int V1_minix_sync_file(struct inode * inode, struct file * file)
{
int wait, err = 0;
- if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
- S_ISLNK(inode->i_mode)))
- return -EINVAL;
-
+ lock_kernel();
for (wait=0; wait<=1; wait++)
{
err |= V1_sync_direct(inode, wait);
@@ -159,6 +157,7 @@ static int V1_minix_sync_file(struct inode * inode, struct file * file)
err |= V1_sync_dindirect(inode, inode->u.minix_i.u.i1_data + 8, wait);
}
err |= minix_sync_inode (inode);
+ unlock_kernel();
return (err < 0) ? -EIO : 0;
}
@@ -309,10 +308,7 @@ static int V2_minix_sync_file(struct inode * inode, struct file * file)
{
int wait, err = 0;
- if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
- S_ISLNK(inode->i_mode)))
- return -EINVAL;
-
+ lock_kernel();
for (wait=0; wait<=1; wait++)
{
err |= V2_sync_direct(inode, wait);
@@ -324,6 +320,7 @@ static int V2_minix_sync_file(struct inode * inode, struct file * file)
(unsigned long *) inode->u.minix_i.u.i2_data + 9, wait);
}
err |= minix_sync_inode (inode);
+ unlock_kernel();
return (err < 0) ? -EIO : 0;
}
@@ -336,6 +333,10 @@ int minix_sync_file(struct file * file, struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
+ if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
+ S_ISLNK(inode->i_mode)))
+ return -EINVAL;
+
if (INODE_VERSION(inode) == MINIX_V1)
return V1_minix_sync_file(inode, file);
else
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index de093d02f..e33fe9787 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -968,7 +968,7 @@ abort_too_big:
goto abort;
}
-int minix_get_block(struct inode *inode, long block,
+static int minix_get_block(struct inode *inode, long block,
struct buffer_head *bh_result, int create)
{
if (INODE_VERSION(inode) == MINIX_V1)
@@ -1016,6 +1016,30 @@ struct buffer_head * minix_bread(struct inode * inode, int block, int create)
return NULL;
}
+static int minix_writepage(struct dentry *dentry, struct page *page)
+{
+ return block_write_full_page(page,minix_get_block);
+}
+static int minix_readpage(struct dentry *dentry, struct page *page)
+{
+ return block_read_full_page(page,minix_get_block);
+}
+static int minix_prepare_write(struct page *page, unsigned from, unsigned to)
+{
+ return block_prepare_write(page,from,to,minix_get_block);
+}
+static int minix_bmap(struct address_space *mapping, long block)
+{
+ return generic_block_bmap(mapping,block,minix_get_block);
+}
+struct address_space_operations minix_aops = {
+ readpage: minix_readpage,
+ writepage: minix_writepage,
+ prepare_write: minix_prepare_write,
+ commit_write: generic_commit_write,
+ bmap: minix_bmap
+};
+
/*
* The minix V1 function to read an inode.
*/
@@ -1053,13 +1077,15 @@ static void V1_minix_read_inode(struct inode * inode)
inode->i_blocks = inode->i_blksize = 0;
for (block = 0; block < 9; block++)
inode->u.minix_i.u.i1_data[block] = raw_inode->i_zone[block];
- if (S_ISREG(inode->i_mode))
+ if (S_ISREG(inode->i_mode)) {
inode->i_op = &minix_file_inode_operations;
- else if (S_ISDIR(inode->i_mode))
+ inode->i_mapping->a_ops = &minix_aops;
+ } else if (S_ISDIR(inode->i_mode))
inode->i_op = &minix_dir_inode_operations;
- else if (S_ISLNK(inode->i_mode))
- inode->i_op = &minix_symlink_inode_operations;
- else
+ else if (S_ISLNK(inode->i_mode)) {
+ inode->i_op = &page_symlink_inode_operations;
+ inode->i_mapping->a_ops = &minix_aops;
+ } else
init_special_inode(inode, inode->i_mode, raw_inode->i_zone[0]);
brelse(bh);
}
@@ -1103,13 +1129,15 @@ static void V2_minix_read_inode(struct inode * inode)
inode->i_blocks = inode->i_blksize = 0;
for (block = 0; block < 10; block++)
inode->u.minix_i.u.i2_data[block] = raw_inode->i_zone[block];
- if (S_ISREG(inode->i_mode))
+ if (S_ISREG(inode->i_mode)) {
inode->i_op = &minix_file_inode_operations;
- else if (S_ISDIR(inode->i_mode))
+ inode->i_mapping->a_ops = &minix_aops;
+ } else if (S_ISDIR(inode->i_mode))
inode->i_op = &minix_dir_inode_operations;
- else if (S_ISLNK(inode->i_mode))
- inode->i_op = &minix_symlink_inode_operations;
- else
+ else if (S_ISLNK(inode->i_mode)) {
+ inode->i_op = &page_symlink_inode_operations;
+ inode->i_mapping->a_ops = &minix_aops;
+ } else
init_special_inode(inode, inode->i_mode, raw_inode->i_zone[0]);
brelse(bh);
}
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index a3e73dbcd..de2d0f279 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -219,6 +219,7 @@ int minix_create(struct inode * dir, struct dentry *dentry, int mode)
if (!inode)
return -ENOSPC;
inode->i_op = &minix_file_inode_operations;
+ inode->i_mapping->a_ops = &minix_aops;
inode->i_mode = mode;
mark_inode_dirty(inode);
error = minix_add_entry(dir, dentry->d_name.name,
@@ -477,7 +478,8 @@ int minix_symlink(struct inode * dir, struct dentry *dentry,
goto out;
inode->i_mode = S_IFLNK | 0777;
- inode->i_op = &minix_symlink_inode_operations;
+ inode->i_op = &page_symlink_inode_operations;
+ inode->i_mapping->a_ops = &minix_aops;
err = block_symlink(inode, symname, i);
if (err)
goto fail;
diff --git a/fs/minix/symlink.c b/fs/minix/symlink.c
deleted file mode 100644
index 7e1d03a10..000000000
--- a/fs/minix/symlink.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * linux/fs/minix/symlink.c
- *
- * Copyright (C) 1991, 1992 Linus Torvalds
- *
- * minix symlink handling code
- *
- * Code removed. 1999, AV ;-)
- */
-
-#include <linux/fs.h>
-#include <linux/minix_fs.h>
-
-/*
- * symlinks can't do much...
- */
-struct inode_operations minix_symlink_inode_operations = {
- readlink: page_readlink,
- follow_link: page_follow_link,
- get_block: minix_get_block,
- readpage: block_read_full_page
-};