Documentation
¶
Index ¶
- func Namespace() string
- type Conn
- type Error
- type Fid
- func (fid *Fid) Close() error
- func (fid *Fid) Create(name string, mode uint8, perm uint32) error
- func (fid *Fid) Dirread() ([]*plan9.Dir, error)
- func (fid *Fid) Dirreadall() ([]*plan9.Dir, error)
- func (fid *Fid) Open(mode uint8) error
- func (fid *Fid) Qid() plan9.Qid
- func (fid *Fid) Read(b []byte) (n int, err error)
- func (fid *Fid) ReadAt(b []byte, offset int64) (n int, err error)
- func (fid *Fid) ReadFull(b []byte) (n int, err error)
- func (fid *Fid) Remove() error
- func (fid *Fid) Seek(n int64, whence int) (int64, error)
- func (fid *Fid) Stat() (*plan9.Dir, error)
- func (fid *Fid) Walk(name string) (*Fid, error)
- func (fid *Fid) Write(b []byte) (n int, err error)
- func (fid *Fid) WriteAt(b []byte, offset int64) (n int, err error)
- func (fid *Fid) Wstat(d *plan9.Dir) error
- type Fsys
- func (fs *Fsys) Access(name string, mode int) error
- func (fs *Fsys) Close() error
- func (fs *Fsys) Create(name string, mode uint8, perm uint32) (*Fid, error)
- func (fs *Fsys) Open(name string, mode uint8) (*Fid, error)
- func (fs *Fsys) Remove(name string) error
- func (fs *Fsys) Stat(name string) (*plan9.Dir, error)
- func (fs *Fsys) Wstat(name string, d *plan9.Dir) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func Dial ¶
Dial makes a call to destination addr on a multiplexed network.
If the network in addr is net, dial will try all networks in succession that are common between the source and destination until the call succeeds.
func DialService ¶
DialService is a convenience function that wraps Dial by calling the named service.
func (*Conn) Attach ¶
Attach establishes a 9P fileserver connection for a given user.
The afid argument specifies a fid to reuse from a previous auth message. To connect without authentication, the afid field should be set to NOFID.
type Fid ¶
type Fid struct {
// contains filtered or unexported fields
}
type Fsys ¶
type Fsys struct {
// contains filtered or unexported fields
}
Fsys represents a connection to a 9P server.
func MountService ¶
func MountServiceAname ¶
func (*Fsys) Close ¶
Close closes the file associated with a file descriptor.
Provide the file descriptor is a valid open descriptor, close is guaranteed to close it; there will be no error. Files are closed automatically upon termination of a process; close allows the file descriptor to be reused.
func (*Fsys) Create ¶
Create creates a new file or prepares to rewrite an existinf file.
The filename is opened according to omode (as described for open), and returns the an associated file descriptor. If the file is new, the owner is set to the userid of the creating process group; the group to that of the containing directory; the permissions to perm ANDed with the permissions of the containing directory.
If the file already exists, it is truncated to 0 length, and the permissions, owner, and group remain unchanged. The created file is a directory if the DMDIR bit is set in perm, an exclusive-use file if the DMEXCL bit is set, and append-only file if the DMAPPEND bit is set.
Exclusive-use files may be open for I/O by only one client at a time, but the file descriptor may become invalid if no I/O is done for an extended period.
Create fails if the path up to the last element of a file cannot be evaluated, if the user doesn't have write permission in the final directory, if the file already exists and does not permit the access defined by omode, or if there are no free file descriptors. In the last case, the file may be created even when an error is returned.
Since create may succeed even if the file exists, a special mechanism is necessary for those applications that require an atomic create operation. If th OEXCL (0x1000) bit is set in the mode for a create, the call succeeds only if the file does not already exist.
See: open(9p)
func (*Fsys) Open ¶
Open opens the file for I/O and returns an associated file descriptor.
Omode is one of OREAD, OWRITE, ORDWR or OEXEC, asking for permssion to read, write, read and write, or execute, respecitvely. In addition, there are three values that can be ORed with omode: OTRUN says to truncate the file to zero length before opening it; OCEXEC says to close the file when an exec(3) or execl system is made; ORCLOSE says to remove the file when it is closed (by everyone who has a copy of the file descriptor); and OAPPEND says to open the file in append-only mode, so that writes are always appened to the end of the file.
Open fails if the file does not exist or the user does not have permission to open it for the requested purpose. See: stat(3). The user must have write permission on the file if the OTRUNC bit is set. For the open system call, unlike the implicit open in exec(3), OEXEC is actually identical to OREAD.