• G
    tests: virtio-9p: add version operation test · 6cc9906b
    Greg Kurz 提交于
    This patch lays the foundations to be able to test 9P operations and
    provides a test for the version operation as a first example.
    
    A 9P request is composed of a T-message sent by the client (guest) to the
    server (QEMU), and a R-message sent by the server back to the client.
    
    The following general calls are available to implement requests for any
    9P operations:
    
    v9fs_req_init(): allocates the request structure and the guest memory for
                     the T-message
    
    v9fs_req_send(): allocates the guest memory for the R-message and sends the
                     T-message to QEMU
    
    v9fs_req_recv(): waits for QEMU to answer and does some sanity checks on the
                     returned R-message header
    
    v9fs_req_free(): releases the guest memory and the request structure
    
    Helpers are provided, to be used by each specific 9P operation to copy data
    to/from the guest memory.
    
    The version operation is used to negotiate the 9P protocol version to be
    used and the maximum buffer size for exchanged data. It is necessarily
    the first message of a 9P session. For simplicity, the maximum buffer size
    is hardcoded to 4k, which should be enough for functional tests.
    
    The test simply advertises the "9P2000.L" version to QEMU and expects QEMU
    to answer it is supported.
    
    References:
    
    http://man.cat-v.org/plan_9/5/intro
    http://man.cat-v.org/plan_9/5/versionSigned-off-by: NGreg Kurz <groug@kaod.org>
    6cc9906b
virtio-9p-test.c 8.4 KB