SYNOPSIS

#include <ixp.h>

IxpCFid *ixp_open(IxpClient *c, const char *path, uint8_t mode);

IxpCFid *ixp_create(IxpClient *c, const char *path, uint perm, uint8_t mode);

typedef struct IxpCFid IxpCFid;
struct IxpCFid {
        uint32_t        fid;
        IxpQid          qid;
        uint8_t         mode;
        uint            open;
        uint            iounit;
        uint32_t        offset;
        IxpClient*      client;

        /* Private members */
        ...
}

enum IxpOMode {
        P9_OREAD        = 0,    /* open for read */
        P9_OWRITE       = 1,    /* write */
        P9_ORDWR        = 2,    /* read and write */
        P9_OEXEC        = 3,    /* execute, == read but check execute permission */
        P9_OTRUNC       = 16,   /* or'ed in (except for exec), truncate file first */
        P9_OCEXEC       = 32,   /* or'ed in, close on exec */
        P9_ORCLOSE      = 64,   /* or'ed in, remove on close */
        P9_ODIRECT      = 128,  /* or'ed in, direct access */
        P9_ONONBLOCK    = 256,  /* or'ed in, non-blocking call */
        P9_OEXCL        = 0x1000,       /* or'ed in, exclusive use (create only) */
        P9_OLOCK        = 0x2000,       /* or'ed in, lock after opening */
        P9_OAPPEND      = 0x4000        /* or'ed in, append only */
}

PARAMETERS

path

The path of the file to open or create.

perm

The permissions with which to create the new file. These will be ANDed with those of the parent directory by the server.

mode

The file's open mode.

DESCRIPTION

ixp_open and ixp_create each open a file at path. mode must include OREAD, OWRITE, or ORDWR, and may include any of the modes specified in IxpOMode(3). ixp_create, additionally, creates a file at path if it doesn't already exist.

RETURN VALUE

A pointer on which to operate on the newly opened file.

RELATED TO IxpOMode…