This patch implements TLCREATE for 9p2000.L protocol.
PATCH 1/1 This patch implements TLCREATE for 9p2000.L protocol.
SYNOPSIS
size[4] Tlcreate tag[2] fid[4] name[s] flags[4] mode[4] gid[4]
size[4] Rlcreate tag[2] qid[13] iounit[4]DESCRIPTION
The Tlreate request asks the file server to create a new regular file with the name supplied, in the directory (dir) represented by fid.
The mode argument specifies the permissions to use. New file is created with the uid if the fid and with supplied gid.
The flags argument represent Linux access mode flags with which the caller is requesting to open the file with. Protocol allows all the Linux access modes but it is upto the server to allow/disallow any of these acess modes. If the server doesn't support any of the access mode, it is expected to return error.
To start with we will not restricit/limit any Linux flags on this server. If needed, We can start restricting as we move forward with various use cases.
--- hw/virtio-9p-debug.c | 13 ++++++ hw/virtio-9p.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++--- hw/virtio-9p.h | 13 ++++++ 3 files changed, 119 insertions(+), 7 deletions(-)
hw/virtio-9p-debug.c +13 -0
@@ -462,6 +462,19 @@ void pprint_pdu(V9fsPDU *pdu)pprint_qid (pdu,1 , &offset,"qid" );pprint_int32 (pdu,1 , &offset,", iounit" );break ; +case P9_TLCREATE : +fprintf (llogfile,"TLCREATE: (" ); +pprint_int32 (pdu,0 , &offset,"dfid" ); +pprint_str (pdu,0 , &offset,", name" ); +pprint_int32 (pdu,0 , &offset,", flags" ); +pprint_int32 (pdu,0 , &offset,", mode" ); +pprint_int32 (pdu,0 , &offset,", gid" ); +break ; +case P9_RLCREATE : +fprintf (llogfile,"RLCREATE: (" ); +pprint_qid (pdu,1 , &offset,"qid" ); +pprint_int32 (pdu,1 , &offset,", iounit" ); +break ;case P9_TREAD :fprintf (llogfile,"TREAD: (" );pprint_int32 (pdu,0 , &offset,"fid" );
hw/virtio-9p.c +93 -7
129 lines not on this page · raw message
hw/virtio-9p.h +13 -0
@@ -15,6 +15,8 @@enum {P9_TSTATFS =8 ,P9_RSTATFS , +P9_TLCREATE =14 , +P9_RLCREATE ,P9_TGETATTR =24 ,P9_RGETATTR ,P9_TSETATTR =26 ,
@@ -180,6 +182,17 @@ typedef struct V9fsCreateState {V9fsString fullname; } V9fsCreateState; +typedef struct V9fsLcreateState { +V9fsPDU *pdu; +size_t offset; +V9fsFidState *fidp; +V9fsQID qid; +int32_t iounit; +struct stat stbuf; +V9fsString name; +V9fsString fullname; +}V9fsLcreateState ; + typedef struct V9fsStatState { V9fsPDU *pdu; size_t offset;
Signature · 1 line
1.6.5.2