Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ func getVfsConf(c *cli.Context, metaConf *meta.Config, format *meta.Format, chun
PPid: os.Getppid(),
UMask: 0xFFFF,
HideInternal: c.Bool("hide-internal"),
SkipTrash: c.Bool("skip-trash"),
}

if c.IsSet("umask") {
Expand Down
4 changes: 4 additions & 0 deletions cmd/mount_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ func mountFlags() []cli.Flag {
Name: "hide-internal",
Usage: "hide all internal files (.accesslog, .stats, etc.)",
},
&cli.BoolFlag{
Name: "skip-trash",
Usage: "skip trash and delete files directly",
},
}
if runtime.GOOS == "linux" {
selfFlags = append(selfFlags, &cli.BoolFlag{
Expand Down
5 changes: 3 additions & 2 deletions pkg/vfs/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ type Config struct {
AllSquash *AnonymousAccount `json:",omitempty"`
NonDefaultPermission bool `json:",omitempty"`
UMask uint16
SkipTrash bool `json:",omitempty"`

Pid int
PPid int
Expand Down Expand Up @@ -276,7 +277,7 @@ func (v *VFS) Unlink(ctx Context, parent Ino, name string) (err syscall.Errno) {
err = syscall.ENAMETOOLONG
return
}
err = v.Meta.Unlink(ctx, parent, name)
err = v.Meta.Unlink(ctx, parent, name, v.Conf.SkipTrash)
if err == 0 {
v.invalidateDirHandle(parent, name, 0, nil)
}
Expand Down Expand Up @@ -312,7 +313,7 @@ func (v *VFS) Rmdir(ctx Context, parent Ino, name string) (err syscall.Errno) {
err = syscall.ENAMETOOLONG
return
}
err = v.Meta.Rmdir(ctx, parent, name)
err = v.Meta.Rmdir(ctx, parent, name, v.Conf.SkipTrash)
if err == 0 {
v.invalidateDirHandle(parent, name, 0, nil)
}
Expand Down