Re: [PATCH v2 1/3] uuid: Add inline helpers to operate on raw buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 16, 2019 at 06:04:16PM +0300, Andy Shevchenko wrote:
> +static inline void guid_copy_from_raw(guid_t *dst, const __u8 *src)
> +{
> +	memcpy(dst, (const guid_t *)src, sizeof(guid_t));
> +}
> +
> +static inline void guid_copy_to_raw(__u8 *dst, const guid_t *src)
> +{
> +	memcpy((guid_t *)dst, src, sizeof(guid_t));
> +}

Maybe import_guid/export_guid is a better name?

Either way, I don't think we need the casts, and they probably want
kerneldoc comments describing their use.

Same for the uuid side.

> +static inline void guid_gen_raw(__u8 *guid)
> +{
> +	guid_gen((guid_t *)guid);
> +}
> +
> +static inline void uuid_gen_raw(__u8 *uuid)
> +{
> +	uuid_gen((uuid_t *)uuid);
> +}

I hate this raw naming.  If people really want to use the generators on
u8 fields a cast seems more descriptive then hiding it.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux