Commit 84c827f9 authored by Aaron Jacobs's avatar Aaron Jacobs

Stop using fuseops.Header in memfs.

parent 591350f2
...@@ -30,6 +30,10 @@ import ( ...@@ -30,6 +30,10 @@ import (
type memFS struct { type memFS struct {
fuseutil.NotImplementedFileSystem fuseutil.NotImplementedFileSystem
// The UID and GID that every inode receives.
uid uint32
gid uint32
///////////////////////// /////////////////////////
// Dependencies // Dependencies
///////////////////////// /////////////////////////
...@@ -74,6 +78,8 @@ func NewMemFS( ...@@ -74,6 +78,8 @@ func NewMemFS(
fs := &memFS{ fs := &memFS{
clock: clock, clock: clock,
inodes: make([]*inode, fuseops.RootInodeID+1), inodes: make([]*inode, fuseops.RootInodeID+1),
uid: uid,
gid: gid,
} }
// Set up the root inode. // Set up the root inode.
...@@ -268,13 +274,12 @@ func (fs *memFS) MkDir( ...@@ -268,13 +274,12 @@ func (fs *memFS) MkDir(
return return
} }
// Set up attributes from the child, using the credentials of the calling // Set up attributes from the child.
// process as owner (matching inode_init_owner, cf. http://goo.gl/5qavg8).
childAttrs := fuseops.InodeAttributes{ childAttrs := fuseops.InodeAttributes{
Nlink: 1, Nlink: 1,
Mode: op.Mode, Mode: op.Mode,
Uid: op.Header().Uid, Uid: fs.uid,
Gid: op.Header().Gid, Gid: fs.gid,
} }
// Allocate a child. // Allocate a child.
...@@ -311,8 +316,7 @@ func (fs *memFS) CreateFile( ...@@ -311,8 +316,7 @@ func (fs *memFS) CreateFile(
return return
} }
// Set up attributes from the child, using the credentials of the calling // Set up attributes from the child.
// process as owner (matching inode_init_owner, cf. http://goo.gl/5qavg8).
now := fs.clock.Now() now := fs.clock.Now()
childAttrs := fuseops.InodeAttributes{ childAttrs := fuseops.InodeAttributes{
Nlink: 1, Nlink: 1,
...@@ -321,8 +325,8 @@ func (fs *memFS) CreateFile( ...@@ -321,8 +325,8 @@ func (fs *memFS) CreateFile(
Mtime: now, Mtime: now,
Ctime: now, Ctime: now,
Crtime: now, Crtime: now,
Uid: op.Header().Uid, Uid: fs.uid,
Gid: op.Header().Gid, Gid: fs.gid,
} }
// Allocate a child. // Allocate a child.
...@@ -361,8 +365,7 @@ func (fs *memFS) CreateSymlink( ...@@ -361,8 +365,7 @@ func (fs *memFS) CreateSymlink(
return return
} }
// Set up attributes from the child, using the credentials of the calling // Set up attributes from the child.
// process as owner (matching inode_init_owner, cf. http://goo.gl/5qavg8).
now := fs.clock.Now() now := fs.clock.Now()
childAttrs := fuseops.InodeAttributes{ childAttrs := fuseops.InodeAttributes{
Nlink: 1, Nlink: 1,
...@@ -371,8 +374,8 @@ func (fs *memFS) CreateSymlink( ...@@ -371,8 +374,8 @@ func (fs *memFS) CreateSymlink(
Mtime: now, Mtime: now,
Ctime: now, Ctime: now,
Crtime: now, Crtime: now,
Uid: op.Header().Uid, Uid: fs.uid,
Gid: op.Header().Gid, Gid: fs.gid,
} }
// Allocate a child. // Allocate a child.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment