From 211c21a592d8b2bd3e310d218f728d58eeaf647a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 1 Apr 2014 06:22:01 +0200 Subject: [PATCH] packagefs: Add support for node_ref --- .../file_systems/packagefs/util/NodeRef.h | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/add-ons/kernel/file_systems/packagefs/util/NodeRef.h diff --git a/src/add-ons/kernel/file_systems/packagefs/util/NodeRef.h b/src/add-ons/kernel/file_systems/packagefs/util/NodeRef.h new file mode 100644 index 0000000000..57c8493b7f --- /dev/null +++ b/src/add-ons/kernel/file_systems/packagefs/util/NodeRef.h @@ -0,0 +1,71 @@ +/* + * Copyright 2014, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef NODE_REF_H +#define NODE_REF_H + + +#include + + +inline +node_ref::node_ref() + : + device(-1), + node(-1) +{ +} + + +inline +node_ref::node_ref(dev_t device, ino_t node) + : + device(device), + node(node) +{ +} + + +inline +node_ref::node_ref(const node_ref& other) + : + device(other.device), + node(other.node) +{ +} + + +inline bool +node_ref::operator==(const node_ref& other) const +{ + return device == other.device && node == other.node; +} + + +inline bool +node_ref::operator!=(const node_ref& other) const +{ + return !(*this == other); +} + + +inline bool +node_ref::operator<(const node_ref& other) const +{ + if (device != other.device) + return device < other.device; + return node < other.node; +} + + +inline node_ref& +node_ref::operator=(const node_ref& other) +{ + device = other.device; + node = other.node; + return *this; +} + + +#endif // NODE_REF_H