Last change
on this file since 34079 was 33440, checked in by vboxsync, 14 years ago |
Linux Additions: symlinks only for Linux 2.6 guests
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.3 KB
|
Line | |
---|
1 | #include "vfsmod.h"
|
---|
2 |
|
---|
3 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
|
---|
4 |
|
---|
5 | static void *sf_follow_link(struct dentry *dentry, struct nameidata *nd)
|
---|
6 | {
|
---|
7 | struct inode *inode = dentry->d_inode;
|
---|
8 | struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
|
---|
9 | struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
|
---|
10 | int error = -ENOMEM;
|
---|
11 | unsigned long page = get_zeroed_page(GFP_KERNEL);
|
---|
12 | int rc;
|
---|
13 |
|
---|
14 | if (page)
|
---|
15 | {
|
---|
16 | error = 0;
|
---|
17 | rc = vboxReadLink(&client_handle, &sf_g->map, sf_i->path, PATH_MAX, (char *)page);
|
---|
18 | if (RT_FAILURE(rc))
|
---|
19 | {
|
---|
20 | LogFunc(("vboxReadLink failed, caller=%s, rc=%Rrc\n",
|
---|
21 | __func__, rc));
|
---|
22 | error = -EPROTO;
|
---|
23 | }
|
---|
24 | }
|
---|
25 | nd_set_link(nd, error ? ERR_PTR(error) : (char *)page);
|
---|
26 | return NULL;
|
---|
27 | }
|
---|
28 |
|
---|
29 | static void sf_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
|
---|
30 | {
|
---|
31 | char *page = nd_get_link(nd);
|
---|
32 | if (!IS_ERR(page))
|
---|
33 | free_page((unsigned long)page);
|
---|
34 | }
|
---|
35 |
|
---|
36 | struct inode_operations sf_lnk_iops =
|
---|
37 | {
|
---|
38 | .readlink = generic_readlink,
|
---|
39 | .follow_link = sf_follow_link,
|
---|
40 | .put_link = sf_put_link
|
---|
41 | };
|
---|
42 |
|
---|
43 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.