1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "Node.h" 8 9 #include <stdlib.h> 10 #include <string.h> 11 12 #include "DebugSupport.h" 13 #include "EmptyAttributeDirectoryCookie.h" 14 15 16 DEFINE_INLINE_REFERENCEABLE_METHODS(Node, fReferenceable); 17 18 19 Node::Node(ino_t id) 20 : 21 fID(id), 22 fParent(NULL), 23 fName(), 24 fFlags(0) 25 { 26 rw_lock_init(&fLock, "packagefs node"); 27 } 28 29 30 Node::~Node() 31 { 32 rw_lock_destroy(&fLock); 33 } 34 35 36 status_t 37 Node::Init(const String& name) 38 { 39 fName = name; 40 fFlags = 0; 41 return B_OK; 42 } 43 44 45 void 46 Node::SetID(ino_t id) 47 { 48 fID = id; 49 } 50 51 52 void 53 Node::_SetParent(Directory* parent) 54 { 55 fParent = parent; 56 } 57 58 59 status_t 60 Node::VFSInit(dev_t deviceID) 61 { 62 fFlags |= NODE_FLAG_KNOWN_TO_VFS; 63 return B_OK; 64 } 65 66 67 void 68 Node::VFSUninit() 69 { 70 fFlags &= ~(uint32)NODE_FLAG_KNOWN_TO_VFS; 71 } 72 73 74 uid_t 75 Node::UserID() const 76 { 77 return 0; 78 } 79 80 81 gid_t 82 Node::GroupID() const 83 { 84 return 0; 85 } 86 87 88 status_t 89 Node::OpenAttributeDirectory(AttributeDirectoryCookie*& _cookie) 90 { 91 AttributeDirectoryCookie* cookie 92 = new(std::nothrow) EmptyAttributeDirectoryCookie; 93 if (cookie == NULL) 94 return B_NO_MEMORY; 95 96 _cookie = cookie; 97 return B_OK; 98 } 99 100 101 status_t 102 Node::OpenAttribute(const StringKey& name, int openMode, 103 AttributeCookie*& _cookie) 104 { 105 return B_ENTRY_NOT_FOUND; 106 } 107 108 109 status_t 110 Node::IndexAttribute(AttributeIndexer* indexer) 111 { 112 return B_NOT_SUPPORTED; 113 } 114 115 116 void* 117 Node::IndexCookieForAttribute(const StringKey& name) const 118 { 119 return NULL; 120 } 121