2 * linux/fs/sysv/symlink.c
5 * Copyright (C) 1991, 1992 Linus Torvalds
8 * Copyright (C) 1993 Pascal Haible, Bruno Haible
11 * Copyright (C) 1993 Bruno Haible
13 * SystemV/Coherent symlink handling code
16 #include <linux/errno.h>
17 #include <linux/sched.h>
18 #include <linux/sysv_fs.h>
19 #include <linux/stat.h>
21 #include <asm/uaccess.h>
23 static int sysv_readlink(struct dentry
*, char *, int);
24 static struct dentry
*sysv_follow_link(struct dentry
*, struct dentry
*, unsigned int);
27 * symlinks can't do much...
29 struct inode_operations sysv_symlink_inode_operations
= {
30 NULL
, /* no file-operations */
40 sysv_readlink
, /* readlink */
41 sysv_follow_link
, /* follow_link */
47 NULL
, /* permission */
52 static struct dentry
*sysv_follow_link(struct dentry
* dentry
,
56 struct inode
*inode
= dentry
->d_inode
;
57 struct buffer_head
* bh
;
59 bh
= sysv_file_bread(inode
, 0, 0);
65 base
= lookup_dentry(bh
->b_data
, base
, follow
);
70 static int sysv_readlink(struct dentry
* dentry
, char * buffer
, int buflen
)
72 struct inode
*inode
= dentry
->d_inode
;
73 struct buffer_head
* bh
;
78 if (buflen
> inode
->i_sb
->sv_block_size_1
)
79 buflen
= inode
->i_sb
->sv_block_size_1
;
80 bh
= sysv_file_bread(inode
, 0, 0);
85 while (i
<buflen
&& (c
= bh_data
[i
])) {