nfsv3

package
v0.0.0-...-b3f7bda Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access uint32

type AccessCall

type AccessCall struct {
	FileHandle []byte // root handle
	Access            //todo
}

func (*AccessCall) String

func (self *AccessCall) String() string

type AccessReply

type AccessReply struct {
	NFSStatus
	Attr   PostOpAttr
	Access //todo
}

func (*AccessReply) String

func (self *AccessReply) String() string

type CommitCall

type CommitCall struct {
	FileHandle []byte
	Offset     uint64
	Count      uint32
}

func (*CommitCall) String

func (self *CommitCall) String() string

type CommitReply

type CommitReply struct {
	NFSStatus
	Wcc
	Verifier uint64
}

func (*CommitReply) String

func (self *CommitReply) String() string

type CreateCall

type CreateCall struct {
	DirOpArg
	// 0 : UNCHECKED (default)
	// 1 : GUARDED
	// 2 : EXCLUSIVE
	Mode uint32
	Attr Sattr3
}

func (*CreateCall) String

func (self *CreateCall) String() string

type CreateReply

type CreateReply struct {
	NFSStatus
	FileHandle PostOpFH3
	Attr       PostOpAttr
	Wcc
}

func (*CreateReply) String

func (self *CreateReply) String() string

type DirOpArg

type DirOpArg struct {
	FH       []byte
	Filename []byte
}

func (DirOpArg) FileName

func (self DirOpArg) FileName() string

func (DirOpArg) String

func (self DirOpArg) String() string

type Entry

type Entry struct {
	Field    uint64
	Filename []byte
	Cookie   uint64
}

type Entry3

type Entry3 struct {
	IsSet bool  `xdr:"union"`
	Entry Entry `xdr:"unioncase=1"`
}

type EntryPlus

type EntryPlus struct {
	FileId   uint64
	FileName []byte
	Cookie   uint64
	Attr     PostOpAttr
	Handle   PostOpFH3
}

func (EntryPlus) FileHandleHex

func (e EntryPlus) FileHandleHex() string

func (EntryPlus) FileNameStr

func (e EntryPlus) FileNameStr() string

type EntryPlus3

type EntryPlus3 struct {
	IsSet bool      `xdr:"union"`
	Entry EntryPlus `xdr:"unioncase=1"`
}

type Fattr

type Fattr struct {
	Type FileType
	//todo:展示详细信息S_ISUID、S_ISGID、S_ISVTX、S_IRUSR、S_IWUSR、S_IXUSR、S_IRGRP、S_IWGRP、S_IXGRP、S_IROTH、S_IWOTH、S_IXOTH
	FileMode            uint32
	Nlink               uint32
	UID                 uint32
	GID                 uint32
	Filesize            uint64
	Used                uint64
	SpecData            [2]uint32
	FSID                uint64
	Fileid              uint64
	Atime, Mtime, Ctime NFS3Time
}

func ReadAttributes

func ReadAttributes(r io.Reader) (*Fattr, error)

func (*Fattr) String

func (self *Fattr) String() string

type FileCacheAttribute

type FileCacheAttribute struct {
	Filesize     uint64
	Mtime, Ctime NFS3Time
}

func (*FileCacheAttribute) String

func (self *FileCacheAttribute) String() string

type FileType

type FileType uint32
const (
	FileTypeRegular FileType = iota + 1
	FileTypeDirectory
	FileTypeBlock
	FileTypeCharacter
	FileTypeLink
	FileTypeSocket
	FileTypeFIFO
)

Enumeration of NFS FileTypes

func (FileType) String

func (f FileType) String() string

type FsInfoCall

type FsInfoCall struct {
	FileHandle []byte
}

func (*FsInfoCall) String

func (self *FsInfoCall) String() string

type FsInfoReply

type FsInfoReply struct {
	NFSStatus
	Attr       PostOpAttr
	Rtmax      uint32
	Rtpref     uint32
	Rtmult     uint32
	Wtmax      uint32
	Wtpref     uint32
	Wtmult     uint32
	Dtpref     uint32
	Size       uint64
	TimeDelta  NFS3Time
	Properties uint32 //todo:format
}

func (*FsInfoReply) String

func (self *FsInfoReply) String() string

type FsStatCall

type FsStatCall struct {
	FileHandle []byte
}

func (*FsStatCall) String

func (self *FsStatCall) String() string

type FsStatReply

