Skip to content

Commit

Permalink
options: Introduce a new option: AllowNonEmptyMount
Browse files Browse the repository at this point in the history
This option allows the mounting over a non-empty directory and shadows the files
in it, if any. I didn't see this MountOption yet in the package.
It simply passes 'nonempty' to '-o'.
  • Loading branch information
sahib authored and tv42 committed Aug 11, 2016
1 parent 08e592e commit 1453c89
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,15 @@ func OSXFUSELocations(paths ...OSXFUSEPaths) MountOption {
return nil
}
}

// AllowNonEmptyMount allows the mounting over a non-empty directory.
//
// The files in it will be shadowed by the freshly created mount.
// By default these mounts are rejected to prevent accidental covering up of
// data, which could for example prevent automatic backup.
func AllowNonEmptyMount() MountOption {
return func(conf *mountConfig) error {
conf.options["nonempty"] = ""
return nil
}
}

0 comments on commit 1453c89

Please sign in to comment.