Message ID | 20230428-nolibc-reboot-v1-1-0bca02d20ba6@weissschuh.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1035392vqo; Fri, 28 Apr 2023 09:05:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bhWXvStonGvQM+2cuLC06ueEBPtKz4xpDqSshYEeiDevOLdxMmdFtFcCgJNltPFUzAFeG X-Received: by 2002:a17:90a:3843:b0:247:160d:3a8e with SMTP id l3-20020a17090a384300b00247160d3a8emr5593808pjf.22.1682697907361; Fri, 28 Apr 2023 09:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682697907; cv=none; d=google.com; s=arc-20160816; b=IicebjY9FCjJyO2vIoHhq/Sv/M3EFyxsPIpwaSbZKbc8Y2GLXugkCKhOhf9tYEY7ll H76W0wMUIXARSc4y0i6IUNpsqqdEDt3lS0Oi36z7elioEHvOODc8KpFqIfNrq6MewZmW h1mVL+FBStnykjycwtWYRF31LCMI+Jgf5pMVSsTY3JrtFvHLrDGSBg1sDF9e8rOkwV19 2Y6il9WCXqkMJXfUFoskZGmEGwfOMq0qCiR0OPiylgXavPzcL89HtA1MykJ2bd+xN8Qm kQ8/LYo1PnxvNGk6PdwdBcKZ+9RIqhNYVc6KUtnoA4u/BYeTN8UiBfXL+mWeuexWL6oo edUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:dkim-signature:from; bh=kkiT1/vfGILGhs9DDIR8P1bBnbyCXeTqLC69hO30Oqg=; b=H8QI9kOaeclwj0J1D5ggqykL7dMrYtmEwbUdVLDUXNZxfcjHJG7MFHEj7r2PbCCUfP jWOKGndhtNraBEkz0j7Zor8kbXWVHyAXBsTf28fBkCQH2PGy8eY495ypRzj1psAEOpSo k3P3k6Fgrb8f69wxcsQ6O2yil+d66iEtlVO01Oto7WkC+MGOIZHA2GX3KoiQs6OobK0w Okk4f2WEFJIDLs6zdPlYxw2et+6WgloL8kmYzT8kcxyAlKaAiSbFyJxMBI2OgxXdnlPM XPIx8zRKXeAm9lEnf124/Y1f/REoOyqZDYvAty1E1K3bC4RNZr9Eq0CSm4YcohA1h4l8 s43Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=NpAXjKrK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a17090a08cd00b002467062c312si23095962pjn.128.2023.04.28.09.04.35; Fri, 28 Apr 2023 09:05:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=NpAXjKrK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345937AbjD1PwT (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 99 others); Fri, 28 Apr 2023 11:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345900AbjD1PwR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Apr 2023 11:52:17 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F2D2129 for <linux-kernel@vger.kernel.org>; Fri, 28 Apr 2023 08:52:15 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <linux@weissschuh.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1682697131; bh=yA2p+JNjmFfGlYa0wIdrC8Z5YlWh5St1B631YdUOEJc=; h=From:Date:Subject:To:Cc:From; b=NpAXjKrKzJnetymlNBJ8g1xKFOazMwZ5dCBSH/bIsdnew7Gsb+ATyUvK/MEtCDdMZ zhAfxk9hAIDQD5aBVY16Sgmhh928kGPhcLjlArKiafKXjr/EIrW58LMpsWUEM5FYnL S/5omzMXOkTrtUpA4Wkit47fNpI2AkCKJy8v3H2M= Date: Fri, 28 Apr 2023 17:52:11 +0200 Subject: [PATCH] tools/nolibc: remove LINUX_REBOOT_ constants MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230428-nolibc-reboot-v1-1-0bca02d20ba6@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAKrrS2QC/x2N0QrCMAwAf2Xk2UBXZU5/RXxoumwLlFTSKcLYv xt8vIPjdmhswg3u3Q7GH2lS1aE/dZDXpAujTM4QQzyHSxxRaxHKaEy1bnjtbzxQGKYxZPCGUmM kS5pXr/RdisuX8Szf/+TxPI4fLSlCDXQAAAA= To: Willy Tarreau <w@1wt.eu> Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <linux@weissschuh.net> X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1682697131; l=1245; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=yA2p+JNjmFfGlYa0wIdrC8Z5YlWh5St1B631YdUOEJc=; b=Gt3010UUPuT/YnL934/uirUuPbLuQv6XVi9Uuo9WkN92QI0hTMYYBnBVoopDcjfStpXvAB1OM g3s0Zj3DtCsDx6eGfbFeC/548m7RnuvlXJe0z5PflsOL8NxR5JH31QF X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764436640978574771?= X-GMAIL-MSGID: =?utf-8?q?1764436640978574771?= |
Series |
tools/nolibc: remove LINUX_REBOOT_ constants
|
|
Commit Message
Thomas Weißschuh
April 28, 2023, 3:52 p.m. UTC
The same constants and some more have been exposed to userspace via
linux/reboot.h for a long time.
To avoid conflicts and trim down nolibc a bit drop the custom
definitions.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
tools/include/nolibc/types.h | 8 --------
1 file changed, 8 deletions(-)
---
base-commit: 33afd4b76393627477e878b3b195d606e585d816
change-id: 20230428-nolibc-reboot-719e6b06d80c
Best regards,
Comments
Hi Thomas, On Fri, Apr 28, 2023 at 05:52:11PM +0200, Thomas Weißschuh wrote: > The same constants and some more have been exposed to userspace via > linux/reboot.h for a long time. > > To avoid conflicts and trim down nolibc a bit drop the custom > definitions. For me it breaks the build when including nolibc directly, so most likely we need to include certain files: In file included from /g/public/linux/master/tools/include/nolibc/nolibc.h:99, from <command-line>: /g/public/linux/master/tools/include/nolibc/sys.h: In function 'reboot': /g/public/linux/master/tools/include/nolibc/sys.h:972:30: error: 'LINUX_REBOOT_MAGIC1' undeclared (first use in this function) 972 | int ret = sys_reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, 0); | ^~~~~~~~~~~~~~~~~~~ /g/public/linux/master/tools/include/nolibc/sys.h:972:30: note: each undeclared identifier is reported only once for each function it appears in I suspect it might be like the S_* macros for stat() that we had to guard against. What build conflict did you meet ? I would like as well to redefine the least possible and if we can make sure to fix the conflict efficiently without breaking code, that would be better. Thanks, Willy
On 2023-05-02 08:32:15+0200, Willy Tarreau wrote: > On Fri, Apr 28, 2023 at 05:52:11PM +0200, Thomas Weißschuh wrote: > > The same constants and some more have been exposed to userspace via > > linux/reboot.h for a long time. > > > > To avoid conflicts and trim down nolibc a bit drop the custom > > definitions. > > For me it breaks the build when including nolibc directly, so most > likely we need to include certain files: Indeed, sorry no idea how I missed that. > In file included from /g/public/linux/master/tools/include/nolibc/nolibc.h:99, > from <command-line>: > /g/public/linux/master/tools/include/nolibc/sys.h: In function 'reboot': > /g/public/linux/master/tools/include/nolibc/sys.h:972:30: error: 'LINUX_REBOOT_MAGIC1' undeclared (first use in this function) > 972 | int ret = sys_reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, 0); > | ^~~~~~~~~~~~~~~~~~~ > /g/public/linux/master/tools/include/nolibc/sys.h:972:30: note: each undeclared identifier is reported only once for each function it appears in > > I suspect it might be like the S_* macros for stat() that we had to > guard against. What build conflict did you meet ? I would like as well > to redefine the least possible and if we can make sure to fix the > conflict efficiently without breaking code, that would be better. The conflict looks like this: In file included from nolibc-test.c:18: sysroot/x86/include/linux/reboot.h:10: warning: "LINUX_REBOOT_MAGIC2" redefined 10 | #define LINUX_REBOOT_MAGIC2 672274793 | In file included from sysroot/x86/include/nolibc.h:98, from sysroot/x86/include/errno.h:26, from sysroot/x86/include/stdio.h:14, from nolibc-test.c:15: ... and all the other ones. The following trivial fix on top of my patch would fix the problem: diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 5d624dc63a42..9d27131c224e 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -21,6 +21,7 @@ #include <linux/auxvec.h> #include <linux/fcntl.h> // for O_* and AT_* #include <linux/stat.h> // for statx() +#include <linux/reboot.h> // for LINUX_REBOOT_* #include "arch.h" #include "errno.h" Want me to send a v2 or will you fix it up on your side?
On Tue, May 02, 2023 at 08:47:15AM +0200, Thomas Weißschuh wrote: > On 2023-05-02 08:32:15+0200, Willy Tarreau wrote: > > On Fri, Apr 28, 2023 at 05:52:11PM +0200, Thomas Weißschuh wrote: > > > The same constants and some more have been exposed to userspace via > > > linux/reboot.h for a long time. > > > > > > To avoid conflicts and trim down nolibc a bit drop the custom > > > definitions. > > > > For me it breaks the build when including nolibc directly, so most > > likely we need to include certain files: > > Indeed, sorry no idea how I missed that. No worries, it happens to me as well and that's the benefit of cross-testing ;-) > The conflict looks like this: > > In file included from nolibc-test.c:18: > sysroot/x86/include/linux/reboot.h:10: warning: "LINUX_REBOOT_MAGIC2" redefined > 10 | #define LINUX_REBOOT_MAGIC2 672274793 > | > In file included from sysroot/x86/include/nolibc.h:98, > from sysroot/x86/include/errno.h:26, > from sysroot/x86/include/stdio.h:14, > from nolibc-test.c:15: > ... and all the other ones. > > > > The following trivial fix on top of my patch would fix the problem: > > diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h > index 5d624dc63a42..9d27131c224e 100644 > --- a/tools/include/nolibc/sys.h > +++ b/tools/include/nolibc/sys.h > @@ -21,6 +21,7 @@ > #include <linux/auxvec.h> > #include <linux/fcntl.h> // for O_* and AT_* > #include <linux/stat.h> // for statx() > +#include <linux/reboot.h> // for LINUX_REBOOT_* > > #include "arch.h" > #include "errno.h" Indeed it works for me as well. > Want me to send a v2 or will you fix it up on your side? It depends. If for you it's a fix and needed for 6.4 (or maybe older), then that one is needed with the "//" comment, and it will later conflict with your previous cleanup patch that's already queued. If you're fine with having it queued for 6.5 only however, then I'll just edit your patch and add that above. I tend to think the second solution is sufficient given that nobody complained till now ;-) Just let me know, thanks, Willy
On 2023-05-02 08:59:27+0200, Willy Tarreau wrote: <snip> > > The following trivial fix on top of my patch would fix the problem: > > > > diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h > > index 5d624dc63a42..9d27131c224e 100644 > > --- a/tools/include/nolibc/sys.h > > +++ b/tools/include/nolibc/sys.h > > @@ -21,6 +21,7 @@ > > #include <linux/auxvec.h> > > #include <linux/fcntl.h> // for O_* and AT_* > > #include <linux/stat.h> // for statx() > > +#include <linux/reboot.h> // for LINUX_REBOOT_* > > > > #include "arch.h" > > #include "errno.h" > > Indeed it works for me as well. > > > Want me to send a v2 or will you fix it up on your side? > > It depends. If for you it's a fix and needed for 6.4 (or maybe older), > then that one is needed with the "//" comment, and it will later > conflict with your previous cleanup patch that's already queued. If > you're fine with having it queued for 6.5 only however, then I'll just > edit your patch and add that above. I tend to think the second solution > is sufficient given that nobody complained till now ;-) This is absolutely not urgent. 6.5 is fine. Thomas
On Tue, May 02, 2023 at 09:05:29AM +0200, Thomas Weißschuh wrote: > On 2023-05-02 08:59:27+0200, Willy Tarreau wrote: > > <snip> > > > > The following trivial fix on top of my patch would fix the problem: > > > > > > diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h > > > index 5d624dc63a42..9d27131c224e 100644 > > > --- a/tools/include/nolibc/sys.h > > > +++ b/tools/include/nolibc/sys.h > > > @@ -21,6 +21,7 @@ > > > #include <linux/auxvec.h> > > > #include <linux/fcntl.h> // for O_* and AT_* > > > #include <linux/stat.h> // for statx() > > > +#include <linux/reboot.h> // for LINUX_REBOOT_* > > > > > > #include "arch.h" > > > #include "errno.h" > > > > Indeed it works for me as well. > > > > > Want me to send a v2 or will you fix it up on your side? > > > > It depends. If for you it's a fix and needed for 6.4 (or maybe older), > > then that one is needed with the "//" comment, and it will later > > conflict with your previous cleanup patch that's already queued. If > > you're fine with having it queued for 6.5 only however, then I'll just > > edit your patch and add that above. I tend to think the second solution > > is sufficient given that nobody complained till now ;-) > > This is absolutely not urgent. 6.5 is fine. OK, now queued on top of my 20230415-nolibc-updates-4a branch that I'll soon send to Paul. Thank you! Willy
diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h index aedd7d9e3f64..15b0baffd336 100644 --- a/tools/include/nolibc/types.h +++ b/tools/include/nolibc/types.h @@ -86,14 +86,6 @@ #define SEEK_CUR 1 #define SEEK_END 2 -/* cmd for reboot() */ -#define LINUX_REBOOT_MAGIC1 0xfee1dead -#define LINUX_REBOOT_MAGIC2 0x28121969 -#define LINUX_REBOOT_CMD_HALT 0xcdef0123 -#define LINUX_REBOOT_CMD_POWER_OFF 0x4321fedc -#define LINUX_REBOOT_CMD_RESTART 0x01234567 -#define LINUX_REBOOT_CMD_SW_SUSPEND 0xd000fce2 - /* Macros used on waitpid()'s return status */ #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) #define WIFEXITED(status) (((status) & 0x7f) == 0)