xref: /haiku/src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingAttributeCookie.h (revision 1e7416d9b3846396e2f7d6552e37d72664cd6853)
1*1e7416d9SIngo Weinhold /*
2*1e7416d9SIngo Weinhold  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3*1e7416d9SIngo Weinhold  * Distributed under the terms of the MIT License.
4*1e7416d9SIngo Weinhold  */
5*1e7416d9SIngo Weinhold #ifndef UNPACKING_ATTRIBUTE_COOKIE_H
6*1e7416d9SIngo Weinhold #define UNPACKING_ATTRIBUTE_COOKIE_H
7*1e7416d9SIngo Weinhold 
8*1e7416d9SIngo Weinhold 
9*1e7416d9SIngo Weinhold #include "AttributeCookie.h"
10*1e7416d9SIngo Weinhold 
11*1e7416d9SIngo Weinhold 
12*1e7416d9SIngo Weinhold class AttributeIndexer;
13*1e7416d9SIngo Weinhold class Package;
14*1e7416d9SIngo Weinhold class PackageNode;
15*1e7416d9SIngo Weinhold class PackageNodeAttribute;
16*1e7416d9SIngo Weinhold 
17*1e7416d9SIngo Weinhold 
18*1e7416d9SIngo Weinhold class UnpackingAttributeCookie : public AttributeCookie {
19*1e7416d9SIngo Weinhold public:
20*1e7416d9SIngo Weinhold 								UnpackingAttributeCookie(
21*1e7416d9SIngo Weinhold 									PackageNode* packageNode,
22*1e7416d9SIngo Weinhold 									PackageNodeAttribute* attribute,
23*1e7416d9SIngo Weinhold 									int openMode);
24*1e7416d9SIngo Weinhold 	virtual						~UnpackingAttributeCookie();
25*1e7416d9SIngo Weinhold 
26*1e7416d9SIngo Weinhold 	static	status_t			Open(PackageNode* packageNode, const char* name,
27*1e7416d9SIngo Weinhold 									int openMode, AttributeCookie*& _cookie);
28*1e7416d9SIngo Weinhold 
29*1e7416d9SIngo Weinhold 	virtual	status_t			ReadAttribute(off_t offset, void* buffer,
30*1e7416d9SIngo Weinhold 									size_t* bufferSize);
31*1e7416d9SIngo Weinhold 	virtual	status_t			ReadAttributeStat(struct stat* st);
32*1e7416d9SIngo Weinhold 
33*1e7416d9SIngo Weinhold 	static	status_t			ReadAttribute(PackageNode* packageNode,
34*1e7416d9SIngo Weinhold 									PackageNodeAttribute* attribute,
35*1e7416d9SIngo Weinhold 									off_t offset, void* buffer,
36*1e7416d9SIngo Weinhold 									size_t* bufferSize);
37*1e7416d9SIngo Weinhold 	static	status_t			IndexAttribute(PackageNode* packageNode,
38*1e7416d9SIngo Weinhold 									AttributeIndexer* indexer);
39*1e7416d9SIngo Weinhold 
40*1e7416d9SIngo Weinhold private:
41*1e7416d9SIngo Weinhold 			PackageNode*		fPackageNode;
42*1e7416d9SIngo Weinhold 			Package*			fPackage;
43*1e7416d9SIngo Weinhold 			PackageNodeAttribute* fAttribute;
44*1e7416d9SIngo Weinhold 			int					fOpenMode;
45*1e7416d9SIngo Weinhold };
46*1e7416d9SIngo Weinhold 
47*1e7416d9SIngo Weinhold 
48*1e7416d9SIngo Weinhold #endif	// UNPACKING_ATTRIBUTE_COOKIE_H
49