mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
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:
committed by
gVisor bot
parent
4874525161
commit
7ef1c44a7f
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 := ®ularFile{}
|
||||
file.inode.init(file, fs, creds, mode)
|
||||
file.inode.nlink = 1 // from parent directory
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user