From a492c4a31f1c8b2a0d58e24ab957ef3c8f9edfd2 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 28 Mar 2025 10:03:44 -0600 Subject: lib9p: idl: Touch up the *.9p files --- lib9p/idl/2002-9P2000.9p | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib9p/idl/2002-9P2000.9p') diff --git a/lib9p/idl/2002-9P2000.9p b/lib9p/idl/2002-9P2000.9p index 2a4f7ed..c569c74 100644 --- a/lib9p/idl/2002-9P2000.9p +++ b/lib9p/idl/2002-9P2000.9p @@ -36,13 +36,13 @@ bitfield dm = 4 "31=DIR" "30=APPEND" "29=EXCL" - # DMMOUNT has been around in Plan 9 forever (CHMOUNT in <4e), + # DMMOUNT has been around in Plan 9 since 2e (CHMOUNT in <4e), # but is undocumented, and is explicitly excluded from the # 9P2000 draft RFC. As I understand it, DMMOUNT indicates # that the file is mounted by the kernel as a 9P transport; # that the kernel has a lock on doing I/O on it, so userspace # can't do I/O on it. - "28=reserved(PLAN9_MOUNT)" + "28=_PLAN9_MOUNT" "27=AUTH" "26=TMP" #... @@ -63,7 +63,7 @@ bitfield qt = 1 "7=DIR" "6=APPEND" "5=EXCL" - "4=reserved(PLAN9_MOUNT)" # See "PLAN9_MOUNT" in "dm" above. + "4=_PLAN9_MOUNT" # See "_PLAN9_MOUNT" in "dm" above. "3=AUTH" # Fun historical fact: QTTMP was a relatively late addition to # Plan 9, in 2003-12. -- cgit v1.2.3-2-g168b From fc462d13cb2f49b4c4745742dfaed994596a54b8 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 28 Mar 2025 11:03:37 -0600 Subject: lib9p: idl: In bitfields, explicitly say "bit" or "alias" --- lib9p/idl/2002-9P2000.9p | 76 ++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'lib9p/idl/2002-9P2000.9p') diff --git a/lib9p/idl/2002-9P2000.9p b/lib9p/idl/2002-9P2000.9p index c569c74..204b352 100644 --- a/lib9p/idl/2002-9P2000.9p +++ b/lib9p/idl/2002-9P2000.9p @@ -33,46 +33,46 @@ struct s = "len[2] len*(utf8[1])" # "D"ir-entry "M"ode - file permissions and attributes bitfield dm = 4 - "31=DIR" - "30=APPEND" - "29=EXCL" + "bit 31=DIR" + "bit 30=APPEND" + "bit 29=EXCL" # DMMOUNT has been around in Plan 9 since 2e (CHMOUNT in <4e), # but is undocumented, and is explicitly excluded from the # 9P2000 draft RFC. As I understand it, DMMOUNT indicates # that the file is mounted by the kernel as a 9P transport; # that the kernel has a lock on doing I/O on it, so userspace # can't do I/O on it. - "28=_PLAN9_MOUNT" - "27=AUTH" - "26=TMP" + "bit 28=_PLAN9_MOUNT" + "bit 27=AUTH" + "bit 26=TMP" #... - "8=OWNER_R" - "7=OWNER_W" - "6=OWNER_X" - "5=GROUP_R" - "4=GROUP_W" - "3=GROUP_X" - "2=OTHER_R" - "1=OTHER_W" - "0=OTHER_X" + "bit 8=OWNER_R" + "bit 7=OWNER_W" + "bit 6=OWNER_X" + "bit 5=GROUP_R" + "bit 4=GROUP_W" + "bit 3=GROUP_X" + "bit 2=OTHER_R" + "bit 1=OTHER_W" + "bit 0=OTHER_X" - "PERM_MASK=0777" # {OWNER,GROUP,OTHER}_{R,W,X} + "alias PERM_MASK=0777" # {OWNER,GROUP,OTHER}_{R,W,X} # QID Type - see `struct qid` below bitfield qt = 1 - "7=DIR" - "6=APPEND" - "5=EXCL" - "4=_PLAN9_MOUNT" # See "_PLAN9_MOUNT" in "dm" above. - "3=AUTH" + "bit 7=DIR" + "bit 6=APPEND" + "bit 5=EXCL" + "bit 4=_PLAN9_MOUNT" # See "_PLAN9_MOUNT" in "dm" above. + "bit 3=AUTH" # Fun historical fact: QTTMP was a relatively late addition to # Plan 9, in 2003-12. - "2=TMP" - #"1=unused" + "bit 2=TMP" + #"bit 1=unused" # "The name QTFILE, defined to be zero, identifies the value # of the type for a plain file." - "FILE=0" + "alias FILE=0" # uni"Q"ue "ID"entification - "two files on the same server hierarchy # are the same if and only if their qids are the same" @@ -107,22 +107,22 @@ struct stat = "stat_size[2,val=end-&kern_type]" # "O"pen flags (flags to pass to Topen and Tcreate) # Unused bits *must* be 0. bitfield o = 1 - "0=subfield(mode)" # low bit of the 2-bit READ/WRITE/RDWR/EXEC enum - "1=subfield(mode)" # high bit of the 2-bit READ/WRITE/RDWR/EXEC enum - #"2=unused" - #"3=unused" - "4=TRUNC" - "5=reserved(CEXEC)" # close-on-exec - "6=RCLOSE" # remove-on-close - #"7=unused" + "bit 0=subfield(mode)" # low bit of the 2-bit READ/WRITE/RDWR/EXEC enum + "bit 1=subfield(mode)" # high bit of the 2-bit READ/WRITE/RDWR/EXEC enum + #"bit 2=unused" + #"bit 3=unused" + "bit 4=TRUNC" + "bit 5=reserved(CEXEC)" # close-on-exec + "bit 6=RCLOSE" # remove-on-close + #"bit 7=unused" - "READ = 0" # make available for this FID: Tread() - "WRITE = 1" # make available for this FID: Twrite() - "RDWR = 2" # make available for this FID: Tread() and Twrite() - "EXEC = 3" # make available for this FID: Tread() + "alias READ = 0" # make available for this FID: Tread() + "alias WRITE = 1" # make available for this FID: Twrite() + "alias RDWR = 2" # make available for this FID: Tread() and Twrite() + "alias EXEC = 3" # make available for this FID: Tread() - "MODE_MASK = 0b00000011" - "FLAG_MASK = 0b11111100" + "alias MODE_MASK = 0b00000011" + "alias FLAG_MASK = 0b11111100" # A 9P2000 session goes: # -- cgit v1.2.3-2-g168b From 9096e2d9cb6f438e49aa29aa2cfaef1717466a05 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 28 Mar 2025 11:31:26 -0600 Subject: lib9p: idl: Rework bitfields, allow full exprs more places --- lib9p/idl/2002-9P2000.9p | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'lib9p/idl/2002-9P2000.9p') diff --git a/lib9p/idl/2002-9P2000.9p b/lib9p/idl/2002-9P2000.9p index 204b352..36a2427 100644 --- a/lib9p/idl/2002-9P2000.9p +++ b/lib9p/idl/2002-9P2000.9p @@ -22,11 +22,11 @@ version "9P2000" # tag - identify a request/response pair num tag = 2 - "NOTAG = ~0" + "NOTAG = u16_max" # file identifier - like a UNIX file-descriptor num fid = 4 - "NOFID = ~0" + "NOFID = u32_max" # string - u16le `n`, then `n` bytes of UTF-8, without any nul-bytes struct s = "len[2] len*(utf8[1])" @@ -56,7 +56,7 @@ bitfield dm = 4 "bit 1=OTHER_W" "bit 0=OTHER_X" - "alias PERM_MASK=0777" # {OWNER,GROUP,OTHER}_{R,W,X} + "mask PERM=0777" # {OWNER,GROUP,OTHER}_{R,W,X} # QID Type - see `struct qid` below bitfield qt = 1 @@ -107,8 +107,8 @@ struct stat = "stat_size[2,val=end-&kern_type]" # "O"pen flags (flags to pass to Topen and Tcreate) # Unused bits *must* be 0. bitfield o = 1 - "bit 0=subfield(mode)" # low bit of the 2-bit READ/WRITE/RDWR/EXEC enum - "bit 1=subfield(mode)" # high bit of the 2-bit READ/WRITE/RDWR/EXEC enum + "bit 0=num(MODE)" # low bit of the 2-bit READ/WRITE/RDWR/EXEC enum + "bit 1=num(MODE)" # high bit of the 2-bit READ/WRITE/RDWR/EXEC enum #"bit 2=unused" #"bit 3=unused" "bit 4=TRUNC" @@ -116,13 +116,12 @@ bitfield o = 1 "bit 6=RCLOSE" # remove-on-close #"bit 7=unused" - "alias READ = 0" # make available for this FID: Tread() - "alias WRITE = 1" # make available for this FID: Twrite() - "alias RDWR = 2" # make available for this FID: Tread() and Twrite() - "alias EXEC = 3" # make available for this FID: Tread() + "num(MODE) READ = 0" # make available for this FID: Tread() + "num(MODE) WRITE = 1" # make available for this FID: Twrite() + "num(MODE) RDWR = 2" # make available for this FID: Tread() and Twrite() + "num(MODE) EXEC = 3" # make available for this FID: Tread() - "alias MODE_MASK = 0b00000011" - "alias FLAG_MASK = 0b11111100" + "mask FLAG = 0b11111100" # A 9P2000 session goes: # -- cgit v1.2.3-2-g168b