コード例 #1
0
ファイル: dot-snap.go プロジェクト: jgluck/bazil
	"bazil.org/bazil/tokens"
	"bazil.org/bazil/util/env"
	"bazil.org/fuse"
	"bazil.org/fuse/fs"
)

type listSnaps struct {
	fs      *Volume
	rootDir *dir
}

var _ = fs.Node(&listSnaps{})
var _ = fs.NodeMkdirer(&listSnaps{})
var _ = fs.NodeStringLookuper(&listSnaps{})
var _ = fs.Handle(&listSnaps{})
var _ = fs.HandleReadDirer(&listSnaps{})

func (d *listSnaps) Attr() fuse.Attr {
	return fuse.Attr{
		Inode: tokens.InodeSnap,
		Mode:  os.ModeDir | 0755,
		Nlink: 1,
		Uid:   env.MyUID,
		Gid:   env.MyGID,
	}
}

var _ = fs.NodeStringLookuper(&listSnaps{})

func (d *listSnaps) Lookup(name string, intr fs.Intr) (fs.Node, fuse.Error) {
	var buf []byte
コード例 #2
0
ファイル: dir.go プロジェクト: jgluck/bazil
	//
	// each child also stores its own name; if the value in the child,
	// looked up in this map, does not equal the child, that means the
	// child has been unlinked
	active map[string]node
}

var _ = node(&dir{})
var _ = fs.Node(&dir{})
var _ = fs.NodeCreater(&dir{})
var _ = fs.NodeForgetter(&dir{})
var _ = fs.NodeMkdirer(&dir{})
var _ = fs.NodeRemover(&dir{})
var _ = fs.NodeRenamer(&dir{})
var _ = fs.NodeStringLookuper(&dir{})
var _ = fs.HandleReadDirer(&dir{})

func (d *dir) setName(name string) {
	d.mu.Lock()
	defer d.mu.Unlock()
	d.name = name
}

func (d *dir) Attr() fuse.Attr {
	return fuse.Attr{
		Inode: d.inode,
		Mode:  os.ModeDir | 0755,
		Nlink: 1,
		Uid:   env.MyUID,
		Gid:   env.MyGID,
	}
コード例 #3
0
ファイル: bench_test.go プロジェクト: seacoastboy/fuse
	resp.Flags |= fuse.InitAsyncRead
	return nil
}

func (f benchFS) Root() (fs.Node, fuse.Error) {
	return benchDir{conf: f.conf}, nil
}

type benchDir struct {
	conf *benchConfig
}

var _ = fs.Node(benchDir{})
var _ = fs.NodeStringLookuper(benchDir{})
var _ = fs.Handle(benchDir{})
var _ = fs.HandleReadDirer(benchDir{})

func (benchDir) Attr() fuse.Attr {
	return fuse.Attr{Inode: 1, Mode: os.ModeDir | 0555}
}

func (d benchDir) Lookup(name string, intr fs.Intr) (fs.Node, fuse.Error) {
	if name == "bench" {
		return benchFile{conf: d.conf}, nil
	}
	return nil, fuse.ENOENT
}

func (benchDir) ReadDir(intr fs.Intr) ([]fuse.Dirent, fuse.Error) {
	l := []fuse.Dirent{
		{Inode: 2, Name: "bench", Type: fuse.DT_File},
コード例 #4
0
ファイル: fuse.go プロジェクト: jgluck/bazil
		chunkStore: chunkStore,
		reader:     r,
	}
	return node, nil
}

type fuseDir struct {
	chunkStore chunks.Store
	reader     *Reader
}

var _ = fusefs.Node(fuseDir{})
var _ = fusefs.NodeStringLookuper(fuseDir{})
var _ = fusefs.NodeCreater(fuseDir{})
var _ = fusefs.Handle(fuseDir{})
var _ = fusefs.HandleReadDirer(fuseDir{})

func (d fuseDir) Attr() fuse.Attr {
	return fuse.Attr{
		Mode:  os.ModeDir | 0555,
		Nlink: 1,
		Uid:   env.MyUID,
		Gid:   env.MyGID,
	}
}

const _MAX_INT64 = 9223372036854775807

func (d fuseDir) Lookup(name string, intr fusefs.Intr) (fusefs.Node, fuse.Error) {
	de, err := d.reader.Lookup(name)
	if err != nil {