git: cabe7f05fa0d - stable/11 - MFC r368406: Prefer using the MIN() function macro over the min() inline function in the LinuxKPI. Linux defines min() to be a macro, while in FreeBSD min() is a static inline function clamping its arguments to "unsigned int".

Hans Petter Selasky hselasky at FreeBSD.org
Mon Dec 28 13:22:02 UTC 2020


The branch stable/11 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=cabe7f05fa0d7e6c65c2ed2836e66b2237647de8

commit cabe7f05fa0d7e6c65c2ed2836e66b2237647de8
Author:     Hans Petter Selasky <hselasky at FreeBSD.org>
AuthorDate: 2020-12-07 09:48:06 +0000
Commit:     Hans Petter Selasky <hselasky at FreeBSD.org>
CommitDate: 2020-12-28 13:21:05 +0000

    MFC r368406:
    Prefer using the MIN() function macro over the min() inline function
    in the LinuxKPI. Linux defines min() to be a macro, while in FreeBSD
    min() is a static inline function clamping its arguments to
    "unsigned int".
    
    Sponsored by:   Mellanox Technologies // NVIDIA Networking
---
 sys/compat/linuxkpi/common/include/linux/bitops.h      | 2 +-
 sys/compat/linuxkpi/common/include/linux/scatterlist.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h
index f3c62596bcf5..f93c6e002247 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitops.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitops.h
@@ -357,7 +357,7 @@ linux_reg_op(unsigned long *bitmap, int pos, int order, int reg_op)
         index = pos / BITS_PER_LONG;
         offset = pos - (index * BITS_PER_LONG);
         nlongs_reg = BITS_TO_LONGS(nbits_reg);
-        nbitsinlong = min(nbits_reg,  BITS_PER_LONG);
+        nbitsinlong = MIN(nbits_reg,  BITS_PER_LONG);
 
         mask = (1UL << (nbitsinlong - 1));
         mask += mask - 1;
diff --git a/sys/compat/linuxkpi/common/include/linux/scatterlist.h b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
index 2531bbb42c73..8a7a38351331 100644
--- a/sys/compat/linuxkpi/common/include/linux/scatterlist.h
+++ b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
@@ -341,7 +341,7 @@ __sg_alloc_table_from_pages(struct sg_table *sgt,
 		}
 
 		seg_size = ((j - cur) << PAGE_SHIFT) - off;
-		sg_set_page(s, pages[cur], min(size, seg_size), off);
+		sg_set_page(s, pages[cur], MIN(size, seg_size), off);
 		size -= seg_size;
 		off = 0;
 		cur = j;


More information about the dev-commits-src-all mailing list