• Martijn Coenen's avatar
    binder: Add support for scatter-gather · 7980240b
    Martijn Coenen authored
    Previously all data passed over binder needed
    to be serialized, with the exception of Binder
    objects and file descriptors.
    
    This patchs adds support for scatter-gathering raw
    memory buffers into a binder transaction, avoiding
    the need to first serialize them into a Parcel.
    
    To remain backwards compatibile with existing
    binder clients, it introduces two new command
    ioctls for this purpose - BC_TRANSACTION_SG and
    BC_REPLY_SG. These commands may only be used with
    the new binder_transaction_data_sg structure,
    which adds a field for the total size of the
    buffers we are scatter-gathering.
    
    Because memory buffers may contain pointers to
    other buffers, we allow callers to specify
    a parent buffer and an offset into it, to indicate
    this is a location pointing to the buffer that
    we are fixing up. The kernel will then take care
    of fixing up the pointer to that buffer as well.
    
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Martijn Coenen <maco@google.com>
    Cc: Arve Hjønnevåg <arve@android.com>
    Cc: Amit Pundir <amit.pundir@linaro.org>
    Cc: Serban Constantinescu <serban.constantinescu@arm.com>
    Cc: Dmitry Shmidt <dimitrysh@google.com>
    Cc: Rom Lemarchand <romlem@google.com>
    Cc: Android Kernel Team <kernel-team@android.com>
    Signed-off-by: default avatarMartijn Coenen <maco@google.com>
    [jstultz: Fold in small fix from Amit Pundir <amit.pundir@linaro.org>]
    Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    7980240b
binder.c 114 KB