xref: /haiku/src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingLeafNode.h (revision fc7456e9b1ec38c941134ed6d01c438cf289381e)
1 /*
2  * Copyright 2009-2013, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef LEAF_NODE_H
6 #define LEAF_NODE_H
7 
8 
9 #include "Node.h"
10 #include "PackageLeafNode.h"
11 #include "UnpackingNode.h"
12 
13 
14 class UnpackingLeafNode final : public Node, public UnpackingNode {
15 public:
16 	static	void*				operator new(size_t size);
17 	static	void				operator delete(void* block);
18 
19 								UnpackingLeafNode(ino_t id);
20 	virtual						~UnpackingLeafNode();
21 
22 	virtual	status_t			VFSInit(dev_t deviceID);
23 	virtual	void				VFSUninit();
24 
25 	virtual	mode_t				Mode() const;
26 	virtual	uid_t				UserID() const;
27 	virtual	gid_t				GroupID() const;
28 	virtual	timespec			ModifiedTime() const;
29 	virtual	off_t				FileSize() const;
30 
31 	virtual	Node*				GetNode();
32 
33 	virtual	status_t			AddPackageNode(PackageNode* packageNode,
34 									dev_t deviceID);
35 	virtual	void				RemovePackageNode(PackageNode* packageNode,
36 									dev_t deviceID);
37 
38 	virtual	PackageNode*		GetPackageNode();
39 	virtual	bool				IsOnlyPackageNode(PackageNode* node) const;
40 	virtual	bool				WillBeFirstPackageNode(
41 									PackageNode* packageNode) const;
42 
43 	virtual	void				PrepareForRemoval();
44 	virtual	status_t			CloneTransferPackageNodes(ino_t id,
45 									UnpackingNode*& _newNode);
46 
47 	virtual	status_t			Read(off_t offset, void* buffer,
48 									size_t* bufferSize);
49 	virtual	status_t			Read(io_request* request);
50 
51 	virtual	status_t			ReadSymlink(void* buffer,
52 									size_t* bufferSize);
53 
54 	virtual	status_t			OpenAttributeDirectory(
55 									AttributeDirectoryCookie*& _cookie);
56 	virtual	status_t			OpenAttribute(const StringKey& name,
57 									int openMode, AttributeCookie*& _cookie);
58 
59 	virtual	status_t			IndexAttribute(AttributeIndexer* indexer);
60 	virtual	void*				IndexCookieForAttribute(const StringKey& name)
61 									const;
62 
63 private:
64 	inline	PackageLeafNode*	_ActivePackageNode() const;
65 
66 private:
67 			PackageLeafNodeList	fPackageNodes;
68 			PackageLeafNode*	fFinalPackageNode;
69 };
70 
71 
72 #endif	// LEAF_NODE_H
73