• Jacob Keller's avatar
    devlink: report error once U32_MAX snapshot ids have been used · 7ef19d3b
    Jacob Keller authored
    The devlink_snapshot_id_get() function returns a snapshot id. The
    snapshot id is a u32, so there is no way to indicate an error code.
    
    A future change is going to possibly add additional cases where this
    function could fail. Refactor the function to return the snapshot id in
    an argument, so that it can return zero or an error value.
    
    This ensures that snapshot ids cannot be confused with error values, and
    aids in the future refactor of snapshot id allocation management.
    
    Because there is no current way to release previously used snapshot ids,
    add a simple check ensuring that an error is reported in case the
    snapshot_id would over flow.
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7ef19d3b
devlink.h 36.9 KB