lkml.org 
[lkml]   [2017]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v1 1/8] lib/uuid: Introduce uuid_{be|le}_cmp_p{p}() helpers
    Date
    New helpers take pointers to uuid_{be|le} as parameters.

    When using them on a raw data we don't need to do an ugly dereference
    and, in some cases, a type casting.

    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Liam Girdwood <lgirdwood@gmail.com>
    Cc: Mark Brown <broonie@kernel.org>
    Cc: Vinod Koul <vinod.koul@intel.com>
    Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
    Cc: Kirti Wankhede <kwankhede@nvidia.com>
    Cc: Alex Williamson <alex.williamson@redhat.com>
    Cc: "K. Y. Srinivasan" <kys@microsoft.com>
    Cc: Haiyang Zhang <haiyangz@microsoft.com>
    Cc: Stephen Hemminger <sthemmin@microsoft.com>
    Cc: Tomas Winkler <tomas.winkler@intel.com>
    Cc: Matt Fleming <matt@codeblueprint.co.uk>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    ---
    include/linux/uuid.h | 20 ++++++++++++++++++++
    1 file changed, 20 insertions(+)

    diff --git a/include/linux/uuid.h b/include/linux/uuid.h
    index 4dff73a89758..45312cb5ac65 100644
    --- a/include/linux/uuid.h
    +++ b/include/linux/uuid.h
    @@ -58,6 +58,26 @@ static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
    return memcmp(&u1, &u2, sizeof(uuid_be));
    }

    +static inline int uuid_le_cmp_p(const uuid_le *pu1, const uuid_le u2)
    +{
    + return memcmp(pu1, &u2, sizeof(uuid_le));
    +}
    +
    +static inline int uuid_be_cmp_p(const uuid_be *pu1, const uuid_be u2)
    +{
    + return memcmp(pu1, &u2, sizeof(uuid_be));
    +}
    +
    +static inline int uuid_le_cmp_pp(const uuid_le *pu1, const uuid_le *pu2)
    +{
    + return memcmp(pu1, pu2, sizeof(uuid_le));
    +}
    +
    +static inline int uuid_be_cmp_pp(const uuid_be *pu1, const uuid_be *pu2)
    +{
    + return memcmp(pu1, pu2, sizeof(uuid_be));
    +}
    +
    void generate_random_uuid(unsigned char uuid[16]);

    extern void uuid_le_gen(uuid_le *u);
    --
    2.11.0
    \
     
     \ /
      Last update: 2017-04-21 19:08    [W:2.766 / U:0.056 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site