Change linux.FileMode from uint to uint16, and update VFS to use FileMode.

In Linux (include/linux/types.h), mode_t is an unsigned short.

PiperOrigin-RevId: 272956350
This commit is contained in:
Kevin Krakauer
2019-10-04 14:20:32 -07:00
committed by gVisor bot
parent 4874525161
commit 7ef1c44a7f
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -271,7 +271,7 @@ type Statx struct {
}
// FileMode represents a mode_t.
type FileMode uint
type FileMode uint16
// Permissions returns just the permission bits.
func (m FileMode) Permissions() FileMode {
+1 -1
View File
@@ -32,7 +32,7 @@ type directory struct {
childList dentryList
}
func (fs *filesystem) newDirectory(creds *auth.Credentials, mode uint16) *inode {
func (fs *filesystem) newDirectory(creds *auth.Credentials, mode linux.FileMode) *inode {
dir := &directory{}
dir.inode.init(dir, fs, creds, mode)
dir.inode.nlink = 2 // from "." and parent directory or ".." for root
+1 -1
View File
@@ -137,7 +137,7 @@ type inode struct {
impl interface{} // immutable
}
func (i *inode) init(impl interface{}, fs *filesystem, creds *auth.Credentials, mode uint16) {
func (i *inode) init(impl interface{}, fs *filesystem, creds *auth.Credentials, mode linux.FileMode) {
i.refs = 1
i.mode = uint32(mode)
i.uid = uint32(creds.EffectiveKUID)
+1 -1
View File
@@ -37,7 +37,7 @@ type regularFile struct {
dataLen int64
}
func (fs *filesystem) newRegularFile(creds *auth.Credentials, mode uint16) *inode {
func (fs *filesystem) newRegularFile(creds *auth.Credentials, mode linux.FileMode) *inode {
file := &regularFile{}
file.inode.init(file, fs, creds, mode)
file.inode.nlink = 1 // from parent directory
+3 -3
View File
@@ -31,14 +31,14 @@ type GetDentryOptions struct {
// FilesystemImpl.MkdirAt().
type MkdirOptions struct {
// Mode is the file mode bits for the created directory.
Mode uint16
Mode linux.FileMode
}
// MknodOptions contains options to VirtualFilesystem.MknodAt() and
// FilesystemImpl.MknodAt().
type MknodOptions struct {
// Mode is the file type and mode bits for the created file.
Mode uint16
Mode linux.FileMode
// If Mode specifies a character or block device special file, DevMajor and
// DevMinor are the major and minor device numbers for the created device.
@@ -61,7 +61,7 @@ type OpenOptions struct {
// If FilesystemImpl.OpenAt() creates a file, Mode is the file mode for the
// created file.
Mode uint16
Mode linux.FileMode
}
// ReadOptions contains options to FileDescription.PRead(),