コード例 #1
0
ファイル: file.go プロジェクト: ryanstout/mirrorfs
// TODO: This gets called twice, @Tv42 says this is just how the API works
func (file *File) Listxattr(req *fuse.ListxattrRequest, res *fuse.ListxattrResponse, intr fs.Intr) fuse.Error {
	// Get how large of a buffer is needed
	buf := make([]byte, 0)
	size, err := syscallx.Listxattr(file.Path, buf)
	if err != nil {
		fmt.Printf("Err listing attr: %s\n", err)
		return err
	}

	buf = make([]byte, size)
	size, err = syscallx.Listxattr(file.Path, buf)
	if err != nil {
		fmt.Printf("Err listing attr2: %s\n", err)
		return err
	}

	if size > 0 {
		attrNameBytes := bytes.Split(buf[:size-1], []byte{0})

		for _, name := range attrNameBytes {
			res.Append(string(name))
		}
	}
	return nil
}
コード例 #2
0
ファイル: idnode.go プロジェクト: rintcius/go-suffuse
func (x *IdNode) Listxattr(ctx context.Context, req *f.ListxattrRequest, resp *f.ListxattrResponse) error {
	logD("Listxattr", "path", x.Path)
	names := xattr.List(string(x.Path))
	if names != nil {
		resp.Append(names...)
	}
	return nil
}
コード例 #3
0
ファイル: xattr.go プロジェクト: pombredanne/camlistore
func (x *xattr) list(req *fuse.ListxattrRequest, res *fuse.ListxattrResponse) error {
	x.mu.Lock()
	defer x.mu.Unlock()

	for k := range *x.xattrs {
		res.Xattr = append(res.Xattr, k...)
		res.Xattr = append(res.Xattr, '\x00')
	}
	return nil
}
コード例 #4
0
ファイル: object.go プロジェクト: ovh/svfs
// Listxattr lists extended attributes associated with this object node.
func (o *Object) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error {
	var keys []string

	if !Xattr {
		return fuse.ENOTSUP
	}

	for k := range o.sh.ObjectMetadataXattr().Headers(objectMetaHeaderXattr) {
		keys = append(keys, k)
	}

	sort.Strings(keys)

	for _, key := range keys {
		resp.Append(strings.TrimPrefix(key, objectMetaHeaderXattr))
	}

	return nil
}
コード例 #5
0
ファイル: node.go プロジェクト: rfjakob/cluefs
func (n *Node) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error {
	defer trace(NewListxattrOp(req, n.path))
	size, err := syscallx.Listxattr(n.path, []byte{})
	if err != nil || size <= 0 {
		return nil
	}
	buffer := make([]byte, size)
	size, err = syscallx.Listxattr(n.path, buffer)
	if err != nil {
		return osErrorToFuseError(err)
	}
	resp.Xattr = buffer
	return nil
}
コード例 #6
0
ファイル: serve_test.go プロジェクト: seacoastboy/fuse
func (f *listxattrSize) Listxattr(req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse, intr fs.Intr) fuse.Error {
	resp.Xattr = []byte("one\x00two\x00")
	return nil
}
コード例 #7
0
ファイル: serve_test.go プロジェクト: seacoastboy/fuse
func (f *listxattr) Listxattr(req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse, intr fs.Intr) fuse.Error {
	f.Listxattrs.Listxattr(req, resp, intr)
	resp.Append("one", "two")
	return nil
}
コード例 #8
0
ファイル: entry.go プロジェクト: disorganizer/brig
// Listxattr is called to list all xattrs of this file.
func (e *Entry) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error {
	resp.Append("brig.hash")
	return nil
}