From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A240DC7618F for ; Tue, 16 Jul 2019 15:11:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 822012173B for ; Tue, 16 Jul 2019 15:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733302AbfGPPLg (ORCPT ); Tue, 16 Jul 2019 11:11:36 -0400 Received: from verein.lst.de ([213.95.11.211]:42469 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728384AbfGPPLg (ORCPT ); Tue, 16 Jul 2019 11:11:36 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id B3D41227A81; Tue, 16 Jul 2019 17:11:33 +0200 (CEST) Date: Tue, 16 Jul 2019 17:11:33 +0200 From: Christoph Hellwig To: Andy Shevchenko Cc: Chris Mason , Josef Bacik , David Sterba , Lu Fengqi , linux-btrfs@vger.kernel.org, Christoph Hellwig , David Sterba Subject: Re: [PATCH v2 1/3] uuid: Add inline helpers to operate on raw buffers Message-ID: <20190716151133.GA6073@lst.de> References: <20190716150418.84018-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190716150418.84018-1-andriy.shevchenko@linux.intel.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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.