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
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									dev_t deviceID);
32	virtual	void				RemovePackageNode(PackageNode* packageNode,
33									dev_t deviceID);
34
35	virtual	PackageNode*		GetPackageNode();
36	virtual	bool				IsOnlyPackageNode(PackageNode* node) const;
37	virtual	bool				WillBeFirstPackageNode(
38									PackageNode* packageNode) const;
39
40	virtual	void				PrepareForRemoval();
41	virtual	status_t			CloneTransferPackageNodes(ino_t id,
42									UnpackingNode*& _newNode);
43
44	virtual	status_t			Read(off_t offset, void* buffer,
45									size_t* bufferSize);
46	virtual	status_t			Read(io_request* request);
47
48	virtual	status_t			ReadSymlink(void* buffer,
49									size_t* bufferSize);
50
51	virtual	status_t			OpenAttributeDirectory(
52									AttributeDirectoryCookie*& _cookie);
53	virtual	status_t			OpenAttribute(const StringKey& name,
54									int openMode, AttributeCookie*& _cookie);
55
56	virtual	status_t			IndexAttribute(AttributeIndexer* indexer);
57	virtual	void*				IndexCookieForAttribute(const StringKey& name)
58									const;
59
60private:
61	inline	PackageLeafNode*	_ActivePackageNode() const;
62
63private:
64			PackageLeafNodeList	fPackageNodes;
65			PackageLeafNode*	fFinalPackageNode;
66};
67
68
69#endif	// LEAF_NODE_H
70