Defined In: be/kernel/fs_attr.h
typedef struct attr_info uint32type; off_tsize; } attr_info;
The attr_info structure contains the following members
type is a constant (B_STRING_TYPE,
B_INT32_TYPE, etc) that describes
the type of data that the attribute holds.
size is the size of the attribute's data, in bytes.
Declared in: be/storage/Entry.h
struct entry_ref {entry_ref();entry_ref(dev_tdevice, ino_tdir, const char*name);entry_ref(const entry_ref&ref);~entry_ref(); status_tset_name(const char*name); booloperator==(const entry_ref&ref) const; booloperator!=(const entry_ref&ref) const; entry_ref&operator=(const entry_ref&ref); dev_tdevice; ino_tdirectory; char*name; }
The entry_ref structure describes a single entry in a directory.
device contains the device number on which the entry's target is located.
directory contains the inode of the directory that contains the entry's
target.
name contains the name of the entry.
entry_ref();entry_ref(const entry_ref& ref);entry_ref(dev_t device,
ino_t dir,
const char* name);The constructor for the entry_ref structure. The first of these creates an empty entry_ref, the second duplicates an existing entry_ref, and the last version of the constructor accepts a device number, directory inode number, and a file name and constructs an entry_ref referring to that entry.
~entry_ref();The destructor for entry_ref.
status_t set_name(const char* name);Lets you change the name of the file referred to by the entry_ref structure.
operator ==
Lets you perform comparisons of entry_ref structures to see if they refer to the same entry.
operator !=
Lets you test to see if two entry_ref structures refer to different entries.
Declared in: be/storage/Node.h
struct node_ref {node_ref();node_ref(const node_ref&ref);~node_ref(); booloperator==(const node_ref&ref) const; booloperator!=(const node_ref&ref) const; node_ref&operator=(const node_ref&ref); dev_tdevice; ino_tnode; }
The node_ref structure describes a node in a file system.
device contains the device number on which the node is located.
node contains the inode of the node.
node_ref();node_ref(const node_ref& ref);The constructor for the node_ref structure. The first of these creates an empty node_ref, and the second duplicates an existing node_ref.
~node_ref();The destructor for node_ref.
operator ==
Lets you perform comparisons of node_ref structures to see if they refer to the same node.
operator !=
Lets you test to see if two node_ref structures refer to different nodes.
Declared in: be/storage/AppFileInfo.h
struct version_info {
uint32 major;
uint32 middle;
uint32 minor;
uint32 variety;
uint32 internal;
char short_info[64];
char long_info[256];
}The version_info structure is used to contain version information about an application. Although none of these fields have prescribed uses, and you can use them for anything you want, their names do hint at their suggested uses.
The query_op constants are used to construct the predicate for a
BQuery:
| Constant | Operation |
|---|---|
B_EQ | = |
B_NE | != |
B_GT | > |
B_LT | < |
B_GE | >= |
B_LE | <= |
B_CONTAINS | string contains value ("*value*") |
B_BEGINS_WITH | string begins with value ("value*") |
B_ENDS_WITH | string ends with value ("*value") |
B_AND | && |
B_OR | || |
B_NOT | ! |
Declared in: be/posix/sys/stat.h
The stat structure looks like this:
struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
off_t st_size;
dev_t st_rdev;
size_t st_blksize;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
} stat;And the fields are…
st_dev identifies the node's device.
st_ino is the node's "inode" number.
By combining st_dev and st_ino you can roll your own
node_ref:
node_refnref; statst; if (file.GetStat(&st) ==B_OK) {nref.dev=st.st_dev;nref.node=st.st_ino; }
Meanwhile…
st_mode describes the node's flavor: plain file, directory or
symbolic link. To test the field, pass it to the
S_ISREG(),
S_ISDIR(),
and S_ISLNK() boolean macros:
if (S_ISREG(st.st_mode)) /* it's a "regular" file */ else if (S_ISDIR(st.st_mode)) /* it's a directory */ else if (S_ISLNK(st.st_mode)) /* it's a symbolic link */
st_nlink is the number of "hard links" that point to this node.
st_uid and st_gid are the user (owner) and group ids that were
described in the
GetOwner() function.
st_rdev is, well, no one really knows. It's provided for System V
compatibility (hold your applause), but it's unused.
st_blksize is the "preferred block size" that's used during copying.
The cp command line program allocates buffers of this size when it's
copying the file's data.
st_atime, st_mtime, and st_ctime are the access, modification, and
creation times in seconds since January 1, 1970. Access time (st_atime)
is currently unused.
The fs_info structure is defined as:
typedef struct fs_info { dev_tdev; ino_troot; uint32flags; off_tblock_size; off_tio_size; off_ttotal_blocks; off_tfree_blocks; off_ttotal_nodes; off_tfree_nodes; chardevice_name[128]; charvolume_name[B_FILE_NAME_LENGTH]; charfsh_name[B_OS_NAME_LENGTH]; };
The structure's fields are:
dev. The device number of the device.
root. The inode of the root of the device.
flags. Flags describing the device's capabilities.
block_size. The fundamental block size of the device.
io_size. Optimal I/O size of the device.
total_blocks. The total number of blocks on the device.
free_blocks. The number of free (unused) blocks on the device.
total_nodes. The total number of nodes on the device.
free_nodes. The number of free (unused) nodes on the device.
device_name. Name of the device holding the file system.
volume_name. Name of the volume contained by the device.
fsh_name. Name of the file system handler for the device.
The flags can be any combination of the following values, which specify
the attributes of the file system on the device:
B_FS_IS_READONLY. The file system on the device is read-only.
B_FS_IS_REMOVABLE. The device contains removable media.
B_FS_IS_PERSISTENT. Data written to the device remains even while the
device is off.
B_FS_IS_SHARED. The file system is being shared on a network.
B_FS_HAS_MIME. The file system supports the MIME typing system used
by the BeOS.
B_FS_HAS_ATTR. The file system supports node attributes.
B_FS_HAS_QUERY. The file system supports the BeOS query mechanism.
The information in the fs_info structure is guaranteed to be internally consistent, but the structure as a whole should be considered to be out-of-date as soon as you receive it. It provides a picture of a device as it exists just before the info-retrieving function returns. In particular, the number of free blocks and of free nodes can easily change immediately after you receive this information.