summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-07 15:29:21 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-07 15:29:21 -0600
commit28486154a1b3763992548bc085070f3f09e4bf09 (patch)
treeebbe770c7dea2044e9db91275b316b10957716c6
parentb160e07ac1cb13bef89c248c555a00287c7574b9 (diff)
lib9p: add DM_PERM, more newlines in bitfield headers
-rw-r--r--lib9p/9P2000.txt2
-rwxr-xr-xlib9p/9p.gen5
-rw-r--r--lib9p/include/lib9p/9p.generated.h7
3 files changed, 14 insertions, 0 deletions
diff --git a/lib9p/9P2000.txt b/lib9p/9P2000.txt
index 9cdb943..ab898ec 100644
--- a/lib9p/9P2000.txt
+++ b/lib9p/9P2000.txt
@@ -55,6 +55,8 @@ bitfield dm 32
1/OTHER_W
0/OTHER_X
+ PERM=0777 # {OWNER,GROUP,OTHER}_{R,W,X}
+
# QID Type (see qid below)
bitfield qt 8
7/DIR
diff --git a/lib9p/9p.gen b/lib9p/9p.gen
index 4a8e4d1..4dff97d 100755
--- a/lib9p/9p.gen
+++ b/lib9p/9p.gen
@@ -401,11 +401,16 @@ enum {idprefix}version {{
ret += f"typedef uint{bf.static_size*8}_t {c_typename(idprefix, bf)};\n"
names = [
*reversed([bf.bits[n] or f"_UNUSED_{n}" for n in range(0, len(bf.bits))]),
+ "",
*[k for k in bf.names if k not in bf.bits],
]
namewidth = max(len(name) for name in names)
+ ret += "\n"
for name in names:
+ if name == "":
+ ret += "\n"
+ continue
if name.startswith("_"):
cname = f"_{idprefix.upper()}{bf.name.upper()}_{name[1:]}"
else:
diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/include/lib9p/9p.generated.h
index a682908..6d44472 100644
--- a/lib9p/include/lib9p/9p.generated.h
+++ b/lib9p/include/lib9p/9p.generated.h
@@ -21,6 +21,7 @@ const char *lib9p_version_str(enum lib9p_version);
/* non-message types **********************************************************/
typedef uint32_t lib9p_dm_t;
+
#define LIB9P_DM_DIR ((lib9p_dm_t)(1<<31))
#define LIB9P_DM_APPEND ((lib9p_dm_t)(1<<30))
#define LIB9P_DM_EXCL ((lib9p_dm_t)(1<<29))
@@ -54,7 +55,10 @@ typedef uint32_t lib9p_dm_t;
#define LIB9P_DM_OTHER_W ((lib9p_dm_t)(1<<1))
#define LIB9P_DM_OTHER_X ((lib9p_dm_t)(1<<0))
+#define LIB9P_DM_PERM ((lib9p_dm_t)(0777))
+
typedef uint8_t lib9p_qt_t;
+
#define LIB9P_QT_DIR ((lib9p_qt_t)(1<<7))
#define LIB9P_QT_APPEND ((lib9p_qt_t)(1<<6))
#define LIB9P_QT_EXCL ((lib9p_qt_t)(1<<5))
@@ -63,9 +67,11 @@ typedef uint8_t lib9p_qt_t;
#define LIB9P_QT_TMP ((lib9p_qt_t)(1<<2))
#define LIB9P_QT_SYMLINK ((lib9p_qt_t)(1<<1)) /* 9P2000.u */
#define _LIB9P_QT_UNUSED_0 ((lib9p_qt_t)(1<<0))
+
#define LIB9P_QT_FILE ((lib9p_qt_t)(0))
typedef uint8_t lib9p_o_t;
+
#define _LIB9P_O_UNUSED_7 ((lib9p_o_t)(1<<7))
#define LIB9P_O_RCLOSE ((lib9p_o_t)(1<<6))
#define _LIB9P_O_UNUSED_5 ((lib9p_o_t)(1<<5))
@@ -74,6 +80,7 @@ typedef uint8_t lib9p_o_t;
#define _LIB9P_O_UNUSED_2 ((lib9p_o_t)(1<<2))
#define LIB9P_O_rwx_1 ((lib9p_o_t)(1<<1))
#define LIB9P_O_rwx_0 ((lib9p_o_t)(1<<0))
+
#define LIB9P_O_READ ((lib9p_o_t)(0))
#define LIB9P_O_WRITE ((lib9p_o_t)(1))
#define LIB9P_O_RDWR ((lib9p_o_t)(2))