github.com/hanwen/go-fuse@v1.0.0/fuse/pathfs/loopback_linux.go (about) 1 // Copyright 2016 the Go-FUSE Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package pathfs 6 7 import ( 8 "fmt" 9 "syscall" 10 "time" 11 12 "github.com/hanwen/go-fuse/fuse" 13 ) 14 15 func (fs *loopbackFileSystem) ListXAttr(name string, context *fuse.Context) ([]string, fuse.Status) { 16 data, err := listXAttr(fs.GetPath(name)) 17 18 return data, fuse.ToStatus(err) 19 } 20 21 func (fs *loopbackFileSystem) RemoveXAttr(name string, attr string, context *fuse.Context) fuse.Status { 22 err := sysRemovexattr(fs.GetPath(name), attr) 23 return fuse.ToStatus(err) 24 } 25 26 func (fs *loopbackFileSystem) String() string { 27 return fmt.Sprintf("LoopbackFs(%s)", fs.Root) 28 } 29 30 func (fs *loopbackFileSystem) GetXAttr(name string, attr string, context *fuse.Context) ([]byte, fuse.Status) { 31 data := make([]byte, 1024) 32 data, err := getXAttr(fs.GetPath(name), attr, data) 33 34 return data, fuse.ToStatus(err) 35 } 36 37 func (fs *loopbackFileSystem) SetXAttr(name string, attr string, data []byte, flags int, context *fuse.Context) fuse.Status { 38 err := syscall.Setxattr(fs.GetPath(name), attr, data, flags) 39 return fuse.ToStatus(err) 40 } 41 42 // Utimens - path based version of loopbackFile.Utimens() 43 func (fs *loopbackFileSystem) Utimens(path string, a *time.Time, m *time.Time, context *fuse.Context) (code fuse.Status) { 44 var ts [2]syscall.Timespec 45 ts[0] = fuse.UtimeToTimespec(a) 46 ts[1] = fuse.UtimeToTimespec(m) 47 err := sysUtimensat(0, fs.GetPath(path), &ts, _AT_SYMLINK_NOFOLLOW) 48 return fuse.ToStatus(err) 49 }