package main import ( "bazil.org/fuse" "bazil.org/fuse/fs" "golang.org/x/net/context" "time" ) type MyFile struct {} func (f *MyFile) Attr(ctx context.Context, attr *fuse.Attr) error { attr.Mode = 0777 attr.Atime = time.Now() return nil } func main() { // Initialize FUSE connection and mount point conn, err := fuse.Mount("/mnt/myfs") if err != nil { panic(err) } defer conn.Close() // Create a file system handler handler := &MyFile{} // Start FUSE server with the handler err = fs.Serve(conn, handler) if err != nil { panic(err) } }
package main import ( "bazil.org/fuse" "bazil.org/fuse/fs" "golang.org/x/net/context" ) type MyFile struct {} func (f *MyFile) Attr(ctx context.Context, attr *fuse.Attr) error { attr.Mode = 0777 attr.Atime = time.Now() return nil } func main() { // Initialize FUSE connection and mount point conn, err := fuse.Mount("/mnt/myfs") if err != nil { panic(err) } defer conn.Close() // Create a file system handler handler := &MyFile{} // Start FUSE server with the handler err = fs.Serve(conn, handler) if err != nil { panic(err) } // Get Atime from a file file, err := conn.Root().Lookup("myfile.txt") if err != nil { panic(err) } var attr fuse.Attr err = file.Attr(context.Background(), &attr) if err != nil { panic(err) } // Print Atime fmt.Printf("Access time: %v", attr.Atime) }