作者:ryanstou
项目:mirrorf
// 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
}
作者:rintciu
项目:go-suffus
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
}
作者:pombredann
项目:camlistor
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
}
作者:ov
项目:svf
// 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
}
作者:rfjako
项目:cluef
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
}
作者:seacoastbo
项目:fus
func (f *listxattrSize) Listxattr(req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse, intr fs.Intr) fuse.Error {
resp.Xattr = []byte("one\x00two\x00")
return nil
}
作者:disorganize
项目:bri
// 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
}