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