Date: Wed, 22 May 2019 04:00:14 +0000 (UTC) From: Johannes Lundberg <johalun@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348086 - stable/12/sys/compat/linuxkpi/common/include/linux Message-ID: <201905220400.x4M40Es1046959@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: johalun Date: Wed May 22 04:00:13 2019 New Revision: 348086 URL: https://svnweb.freebsd.org/changeset/base/348086 Log: MFC r347626: LinuxKPI: Add helper macros IS_ALIGNED and DIV_ROUND_DOWN_ULL. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Wed May 22 03:58:41 2019 (r348085) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Wed May 22 04:00:13 2019 (r348086) @@ -130,9 +130,14 @@ #define ALIGN(x, y) roundup2((x), (y)) #undef PTR_ALIGN #define PTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), (a))) +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 +/* Moved from linuxkpi_gplv2 */ +#define IS_ALIGNED(x, a) (((x) & ((__typeof(x))(a) - 1)) == 0) +#endif #define DIV_ROUND_UP(x, n) howmany(x, n) #define __KERNEL_DIV_ROUND_UP(x, n) howmany(x, n) #define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n)) +#define DIV_ROUND_DOWN_ULL(x, n) (((unsigned long long)(x) / (n)) * (n)) #define FIELD_SIZEOF(t, f) sizeof(((t *)0)->f) #define printk(...) printf(__VA_ARGS__)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905220400.x4M40Es1046959>