Commit df9f2b75 authored by Aaron Jacobs's avatar Aaron Jacobs

Removed fuseops.OpHeader.

This gave UID and GID information that wasn't obviously useful to the file
system, given that (by default at least) the file system can only be used by
the mounting user.
parents 591350f2 e6f7fe60
...@@ -105,14 +105,6 @@ func (o *commonOp) init( ...@@ -105,14 +105,6 @@ func (o *commonOp) init(
} }
} }
func (o *commonOp) Header() OpHeader {
bh := o.bazilReq.Hdr()
return OpHeader{
Uid: bh.Uid,
Gid: bh.Gid,
}
}
func (o *commonOp) Context() context.Context { func (o *commonOp) Context() context.Context {
return o.ctx return o.ctx
} }
......
...@@ -30,9 +30,6 @@ type Op interface { ...@@ -30,9 +30,6 @@ type Op interface {
// A short description of the op, to be used in logging. // A short description of the op, to be used in logging.
ShortDesc() string ShortDesc() string
// Return the fields common to all operations.
Header() OpHeader
// A context that can be used for long-running operations. // A context that can be used for long-running operations.
Context() context.Context Context() context.Context
......
...@@ -125,13 +125,6 @@ type HandleID uint64 ...@@ -125,13 +125,6 @@ type HandleID uint64
// ReadDirOp.Offset for details. // ReadDirOp.Offset for details.
type DirOffset uint64 type DirOffset uint64
// A header that is included with every op.
type OpHeader struct {
// Credentials information for the process making the request.
Uid uint32
Gid uint32
}
// Information about a child inode within its parent directory. Shared by // Information about a child inode within its parent directory. Shared by
// LookUpInodeOp, MkDirOp, CreateFileOp, etc. Consumed by the kernel in order // LookUpInodeOp, MkDirOp, CreateFileOp, etc. Consumed by the kernel in order
// to set up a dcache entry. // to set up a dcache entry.
......
...@@ -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