xref: /haiku/src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingDirectory.h (revision 52c4471a3024d2eb81fe88e2c3982b9f8daa5e56)
1 /*
2  * Copyright 2009-2013, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef UNPACKING_DIRECTORY_H
6 #define UNPACKING_DIRECTORY_H
7 
8 
9 #include "Directory.h"
10 #include "PackageDirectory.h"
11 #include "UnpackingNode.h"
12 
13 
14 class UnpackingDirectory : public Directory, public UnpackingNode {
15 public:
16 								UnpackingDirectory(ino_t id);
17 	virtual						~UnpackingDirectory();
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 
42 	virtual	status_t			OpenAttributeDirectory(
43 									AttributeDirectoryCookie*& _cookie);
44 	virtual	status_t			OpenAttribute(const StringKey& name,
45 									int openMode, AttributeCookie*& _cookie);
46 
47 	virtual	status_t			IndexAttribute(AttributeIndexer* indexer);
48 	virtual	void*				IndexCookieForAttribute(const StringKey& name)
49 									const;
50 
51 private:
52 			PackageDirectoryList fPackageDirectories;
53 };
54 
55 
56 class RootDirectory : public UnpackingDirectory {
57 public:
58 								RootDirectory(ino_t id,
59 									const timespec& modifiedTime);
60 
61 	virtual	status_t			OpenAttributeDirectory(
62 									AttributeDirectoryCookie*& _cookie) override;
63 
64 	virtual	timespec			ModifiedTime() const;
65 
66 private:
67 			timespec			fModifiedTime;
68 };
69 
70 
71 #endif	// UNPACKING_DIRECTORY_H
72