1/*
2 * Copyright 2009-2011, 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
14class UnpackingLeafNode : public Node, public UnpackingNode {
15public:
16								UnpackingLeafNode(ino_t id);
17	virtual						~UnpackingLeafNode();
18
19	virtual	status_t			VFSInit(dev_t deviceID);
20	virtual	void				VFSUninit();
21
22	virtual	mode_t				Mode() const;
23	virtual	uid_t				UserID() const;
24	virtual	gid_t				GroupID() const;
25	virtual	timespec			ModifiedTime() const;
26	virtual	off_t				FileSize() const;
27
28	virtual	Node*				GetNode();
29
30	virtual	status_t			AddPackageNode(PackageNode* packageNode);
31	virtual	void				RemovePackageNode(PackageNode* packageNode);
32
33	virtual	PackageNode*		GetPackageNode();
34	virtual	bool				IsOnlyPackageNode(PackageNode* node) const;
35	virtual	bool				WillBeFirstPackageNode(
36									PackageNode* packageNode) const;
37
38	virtual	void				PrepareForRemoval();
39	virtual	status_t			CloneTransferPackageNodes(ino_t id,
40									UnpackingNode*& _newNode);
41
42	virtual	status_t			Read(off_t offset, void* buffer,
43									size_t* bufferSize);
44	virtual	status_t			Read(io_request* request);
45
46	virtual	status_t			ReadSymlink(void* buffer,
47									size_t* bufferSize);
48
49	virtual	status_t			OpenAttributeDirectory(
50									AttributeDirectoryCookie*& _cookie);
51	virtual	status_t			OpenAttribute(const char* name, int openMode,
52									AttributeCookie*& _cookie);
53
54	virtual	status_t			IndexAttribute(AttributeIndexer* indexer);
55	virtual	void*				IndexCookieForAttribute(const char* name) const;
56
57private:
58	inline	PackageLeafNode*	_ActivePackageNode() const;
59
60private:
61			PackageLeafNodeList	fPackageNodes;
62			PackageLeafNode*	fFinalPackageNode;
63};
64
65
66#endif	// LEAF_NODE_H
67