Giter Site home page Giter Site logo

Comments (2)

hanwen avatar hanwen commented on August 25, 2024

off the bat, I suspect because you are not filling *Attr in the call.

You are setting Debug, but nothing gets printed. Are you sure stderr is not
redirected?

On Wed, May 28, 2014 at 9:49 AM, fbenkstein [email protected]:

Hi,

I am trying to dynamically create filenames when they are being accessed
but it seems something isn't working. I do not know whether it is a bug in
my program or no.

Here's my example program:

package main
import (
"flag"
"fmt"
"log"
"os"
"path"

    "github.com/hanwen/go-fuse/fuse"
    "github.com/hanwen/go-fuse/fuse/nodefs")

type testNode struct {
nodefs.Node}
func newTestNode() nodefs.Node {
node := testNode{nodefs.NewDefaultNode()}
return &node}
func (r _testNode) Lookup(out *fuse.Attr, name string, context *fuse.Context) (_nodefs.Inode, fuse.Status) {
node := r.Inode().NewChild(name, false, newTestNode())
return node, fuse.OK}
func main() {
flag.Parse()

    if flag.NArg() < 1 {
            fmt.Printf("usage: %s MOUNTPOINT\n", path.Base(os.Args[0]))
            os.Exit(2)
    }

    mountPoint := flag.Arg(0)

    root := newTestNode()

    server, _, err := nodefs.MountRoot(mountPoint, root, &nodefs.Options{
            EntryTimeout:    0,
            NegativeTimeout: 0,
            AttrTimeout:     0,
            PortableInodes:  true,
    })
    server.SetDebug(true)

    if err != nil {
            log.Fatalf("Failed to mount filesystem: %v", err)
    }

    server.Serve()}

On the shell I get the following results:

$ go run test.go /tmp/test
$ stat /tmp/test/abc
stat: cannot stat /tmp/test/abc': Input/output error $ stat /tmp/test/abc File:/tmp/test/abc'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 1ah/26d Inode: 3 Links: 0
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 1970-01-01 01:00:00.000000000 +0100
Modify: 1970-01-01 01:00:00.000000000 +0100
Change: 1970-01-01 01:00:00.000000000 +0100
Birth: -

Why does the first call fail and second one succeed?

Best regards,
Frank.


Reply to this email directly or view it on GitHubhttps://github.com//issues/23
.

Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen

from go-fuse.

fbenkstein avatar fbenkstein commented on August 25, 2024

Hi,

you were absolutely right about *Attr. After setting Mode to something reasonable the error disappears. The reason the debug output was missing was that I switched debug off to generate the output above.

Thank you for your help!

Regards,
Frank.

from go-fuse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.