From eadc3c844da335809e728635ff76a298a9d0d999 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 27 Jun 2011 06:50:39 +0200 Subject: [PATCH] Add architecture property to Package --- .../kernel/file_systems/packagefs/Package.cpp | 20 +++++++++++++++++++ .../kernel/file_systems/packagefs/Package.h | 13 ++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/add-ons/kernel/file_systems/packagefs/Package.cpp b/src/add-ons/kernel/file_systems/packagefs/Package.cpp index 487ffd0fdf..9e4b43bb1f 100644 --- a/src/add-ons/kernel/file_systems/packagefs/Package.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/Package.cpp @@ -19,12 +19,20 @@ #include "Version.h" +const char* const kArchitectureNames[B_PACKAGE_ARCHITECTURE_ENUM_COUNT] = { + "any", + "x86", + "x86_gcc2", +}; + + Package::Package(PackageDomain* domain, dev_t deviceID, ino_t nodeID) : fDomain(domain), fFileName(NULL), fName(NULL), fVersion(NULL), + fArchitecture(B_PACKAGE_ARCHITECTURE_ENUM_COUNT), fLinkDirectory(NULL), fFD(-1), fOpenCount(0), @@ -89,6 +97,18 @@ Package::SetVersion(::Version* version) } +const char* +Package::ArchitectureName() const +{ + if (fArchitecture < 0 + || fArchitecture >= B_PACKAGE_ARCHITECTURE_ENUM_COUNT) { + return NULL; + } + + return kArchitectureNames[fArchitecture]; +} + + void Package::AddNode(PackageNode* node) { diff --git a/src/add-ons/kernel/file_systems/packagefs/Package.h b/src/add-ons/kernel/file_systems/packagefs/Package.h index d6ec920c0e..ff7a6522b0 100644 --- a/src/add-ons/kernel/file_systems/packagefs/Package.h +++ b/src/add-ons/kernel/file_systems/packagefs/Package.h @@ -6,6 +6,8 @@ #define PACKAGE_H +#include + #include #include @@ -19,6 +21,9 @@ #include "Resolvable.h" +using BPackageKit::BPackageArchitecture; + + class PackageDomain; class PackageLinkDirectory; class Version; @@ -44,6 +49,13 @@ public: ::Version* Version() const { return fVersion; } + void SetArchitecture( + BPackageArchitecture architecture) + { fArchitecture = architecture; } + BPackageArchitecture Architecture() const + { return fArchitecture; } + const char* ArchitectureName() const; + void SetLinkDirectory( PackageLinkDirectory* linkDirectory) { fLinkDirectory = linkDirectory; } @@ -72,6 +84,7 @@ private: char* fFileName; char* fName; ::Version* fVersion; + BPackageArchitecture fArchitecture; PackageLinkDirectory* fLinkDirectory; int fFD; uint32 fOpenCount;