From cc1dc4db4c4b93636dce067ea0f1485e3f15de83 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 22 Jun 2011 01:59:24 +0200 Subject: [PATCH] Rename Package "name" property to "fileName" --- .../kernel/file_systems/packagefs/Package.cpp | 18 ++++++------ .../kernel/file_systems/packagefs/Package.h | 28 +++++++++---------- .../file_systems/packagefs/PackageDomain.cpp | 6 ++-- .../file_systems/packagefs/PackageDomain.h | 8 +++--- .../kernel/file_systems/packagefs/Volume.cpp | 4 +-- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/add-ons/kernel/file_systems/packagefs/Package.cpp b/src/add-ons/kernel/file_systems/packagefs/Package.cpp index e0123a6926..dd170dbe21 100644 --- a/src/add-ons/kernel/file_systems/packagefs/Package.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/Package.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -21,7 +21,7 @@ Package::Package(PackageDomain* domain, dev_t deviceID, ino_t nodeID) : fDomain(domain), - fName(NULL), + fFileName(NULL), fFD(-1), fOpenCount(0), fNodeID(nodeID), @@ -36,17 +36,17 @@ Package::~Package() while (PackageNode* node = fNodes.RemoveHead()) node->ReleaseReference(); - free(fName); + free(fFileName); mutex_destroy(&fLock); } status_t -Package::Init(const char* name) +Package::Init(const char* fileName) { - fName = strdup(name); - if (fName == NULL) + fFileName = strdup(fileName); + if (fFileName == NULL) RETURN_ERROR(B_NO_MEMORY); return B_OK; @@ -71,16 +71,16 @@ Package::Open() } // open the file - fFD = openat(fDomain->DirectoryFD(), fName, O_RDONLY); + fFD = openat(fDomain->DirectoryFD(), fFileName, O_RDONLY); if (fFD < 0) { - ERROR("Failed to open package file \"%s\"\n", fName); + ERROR("Failed to open package file \"%s\"\n", fFileName); return errno; } // stat it to verify that it's still the same file struct stat st; if (fstat(fFD, &st) < 0) { - ERROR("Failed to stat package file \"%s\"\n", fName); + ERROR("Failed to stat package file \"%s\"\n", fFileName); close(fFD); fFD = -1; return errno; diff --git a/src/add-ons/kernel/file_systems/packagefs/Package.h b/src/add-ons/kernel/file_systems/packagefs/Package.h index 17f76633ec..a784accd2b 100644 --- a/src/add-ons/kernel/file_systems/packagefs/Package.h +++ b/src/add-ons/kernel/file_systems/packagefs/Package.h @@ -1,5 +1,5 @@ /* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #ifndef PACKAGE_H @@ -25,28 +25,28 @@ public: ino_t nodeID); ~Package(); - status_t Init(const char* name); + status_t Init(const char* fileName); - PackageDomain* Domain() const { return fDomain; } - const char* Name() const { return fName; } + PackageDomain* Domain() const { return fDomain; } + const char* FileName() const { return fFileName; } - Package*& HashTableNext() { return fHashTableNext; } + Package*& FileNameHashTableNext() + { return fFileNameHashTableNext; } void AddNode(PackageNode* node); int Open(); void Close(); - const PackageNodeList& Nodes() const - { return fNodes; } + const PackageNodeList& Nodes() const { return fNodes; } private: mutex fLock; PackageDomain* fDomain; - char* fName; + char* fFileName; int fFD; uint32 fOpenCount; - Package* fHashTableNext; + Package* fFileNameHashTableNext; ino_t fNodeID; dev_t fDeviceID; PackageNodeList fNodes; @@ -76,7 +76,7 @@ private: }; -struct PackageHashDefinition { +struct PackageFileNameHashDefinition { typedef const char* KeyType; typedef Package ValueType; @@ -87,22 +87,22 @@ struct PackageHashDefinition { size_t Hash(const Package* value) const { - return HashKey(value->Name()); + return HashKey(value->FileName()); } bool Compare(const char* key, const Package* value) const { - return strcmp(value->Name(), key) == 0; + return strcmp(value->FileName(), key) == 0; } Package*& GetLink(Package* value) const { - return value->HashTableNext(); + return value->FileNameHashTableNext(); } }; -typedef BOpenHashTable PackageHashTable; +typedef BOpenHashTable PackageFileNameHashTable; #endif // PACKAGE_H diff --git a/src/add-ons/kernel/file_systems/packagefs/PackageDomain.cpp b/src/add-ons/kernel/file_systems/packagefs/PackageDomain.cpp index f060f2e89d..a44786f2ff 100644 --- a/src/add-ons/kernel/file_systems/packagefs/PackageDomain.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/PackageDomain.cpp @@ -41,7 +41,7 @@ PackageDomain::~PackageDomain() Package* package = fPackages.Clear(true); while (package != NULL) { - Package* next = package->HashTableNext(); + Package* next = package->FileNameHashTableNext(); package->ReleaseReference(); package = next; } @@ -113,7 +113,7 @@ PackageDomain::RemovePackage(Package* package) Package* -PackageDomain::FindPackage(const char* name) const +PackageDomain::FindPackage(const char* fileName) const { - return fPackages.Lookup(name); + return fPackages.Lookup(fileName); } diff --git a/src/add-ons/kernel/file_systems/packagefs/PackageDomain.h b/src/add-ons/kernel/file_systems/packagefs/PackageDomain.h index e203f39f36..ac39020693 100644 --- a/src/add-ons/kernel/file_systems/packagefs/PackageDomain.h +++ b/src/add-ons/kernel/file_systems/packagefs/PackageDomain.h @@ -1,5 +1,5 @@ /* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #ifndef PACKAGE_DOMAIN_H @@ -34,9 +34,9 @@ public: void AddPackage(Package* package); void RemovePackage(Package* package); - Package* FindPackage(const char* name) const; + Package* FindPackage(const char* fileName) const; - const PackageHashTable& Packages() const + const PackageFileNameHashTable& Packages() const { return fPackages; } private: @@ -45,7 +45,7 @@ private: dev_t fDeviceID; ino_t fNodeID; NotificationListener* fListener; - PackageHashTable fPackages; + PackageFileNameHashTable fPackages; }; diff --git a/src/add-ons/kernel/file_systems/packagefs/Volume.cpp b/src/add-ons/kernel/file_systems/packagefs/Volume.cpp index 447c21e69d..7c1676f805 100644 --- a/src/add-ons/kernel/file_systems/packagefs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/Volume.cpp @@ -603,8 +603,8 @@ Volume::_AddPackageDomain(PackageDomain* domain, bool notify) // add the packages to the node tree VolumeWriteLocker volumeLocker(this); - for (PackageHashTable::Iterator it = domain->Packages().GetIterator(); - Package* package = it.Next();) { + for (PackageFileNameHashTable::Iterator it + = domain->Packages().GetIterator(); Package* package = it.Next();) { error = _AddPackageContent(package, notify); if (error != B_OK) { for (it.Rewind(); Package* activePackage = it.Next();) {