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

Re: [PATCH v3 1/8] common: move a few macros out of xen/lib.h


  • To: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Jul 2023 08:28:29 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6cnti6WBD7BbuSt64XJmyACwwfLUPvuFISE9Wd6tksE=; b=mdM2Ei4JVwF3ULSRo7jmrpDqGtnoX+h5sphynOMg80VZGqGiAOeBxVz5tfgphhKkP3FiuZqiLnpzKsUme1q/mIxuEw9ncdMUgMZDnx7rEq3+GB8D728++sobiQ3Wb00coIhy562ysILhlfNFwvHCVrJb975nHPl+6nhr9hLl6vmSLaNt+HhuPL2Fv4ag9uWRGqeq/9U7ht8xIQgfmvXKK+LE4nd22QsCo/ACLdmT0DQqZfQFPfmSuP3IsD+S/rnjx0OSGtSnILbwWzNum8INtqKTU0zE/37PGSxvNseMtJWCUnwblzvgcTlNI0APeL437NmkBFuwHRop4HSz+4itKQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fT74U3fHwWg0goneAtyBljF+ZgMUpWHOVjWdpJvFfq5oL94HuozhcM0aQLCT8I4PyD+RZI3oyliKjAGseNXNP0DkFrusmtcSo3Y12sIYL2dZ90jg8nDCGMxQzqMRbv4+9j4gcWWdCjvpeJRpyUIVo1ISF9VKL5Qq+L1FtSws62MkRo/wnHRTR33ecfpbn5G0VGkWov8SJlAu2SZsd0m2xF90Q0WFMhdioXSEc2xtmwABHqldiJ/2xUzZQJCBgZ4OZf3U8/X+pJmrKhpeTrAv/RerL/M/2PfC1hGRFknTW3nSACOcDlJUE37gWC/g19q1uZLmVLtEKYFvvJrIlqQu1g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 19 Jul 2023 06:28:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.07.2023 21:49, Shawn Anastasio wrote:
> On 7/10/23 3:51 AM, Jan Beulich wrote:
>> --- /dev/null
>> +++ b/xen/include/xen/macros.h
>> @@ -0,0 +1,34 @@
> 
> Should there be an SPDX header here?

Probably, but I wouldn't know which version to use, since lib.h doesn't
have one either. Not putting one there leaves things a clear or vague
as they are for others without the tag (and without a full license
header); putting one there would firmly state something, which then may
be wrong. Therefore I think this will need sorting in (more or less)
one go for all of the "license-free" source files.

>> +#ifndef __MACROS_H__
>> +#define __MACROS_H__
>> +
>> +#define ROUNDUP(x, a) (((x) + (a) - 1) & ~((a) - 1))
>> +
>> +#define IS_ALIGNED(val, align) (!((val) & ((align) - 1)))
>> +
>> +#define DIV_ROUND(n, d) (((n) + (d) / 2) / (d))
>> +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
>> +
>> +#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
>> +#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
>> +
>> +#define count_args_(dot, a1, a2, a3, a4, a5, a6, a7, a8, x, ...) x
>> +#define count_args(args...) \
>> +    count_args_(., ## args, 8, 7, 6, 5, 4, 3, 2, 1, 0)
>> +
>> +/* Indirect macros required for expanded argument pasting. */
>> +#define PASTE_(a, b) a ## b
>> +#define PASTE(a, b) PASTE_(a, b)
>> +
>> +#define __STR(...) #__VA_ARGS__
>> +#define STR(...) __STR(__VA_ARGS__)
>> +
>> +#endif /* __MACROS_H__ */
>> +
>> +/*
>> + * Local variables:
>> + * mode: C
>> + * c-file-style: "BSD"
>> + * c-basic-offset: 4
>> + * indent-tabs-mode: nil
>> + * End:
>> + */
> 
> Reviewed-by: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>

Thanks.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.