fusefrontend: only compile getBackingPath() on Darwin
This function is NOT symlink-safe. Darwin needs it because it lacks fgetxattr(2) and friends.
This commit is contained in:
parent
c3adf9729d
commit
1d5500c3db
|
@ -31,21 +31,6 @@ func (fs *FS) isFiltered(path string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBackingPath - get the absolute encrypted path of the backing file
|
|
||||||
// from the relative plaintext path "relPath"
|
|
||||||
//
|
|
||||||
// TODO: this function is NOT symlink-safe.
|
|
||||||
// TODO: Move to xattr_darwin.go.
|
|
||||||
func (fs *FS) getBackingPath(relPath string) (string, error) {
|
|
||||||
cPath, err := fs.encryptPath(relPath)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
cAbsPath := filepath.Join(fs.args.Cipherdir, cPath)
|
|
||||||
tlog.Debug.Printf("getBackingPath: %s + %s -> %s", fs.args.Cipherdir, relPath, cAbsPath)
|
|
||||||
return cAbsPath, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// openBackingDir opens the parent ciphertext directory of plaintext path
|
// openBackingDir opens the parent ciphertext directory of plaintext path
|
||||||
// "relPath" and returns the dirfd and the encrypted basename.
|
// "relPath" and returns the dirfd and the encrypted basename.
|
||||||
//
|
//
|
||||||
|
|
|
@ -4,9 +4,13 @@
|
||||||
package fusefrontend
|
package fusefrontend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/pkg/xattr"
|
"github.com/pkg/xattr"
|
||||||
|
|
||||||
"github.com/hanwen/go-fuse/fuse"
|
"github.com/hanwen/go-fuse/fuse"
|
||||||
|
|
||||||
|
"github.com/rfjakob/gocryptfs/internal/tlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func disallowedXAttrName(attr string) bool {
|
func disallowedXAttrName(attr string) bool {
|
||||||
|
@ -67,3 +71,18 @@ func (fs *FS) listXAttr(relPath string, context *fuse.Context) ([]string, fuse.S
|
||||||
}
|
}
|
||||||
return cNames, fuse.OK
|
return cNames, fuse.OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getBackingPath - get the absolute encrypted path of the backing file
|
||||||
|
// from the relative plaintext path "relPath"
|
||||||
|
//
|
||||||
|
// This function is NOT symlink-safe. Darwin needs it because it lacks
|
||||||
|
// fgetxattr(2) and friends.
|
||||||
|
func (fs *FS) getBackingPath(relPath string) (string, error) {
|
||||||
|
cPath, err := fs.encryptPath(relPath)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
cAbsPath := filepath.Join(fs.args.Cipherdir, cPath)
|
||||||
|
tlog.Debug.Printf("getBackingPath: %s + %s -> %s", fs.args.Cipherdir, relPath, cAbsPath)
|
||||||
|
return cAbsPath, nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue