]> www.infradead.org Git - users/dhowells/kafs-utils.git/commit
Implement "bos getlog" and reengineer the decode path somewhat
authorDavid Howells <dhowells@redhat.com>
Thu, 1 May 2014 14:53:03 +0000 (15:53 +0100)
committerDavid Howells <dhowells@redhat.com>
Thu, 1 May 2014 14:53:03 +0000 (15:53 +0100)
commite2f47f1249a35d24ddc7f14e8e68ae3cbd9a032f
tree61fc1ec90a74cee51cccc04b7003465f01c517f2
parente8f9ef422303b6366ba21774f10ed8a10d51b78b
Implement "bos getlog" and reengineer the decode path somewhat

Implement the "bos getlog" subcommand - which requires making the receive side
of split RPC function work.  To this end, the following reengineering has been
done to the decode side:

 (1) Lift the requirement that the Rx buffer cursor be 4-byte aligned as
     BOZO.GetLog() doesn't align the log data it returns.

 (2) Permit a request for an unknown - and possibly zero - amount of data to be
     set in call->need_size.  BOZO.GetLog() doesn't tell you in advance how
     much data it will return: the data stops when the Rx receive phase ends
     with LAST_PACKET being flagged.

 (3) Separate blob decoding (strings & opaques) from bulk decoding in the
     member variables of the rx_call struct, where a bulk decode is now a
     sequence of blobs, structs or ints.

 (4) Handle blob decoding asynchronously, where the buffer into which a blob is
     being written may not represent contiguous memory.  This is done by
     setting up with an init function, called once, and a decode-into function,
     called repeatedly whilst it returns 1.  The function is only called when
     there is sufficient data in the receive buffers.

 (5) Decode padding asynchronously by working out up front for a blob how much
     padding it requires and then decoding it as its own blob at the end using
     a special source buffer as a marker to switch processing.

 (6) Perform split reception by adding additional states within the decode
     state machine to call out to the handler functions.

The receive() method of the split_handler class provided to a split RPC
function then implements its own state machine on top of the decoder state
machine.

Further:

 (*) rxrpc_recv_data() now reports ENODATA rather than EMSGSIZE if the receive
     phase ends with short data.

 (*) MSG_MORE handling has separate rx_call struct members for the send and
     receive phase now to avoid confusion.

 (*) rxrpc_enc/dec_slow() now use rxrpc_enc/dec_blob() to avoid duplicating a
     lot of code.

 (*) rxrpc_enc/dec() now also go to the slow path if the cursor is misaligned,
     which may mean the data to be read is split across buffers.

 (*) The rx_call struct now has a pointer to a cleanup function to clean up the
     decoder state at the end to deal with aborted calls.

 (*) rxrpc_post_dec() reduces call->need_size as well as call->data_count as we
     don't want to be waiting for N bytes to turn up for a size-N blob if we
     have already received N-1 bytes of it and only need one more byte.

     This does mean that call->need_size may need resetting more often.

 (*) Added an output_raw() python output method to permit bytearray objects to
     be printed.  Conversion to a string means that control characters and
     quotes get escaped (eg. a newline char gets converted to \n).

 (*) Catching the SystemExit exception should not produce an error due to ret
     not existing as a variable.

Signed-off-by: David Howells <dhowells@redhat.com>
13 files changed:
af_rxrpc.c
py_rxgen.c
py_rxgen.h
py_rxsplit.c
rxgen.h
rxgen/emit_c_sync_funcs.pm
rxgen/emit_py_module.pm
rxgen/emit_py_sync_funcs.pm
rxgen/rxgen.pl
suite/commands/bos/getlog.py [new file with mode: 0644]
suite/commands/bos/install.py
suite/lib/output.py
suite/main.py