From: David Howells Date: Wed, 7 Feb 2018 06:55:16 +0000 (+0000) Subject: Add VOLSER.GetSize and uint64_t xdr support X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fpythonify;p=users%2Fdhowells%2Fkafs-utils.git Add VOLSER.GetSize and uint64_t xdr support Add the VOLSER.GetSize RPC operation and add the uint64_t encode/decode support to rxgen. Signed-off-by: David Howells --- diff --git a/kafs/rpc-api/volumeserver.xg b/kafs/rpc-api/volumeserver.xg index 2e4dc9d..2a96c4a 100644 --- a/kafs/rpc-api/volumeserver.xg +++ b/kafs/rpc-api/volumeserver.xg @@ -78,6 +78,7 @@ const VOLXLISTONEVOL = 125; const VOLSETINFO = 126; const VOLXLISTPARTITIONS= 127; const VOLFORWARDMULTIPLE= 128; +const VOLGETSIZE = 65537; const PARTVALID = 0x01; const VOK = 0x02; @@ -385,3 +386,12 @@ ForwardMultiple(IN int32_t fromTrans, IN uint32_t spare0, IN restoreCookie *cookie, OUT multi_results *results) = VOLFORWARDMULTIPLE; + +struct volintSize { + uint64_t dump_size; +}; +GetSize( + IN int32_t fromTrans, + IN int32_t fromDate, + OUT volintSize *size +) = VOLGETSIZE; diff --git a/rxgen/emit_c_struct.py b/rxgen/emit_c_struct.py index 1bb071b..5040b5d 100644 --- a/rxgen/emit_c_struct.py +++ b/rxgen/emit_c_struct.py @@ -67,6 +67,9 @@ def emit_struct_encdec(o, struct): o.where(struct.name + "::" + m.name) if m.is_single_int32(): o.rxsrc("\trxrpc_enc(call, p->", m.name, ");\n") + elif m.is_single_int64(): + o.rxsrc("\trxrpc_enc(call, p->", m.name, " >> 32);\n") + o.rxsrc("\trxrpc_enc(call, (uint32_t)p->", m.name, ");\n") elif m.is_single_struct(): o.rxsrc("\trxgen_encode_", m.ty.name, "(call, &p->", m.name, ");\n") elif m.is_array(): @@ -100,6 +103,9 @@ def emit_struct_encdec(o, struct): o.where(struct.name + "::" + m.name) if m.is_single_int32(): o.rxsrc("\tp->", m.name, " = rxrpc_dec(call);\n") + elif m.is_single_int64(): + o.rxsrc("\tp->", m.name, " = (uint64_t)rxrpc_dec(call) << 32;\n") + o.rxsrc("\tp->", m.name, " |= (uint64_t)rxrpc_dec(call);\n") elif m.is_single_struct(): o.rxsrc("\trxgen_decode_", m.ty.name, "(call, &p->", m.name, ");\n") elif m.is_array(): diff --git a/rxgen/rxgen_bits.py b/rxgen/rxgen_bits.py index 9e0f548..7ed30b0 100644 --- a/rxgen/rxgen_bits.py +++ b/rxgen/rxgen_bits.py @@ -142,15 +142,15 @@ class xdr_context: elif name in self.typedefs: typespec = self.typedefs[name].typespec else: - raise RuntimeError("Undefined type requested" + name); + raise RuntimeError("Undefined type requested '" + name + "'"); if not isinstance(typespec, xdr_type): - raise TypeError("Retrieved type object is not xdr_type" + name + str(typespec)); + raise TypeError("Retrieved type object is not xdr_type " + name + str(typespec)); typespec.referenced = True return typespec def add_proc(self, proc): if not isinstance(proc, xdr_proc): - raise KeyError("proc is not an xdr_proc", name, proc); + raise KeyError("proc is not an xdr_proc ", name, proc); name = proc.name if name in self.func_names: self.error("Proc {:s} already exists".format(name))