summaryrefslogtreecommitdiffstats
path: root/fs/minix
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
commit33263fc5f9ac8e8cb2b22d06af3ce5ac1dd815e4 (patch)
tree2d1b86a40bef0958a68cf1a2eafbeb0667a70543 /fs/minix
parent216f5f51aa02f8b113aa620ebc14a9631a217a00 (diff)
Merge with Linux 2.3.32.
Diffstat (limited to 'fs/minix')
-rw-r--r--fs/minix/dir.c2
-rw-r--r--fs/minix/file.c2
-rw-r--r--fs/minix/namei.c57
-rw-r--r--fs/minix/symlink.c72
4 files changed, 33 insertions, 100 deletions
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index a44d5d69d..52c0e0cee 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -55,10 +55,8 @@ struct inode_operations minix_dir_inode_operations = {
NULL, /* get_block */
NULL, /* readpage */
NULL, /* writepage */
- NULL, /* flushpage */
NULL, /* truncate */
NULL, /* permission */
- NULL, /* smap */
NULL /* revalidate */
};
diff --git a/fs/minix/file.c b/fs/minix/file.c
index 6683c393c..4240f622e 100644
--- a/fs/minix/file.c
+++ b/fs/minix/file.c
@@ -73,9 +73,7 @@ struct inode_operations minix_file_inode_operations = {
minix_get_block, /* get_block */
block_read_full_page, /* readpage */
block_write_full_page, /* writepage */
- block_flushpage, /* flushpage */
minix_truncate, /* truncate */
NULL, /* permission */
- NULL, /* smap */
NULL, /* revalidate */
};
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index b268a4676..a3e73dbcd 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -461,46 +461,43 @@ int minix_symlink(struct inode * dir, struct dentry *dentry,
{
struct minix_dir_entry * de;
struct inode * inode = NULL;
- struct buffer_head * bh = NULL, * name_block = NULL;
+ struct buffer_head * bh = NULL;
int i;
- char c;
-
- inode = minix_new_inode(dir, &i);
- if (i)
- return i;
+ int err;
+
+ err = -ENAMETOOLONG;
+ i = strlen(symname)+1;
+ if (i>1024)
+ goto out;
+ inode = minix_new_inode(dir, &err);
+ if (err)
+ goto out;
+ err = -ENOSPC;
if (!inode)
- return -ENOSPC;
+ goto out;
inode->i_mode = S_IFLNK | 0777;
inode->i_op = &minix_symlink_inode_operations;
- name_block = minix_bread(inode,0,1);
- if (!name_block) {
- inode->i_nlink--;
- mark_inode_dirty(inode);
- iput(inode);
- return -ENOSPC;
- }
- i = 0;
- while (i < 1023 && (c=*(symname++)))
- name_block->b_data[i++] = c;
- name_block->b_data[i] = 0;
- mark_buffer_dirty(name_block, 1);
- brelse(name_block);
- inode->i_size = i;
- mark_inode_dirty(inode);
- i = minix_add_entry(dir, dentry->d_name.name,
+ err = block_symlink(inode, symname, i);
+ if (err)
+ goto fail;
+
+ err = minix_add_entry(dir, dentry->d_name.name,
dentry->d_name.len, &bh, &de);
- if (i) {
- inode->i_nlink--;
- mark_inode_dirty(inode);
- iput(inode);
- return i;
- }
+ if (err)
+ goto fail;
+
de->inode = inode->i_ino;
mark_buffer_dirty(bh, 1);
brelse(bh);
d_instantiate(dentry, inode);
- return 0;
+out:
+ return err;
+fail:
+ inode->i_nlink--;
+ mark_inode_dirty(inode);
+ iput(inode);
+ goto out;
}
int minix_link(struct dentry * old_dentry, struct inode * dir,
diff --git a/fs/minix/symlink.c b/fs/minix/symlink.c
index 3a8951b09..7e1d03a10 100644
--- a/fs/minix/symlink.c
+++ b/fs/minix/symlink.c
@@ -4,79 +4,19 @@
* Copyright (C) 1991, 1992 Linus Torvalds
*
* minix symlink handling code
+ *
+ * Code removed. 1999, AV ;-)
*/
-#include <linux/errno.h>
-#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/minix_fs.h>
-#include <linux/stat.h>
-
-#include <asm/uaccess.h>
-
-static int minix_readlink(struct dentry *, char *, int);
-static struct dentry *minix_follow_link(struct dentry *, struct dentry *, unsigned int);
/*
* symlinks can't do much...
*/
struct inode_operations minix_symlink_inode_operations = {
- NULL, /* no file-operations */
- NULL, /* create */
- NULL, /* lookup */
- NULL, /* link */
- NULL, /* unlink */
- NULL, /* symlink */
- NULL, /* mkdir */
- NULL, /* rmdir */
- NULL, /* mknod */
- NULL, /* rename */
- minix_readlink, /* readlink */
- minix_follow_link, /* follow_link */
- NULL, /* get_block */
- NULL, /* readpage */
- NULL, /* writepage */
- NULL, /* flushpage */
- NULL, /* truncate */
- NULL, /* permission */
- NULL, /* smap */
- NULL /* revalidate */
+ readlink: page_readlink,
+ follow_link: page_follow_link,
+ get_block: minix_get_block,
+ readpage: block_read_full_page
};
-
-static struct dentry * minix_follow_link(struct dentry * dentry,
- struct dentry * base,
- unsigned int follow)
-{
- struct inode *inode = dentry->d_inode;
- struct buffer_head * bh;
-
- bh = minix_bread(inode, 0, 0);
- if (!bh) {
- dput(base);
- return ERR_PTR(-EIO);
- }
- UPDATE_ATIME(inode);
- base = lookup_dentry(bh->b_data, base, follow);
- brelse(bh);
- return base;
-}
-
-static int minix_readlink(struct dentry * dentry, char * buffer, int buflen)
-{
- struct buffer_head * bh;
- int i;
- char c;
-
- if (buflen > 1023)
- buflen = 1023;
- bh = minix_bread(dentry->d_inode, 0, 0);
- if (!bh)
- return 0;
- i = 0;
- while (i<buflen && (c = bh->b_data[i])) {
- i++;
- put_user(c,buffer++);
- }
- brelse(bh);
- return i;
-}