vfs: check userland buffers before reading them.
[haiku.git] / src / build / libroot / NodeRef.h
blobfd7ace6f80842128ff169ce2bf2154d7a3f1e15e
1 /*
2 * Copyright 2005-2008, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef NODE_REF_H
6 #define NODE_REF_H
8 #include <sys/stat.h>
10 namespace BPrivate {
12 struct NodeRef {
13 dev_t device;
14 ino_t node;
16 NodeRef(dev_t device = 0, ino_t node = 0)
17 : device(device),
18 node(node)
22 NodeRef(const struct stat &st)
23 : device(st.st_dev),
24 node(st.st_ino)
28 NodeRef(const NodeRef &other)
30 device = other.device;
31 node = other.node;
34 NodeRef &operator=(const NodeRef &other)
36 device = other.device;
37 node = other.node;
38 return *this;
41 bool operator==(const NodeRef &other) const
43 return (device == other.device && node == other.node);
46 bool operator!=(const NodeRef &other) const
48 return !(*this == other);
51 bool operator<(const NodeRef &other) const
53 return (device < other.device
54 || (device == other.device && node < other.node));
59 } // namespace BPrivate
61 #endif // NODE_REF_H