#include <sys/vtoc.h>
cc [ flag ... ] file ... -ladm [ library ... ]
int read_vtoc(int fd, struct vtoc *vtoc);
int write_vtoc(int fd, struct vtoc *vtoc);
Unsafe
read_vtoc() returns the VTOC structure that is stored on the disk associated with the open file descriptor fd.
write_vtoc() stores the VTOC structure on at disk associated with the open file descriptor fd.
fd refers to any slice on a raw disk.
write_vtoc returns:
- positive number
- Success. The positive number is the slice index associated with the open file descriptor.
- negative number
- There are two possible error returns. VT_EIO indicates an I/O error occurred and VT_ERROR indicates an unknown error.
- Success
- negative number
- There are three possible error returns. VT_EIO indicates an I/O error occurred, VT_ERROR indicates an unknown error, and VT_EINVAL indicates an incorrect field within the VTOC.