aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9pfuse
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-07-04 02:52:01 -0400
committerRuss Cox <rsc@swtch.com>2008-07-04 02:52:01 -0400
commitd07db89b00a55db3ca9c3577422cbd9be722dae6 (patch)
tree48cf8ea105565d1818b49cdf4c9a240ea04ece77 /src/cmd/9pfuse
parent382ae73f24c4566b2948d72f65ff68dc35857556 (diff)
downloadplan9port-d07db89b00a55db3ca9c3577422cbd9be722dae6.tar.gz
plan9port-d07db89b00a55db3ca9c3577422cbd9be722dae6.tar.bz2
plan9port-d07db89b00a55db3ca9c3577422cbd9be722dae6.zip
9pfuse: add symlink support
Diffstat (limited to 'src/cmd/9pfuse')
-rw-r--r--src/cmd/9pfuse/main.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c
index a6c1df2f..c9d4f55d 100644
--- a/src/cmd/9pfuse/main.c
+++ b/src/cmd/9pfuse/main.c
@@ -320,6 +320,8 @@ dir2attr(Dir *d, struct fuse_attr *attr)
attr->mode = d->mode&0777;
if(d->mode&DMDIR)
attr->mode |= S_IFDIR;
+ else if(d->mode&DMSYMLINK)
+ attr->mode |= S_IFLNK;
else
attr->mode |= S_IFREG;
attr->nlink = 1; /* works for directories! - see FUSE FAQ */
@@ -815,6 +817,32 @@ fuseread(FuseMsg *m)
free(buf);
}
+/*
+ * Readlink.
+ */
+void
+fusereadlink(FuseMsg *m)
+{
+ Dir *d;
+ CFid *fid;
+
+ if((fid = nodeid2fid(m->hdr->nodeid)) == nil){
+ replyfuseerrno(m, ESTALE);
+ return;
+ }
+ if((d = fsdirfstat(fid)) == nil){
+ replyfuseerrstr(m);
+ return;
+ }
+ if(!(d->mode&DMSYMLINK)){
+ replyfuseerrno(m, EINVAL);
+ return;
+ }
+ replyfuse(m, d->ext, strlen(d->ext));
+ free(d);
+ return;
+}
+
/*
* Readdir.
* Read from file handle in->fh at offset in->offset for size in->size.
@@ -1123,8 +1151,9 @@ struct {
{ FUSE_GETATTR, fusegetattr },
{ FUSE_SETATTR, fusesetattr },
/*
- * FUSE_READLINK, FUSE_SYMLINK, FUSE_MKNOD are unimplemented.
+ * FUSE_SYMLINK, FUSE_MKNOD are unimplemented.
*/
+ { FUSE_READLINK, fusereadlink },
{ FUSE_MKDIR, fusemkdir },
{ FUSE_UNLINK, fuseunlink },
{ FUSE_RMDIR, fusermdir },