type FsStatReply struct {
	NFSStatus
	ObjAttr        PostOpAttr
	TotalSize      uint64
	FreeSize       uint64
	AvailableSize  uint64
	TotalFiles     uint64
	FreeFiles      uint64
	AvailableFiles uint64
	// CacheHint is called "invarsec" in the nfs standard
	Invarsec uint32
}

func (FsStatReply) String

func (self FsStatReply) String() string

type GetAttrCall

type GetAttrCall struct {
	FileHandle []byte
}

func (*GetAttrCall) String

func (self *GetAttrCall) String() string

type GetAttrReply

type GetAttrReply struct {
	NFSStatus
	Fattr
}

func (*GetAttrReply) String

func (self *GetAttrReply) String() string

type LinkCall

type LinkCall struct {
	FileHandle []byte
	DirOpArg
}

func (*LinkCall) String

func (self *LinkCall) String() string

type LinkReply

type LinkReply struct {
	NFSStatus
	ObjAttr PostOpAttr
	Wcc
}

func (*LinkReply) String

func (self *LinkReply) String() string

type LookUpCall

type LookUpCall struct {
	DirOpArg
}

func (*LookUpCall) String

func (self *LookUpCall) String() string

type LookUpReply

type LookUpReply struct {
	NFSStatus
	FH      []byte
	Attr    PostOpAttr
	DirAttr PostOpAttr
}

func (*LookUpReply) String

func (self *LookUpReply) String() string

type MkdirCall

type MkdirCall struct {
	Where DirOpArg
	Attrs Sattr3
}

func (*MkdirCall) String

func (self *MkdirCall) String() string

type MkdirReply

type MkdirReply struct {
	NFSStatus
	FH   PostOpFH3
	Attr PostOpAttr
	Wcc
}

func (*MkdirReply) String

func (self *MkdirReply) String() string

type MknodCall

type MknodCall struct {
	DirOpArg
	FileType
	Sattr3
}

func (*MknodCall) String

func (self *MknodCall) String() string

type MknodReply

type MknodReply struct {
	NFSStatus
	FileHandle []byte
	PostOpAttr
	Wcc
}

func (*MknodReply) String

func (self *MknodReply) String() string

type NFS3Time

type NFS3Time struct {
	Seconds  uint32
	Nseconds uint32
}

FileTime is the NFS wire time format This is equivalent to go-nfs-client/nfs.NFS3Time

func ToNFSTime

func ToNFSTime(t time.Time) NFS3Time

ToNFSTime generates the nfs 64bit time format from a golang time.

func (NFS3Time) EqualTimespec

func (t NFS3Time) EqualTimespec(sec int64, nsec int64) bool

EqualTimespec returns if this time is equal to a local time spec

func (NFS3Time) Native

func (t NFS3Time) Native() *time.Time

Native generates a golang time from an nfs time spec

func (NFS3Time) String

func (t NFS3Time) String() string

type NFSStatus

type NFSStatus uint32
const (
	NFSStatusOk          NFSStatus = 0
	NFSStatusPerm        NFSStatus = 1
	NFSStatusNoEnt       NFSStatus = 2
	NFSStatusIO          NFSStatus = 5
	NFSStatusNXIO        NFSStatus = 6
	NFSStatusAccess      NFSStatus = 13
	NFSStatusExist       NFSStatus = 17
	NFSStatusXDev        NFSStatus = 18
	NFSStatusNoDev       NFSStatus = 19
	NFSStatusNotDir      NFSStatus = 20
	NFSStatusIsDir       NFSStatus = 21
	NFSStatusInval       NFSStatus = 22
	NFSStatusFBig        NFSStatus = 27
	NFSStatusNoSPC       NFSStatus = 28
	NFSStatusROFS        NFSStatus = 30
	NFSStatusMlink       NFSStatus = 31
	NFSStatusNameTooLong NFSStatus = 63
	NFSStatusNotEmpty    NFSStatus = 66
	NFSStatusDQuot       NFSStatus = 69
	NFSStatusStale       NFSStatus = 70
	NFSStatusRemote      NFSStatus = 71
	NFSStatusBadHandle   NFSStatus = 10001
	NFSStatusNotSync     NFSStatus = 10002
	NFSStatusBadCookie   NFSStatus = 10003
	NFSStatusNotSupp     NFSStatus = 10004
	NFSStatusTooSmall    NFSStatus = 10005
	NFSStatusServerFault NFSStatus = 10006
	NFSStatusBadType     NFSStatus = 10007
	NFSStatusJukebox     NFSStatus = 10008
)

