summaryrefslogtreecommitdiffstats
path: root/fs/sysv
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/sysv
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/sysv')
-rw-r--r--fs/sysv/Makefile3
-rw-r--r--fs/sysv/dir.c22
-rw-r--r--fs/sysv/file.c53
-rw-r--r--fs/sysv/fsync.c4
-rw-r--r--fs/sysv/inode.c38
-rw-r--r--fs/sysv/namei.c4
-rw-r--r--fs/sysv/symlink.c26
7 files changed, 48 insertions, 102 deletions
diff --git a/fs/sysv/Makefile b/fs/sysv/Makefile
index 6c31360fd..394af0b4d 100644
--- a/fs/sysv/Makefile
+++ b/fs/sysv/Makefile
@@ -8,8 +8,7 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := sysv.o
-O_OBJS := ialloc.o balloc.o inode.o file.o dir.o symlink.o namei.o \
- fsync.o truncate.o
+O_OBJS := ialloc.o balloc.o inode.o file.o dir.o namei.o fsync.o truncate.o
M_OBJS := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index f17fb8b63..f21a47578 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -30,17 +30,9 @@ static ssize_t sysv_dir_read(struct file * filp, char * buf,
static int sysv_readdir(struct file *, void *, filldir_t);
static struct file_operations sysv_dir_operations = {
- NULL, /* lseek - default */
- sysv_dir_read, /* read */
- NULL, /* write - bad */
- sysv_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: sysv_dir_read,
+ readdir: sysv_readdir,
+ fsync: file_fsync,
};
/*
@@ -57,14 +49,6 @@ struct inode_operations sysv_dir_inode_operations = {
sysv_rmdir, /* rmdir */
sysv_mknod, /* mknod */
sysv_rename, /* rename */
- NULL, /* readlink */
- NULL, /* follow_link */
- NULL, /* get_block */
- NULL, /* readpage */
- NULL, /* writepage */
- NULL, /* truncate */
- NULL, /* permission */
- NULL /* revalidate */
};
static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir)
diff --git a/fs/sysv/file.c b/fs/sysv/file.c
index 2a0d03850..b60a1d02e 100644
--- a/fs/sysv/file.c
+++ b/fs/sysv/file.c
@@ -23,59 +23,18 @@
#include <linux/locks.h>
#include <linux/pagemap.h>
-#include <asm/uaccess.h>
-
-#define NBUF 32
-
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
-
-/*
- * Write to a file (through the page cache).
- */
-static ssize_t
-sysv_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 coh filesystem.
*/
static struct file_operations sysv_file_operations = {
- NULL, /* lseek - default */
- generic_file_read, /* read */
- sysv_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 */
- sysv_sync_file, /* fsync */
- NULL, /* fasync */
+ read: generic_file_read,
+ write: generic_file_write,
+ mmap: generic_file_mmap,
+ fsync: sysv_sync_file,
};
struct inode_operations sysv_file_inode_operations = {
- &sysv_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 */
- sysv_get_block, /* get_block */
- block_read_full_page, /* readpage */
- block_write_full_page, /* writepage */
- sysv_truncate, /* truncate */
- NULL, /* permission */
- NULL /* revalidate */
+ &sysv_file_operations,
+ truncate: sysv_truncate,
};
diff --git a/fs/sysv/fsync.c b/fs/sysv/fsync.c
index b0e1138c7..3c9871be6 100644
--- a/fs/sysv/fsync.c
+++ b/fs/sysv/fsync.c
@@ -16,9 +16,9 @@
#include <linux/errno.h>
#include <linux/stat.h>
-
#include <linux/fs.h>
#include <linux/sysv_fs.h>
+#include <linux/smp_lock.h>
/* return values: 0 means OK/done, 1 means redo, -1 means I/O error. */
@@ -187,6 +187,7 @@ int sysv_sync_file(struct file * file, struct dentry *dentry)
S_ISLNK(inode->i_mode)))
return -EINVAL;
+ lock_kernel();
for (wait=0; wait<=1; wait++) {
err |= sync_direct(inode, wait);
err |= sync_indirect(inode, inode->u.sysv_i.i_data+10, 0, wait);
@@ -194,5 +195,6 @@ int sysv_sync_file(struct file * file, struct dentry *dentry)
err |= sync_tindirect(inode, inode->u.sysv_i.i_data+12, 0, wait);
}
err |= sysv_sync_inode (inode);
+ unlock_kernel();
return (err < 0) ? -EIO : 0;
}
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index cfe016728..6580b6125 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -832,7 +832,7 @@ out:
return result;
}
-int sysv_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create)
+static int sysv_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create)
{
struct super_block *sb;
int ret, err, new;
@@ -961,6 +961,30 @@ struct buffer_head *sysv_file_bread(struct inode *inode, int block, int create)
return NULL;
}
+static int sysv_writepage(struct dentry *dentry, struct page *page)
+{
+ return block_write_full_page(page,sysv_get_block);
+}
+static int sysv_readpage(struct dentry *dentry, struct page *page)
+{
+ return block_read_full_page(page,sysv_get_block);
+}
+static int sysv_prepare_write(struct page *page, unsigned from, unsigned to)
+{
+ return block_prepare_write(page,from,to,sysv_get_block);
+}
+static int sysv_bmap(struct address_space *mapping, long block)
+{
+ return generic_block_bmap(mapping,block,sysv_get_block);
+}
+struct address_space_operations sysv_aops = {
+ readpage: sysv_readpage,
+ writepage: sysv_writepage,
+ prepare_write: sysv_prepare_write,
+ commit_write: generic_commit_write,
+ bmap: sysv_bmap
+};
+
#ifdef __BIG_ENDIAN
static inline unsigned long read3byte (unsigned char * p)
@@ -1059,13 +1083,15 @@ static void sysv_read_inode(struct inode *inode)
for (block = 0; block < 10+1+1+1; block++)
inode->u.sysv_i.i_data[block] =
read3byte(&raw_inode->i_a.i_addb[3*block]);
- if (S_ISREG(inode->i_mode))
+ if (S_ISREG(inode->i_mode)) {
inode->i_op = &sysv_file_inode_operations;
- else if (S_ISDIR(inode->i_mode))
+ inode->i_mapping->a_ops = &sysv_aops;
+ } else if (S_ISDIR(inode->i_mode))
inode->i_op = &sysv_dir_inode_operations;
- else if (S_ISLNK(inode->i_mode))
- inode->i_op = &sysv_symlink_inode_operations;
- else
+ else if (S_ISLNK(inode->i_mode)) {
+ inode->i_op = &page_symlink_inode_operations;
+ inode->i_mapping->a_ops = &sysv_aops;
+ } else
init_special_inode(inode, inode->i_mode,raw_inode->i_a.i_rdev);
brelse(bh);
}
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c
index 844912898..9661af99c 100644
--- a/fs/sysv/namei.c
+++ b/fs/sysv/namei.c
@@ -204,6 +204,7 @@ int sysv_create(struct inode * dir, struct dentry * dentry, int mode)
if (!inode)
return -ENOSPC;
inode->i_op = &sysv_file_inode_operations;
+ inode->i_mapping->a_ops = &sysv_aops;
inode->i_mode = mode;
mark_inode_dirty(inode);
error = sysv_add_entry(dir, dentry->d_name.name,
@@ -455,7 +456,8 @@ int sysv_symlink(struct inode * dir, struct dentry * dentry,
goto out;
inode->i_mode = S_IFLNK | 0777;
- inode->i_op = &sysv_symlink_inode_operations;
+ inode->i_op = &page_symlink_inode_operations;
+ inode->i_mapping->a_ops = &sysv_aops;
err = block_symlink(inode, symname, l);
if (err)
goto out_no_entry;
diff --git a/fs/sysv/symlink.c b/fs/sysv/symlink.c
deleted file mode 100644
index 3f77f831e..000000000
--- a/fs/sysv/symlink.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * linux/fs/sysv/symlink.c
- *
- * minix/symlink.c
- * Copyright (C) 1991, 1992 Linus Torvalds
- *
- * coh/symlink.c
- * Copyright (C) 1993 Pascal Haible, Bruno Haible
- *
- * sysv/symlink.c
- * Copyright (C) 1993 Bruno Haible
- *
- * SystemV/Coherent symlink handling code
- */
-
-#include <linux/sysv_fs.h>
-
-/*
- * symlinks can't do much...
- */
-struct inode_operations sysv_symlink_inode_operations = {
- readlink: page_readlink,
- follow_link: page_follow_link,
- get_block: sysv_get_block,
- readpage: block_read_full_page
-};