public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	Lu Fengqi <lufq.fnst@cn.fujitsu.com>,
	linux-btrfs@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	David Sterba <dsterba@suse.cz>
Subject: Re: [PATCH v2 1/3] uuid: Add inline helpers to operate on raw buffers
Date: Tue, 16 Jul 2019 17:11:33 +0200	[thread overview]
Message-ID: <20190716151133.GA6073@lst.de> (raw)
In-Reply-To: <20190716150418.84018-1-andriy.shevchenko@linux.intel.com>

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.

  parent reply	other threads:[~2019-07-16 15:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 15:04 [PATCH v2 1/3] uuid: Add inline helpers to operate on raw buffers Andy Shevchenko
2019-07-16 15:04 ` [PATCH v2 2/3] Btrfs: Switch to use new generic UUID API Andy Shevchenko
2019-07-16 15:04 ` [PATCH v2 3/3] uuid: Remove no more needed macro Andy Shevchenko
2019-07-16 15:11 ` Christoph Hellwig [this message]
2019-07-16 15:22   ` [PATCH v2 1/3] uuid: Add inline helpers to operate on raw buffers Andy Shevchenko
2019-07-17 15:37     ` David Sterba
2019-07-17 15:53       ` Andy Shevchenko
2019-07-18  5:39       ` Christoph Hellwig
2019-07-18 17:52         ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190716151133.GA6073@lst.de \
    --to=hch@lst.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lufq.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox