Skip to content

Simple file system is not read only #553

@WeidiDeng

Description

@WeidiDeng

In the documentation there is a section about Static in-memory file systems.

The file system this creates is not technically read-only, as files and directories can be removed without any error.

There is even todo in the code:

go-fuse/fs/bridge.go

Lines 395 to 408 in f1d40d0

func (b *rawBridge) Rmdir(cancel <-chan struct{}, header *fuse.InHeader, name string) fuse.Status {
parent, _ := b.inode(header.NodeId, 0)
var errno syscall.Errno
if mops, ok := parent.ops.(NodeRmdirer); ok {
errno = mops.Rmdir(&fuse.Context{Caller: header.Caller, Cancel: cancel}, name)
}
// TODO - this should not succeed silently.
if errno == 0 {
parent.RmChild(name)
}
return errnoToStatus(errno)
}

go-fuse/fs/bridge.go

Lines 410 to 423 in f1d40d0

func (b *rawBridge) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name string) fuse.Status {
parent, _ := b.inode(header.NodeId, 0)
var errno syscall.Errno
if mops, ok := parent.ops.(NodeUnlinker); ok {
errno = mops.Unlink(&fuse.Context{Caller: header.Caller, Cancel: cancel}, name)
}
// TODO - this should not succeed silently.
if errno == 0 {
parent.RmChild(name)
}
return errnoToStatus(errno)
}

The docs for these methods also indicate success by default

NodeRmdirer.Rmdir

NodeRmdirer.Rmdir

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions