patch-2.1.43 linux/fs/affs/symlink.c
Next file: linux/fs/attr.c
Previous file: linux/fs/affs/namei.c
Back to the patch index
Back to the overall index
- Lines: 112
- Date:
Thu Jun 12 16:22:08 1997
- Orig file:
v2.1.42/linux/fs/affs/symlink.c
- Orig date:
Tue May 13 22:41:14 1997
diff -u --recursive --new-file v2.1.42/linux/fs/affs/symlink.c linux/fs/affs/symlink.c
@@ -20,7 +20,6 @@
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
static int affs_readlink(struct inode *, char *, int);
-static int affs_follow_link(struct inode *, struct inode *, int, int, struct inode **);
struct inode_operations affs_symlink_inode_operations = {
NULL, /* no file-operations */
@@ -34,92 +33,12 @@
NULL, /* mknod */
NULL, /* rename */
affs_readlink, /* readlink */
- affs_follow_link, /* follow_link */
NULL, /* bmap */
NULL, /* truncate */
NULL /* permission */
};
static int
-affs_follow_link(struct inode *dir, struct inode *inode, int flag, int mode,
- struct inode **res_inode)
-{
- struct buffer_head *bh;
- struct slink_front *lf;
- char *buffer;
- int error;
- int i, j;
- char c;
- char lc;
-
- pr_debug("AFFS: follow_link(ino=%lu)\n",inode->i_ino);
-
- *res_inode = NULL;
- if (!dir) {
- dir = current->fs->root;
- dir->i_count++;
- }
- if (!inode) {
- iput(dir);
- return -ENOENT;
- }
- if (!S_ISLNK(inode->i_mode)) {
- iput(dir);
- *res_inode = inode;
- return 0;
- }
- if (current->link_count > 5) {
- iput(inode);
- iput(dir);
- return -ELOOP;
- }
- if (!(buffer = kmalloc(1024,GFP_KERNEL))) {
- iput(inode);
- iput(dir);
- return -ENOSPC;
- }
- bh = affs_bread(inode->i_dev,inode->i_ino,AFFS_I2BSIZE(inode));
- i = 0;
- j = 0;
- if (!bh) {
- affs_error(inode->i_sb,"follow_link","Cannot read block %lu\n",inode->i_ino);
- kfree(buffer);
- iput(inode);
- iput(dir);
- return -EIO;
- }
- lf = (struct slink_front *)bh->b_data;
- lc = 0;
- if (strchr(lf->symname,':')) { /* Handle assign or volume name */
- while (i < 1023 && (c = inode->i_sb->u.affs_sb.s_prefix[i]))
- buffer[i++] = c;
- while (i < 1023 && lf->symname[j] != ':')
- buffer[i++] = lf->symname[j++];
- if (i < 1023)
- buffer[i++] = '/';
- j++;
- lc = '/';
- }
- while (i < 1023 && (c = lf->symname[j])) {
- if (c == '/' && lc == '/' && i < 1020) { /* parent dir */
- buffer[i++] = '.';
- buffer[i++] = '.';
- }
- buffer[i++] = c;
- lc = c;
- j++;
- }
- buffer[i] = '\0';
- affs_brelse(bh);
- iput(inode);
- current->link_count++;
- error = open_namei(buffer,flag,mode,res_inode,dir);
- current->link_count--;
- kfree(buffer);
- return error;
-}
-
-static int
affs_readlink(struct inode *inode, char *buffer, int buflen)
{
struct buffer_head *bh;
@@ -130,10 +49,6 @@
pr_debug("AFFS: readlink(ino=%lu,buflen=%d)\n",inode->i_ino,buflen);
- if (!S_ISLNK(inode->i_mode)) {
- iput(inode);
- return -EINVAL;
- }
bh = affs_bread(inode->i_dev,inode->i_ino,AFFS_I2BSIZE(inode));
i = 0;
j = 0;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov