Node: Keep track of VFS init status
* Node::VFSInit() and VFSUninit() set/clear the new node flag NODE_FLAG_KNOWN_TO_VFS. They need to be called by overriding methods, now. * Add Node::IsKnownToVFS() which returns the VFS init status.
This commit is contained in:
@@ -56,6 +56,7 @@ Node::Init(Directory* parent, const char* name, uint32 flags)
|
|||||||
status_t
|
status_t
|
||||||
Node::VFSInit(dev_t deviceID)
|
Node::VFSInit(dev_t deviceID)
|
||||||
{
|
{
|
||||||
|
fFlags |= NODE_FLAG_KNOWN_TO_VFS;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +64,7 @@ Node::VFSInit(dev_t deviceID)
|
|||||||
void
|
void
|
||||||
Node::VFSUninit()
|
Node::VFSUninit()
|
||||||
{
|
{
|
||||||
|
fFlags &= ~(uint32)NODE_FLAG_KNOWN_TO_VFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ enum {
|
|||||||
NODE_FLAG_CONST_NAME = 0x02,
|
NODE_FLAG_CONST_NAME = 0x02,
|
||||||
// Init(): The given name is a constant that won't go away during the
|
// Init(): The given name is a constant that won't go away during the
|
||||||
// lifetime of the object. No need to copy.
|
// lifetime of the object. No need to copy.
|
||||||
NODE_FLAG_OWNS_NAME = NODE_FLAG_KEEP_NAME
|
NODE_FLAG_OWNS_NAME = NODE_FLAG_KEEP_NAME,
|
||||||
|
NODE_FLAG_KNOWN_TO_VFS = 0x04,
|
||||||
|
// internal flag
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -61,7 +63,11 @@ public:
|
|||||||
// so also on error.
|
// so also on error.
|
||||||
|
|
||||||
virtual status_t VFSInit(dev_t deviceID);
|
virtual status_t VFSInit(dev_t deviceID);
|
||||||
|
// base class version must be called on
|
||||||
|
// success
|
||||||
virtual void VFSUninit();
|
virtual void VFSUninit();
|
||||||
|
// base class version must be called
|
||||||
|
inline bool IsKnownToVFS() const;
|
||||||
|
|
||||||
void SetID(ino_t id);
|
void SetID(ino_t id);
|
||||||
void SetParent(Directory* parent);
|
void SetParent(Directory* parent);
|
||||||
@@ -126,6 +132,16 @@ Node::WriteUnlock()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Node::IsKnownToVFS() const
|
||||||
|
{
|
||||||
|
return (fFlags & NODE_FLAG_KNOWN_TO_VFS) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
struct NodeNameHashDefinition {
|
struct NodeNameHashDefinition {
|
||||||
typedef const char* KeyType;
|
typedef const char* KeyType;
|
||||||
typedef Node ValueType;
|
typedef Node ValueType;
|
||||||
|
|||||||
@@ -34,9 +34,14 @@ UnpackingLeafNode::~UnpackingLeafNode()
|
|||||||
status_t
|
status_t
|
||||||
UnpackingLeafNode::VFSInit(dev_t deviceID)
|
UnpackingLeafNode::VFSInit(dev_t deviceID)
|
||||||
{
|
{
|
||||||
|
status_t error = B_OK;
|
||||||
if (PackageLeafNode* packageNode = _ActivePackageNode())
|
if (PackageLeafNode* packageNode = _ActivePackageNode())
|
||||||
return packageNode->VFSInit(deviceID, fID);
|
error = packageNode->VFSInit(deviceID, fID);
|
||||||
return B_OK;
|
|
||||||
|
if (error == B_OK)
|
||||||
|
Node::VFSInit(deviceID);
|
||||||
|
|
||||||
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -45,6 +50,8 @@ UnpackingLeafNode::VFSUninit()
|
|||||||
{
|
{
|
||||||
if (PackageLeafNode* packageNode = _ActivePackageNode())
|
if (PackageLeafNode* packageNode = _ActivePackageNode())
|
||||||
packageNode->VFSUninit();
|
packageNode->VFSUninit();
|
||||||
|
|
||||||
|
Node::VFSUninit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user