1/*
2 * Copyright 2022, Raghav Sharma, raghavself28@gmail.com
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef NODE_ATTRIBUTE_H
6#define NODE_ATTRIBUTE_H
7
8
9#include "LeafAttribute.h"
10#include "Node.h"
11
12
13class NodeAttribute : public Attribute {
14public:
15								NodeAttribute(Inode* inode);
16								~NodeAttribute();
17
18			status_t			Init();
19
20			status_t			Stat(attr_cookie* cookie, struct stat& stat);
21
22			status_t			Read(attr_cookie* cookie, off_t pos,
23									uint8* buffer, size_t* length);
24
25			status_t			Open(const char* name, int openMode, attr_cookie** _cookie);
26
27			status_t			GetNext(char* name, size_t* nameLength);
28
29			status_t			Lookup(const char* name, size_t* nameLength);
30private:
31			status_t			_FillMapEntry(xfs_extnum_t num);
32
33			status_t			_FillBuffer(char* buffer, xfs_fsblock_t block);
34
35			xfs_fsblock_t		_LogicalToFileSystemBlock(uint32 LogicalBlock);
36
37			Inode*				fInode;
38			const char*			fName;
39			ExtentMapEntry*		fMap;
40			char*				fLeafBuffer;
41			char*				fNodeBuffer;
42			uint16				fLastEntryOffset;
43			uint16				fLastNodeOffset;
44			uint8				fNodeFlag;
45			AttrLeafNameLocal*	fLocalEntry;
46			AttrLeafNameRemote*	fRemoteEntry;
47};
48
49#endif