user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/2] f3: define F3_NS in cflags rather than C code
Date: Wed, 26 Jul 2023 12:45:15 +0000	[thread overview]
Message-ID: <20230726124515.3639819-3-e@80x24.org> (raw)
In-Reply-To: <20230726124515.3639819-1-e@80x24.org>

This enhances reusability in other projects which use the same C
shim.  The executable will also be `lei.fuse' rather than `leifs',
because `leifs' is likely confused as `leafs' which makes no
sense.
---
 lib/PublicInbox/LeiF3.pm | 5 +++--
 lib/PublicInbox/f3.h     | 6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/LeiF3.pm b/lib/PublicInbox/LeiF3.pm
index 74ad135d..1121340a 100644
--- a/lib/PublicInbox/LeiF3.pm
+++ b/lib/PublicInbox/LeiF3.pm
@@ -13,11 +13,12 @@ use PublicInbox::Spawn;
 my $dir = ($ENV{PERL_INLINE_DIRECTORY} //
 	die('BUG: PERL_INLINE_DIRECTORY unset')) . '/f3';
 my $F3_NS = 'lei';
-my $bin = "$dir/${F3_NS}fs.fuse";
+my $bin = "$dir/${F3_NS}.fuse";
 my ($srcpfx) = (__FILE__ =~ m!\A(.+/)[^/]+\z!);
 my @srcs = map { $srcpfx.$_ } qw(f3.h);
 my $xflags = ($ENV{CFLAGS} // '-Wall -ggdb3 -O0') . ' ' .
-	($ENV{LDFLAGS} // '-Wl,-O1 -Wl,--compress-debug-sections=zlib');
+	($ENV{LDFLAGS} // '-Wl,-O1 -Wl,--compress-debug-sections=zlib') .
+	qq{ -DF3_NS='"$F3_NS"'};
 
 sub xflags_chg () {
 	open my $fh, '<', "$dir/XFLAGS" or return 1;
diff --git a/lib/PublicInbox/f3.h b/lib/PublicInbox/f3.h
index 4494e61b..4572f7f2 100644
--- a/lib/PublicInbox/f3.h
+++ b/lib/PublicInbox/f3.h
@@ -8,7 +8,9 @@
  */
 
 /* another project may use this: */
-#define F3_NS "lei"
+#ifndef F3_NS
+#error F3_NS not defined
+#endif
 
 #define _GNU_SOURCE
 #define _FILE_OFFSET_BITS 64
@@ -126,7 +128,7 @@ static struct f3_data f3 = {
 };
 
 static const struct fuse_opt f3_opt[] = {
-	/* *-fd and root-vid are internal knobs */
+	/* *-fd and root-vid are internal knobs used by perl mount wrapper */
 	{ "reader-fd=%d", offsetof(struct f3_data, rfd) },
 	{ "worker-fd=%d", offsetof(struct f3_data, wfd) },
 	{ "root-vid=%"PRId64, offsetof(struct f3_data, vroot.vid) },

  parent reply	other threads:[~2023-07-26 12:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 12:45 [PATCH 0/2] fuse3 branch updates Eric Wong
2023-07-26 12:45 ` [PATCH 1/2] f3: safer fixed buffer size for alternate F3_NS Eric Wong
2023-07-26 12:45 ` Eric Wong [this message]
2023-08-02 21:35 ` [PATCH 3/2] f3: fix test with updated executable name Eric Wong

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

  List information: https://public-inbox.org/README

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

  git send-email \
    --in-reply-to=20230726124515.3639819-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).