NFSStatus codes

func (NFSStatus) String

func (s NFSStatus) String() string

type PathConfCall

type PathConfCall struct {
	RootHandle []byte
}

func (*PathConfCall) String

func (self *PathConfCall) String() string

type PathConfReply

type PathConfReply struct {
	NFSStatus
	ObjAttr         PostOpAttr
	LinkMax         uint32
	NameMax         uint32
	NoTrunc         uint32 //todo:bool
	ChownRestricted uint32 //todo:bool
	CaseInsensitive uint32 //todo:bool
	CasePreserving  uint32 //todo:bool
}

func (*PathConfReply) String

func (self *PathConfReply) String() string

type PostOpAttr

type PostOpAttr struct {
	IsSet bool  `xdr:"union"`
	Attr  Fattr `xdr:"unioncase=1"`
}

func (PostOpAttr) HasSet

func (self PostOpAttr) HasSet() bool

func (PostOpAttr) String

func (self PostOpAttr) String() string

type PostOpFH3

type PostOpFH3 struct {
	IsSet      bool   `xdr:"union"`
	FileHandle []byte `xdr:"unioncase=1"`
}

func (PostOpFH3) String

func (self PostOpFH3) String() string

type PreOpAttr

type PreOpAttr struct {
	IsSet bool     `xdr:"union"`
	Size  uint64   `xdr:"unioncase=1"`
	MTime NFS3Time `xdr:"unioncase=1"`
	CTime NFS3Time `xdr:"unioncase=1"`
}

func (PreOpAttr) String

func (self PreOpAttr) String() string

type Procedure

type Procedure uint32

Procedure is the valid RPC calls for the nfs service.

const (
	NFS3ProcedureNull Procedure = iota
	NFS3ProcedureGetAttr
	NFS3ProcedureSetAttr
	NFS3ProcedureLookup
	NFS3ProcedureAccess
	NFS3ProcedureReadlink
	NFS3ProcedureRead
	NFS3ProcedureWrite
	NFS3ProcedureCreate
	NFS3ProcedureMkDir
	NFS3ProcedureSymlink
	NFS3ProcedureMkNod
	NFS3ProcedureRemove
	NFS3ProcedureRmDir
	NFS3ProcedureRename
	NFS3ProcedureLink
	NFS3ProcedureReadDir
	NFS3ProcedureReadDirPlus
	NFS3ProcedureFSStat
	NFS3ProcedureFSInfo
	NFS3ProcedurePathConf
	NFS3ProcedureCommit
)

NfsProcedure Codes

func (Procedure) String

func (n Procedure) String() string

type ReaDirPlusArg

type ReaDirPlusArg struct {
	NFSStatus
	DirAttrs   PostOpAttr
	CookieVerf uint64
}

type ReadCall

type ReadCall struct {
	FileHandle []byte
	Offset     uint64
	Count      uint32
}

func (*ReadCall) String

func (self *ReadCall) String() string

type ReadDirArg

type ReadDirArg struct {
	NFSStatus
	DirAttr  PostOpAttr
	Verifier uint64
}

type ReadDirCall

type ReadDirCall struct {
	Handle   []byte
	Cookie   uint64
	Verifier uint64
	Count    uint32
}

func (*ReadDirCall) String

func (self *ReadDirCall) String() string

type ReadDirPlusCall

type ReadDirPlusCall struct {
	Handle   []byte
	Cookie   uint64
	Verifier uint64
	DirCount uint32
	MaxCount uint32
}

func (*ReadDirPlusCall) String

func (self *ReadDirPlusCall) String() string

type ReadDirPlusReply

type ReadDirPlusReply struct {
	ReaDirPlusArg
	Entries []*EntryPlus
}

func (*ReadDirPlusReply) String

func (self *ReadDirPlusReply) String() string

type ReadDirReply

type ReadDirReply struct {
	ReadDirArg
	Entries []*Entry
}

func (*ReadDirReply) String

func (self *ReadDirReply) String() string

type ReadLinkCall

type ReadLinkCall struct {
	FileHandle []byte
}

func (*ReadLinkCall) String

func (self *ReadLinkCall) String() string

type ReadLinkReply

type ReadLinkReply struct {
	NFSStatus
	Attr PostOpAttr
	Path string
}

