Exemplo n.º 1
0
func (c *FileSystemConnector) Open(out *raw.OpenOut, context *Context, input *raw.OpenIn) (status Status) {
	node := c.toInode(context.NodeId)
	f, code := node.fsInode.Open(input.Flags, context)
	if !code.Ok() {
		return code
	}
	h, opened := node.mount.registerFileHandle(node, nil, f, input.Flags)
	out.OpenFlags = opened.FuseFlags
	out.Fh = h
	return OK
}
Exemplo n.º 2
0
func (c *FileSystemConnector) OpenDir(out *raw.OpenOut, context *Context, input *raw.OpenIn) (code Status) {
	node := c.toInode(context.NodeId)
	stream, err := node.fsInode.OpenDir(context)
	if err != OK {
		return err
	}
	stream = append(stream, node.getMountDirEntries()...)
	de := &connectorDir{
		node:   node.FsNode(),
		stream: append(stream, DirEntry{S_IFDIR, "."}, DirEntry{S_IFDIR, ".."}),
	}
	h, opened := node.mount.registerFileHandle(node, de, nil, input.Flags)
	out.OpenFlags = opened.FuseFlags
	out.Fh = h
	return OK
}