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 Node::Node(ino_t id) 17 : 18 fID(id), 19 fParent(NULL), 20 fName(), 21 fFlags(0) 22 { 23 rw_lock_init(&fLock, "packagefs node"); 24 } 25 26 27 Node::~Node() 28 { 29 rw_lock_destroy(&fLock); 30 } 31 32 33 status_t 34 Node::Init(Directory* parent, const String& name) 35 { 36 fParent = parent; 37 fName = name; 38 fFlags = 0; 39 return B_OK; 40 } 41 42 43 status_t 44 Node::VFSInit(dev_t deviceID) 45 { 46 fFlags |= NODE_FLAG_KNOWN_TO_VFS; 47 return B_OK; 48 } 49 50 51 void 52 Node::VFSUninit() 53 { 54 fFlags &= ~(uint32)NODE_FLAG_KNOWN_TO_VFS; 55 } 56 57 58 void 59 Node::SetID(ino_t id) 60 { 61 fID = id; 62 } 63 64 65 void 66 Node::SetParent(Directory* parent) 67 { 68 fParent = parent; 69 } 70 71 72 uid_t 73 Node::UserID() const 74 { 75 return 0; 76 } 77 78 79 gid_t 80 Node::GroupID() const 81 { 82 return 0; 83 } 84 85 86 status_t 87 Node::OpenAttributeDirectory(AttributeDirectoryCookie*& _cookie) 88 { 89 AttributeDirectoryCookie* cookie 90 = new(std::nothrow) EmptyAttributeDirectoryCookie; 91 if (cookie == NULL) 92 return B_NO_MEMORY; 93 94 _cookie = cookie; 95 return B_OK; 96 } 97 98 99 status_t 100 Node::OpenAttribute(const StringKey& name, int openMode, 101 AttributeCookie*& _cookie) 102 { 103 return B_ENTRY_NOT_FOUND; 104 } 105 106 107 status_t 108 Node::IndexAttribute(AttributeIndexer* indexer) 109 { 110 return B_NOT_SUPPORTED; 111 } 112 113 114 void* 115 Node::IndexCookieForAttribute(const StringKey& name) const 116 { 117 return NULL; 118 } 119