xref: /haiku/src/add-ons/kernel/file_systems/packagefs/package/PackageFile.h (revision 9a6a20d4689307142a7ed26a1437ba47e244e73f)
1 /*
2  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef PACKAGE_FILE_H
6 #define PACKAGE_FILE_H
7 
8 
9 #include "PackageData.h"
10 #include "PackageLeafNode.h"
11 
12 
13 class PackageFile final : public PackageLeafNode {
14 public:
15 	static	void*				operator new(size_t size);
16 	static	void				operator delete(void* block);
17 
18 								PackageFile(Package* package, mode_t mode,
19 									const PackageData& data);
20 	virtual						~PackageFile();
21 
22 	virtual	status_t			VFSInit(dev_t deviceID, ino_t nodeID);
23 	virtual	void				VFSUninit();
24 
25 	virtual	off_t				FileSize() const;
26 
27 	virtual	status_t			Read(off_t offset, void* buffer,
28 									size_t* bufferSize);
29 	virtual	status_t			Read(io_request* request);
30 
31 private:
32 			struct IORequestOutput;
33 			struct DataAccessor;
34 
35 private:
36 			PackageData			fData;
37 			DataAccessor*		fDataAccessor;
38 };
39 
40 
41 #endif	// PACKAGE_FILE_H
42