2 * Copyright 2002-2008, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
16 //! Reference structure to a particular vnode on a particular device
17 /*! <b>node_ref</b> - A node reference.
19 @author <a href="mailto:tylerdauwalder@users.sf.net">Tyler Dauwalder</a>
25 node_ref(const node_ref
&ref
);
27 bool operator==(const node_ref
&ref
) const;
28 bool operator!=(const node_ref
&ref
) const;
29 node_ref
& operator=(const node_ref
&ref
);
31 bool operator<(const node_ref
&ref
) const
33 return device
< ref
.device
34 || (device
== ref
.device
&& node
< ref
.node
);
42 //! A BNode represents a chunk of data in the filesystem.
43 /*! The BNode class provides an interface for manipulating the data and attributes
44 belonging to filesystem entries. The BNode is unaware of the name that refers
45 to it in the filesystem (i.e. its entry); a BNode is solely concerned with
46 the entry's data and attributes.
49 @author <a href='mailto:tylerdauwalder@users.sf.net'>Tyler Dauwalder</a>
53 class BNode
: public BStatable
{
56 BNode(const entry_ref
*ref
);
57 BNode(const BEntry
*entry
);
58 BNode(const char *path
);
59 BNode(const BDirectory
*dir
, const char *path
);
60 BNode(const BNode
&node
);
63 status_t
InitCheck() const;
65 virtual status_t
GetStat(struct stat
*st
) const;
67 status_t
SetTo(const entry_ref
*ref
);
68 status_t
SetTo(const BEntry
*entry
);
69 status_t
SetTo(const char *path
);
70 status_t
SetTo(const BDirectory
*dir
, const char *path
);
78 ssize_t
WriteAttr(const char *name
, type_code type
, off_t offset
,
79 const void *buffer
, size_t len
);
80 ssize_t
ReadAttr(const char *name
, type_code type
, off_t offset
,
81 void *buffer
, size_t len
) const;
82 status_t
RemoveAttr(const char *name
);
83 status_t
RenameAttr(const char *oldname
, const char *newname
);
84 status_t
GetAttrInfo(const char *name
, struct attr_info
*info
) const;
85 status_t
GetNextAttrName(char *buffer
);
86 status_t
RewindAttrs();
87 status_t
WriteAttrString(const char *name
, const BString
*data
);
88 status_t
ReadAttrString(const char *name
, BString
*result
) const;
90 BNode
& operator=(const BNode
&node
);
91 bool operator==(const BNode
&node
) const;
92 bool operator!=(const BNode
&node
) const;
94 int Dup(); // This should be "const" but R5's is not... Ugggh.
98 friend class BDirectory
;
99 friend class BSymLink
;
101 virtual void _RudeNode1();
102 virtual void _RudeNode2();
103 virtual void _RudeNode3();
104 virtual void _RudeNode4();
105 virtual void _RudeNode5();
106 virtual void _RudeNode6();
111 status_t
set_fd(int fd
);
112 virtual void close_fd();
113 void set_status(status_t newStatus
);
115 status_t
_SetTo(int fd
, const char *path
, bool traverse
);
116 status_t
_SetTo(const entry_ref
*ref
, bool traverse
);
118 virtual status_t
set_stat(struct stat
&st
, uint32 what
);
124 status_t
InitAttrDir();