All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	KP Singh <kpsingh@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Yonghong Song <yhs@fb.com>, Song Liu <songliubraving@fb.com>,
	Martin KaFai Lau <kafai@fb.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Dominique Martinet <asmadeus@codewreck.org>
Subject: [PATCH 2/4] tools/bpf: musl compat: do not use DEFFILEMODE
Date: Sun, 24 Apr 2022 14:10:20 +0900	[thread overview]
Message-ID: <20220424051022.2619648-3-asmadeus@codewreck.org> (raw)
In-Reply-To: <20220424051022.2619648-1-asmadeus@codewreck.org>

DEFFILEMODE is not defined on musl libc.

Linus has expressed preference towards using explicit octal value in
the past over combinaisons of S_Ix{USR,GRP,OTH}, so just replace it
with 0666 directly

Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---

I wanted to link to the Linus mail that said this, but it turns out
there weren't any list in Cc... I could be making this up but here's the
relevant part of his mail, which I hope is acceptable to forward as
there's nothing personal in it:
----
Date: Sat, 27 Feb 2021 11:29:31 -0800
From: Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [RFC][PATCHSET] inode type bits fixes
Message-ID: <CAHk-=whRkLinjW3gRJQ=fWHZcFP5iy37+4VVr38TzSXEwZrZGg@mail.gmail.com>

[...]

Finally, I absolutely _abhor_ the crazy "S_%&^%&^$" macros. They are
completely illegible garbage, imnsho. I'm looking at that

+                       mode = stat->st_mode & S_IALLUGO;
+                       mode |= inode->i_mode & ~S_IALLUGO;

and I'm like "WTF is that random character sequence again".

In this case, it's everything but the format.  I think it would be
more legible written the other way around, ie

+                       mode = stat->st_mode & ~S_IFMT;
+                       mode |= inode->i_mode & S_IFMT;

because at least that one has _less_ of the stupid random-generated letters.

Every single one of the "UGO" things are pure and utter crap. The
octal representation of the actual permissions masks are _way_ more
legible than the insane "standard" names for them.
----


 tools/bpf/bpf_jit_disasm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
index c8ae95804728..f748863e294c 100644
--- a/tools/bpf/bpf_jit_disasm.c
+++ b/tools/bpf/bpf_jit_disasm.c
@@ -303,7 +303,7 @@ int main(int argc, char **argv)
 		goto done;
 	}
 
-	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
+	ofd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
 	if (ofd < 0) {
 		fprintf(stderr, "Could not open file %s for writing: ", ofile);
 		perror(NULL);
-- 
2.35.1


  parent reply	other threads:[~2022-04-24  5:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24  5:10 [PATCH 0/4] tools/bpf: allow building with musl Dominique Martinet
2022-04-24  5:10 ` [PATCH 1/4] tools/bpf/runqslower: musl compat: explicitly link with libargp if found Dominique Martinet
2022-04-24  6:58   ` Dominique Martinet
2022-04-25 21:35     ` Daniel Borkmann
2022-04-25 22:33       ` Dominique Martinet
2022-04-24  5:10 ` Dominique Martinet [this message]
2022-04-24  5:10 ` [PATCH 3/4] tools/bpf: musl compat: replace nftw with FTW_ACTIONRETVAL Dominique Martinet
2022-04-25 21:24   ` Quentin Monnet
2022-04-24  5:10 ` [PATCH 4/4] tools/bpf: replace sys/fcntl.h by fcntl.h Dominique Martinet
2022-04-25 21:25   ` Quentin Monnet
2022-04-25 21:30 ` [PATCH 0/4] tools/bpf: allow building with musl patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220424051022.2619648-3-asmadeus@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.