func (*ReadLinkReply) String

func (self *ReadLinkReply) String() string

type ReadReply

type ReadReply struct {
	NFSStatus
	Attr  PostOpAttr
	Count uint32
	EOF   uint32
	Data  []byte
}

func (*ReadReply) String

func (self *ReadReply) String() string

type RemoveCall

type RemoveCall struct {
	DirOpArg
}

func (*RemoveCall) String

func (self *RemoveCall) String() string

type RemoveReply

type RemoveReply struct {
	NFSStatus
	Wcc
}

func (*RemoveReply) String

func (self *RemoveReply) String() string

type RenameCall

type RenameCall struct {
	From DirOpArg
	To   DirOpArg
}

func (*RenameCall) String

func (self *RenameCall) String() string

type RenameReply

type RenameReply struct {
	NFSStatus
	From Wcc
	To   Wcc
}

func (*RenameReply) String

func (self *RenameReply) String() string

type RmdirCall

type RmdirCall struct {
	DirOpArg
}

func (*RmdirCall) String

func (self *RmdirCall) String() string

type RmdirReply

type RmdirReply struct {
	NFSStatus
	Wcc
}

func (*RmdirReply) String

func (self *RmdirReply) String() string

type Sattr3

type Sattr3 struct {
	Mode  SetMode
	UID   SetID
	GID   SetID
	Size  SetSize
	Atime SetTime
	Mtime SetTime
}

func (Sattr3) HasSet

func (self Sattr3) HasSet() bool

func (Sattr3) String

func (self Sattr3) String() string

type Sattrguard3

type Sattrguard3 struct {
	Check bool     `xdr:"union"`
	Time  NFS3Time `xdr:"unioncase=1"` //SetToClientTime
}

func (Sattrguard3) HasCheck

func (self Sattrguard3) HasCheck() bool

func (Sattrguard3) String

func (self Sattrguard3) String() string

type SetAttrCall

type SetAttrCall struct {
	FileHandle []byte
	Attr       Sattr3
	Guard      Sattrguard3
}

func (*SetAttrCall) String

func (self *SetAttrCall) String() string

type SetAttrReply

type SetAttrReply struct {
	NFSStatus
	Wcc
}

func (*SetAttrReply) String

func (self *SetAttrReply) String() string

type SetID

type SetID struct {
	SetIt bool   `xdr:"union"`
	ID    uint32 `xdr:"unioncase=1"`
}

type SetMode

type SetMode struct {
	SetIt bool   `xdr:"union"`
	Mode  uint32 `xdr:"unioncase=1"`
}

type SetSize

type SetSize struct {
	SetIt bool   `xdr:"union"`
	Size  uint64 `xdr:"unioncase=1"`
}

type SetTime

type SetTime struct {
	SetIt TimeHow  `xdr:"union"`
	Time  NFS3Time `xdr:"unioncase=2"` //SetToClientTime
}

type SymLinkData3

type SymLinkData3 struct {
	Sattr3
	Nfs3Path []byte
}

func (*SymLinkData3) String

func (self *SymLinkData3) String() string

type SymlinkCall

type SymlinkCall struct {
	DirOpArg
	SymLinkData3
}

func (*SymlinkCall) String

func (self *SymlinkCall) String() string

type SymlinkReply

type SymlinkReply struct {
	NFSStatus
	Obj     PostOpFH3
	ObjAttr PostOpAttr
	Wcc
}

func (*SymlinkReply) String

func (self *SymlinkReply) String() string

type TimeHow

type TimeHow int

TimeHow DONT_CHANGE = 0 SET_TO_SERVER_TIME = 1 SET_TO_CLIENT_TIME = 2

const (
	DontChange TimeHow = iota
	SetToServerTime
	SetToClientTime
)

type Wcc

type Wcc struct {
	Before PreOpAttr
	After  PostOpAttr
}

func (Wcc) HasSet

func (self Wcc) HasSet() bool

func (*Wcc) String

func (self *Wcc) String() string

type WriteCall

type WriteCall struct {
	Handle []byte
	Offset uint64
	Count  uint32
	How    uint32 //todo :format 2-filesync
	Data   []byte
}

func (*WriteCall) String

func (self *WriteCall) String() string

type WriteReply

type WriteReply struct {
	NFSStatus
	Wcc
	Count    uint32
	Commit   uint32
	Verifier uint64
}

func (*WriteReply) String

func (self *WriteReply) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL