xref: /haiku/src/add-ons/kernel/file_systems/nfs4/Delegation.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
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 DELEGATION_H
9 #define DELEGATION_H
10 
11 
12 #include <lock.h>
13 #include <SupportDefs.h>
14 
15 #include "NFS4Object.h"
16 
17 
18 class Inode;
19 
20 class Delegation : public NFS4Object,
21 	public DoublyLinkedListLinkImpl<Delegation> {
22 public:
23 						Delegation(const OpenDelegationData& data, Inode* inode,
24 							uint64 clientID, bool attr = false);
25 
26 	status_t			GiveUp(bool truncate = false);
27 
28 	inline	void		SetData(const OpenDelegationData& data);
29 	inline	Inode*		GetInode();
30 	inline	OpenDelegation Type();
31 
32 protected:
33 	status_t			ReturnDelegation();
34 
35 private:
36 	uint64				fClientID;
37 	OpenDelegationData	fData;
38 	Inode*				fInode;
39 	bool				fAttribute;
40 };
41 
42 
43 inline void
44 Delegation::SetData(const OpenDelegationData& data)
45 {
46 	fData = data;
47 }
48 
49 
50 inline Inode*
51 Delegation::GetInode()
52 {
53 	return fInode;
54 }
55 
56 
57 inline OpenDelegation
58 Delegation::Type()
59 {
60 	return fData.fType;
61 }
62 
63 
64 #endif	// DELEGATION_H
65 
66