From nobody Mon Sep 15 19:11:16 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cQZPx2J8Pz67sm3; Mon, 15 Sep 2025 19:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cQZPx0Df3z4Fnw; Mon, 15 Sep 2025 19:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757963477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7+wsrIQsuDCL9ZeCZPzMvZ+6FVfO5032a1QDl4BYnfc=; b=KDhq+cdR7iwm1gRpsCIvRp56Ff3UgqbiDqjDXDQB9PA0aJHO4gRLOwEwSl7hWVf51LYAuX XtfW7zV1Vnv9/xtQ+ID0fjxZNCxH3se+qGPVRvPFC1pDSiOy6AQOv8a/bile9IL0wji6zx GMbxe53f20D2eiGuAK6dpiCeYyXY9gjaUS5ACNQbh3+07fOCcYkqcLeczwUo8GimnUJkEL VZ7k2XMd9n3BvHBFMsZTRYEzrfxGOfOL2hhZlbHLVjZaXL8KFsQ62FfnLFzFpcOugguVWH kFzOft6YaxUeMikqDHOJSa2DfSCfYs43Y6CtMLfCxqj0E9fMF5Ql7NuljAetiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757963477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7+wsrIQsuDCL9ZeCZPzMvZ+6FVfO5032a1QDl4BYnfc=; b=iLsv8jrLrUv+gE9glBa/iwnlWYt6ky99gRf4iIZBuDLdzZlWG9yM5CMluWo0W0/TBznPhe wAxpRN5tgtlE/vM5lv5LTzK3dY8LPF5D7efUK0p5coONYEK7xqyFFVey3CQbYi1CPOtmHJ OtJUtzgxmX27Sj9pWkVM9LIOaxJ/5wYdvzrbHDdGx7ypqalhBMdzACIcaLbBDxBxfJf4cX ZOkSZdUSZ9xhEIpO5xHuUMEe+/a4STp+UhwSmg8Gtgi4Ekfl/8e82W0XeuCf1fYnsVSSHn Du6Mv9P8YrVvKSIdJ3Oh0HZZm5dgp9Pi7ZsvjB1nGKhqVf0kbAWsiiNl7lMcFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757963477; a=rsa-sha256; cv=none; b=V19WsWf8mwufwvkMS4RXNmJ7je5C/QRY9I7e5FFpVXNyMUQrPD4RTtpD+8WBUFsU8Dr8uB q8xjgS8/dYFkvowwz42nYtrl4gI/RBLDokXDJqQZTA9ZvAZ2nEAxyc5CBeL7ViMhRWKCTp soj5abuE6NF0S+5uJxaK1Mm7/HP4y/bw5EmNtGEk+CFOqbPUWz5D4Ky2ymjiF+K/QpyVOx qgHAVQjyAKMEyBbsm7Z3ahq3bkgAMJY/5UHUBA66QOA5KhcYv7/vn5jiq6SUPk0jBPGm8p 7tEJbKo5emwI0rSn+PqpIQlW7EBnK0JbzKVYMPnwbJwXKc4jmDqX2pYAmdld4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cQZPw6n4Qz16dy; Mon, 15 Sep 2025 19:11:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58FJBG35049957; Mon, 15 Sep 2025 19:11:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58FJBGNI049954; Mon, 15 Sep 2025 19:11:16 GMT (envelope-from git) Date: Mon, 15 Sep 2025 19:11:16 GMT Message-Id: <202509151911.58FJBGNI049954@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 310885b40ad2 - stable/15 - LinuxKPI: add __struct_size List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 310885b40ad256b054d65353c375b29700ee024c Auto-Submitted: auto-generated The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=310885b40ad256b054d65353c375b29700ee024c commit 310885b40ad256b054d65353c375b29700ee024c Author: Bjoern A. Zeeb AuthorDate: 2025-08-18 19:53:55 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-09-15 14:52:36 +0000 LinuxKPI: add __struct_size Use __builtin_object_size() by default. If __builtin_dynamic_object_size() is available use that instead. I would hope that in a future version we can remove the conditional checks but in order to be able to MFC this without checking all compiler versions simply keep it this way for now. Sponsored by: The FreeBSD Foundation (initially) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52077 (cherry picked from commit ff5bcb742899f8398ccb1b9e292b2e5aeeb7fedb) --- sys/compat/linuxkpi/common/include/linux/compiler.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h index fb5ad3bf4fe4..948396144ad6 100644 --- a/sys/compat/linuxkpi/common/include/linux/compiler.h +++ b/sys/compat/linuxkpi/common/include/linux/compiler.h @@ -130,4 +130,10 @@ #define is_signed_type(t) ((t)-1 < (t)1) #define is_unsigned_type(t) ((t)-1 > (t)1) +#if __has_builtin(__builtin_dynamic_object_size) +#define __struct_size(_s) __builtin_dynamic_object_size(_s, 0) +#else +#define __struct_size(_s) __builtin_object_size(_s, 0) +#endif + #endif /* _LINUXKPI_LINUX_COMPILER_H_ */