packagefs: PackagesDirectory: Use node_ref

This commit is contained in:
Ingo Weinhold
2014-04-18 23:31:38 +02:00
parent 211c21a592
commit 09c07e4c5c
2 changed files with 13 additions and 8 deletions
@@ -18,7 +18,9 @@
PackagesDirectory::PackagesDirectory()
:
fPath(NULL),
fDirFD(-1)
fDirFD(-1),
fNodeRef(),
fHashNext(NULL)
{
}
@@ -72,8 +74,8 @@ status_t PackagesDirectory::Init(const char* path, dev_t mountPointDeviceID,
if (fstat(fDirFD, &st) < 0)
RETURN_ERROR(errno);
fDeviceID = st.st_dev;
fNodeID = st.st_ino;
fNodeRef.device = st.st_dev;
fNodeRef.node = st.st_ino;
// get a normalized path
KPath normalizedPath;
@@ -81,7 +83,7 @@ status_t PackagesDirectory::Init(const char* path, dev_t mountPointDeviceID,
RETURN_ERROR(normalizedPath.InitCheck());
char* normalizedPathBuffer = normalizedPath.LockBuffer();
error = vfs_entry_ref_to_path(fDeviceID, fNodeID, NULL, true,
error = vfs_entry_ref_to_path(fNodeRef.device, fNodeRef.node, NULL, true,
normalizedPathBuffer, normalizedPath.BufferSize());
if (error != B_OK)
RETURN_ERROR(error);
@@ -10,6 +10,8 @@
#include <Referenceable.h>
#include "NodeRef.h"
class PackagesDirectory : public BReferenceable {
public:
@@ -20,10 +22,12 @@ public:
{ return fPath; }
int DirectoryFD() const
{ return fDirFD; }
const node_ref& NodeRef() const
{ return fNodeRef; }
dev_t DeviceID() const
{ return fDeviceID; }
{ return fNodeRef.device; }
ino_t NodeID() const
{ return fNodeID; }
{ return fNodeRef.node; }
status_t Init(const char* path, dev_t mountPointDeviceID,
ino_t mountPointNodeID, struct stat& _st);
@@ -31,8 +35,7 @@ public:
private:
char* fPath;
int fDirFD;
dev_t fDeviceID;
ino_t fNodeID;
node_ref fNodeRef;
};