Commit e9e97851 authored by Aaron Jacobs's avatar Aaron Jacobs

Added package fuse support for creating symlinks.

parents e331443c e9a77cf2
......@@ -114,6 +114,15 @@ func Convert(
io = to
co = &to.commonOp
case *bazilfuse.SymlinkRequest:
to := &CreateSymlinkOp{
Parent: InodeID(typed.Header.Node),
Name: typed.NewName,
Target: typed.Target,
}
io = to
co = &to.commonOp
case *bazilfuse.RemoveRequest:
if typed.Dir {
to := &RmDirOp{
......
......@@ -371,6 +371,47 @@ func (o *CreateFileOp) toBazilfuseResponse() (bfResp interface{}) {
return
}
// Create a symlink inode.
type CreateSymlinkOp struct {
commonOp
// The ID of parent directory inode within which to create the child symlink.
Parent InodeID
// The name of the symlink to create.
Name string
// The target of the symlink.
Target string
// Set by the file system: information about the symlink inode that was
// created.
//
// The lookup count for the inode is implicitly incremented. See notes on
// ForgetInodeOp for more information.
Entry ChildInodeEntry
}
func (o *CreateSymlinkOp) ShortDesc() (desc string) {
desc = fmt.Sprintf(
"CreateSymlink(parent=%v, name=%q, target=%q)",
o.Parent,
o.Name,
o.Target)
return
}
func (o *CreateSymlinkOp) toBazilfuseResponse() (bfResp interface{}) {
resp := bazilfuse.SymlinkResponse{}
bfResp = &resp
convertChildInodeEntry(&o.Entry, &resp.LookupResponse)
return
return
}
////////////////////////////////////////////////////////////////////////
// Unlinking
////////////////////////////////////////////////////////////////////////
......
......@@ -45,6 +45,7 @@ type FileSystem interface {
ForgetInode(*fuseops.ForgetInodeOp)
MkDir(*fuseops.MkDirOp)
CreateFile(*fuseops.CreateFileOp)
CreateSymlink(*fuseops.CreateSymlinkOp)
RmDir(*fuseops.RmDirOp)
Unlink(*fuseops.UnlinkOp)
OpenDir(*fuseops.OpenDirOp)
......@@ -149,6 +150,9 @@ func (s fileSystemServer) handleOp(op fuseops.Op) {
case *fuseops.CreateFileOp:
s.fs.CreateFile(typed)
case *fuseops.CreateSymlinkOp:
s.fs.CreateSymlink(typed)
case *fuseops.RmDirOp:
s.fs.RmDir(typed)
......
......@@ -63,6 +63,11 @@ func (fs *NotImplementedFileSystem) CreateFile(
op.Respond(fuse.ENOSYS)
}
func (fs *NotImplementedFileSystem) CreateSymlink(
op *fuseops.CreateSymlinkOp) {
op.Respond(fuse.ENOSYS)
}
func (fs *NotImplementedFileSystem) RmDir(
op *fuseops.RmDirOp) {
op.Respond(fuse.ENOSYS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment