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