Module Styx__Types.Qid

A Qid is a unique identifier for a file. While any number of client-side identifiers (fids) can point to the same file, two files are the same if and only if they have the same Qid.

type t
type attr =
| QTDIR

A directory

| QTAPPEND

The file is append-only

| QTEXCL

Exclusive-use file

| QTMOUNT

File that serves the 9P protocol

| QTAUTH

Authenticaiton file from a Tauth request

| QTTMP

temporary file

val length : int

length is the length of all qids, in bytes.

val kind : t -> attr -> bool

kind q attr is true if the qid has the provided attribute.

val kind_set : t -> attr -> unit

kind_set qid attr adds the referenced attribute to qid. It does not remove any other existing attributes.

val kind_clear : t -> unit

kind_clear qid clears all type attributes from qid. The resulting qid type is that of an ordinary file.

val version : t -> int

version q is incremented whenever a file is changed. File systems may choose to use this field analagously to the POSIX ctime field. Synthetic files conventionally always have a version field of 0. Some clients may take this as a sign not to cache the contents of a file.

val version_set : t -> int -> unit

version_set qid v sets the qid's version field to v, overwriting the previous version.

val version_incr : t -> unit

version_incr qid increments the qid's version field by 1

val path : t -> int

path q is a unique, 64-bit identifier for a file, analagous to an inode number of unix systems. This accessor should only be used if it is known that the path is no larger than Stdlib.max_int (for example, if it can be proven that the qid value created by this library). Otherwise, the path64 accessor should be used.

val path_set : t -> int -> unit

path_set qid overwrites a qid's path field

val path64 : t -> int64

path64 q retrieves the 64-bit path. Since a 64-bit path may not fit within an int, this method should be used by clients and in other situations where it is not known if the high bits of a Qid path (beyond Sys.int_size) are set.

val of_iovec : Iovec.t -> t

of_iovec iov converts iov to a Qid. No copying is done; the underlying buffer is still used to store the Qid contents.

val empty : t

empty is an empty Qid, or a 13-byte string with all bytes set to 0xFF. It is used in Twstat requests to indicate that the qid field should not be updated.

val write : w:Iovec.writer -> t -> Iovec.writer