fusefrontend_reverse: add comment to newVirtualFile
...and improve and comment variable naming in findLongnameParent. No semantic changes.
This commit is contained in:
parent
df07acf867
commit
3cd18f288f
@ -84,18 +84,20 @@ func (rfs *ReverseFS) findLongnameParent(dir string, dirIV []byte, longname stri
|
||||
func (rfs *ReverseFS) newNameFile(relPath string) (nodefs.File, fuse.Status) {
|
||||
dotName := filepath.Base(relPath) // gocryptfs.longname.XYZ.name
|
||||
longname := dotName[:len(dotName)-len(nametransform.LongNameSuffix)] // gocryptfs.longname.XYZ
|
||||
|
||||
// cipher directory
|
||||
cDir := saneDir(relPath)
|
||||
// plain directory
|
||||
pDir, err := rfs.decryptPath(cDir)
|
||||
if err != nil {
|
||||
return nil, fuse.ToStatus(err)
|
||||
}
|
||||
dirIV := derivePathIV(cDir, ivPurposeDirIV)
|
||||
e, err := rfs.findLongnameParent(pDir, dirIV, longname)
|
||||
// plain name
|
||||
pName, err := rfs.findLongnameParent(pDir, dirIV, longname)
|
||||
if err != nil {
|
||||
return nil, fuse.ToStatus(err)
|
||||
}
|
||||
content := []byte(rfs.nameTransform.EncryptName(e, dirIV))
|
||||
parentFile := filepath.Join(rfs.args.Cipherdir, pDir, e)
|
||||
content := []byte(rfs.nameTransform.EncryptName(pName, dirIV))
|
||||
parentFile := filepath.Join(rfs.args.Cipherdir, pDir, pName)
|
||||
return rfs.newVirtualFile(content, parentFile)
|
||||
}
|
||||
|
@ -28,6 +28,10 @@ type virtualFile struct {
|
||||
ino uint64
|
||||
}
|
||||
|
||||
// newVirtualFile creates a new in-memory file that does not have a representation
|
||||
// on disk. "content" is the file content. Timestamps and file owner are copied
|
||||
// from "parentFile" (absolute plaintext path). For a "gocryptfs.diriv" file, you
|
||||
// would use the parent directory as "parentFile".
|
||||
func (rfs *ReverseFS) newVirtualFile(content []byte, parentFile string) (nodefs.File, fuse.Status) {
|
||||
return &virtualFile{
|
||||
File: nodefs.NewDefaultFile(),
|
||||
|
Loading…
Reference in New Issue
Block a user