1*e674e58bSozaki-r /* $NetBSD: nineproto.h,v 1.2 2019/05/17 08:48:04 ozaki-r Exp $ */ 2e73a712fSpooka 3e73a712fSpooka /* 4e73a712fSpooka * Copyright (c) 2007 Antti Kantee. All Rights Reserved. 5e73a712fSpooka * 6e73a712fSpooka * Redistribution and use in source and binary forms, with or without 7e73a712fSpooka * modification, are permitted provided that the following conditions 8e73a712fSpooka * are met: 9e73a712fSpooka * 1. Redistributions of source code must retain the above copyright 10e73a712fSpooka * notice, this list of conditions and the following disclaimer. 11e73a712fSpooka * 2. Redistributions in binary form must reproduce the above copyright 12e73a712fSpooka * notice, this list of conditions and the following disclaimer in the 13e73a712fSpooka * documentation and/or other materials provided with the distribution. 14e73a712fSpooka * 15e73a712fSpooka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 16e73a712fSpooka * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17e73a712fSpooka * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18e73a712fSpooka * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19e73a712fSpooka * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20e73a712fSpooka * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21e73a712fSpooka * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22e73a712fSpooka * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23e73a712fSpooka * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24e73a712fSpooka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25e73a712fSpooka * SUCH DAMAGE. 26e73a712fSpooka */ 27e73a712fSpooka 28e73a712fSpooka #ifndef PUFFS9P_9PROTO_H_ 29e73a712fSpooka #define PUFFS9P_9PROTO_H_ 30e73a712fSpooka 31e73a712fSpooka #include <stdint.h> 32e73a712fSpooka 33*e674e58bSozaki-r #define P9PROTO_VERSION 0 34*e674e58bSozaki-r #define P9PROTO_VERSION_U 1 35*e674e58bSozaki-r 36*e674e58bSozaki-r #define P9PROTO_VERSTR "9P2000" 37*e674e58bSozaki-r #define P9PROTO_VERSTR_U "9P2000.u" 38*e674e58bSozaki-r #define P9PROTO_VERSTR_MAXLEN (sizeof(P9PROTO_VERSTR_U)) 39e73a712fSpooka 40e73a712fSpooka #define P9PROTO_T_VERSION 100 41e73a712fSpooka #define P9PROTO_R_VERSION 101 42e73a712fSpooka #define P9PROTO_T_AUTH 102 43e73a712fSpooka #define P9PROTO_R_AUTH 103 44e73a712fSpooka #define P9PROTO_T_ATTACH 104 45e73a712fSpooka #define P9PROTO_R_ATTACH 105 46e73a712fSpooka #define P9PROTO_T_ERROR 106 47e73a712fSpooka #define P9PROTO_R_ERROR 107 48e73a712fSpooka #define P9PROTO_T_FLUSH 108 49e73a712fSpooka #define P9PROTO_R_FLUSH 109 50e73a712fSpooka #define P9PROTO_T_WALK 110 51e73a712fSpooka #define P9PROTO_R_WALK 111 52e73a712fSpooka #define P9PROTO_T_OPEN 112 53e73a712fSpooka #define P9PROTO_R_OPEN 113 54e73a712fSpooka #define P9PROTO_T_CREATE 114 55e73a712fSpooka #define P9PROTO_R_CREATE 115 56e73a712fSpooka #define P9PROTO_T_READ 116 57e73a712fSpooka #define P9PROTO_R_READ 117 58e73a712fSpooka #define P9PROTO_T_WRITE 118 59e73a712fSpooka #define P9PROTO_R_WRITE 119 60e73a712fSpooka #define P9PROTO_T_CLUNK 120 61e73a712fSpooka #define P9PROTO_R_CLUNK 121 62e73a712fSpooka #define P9PROTO_T_REMOVE 122 63e73a712fSpooka #define P9PROTO_R_REMOVE 123 64e73a712fSpooka #define P9PROTO_T_STAT 124 65e73a712fSpooka #define P9PROTO_R_STAT 125 66e73a712fSpooka #define P9PROTO_T_WSTAT 126 67e73a712fSpooka #define P9PROTO_R_WSTAT 127 68e73a712fSpooka #define P9PROTO_MIN 9PROTO_T_VERSION 69e73a712fSpooka #define P9PROTO_MAX 9PROTO_R_MAX 70e73a712fSpooka 71e73a712fSpooka #define P9PROTO_NOFID (uint32_t)~0 72e73a712fSpooka #define P9PROTO_NOTAG (uint16_t)~0 73e73a712fSpooka 74*e674e58bSozaki-r #define P9PROTO_NUNAME_UNSPECIFIED (uint16_t)~0 75*e674e58bSozaki-r 76e73a712fSpooka /* type field in a qid */ 77e73a712fSpooka #define P9PROTO_QID_TYPE_DIR 0x80 78e73a712fSpooka #define P9PROTO_QID_TYPE_APPEND 0x40 79e73a712fSpooka #define P9PROTO_QID_TYPE_EXCL 0x20 80e73a712fSpooka #define P9PROTO_QID_TYPE_MOUNT 0x10 81e73a712fSpooka #define P9PROTO_QID_TYPE_AUTH 0x08 82*e674e58bSozaki-r /* P92000.u extensions */ 83*e674e58bSozaki-r #define P9PROTO_QID_TYPE_TMP 0x04 84*e674e58bSozaki-r #define P9PROTO_QID_TYPE_LINK 0x02 85*e674e58bSozaki-r #define P9PROTO_QID_TYPE_FILE 0x00 86e73a712fSpooka 87e73a712fSpooka /* mode in open */ 88e73a712fSpooka #define P9PROTO_OMODE_READ 0x00 89e73a712fSpooka #define P9PROTO_OMODE_WRITE 0x01 90e73a712fSpooka #define P9PROTO_OMODE_RDWR 0x02 91e73a712fSpooka #define P9PROTO_OMODE_EXEC 0x03 92e73a712fSpooka #define P9PROTO_OMODE_TRUNC 0x10 93e73a712fSpooka #define P9PROTO_OMODE_RMCLOSE 0x40 94e73a712fSpooka 95e73a712fSpooka /* for creating directories */ 96e73a712fSpooka #define P9PROTO_CPERM_DIR 0x80000000 97*e674e58bSozaki-r #define P9PROTO_CPERM_APPEND 0x40000000 98*e674e58bSozaki-r #define P9PROTO_CPERM_EXCL 0x20000000 99*e674e58bSozaki-r #define P9PROTO_CPERM_MOUNT 0x10000000 100*e674e58bSozaki-r #define P9PROTO_CPERM_AUTH 0x08000000 101*e674e58bSozaki-r #define P9PROTO_CPERM_TMP 0x04000000 102*e674e58bSozaki-r #define P9PROTO_CPERM_SYMLINK 0x02000000 103*e674e58bSozaki-r /* P92000.u extensions */ 104*e674e58bSozaki-r #define P9PROTO_CPERM_DEVICE 0x00800000 105*e674e58bSozaki-r #define P9PROTO_CPERM_NAMEDPIPE 0x00200000 106*e674e58bSozaki-r #define P9PROTO_CPERM_SOCKET 0x00100000 107*e674e58bSozaki-r #define P9PROTO_CPERM_SETUID 0x00080000 108*e674e58bSozaki-r #define P9PROTO_CPERM_SETGID 0x00040000 109e73a712fSpooka 110e73a712fSpooka /* stat non-values */ 111e73a712fSpooka #define P9PROTO_STAT_NOVAL1 (uint8_t)~0 112e73a712fSpooka #define P9PROTO_STAT_NOVAL2 (uint16_t)~0 113e73a712fSpooka #define P9PROTO_STAT_NOVAL4 (uint32_t)~0 114e73a712fSpooka #define P9PROTO_STAT_NOVAL8 (uint64_t)~0 115*e674e58bSozaki-r #define P9PROTO_STAT_NOSTR "" 116e73a712fSpooka 117e73a712fSpooka #endif /* PUFFS9P_PROTO_H_ */ 118