diff options
author | Jakob Unterwurzacher | 2020-04-12 17:15:03 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2020-04-13 14:54:04 +0200 |
commit | 488111ce390218806fca933b89279b766f7ff49c (patch) | |
tree | d75a8aac95f95767410027da14cd0231c17110a3 /internal/fusefrontend | |
parent | 194030f18ae623fbf5b0bb805b780f81fe9ec7a7 (diff) |
inomap: split into separate package
inomap will also be used by fusefrontend_reverse
in the future. Split if off openfiletable to make
it independent.
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r-- | internal/fusefrontend/file.go | 7 | ||||
-rw-r--r-- | internal/fusefrontend/fs.go | 10 |
2 files changed, 9 insertions, 8 deletions
diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go index 83e39be..8c2bae0 100644 --- a/internal/fusefrontend/file.go +++ b/internal/fusefrontend/file.go @@ -17,6 +17,7 @@ import ( "github.com/hanwen/go-fuse/fuse/nodefs" "github.com/rfjakob/gocryptfs/internal/contentenc" + "github.com/rfjakob/gocryptfs/internal/inomap" "github.com/rfjakob/gocryptfs/internal/openfiletable" "github.com/rfjakob/gocryptfs/internal/serialize_reads" "github.com/rfjakob/gocryptfs/internal/stupidgcm" @@ -42,7 +43,7 @@ type File struct { // Content encryption helper contentEnc *contentenc.ContentEnc // Device and inode number uniquely identify the backing file - qIno openfiletable.QIno + qIno inomap.QIno // Entry in the open file table fileTableEntry *openfiletable.Entry // Store where the last byte was written @@ -66,7 +67,7 @@ func NewFile(fd *os.File, fs *FS) (*File, fuse.Status) { tlog.Warn.Printf("NewFile: Fstat on fd %d failed: %v\n", fd.Fd(), err) return nil, fuse.ToStatus(err) } - qi := openfiletable.QInoFromStat(&st) + qi := inomap.QInoFromStat(&st) e := openfiletable.Register(qi) return &File{ @@ -462,7 +463,7 @@ func (f *File) GetAttr(a *fuse.Attr) fuse.Status { if err != nil { return fuse.ToStatus(err) } - f.fs.inumMap.TranslateStat(&st) + f.fs.inoMap.TranslateStat(&st) a.FromStat(&st) a.Size = f.contentEnc.CipherSizeToPlainSize(a.Size) if f.fs.args.ForceOwner != nil { diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go index d03fc77..cfd17e3 100644 --- a/internal/fusefrontend/fs.go +++ b/internal/fusefrontend/fs.go @@ -18,8 +18,8 @@ import ( "github.com/rfjakob/gocryptfs/internal/configfile" "github.com/rfjakob/gocryptfs/internal/contentenc" + "github.com/rfjakob/gocryptfs/internal/inomap" "github.com/rfjakob/gocryptfs/internal/nametransform" - "github.com/rfjakob/gocryptfs/internal/openfiletable" "github.com/rfjakob/gocryptfs/internal/serialize_reads" "github.com/rfjakob/gocryptfs/internal/syscallcompat" "github.com/rfjakob/gocryptfs/internal/tlog" @@ -59,9 +59,9 @@ type FS struct { IsIdle uint32 // dirCache caches directory fds dirCache dirCacheStruct - // inumMap translates inode numbers from different devices to unique inode + // inoMap translates inode numbers from different devices to unique inode // numbers. - inumMap *openfiletable.InumMap + inoMap *inomap.InoMap } //var _ pathfs.FileSystem = &FS{} // Verify that interface is implemented. @@ -85,7 +85,7 @@ func NewFS(args Args, c *contentenc.ContentEnc, n nametransform.NameTransformer) args: args, nameTransform: n, contentEnc: c, - inumMap: openfiletable.NewInumMap(uint64(st.Dev)), // cast is needed for Darwin + inoMap: inomap.New(uint64(st.Dev)), // cast is needed for Darwin } } @@ -109,7 +109,7 @@ func (fs *FS) GetAttr(relPath string, context *fuse.Context) (*fuse.Attr, fuse.S } a := &fuse.Attr{} st2 := syscallcompat.Unix2syscall(st) - fs.inumMap.TranslateStat(&st2) + fs.inoMap.TranslateStat(&st2) a.FromStat(&st2) if a.IsRegular() { a.Size = fs.contentEnc.CipherSizeToPlainSize(a.Size) |