xref: /haiku/src/add-ons/kernel/file_systems/packagefs/package/PackageFile.h (revision 65f80c14fc486c1ea2f5baa3d54aa0e172e6ab40)
11e7416d9SIngo Weinhold /*
21e7416d9SIngo Weinhold  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
31e7416d9SIngo Weinhold  * Distributed under the terms of the MIT License.
41e7416d9SIngo Weinhold  */
51e7416d9SIngo Weinhold #ifndef PACKAGE_FILE_H
61e7416d9SIngo Weinhold #define PACKAGE_FILE_H
71e7416d9SIngo Weinhold 
81e7416d9SIngo Weinhold 
911cecf98SIngo Weinhold #include "PackageData.h"
101e7416d9SIngo Weinhold #include "PackageLeafNode.h"
111e7416d9SIngo Weinhold 
121e7416d9SIngo Weinhold 
13*65f80c14SAugustin Cavalier class PackageFile final : public PackageLeafNode {
141e7416d9SIngo Weinhold public:
15d230b5fdSAugustin Cavalier 	static	void*				operator new(size_t size);
16d230b5fdSAugustin Cavalier 	static	void				operator delete(void* block);
17d230b5fdSAugustin Cavalier 
181e7416d9SIngo Weinhold 								PackageFile(Package* package, mode_t mode,
1911cecf98SIngo Weinhold 									const PackageData& data);
201e7416d9SIngo Weinhold 	virtual						~PackageFile();
211e7416d9SIngo Weinhold 
221e7416d9SIngo Weinhold 	virtual	status_t			VFSInit(dev_t deviceID, ino_t nodeID);
231e7416d9SIngo Weinhold 	virtual	void				VFSUninit();
241e7416d9SIngo Weinhold 
251e7416d9SIngo Weinhold 	virtual	off_t				FileSize() const;
261e7416d9SIngo Weinhold 
271e7416d9SIngo Weinhold 	virtual	status_t			Read(off_t offset, void* buffer,
281e7416d9SIngo Weinhold 									size_t* bufferSize);
291e7416d9SIngo Weinhold 	virtual	status_t			Read(io_request* request);
301e7416d9SIngo Weinhold 
311e7416d9SIngo Weinhold private:
321e7416d9SIngo Weinhold 			struct IORequestOutput;
331e7416d9SIngo Weinhold 			struct DataAccessor;
341e7416d9SIngo Weinhold 
351e7416d9SIngo Weinhold private:
3611cecf98SIngo Weinhold 			PackageData			fData;
371e7416d9SIngo Weinhold 			DataAccessor*		fDataAccessor;
381e7416d9SIngo Weinhold };
391e7416d9SIngo Weinhold 
401e7416d9SIngo Weinhold 
411e7416d9SIngo Weinhold #endif	// PACKAGE_FILE_H
42