#include <ixp.h>

IxpStat *ixp_stat(IxpClient *c, const char *path);

IxpStat *ixp_fstat(IxpCFid *fid);

typedef struct IxpStat IxpStat;
struct IxpStat {
        uint16_t        type;
        uint32_t        dev;
        IxpQid          qid;
        uint32_t        mode;
        uint32_t        atime;
        uint32_t        mtime;
        uint64_t        length;
        char*   name;
        char*   uid;
        char*   gid;
        char*   muid;

typedef struct IxpQid IxpQid;
struct IxpQid {
        uint8_t         type;
        uint32_t        version;
        uint64_t        path;
        /* Private members */

enum IxpQType {
        P9_QTDIR        = 0x80, /* type bit for directories */
        P9_QTAPPEND     = 0x40, /* type bit for append only files */
        P9_QTEXCL       = 0x20, /* type bit for exclusive use files */
        P9_QTMOUNT      = 0x10, /* type bit for mounted channel */
        P9_QTAUTH       = 0x08, /* type bit for authentication file */
        P9_QTTMP        = 0x04, /* type bit for non-backed-up file */
        P9_QTSYMLINK    = 0x02, /* type bit for symbolic link */
        P9_QTFILE       = 0x00  /* type bits for plain file */

enum IxpDMode {
        P9_DMEXEC       = 0x1,          /* mode bit for execute permission */
        P9_DMWRITE      = 0x2,          /* mode bit for write permission */
        P9_DMREAD       = 0x4,          /* mode bit for read permission */

#define P9_DMDIR        0x80000000      /* mode bit for directories */
#define P9_DMAPPEND     0x40000000      /* mode bit for append only files */
#define P9_DMEXCL       0x20000000      /* mode bit for exclusive use files */
#define P9_DMMOUNT      0x10000000      /* mode bit for mounted channel */
#define P9_DMAUTH       0x08000000      /* mode bit for authentication file */
#define P9_DMTMP        0x04000000      /* mode bit for non-backed-up file */
#define P9_DMSYMLINK    0x02000000      /* mode bit for symbolic link (Unix, 9P2000.u) */
#define P9_DMDEVICE     0x00800000      /* mode bit for device file (Unix, 9P2000.u) */
#define P9_DMNAMEDPIPE  0x00200000      /* mode bit for named pipe (Unix, 9P2000.u) */
#define P9_DMSOCKET     0x00100000      /* mode bit for socket (Unix, 9P2000.u) */
#define P9_DMSETUID     0x00080000      /* mode bit for setuid (Unix, 9P2000.u) */
#define P9_DMSETGID     0x00040000      /* mode bit for setgid (Unix, 9P2000.u) */



The path of the file to stat.


An open file descriptor to stat.


Stats the file at path or pointed to by fid.


Returns an IxpStat structure, which must be freed by the caller with free(3).