1 /* Attribute - connection between pure inode and kernel_interface attributes 2 * 3 * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. 4 * This file may be used under the terms of the MIT License. 5 */ 6 #ifndef ATTRIBUTE_H 7 #define ATTRIBUTE_H 8 9 10 #include "Inode.h" 11 12 13 struct attr_cookie { 14 char name[B_ATTR_NAME_LENGTH]; 15 uint32 type; 16 int open_mode; 17 bool create; 18 }; 19 20 21 class Attribute { 22 public: 23 Attribute(Inode *inode); 24 Attribute(Inode *inode, attr_cookie *cookie); 25 ~Attribute(); 26 27 status_t InitCheck(); 28 status_t CheckAccess(const char *name, int openMode); 29 30 status_t Get(const char *name); 31 void Put(); 32 33 status_t Create(const char *name, type_code type, int openMode, attr_cookie **_cookie); 34 status_t Open(const char *name, int openMode, attr_cookie **_cookie); 35 36 status_t Stat(struct stat &stat); 37 38 status_t Read(attr_cookie *cookie, off_t pos, uint8 *buffer, size_t *_length); 39 status_t Write(Transaction &transaction, attr_cookie *cookie, 40 off_t pos, const uint8 *buffer, size_t *_length); 41 42 private: 43 NodeGetter fNodeGetter; 44 Inode *fInode; 45 small_data *fSmall; 46 Inode *fAttribute; 47 const char *fName; 48 }; 49 50 #endif /* ATTRIBUTE_H */ 51