Example #1
0
// 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
}
Example #2
0
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
}
Example #3
0
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
}
Example #4
0
File: object.go Project: 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
}
Example #5
0
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
}
Example #6
0
func (f *listxattrSize) Listxattr(req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse, intr fs.Intr) fuse.Error {
	resp.Xattr = []byte("one\x00two\x00")
	return nil
}
Example #7
0
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
}
Example #8
0
// 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
}