btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / src / add-ons / kernel / file_systems / bfs / Attribute.h
blobd45bd6d8d7e27c3af76977fc3f299a096e567e45
1 /*
2 * Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de.
3 * This file may be used under the terms of the MIT License.
4 */
5 #ifndef ATTRIBUTE_H
6 #define ATTRIBUTE_H
9 #include "Inode.h"
12 struct attr_cookie {
13 char name[B_ATTR_NAME_LENGTH];
14 uint32 type;
15 int open_mode;
16 bool create;
20 class Attribute {
21 public:
22 Attribute(Inode* inode);
23 Attribute(Inode* inode, attr_cookie* cookie);
24 ~Attribute();
26 status_t InitCheck();
27 status_t CheckAccess(const char* name, int openMode);
29 status_t Get(const char* name);
30 void Put();
32 status_t Create(const char* name, type_code type,
33 int openMode, attr_cookie** _cookie);
34 status_t Open(const char* name, int openMode,
35 attr_cookie** _cookie);
37 status_t Stat(struct stat& stat);
39 status_t Read(attr_cookie* cookie, off_t pos, uint8* buffer,
40 size_t* _length);
41 status_t Write(Transaction& transaction, attr_cookie* cookie,
42 off_t pos, const uint8* buffer, size_t* _length,
43 bool* _created);
45 private:
46 status_t _Truncate();
48 NodeGetter fNodeGetter;
49 Inode* fInode;
50 small_data* fSmall;
51 Inode* fAttribute;
52 const char* fName;
55 #endif // ATTRIBUTE_H