• Zhu Lingshan's avatar
    scsi: tcmu: add new netlink events helpers · 0e5aee39
    Zhu Lingshan authored
    Add new netlink events helpers tcmu_netlink_event_init() and
    tcmu_netlink_event_send(). These new functions intend to replace
    existing netlink events helper function tcmu_netlink_event().
    
    The existing function tcmu_netlink_event() works well for events like
    TCMU_ADDED_DEVICE and TCMU_REMOVED_DEVICE which only has one netlink
    attribute. But if there is a command requires more than one attributes
    to send out, we have to use a struct to adapt the paremeter
    reconfig_data, it is hard to use one struct or a union in one struct to
    adapt every command with different attributes, it may get long and ugly.
    
    With the new two functions, we can call tcmu_netlink_event_init() to
    initialize a netlink event, then add all attributes we need by using
    nla_put_xxx(), at last use tcmu_netlink_event_send() to send it out. So
    that we don't need to use a long struct or union if we want to send
    mulitple attributes for different commands.
    
    [mkp: typos]
    Signed-off-by: default avatarZhu Lingshan <lszhu@suse.com>
    Acked-by: default avatarMike Christie <mchristi@redhat.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    0e5aee39
target_core_user.c 64.8 KB