xref: /haiku/src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingLeafNode.h (revision 4e88440d3f3837b85da9653c16c33767f7acf914)
11e7416d9SIngo Weinhold /*
211802867SIngo Weinhold  * Copyright 2009-2013, Ingo Weinhold, ingo_weinhold@gmx.de.
31e7416d9SIngo Weinhold  * Distributed under the terms of the MIT License.
41e7416d9SIngo Weinhold  */
51e7416d9SIngo Weinhold #ifndef LEAF_NODE_H
61e7416d9SIngo Weinhold #define LEAF_NODE_H
71e7416d9SIngo Weinhold 
81e7416d9SIngo Weinhold 
91e7416d9SIngo Weinhold #include "Node.h"
101e7416d9SIngo Weinhold #include "PackageLeafNode.h"
111e7416d9SIngo Weinhold #include "UnpackingNode.h"
121e7416d9SIngo Weinhold 
131e7416d9SIngo Weinhold 
14*4e88440dSAugustin Cavalier class UnpackingLeafNode final : public Node, public UnpackingNode {
151e7416d9SIngo Weinhold public:
16*4e88440dSAugustin Cavalier 	static	void*				operator new(size_t size);
17*4e88440dSAugustin Cavalier 	static	void				operator delete(void* block);
18*4e88440dSAugustin Cavalier 
191e7416d9SIngo Weinhold 								UnpackingLeafNode(ino_t id);
201e7416d9SIngo Weinhold 	virtual						~UnpackingLeafNode();
211e7416d9SIngo Weinhold 
221e7416d9SIngo Weinhold 	virtual	status_t			VFSInit(dev_t deviceID);
231e7416d9SIngo Weinhold 	virtual	void				VFSUninit();
241e7416d9SIngo Weinhold 
251e7416d9SIngo Weinhold 	virtual	mode_t				Mode() const;
261e7416d9SIngo Weinhold 	virtual	uid_t				UserID() const;
271e7416d9SIngo Weinhold 	virtual	gid_t				GroupID() const;
281e7416d9SIngo Weinhold 	virtual	timespec			ModifiedTime() const;
291e7416d9SIngo Weinhold 	virtual	off_t				FileSize() const;
301e7416d9SIngo Weinhold 
311e7416d9SIngo Weinhold 	virtual	Node*				GetNode();
321e7416d9SIngo Weinhold 
3311802867SIngo Weinhold 	virtual	status_t			AddPackageNode(PackageNode* packageNode,
3411802867SIngo Weinhold 									dev_t deviceID);
3511802867SIngo Weinhold 	virtual	void				RemovePackageNode(PackageNode* packageNode,
3611802867SIngo Weinhold 									dev_t deviceID);
371e7416d9SIngo Weinhold 
381e7416d9SIngo Weinhold 	virtual	PackageNode*		GetPackageNode();
391e7416d9SIngo Weinhold 	virtual	bool				IsOnlyPackageNode(PackageNode* node) const;
401e7416d9SIngo Weinhold 	virtual	bool				WillBeFirstPackageNode(
411e7416d9SIngo Weinhold 									PackageNode* packageNode) const;
421e7416d9SIngo Weinhold 
431e7416d9SIngo Weinhold 	virtual	void				PrepareForRemoval();
441e7416d9SIngo Weinhold 	virtual	status_t			CloneTransferPackageNodes(ino_t id,
451e7416d9SIngo Weinhold 									UnpackingNode*& _newNode);
461e7416d9SIngo Weinhold 
471e7416d9SIngo Weinhold 	virtual	status_t			Read(off_t offset, void* buffer,
481e7416d9SIngo Weinhold 									size_t* bufferSize);
491e7416d9SIngo Weinhold 	virtual	status_t			Read(io_request* request);
501e7416d9SIngo Weinhold 
511e7416d9SIngo Weinhold 	virtual	status_t			ReadSymlink(void* buffer,
521e7416d9SIngo Weinhold 									size_t* bufferSize);
531e7416d9SIngo Weinhold 
541e7416d9SIngo Weinhold 	virtual	status_t			OpenAttributeDirectory(
551e7416d9SIngo Weinhold 									AttributeDirectoryCookie*& _cookie);
56d07c930cSIngo Weinhold 	virtual	status_t			OpenAttribute(const StringKey& name,
57d07c930cSIngo Weinhold 									int openMode, AttributeCookie*& _cookie);
581e7416d9SIngo Weinhold 
591e7416d9SIngo Weinhold 	virtual	status_t			IndexAttribute(AttributeIndexer* indexer);
60d07c930cSIngo Weinhold 	virtual	void*				IndexCookieForAttribute(const StringKey& name)
61d07c930cSIngo Weinhold 									const;
621e7416d9SIngo Weinhold 
631e7416d9SIngo Weinhold private:
641e7416d9SIngo Weinhold 	inline	PackageLeafNode*	_ActivePackageNode() const;
651e7416d9SIngo Weinhold 
661e7416d9SIngo Weinhold private:
671e7416d9SIngo Weinhold 			PackageLeafNodeList	fPackageNodes;
681e7416d9SIngo Weinhold 			PackageLeafNode*	fFinalPackageNode;
691e7416d9SIngo Weinhold };
701e7416d9SIngo Weinhold 
711e7416d9SIngo Weinhold 
721e7416d9SIngo Weinhold #endif	// LEAF_NODE_H
73