]> www.infradead.org Git - users/dhowells/kafs-utils.git/commitdiff
Add VOLSER.GetSize and uint64_t xdr support pythonify
authorDavid Howells <dhowells@redhat.com>
Wed, 7 Feb 2018 06:55:16 +0000 (06:55 +0000)
committerDavid Howells <dhowells@redhat.com>
Tue, 13 Feb 2018 10:20:41 +0000 (10:20 +0000)
Add the VOLSER.GetSize RPC operation and add the uint64_t encode/decode
support to rxgen.

Signed-off-by: David Howells <dhowells@redhat.com>
kafs/rpc-api/volumeserver.xg
rxgen/emit_c_struct.py
rxgen/rxgen_bits.py

index 2e4dc9dd3e6de05ac7f439914d6085afa294b588..2a96c4ad7328c88cfa083677bcbfd53491e26a6a 100644 (file)
@@ -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;
index 1bb071bde91a7023ec37c6cd99bcccbd8d378db9..5040b5de0df49fb955ca110ae32abcf9b084718e 100644 (file)
@@ -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():
index 9e0f548553bb4788b5ec54b0a776d440f4236c23..7ed30b032d33213fa60880549901861f69c8cb99 100644 (file)
@@ -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))