xref: /haiku/src/add-ons/kernel/file_systems/nfs4/NFS4Inode.h (revision 2c36184f198a0511e54da85e20b5bf1379503660)
1 /*
2  * Copyright 2012 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Paweł Dziepak, pdziepak@quarnos.org
7  */
8 #ifndef NFS4INODE_H
9 #define NFS4INODE_H
10 
11 
12 #include <sys/stat.h>
13 
14 #include <SupportDefs.h>
15 
16 #include "Cookie.h"
17 #include "FileInfo.h"
18 #include "FileSystem.h"
19 #include "NFS4Object.h"
20 #include "ReplyInterpreter.h"
21 
22 
23 class NFS4Inode : protected NFS4Object {
24 public:
25 			status_t	GetChangeInfo(uint64* change);
26 			status_t	ReadLink(void* buffer, size_t* length);
27 
28 protected:
29 			status_t	Access(uint32* allowed);
30 
31 			status_t	CommitWrites();
32 
33 			status_t	LookUp(const char* name, uint64* change, uint64* fileID,
34 							FileHandle* handle);
35 
36 			status_t	Link(Inode* dir, const char* name,
37 							ChangeInfo* changeInfo);
38 
39 	static	status_t	Rename(Inode* from, Inode* to, const char* fromName,
40 							const char* toName, ChangeInfo* fromChange,
41 							ChangeInfo* toChange, uint64* fileID);
42 
43 			status_t	GetStat(AttrValue** values, uint32* count);
44 			status_t	WriteStat(OpenState* state, AttrValue* attrs,
45 							uint32 attrCount);
46 
47 			status_t	CreateFile(const char* name, int mode, int perms,
48 							OpenState* state, ChangeInfo* changeInfo,
49 							uint64* fileID, FileHandle* handle,
50 							OpenDelegationData* delegation);
51 			status_t	OpenFile(OpenState* state, int mode,
52 							OpenDelegationData* delegation);
53 
54 			status_t	ReadFile(OpenFileCookie* cookie, OpenState* state,
55 							uint64 position, uint32* length, void* buffer,
56 							bool* eof);
57 			status_t	WriteFile(OpenFileCookie* cookie, OpenState* state,
58 							uint64 position, uint32* length,
59 							const void* buffer);
60 
61 			status_t	CreateObject(const char* name, const char* path,
62 							int mode, FileType type, ChangeInfo* changeInfo,
63 							uint64* fileID, FileHandle* handle);
64 			status_t	RemoveObject(const char* name, FileType type,
65 							ChangeInfo* changeInfo);
66 
67 			status_t	ReadDirOnce(DirEntry** dirents, uint32* count,
68 							OpenDirCookie* cookie, bool* eof, uint64* change,
69 							uint64* dirCookie, uint64* dirCookieVerf);
70 
71 			status_t	TestLock(OpenFileCookie* cookie, LockType* type,
72 							uint64* position, uint64* length, bool& conflict);
73 			status_t	AcquireLock(OpenFileCookie* cookie, LockInfo* lockInfo,
74 							bool wait);
75 			status_t	ReleaseLock(OpenFileCookie* cookie, LockInfo* lockInfo);
76 };
77 
78 
79 #endif	// NFS4INODE_H
80 
81