xref: /haiku/src/add-ons/kernel/file_systems/xfs/NodeAttribute.h (revision 2710b4f5d4251c5cf88c82b0114ea99b0ef46d22)
188131dc3SMashijams /*
288131dc3SMashijams  * Copyright 2022, Raghav Sharma, raghavself28@gmail.com
388131dc3SMashijams  * Distributed under the terms of the MIT License.
488131dc3SMashijams  */
588131dc3SMashijams #ifndef NODE_ATTRIBUTE_H
688131dc3SMashijams #define NODE_ATTRIBUTE_H
788131dc3SMashijams 
888131dc3SMashijams 
988131dc3SMashijams #include "LeafAttribute.h"
1088131dc3SMashijams #include "Node.h"
1188131dc3SMashijams 
1288131dc3SMashijams 
1388131dc3SMashijams class NodeAttribute : public Attribute {
1488131dc3SMashijams public:
1588131dc3SMashijams 								NodeAttribute(Inode* inode);
1688131dc3SMashijams 								~NodeAttribute();
1788131dc3SMashijams 
1888131dc3SMashijams 			status_t			Init();
1988131dc3SMashijams 
2088131dc3SMashijams 			status_t			Stat(attr_cookie* cookie, struct stat& stat);
2188131dc3SMashijams 
2288131dc3SMashijams 			status_t			Read(attr_cookie* cookie, off_t pos,
2388131dc3SMashijams 									uint8* buffer, size_t* length);
2488131dc3SMashijams 
2588131dc3SMashijams 			status_t			Open(const char* name, int openMode, attr_cookie** _cookie);
2688131dc3SMashijams 
2788131dc3SMashijams 			status_t			GetNext(char* name, size_t* nameLength);
2888131dc3SMashijams 
2988131dc3SMashijams 			status_t			Lookup(const char* name, size_t* nameLength);
3088131dc3SMashijams private:
3188131dc3SMashijams 			status_t			_FillMapEntry(xfs_extnum_t num);
3288131dc3SMashijams 
3388131dc3SMashijams 			status_t			_FillBuffer(char* buffer, xfs_fsblock_t block);
3488131dc3SMashijams 
3588131dc3SMashijams 			xfs_fsblock_t		_LogicalToFileSystemBlock(uint32 LogicalBlock);
3688131dc3SMashijams 
3788131dc3SMashijams 			Inode*				fInode;
3888131dc3SMashijams 			const char*			fName;
3988131dc3SMashijams 			ExtentMapEntry*		fMap;
4088131dc3SMashijams 			char*				fLeafBuffer;
4188131dc3SMashijams 			char*				fNodeBuffer;
4288131dc3SMashijams 			uint16				fLastEntryOffset;
43*689f8e90SMashijams 			uint16				fLastNodeOffset;
44*689f8e90SMashijams 			uint8				fNodeFlag;
4588131dc3SMashijams 			AttrLeafNameLocal*	fLocalEntry;
4688131dc3SMashijams 			AttrLeafNameRemote*	fRemoteEntry;
4788131dc3SMashijams };
4888131dc3SMashijams 
4988131dc3SMashijams #endif