From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: brauner@kernel.org, linux-ext4@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/4] fs: send uevents for filesystem mount events
Date: Thu, 18 Dec 2025 11:49:57 -0800 [thread overview]
Message-ID: <20251218194957.GZ7725@frogsfrogsfrogs> (raw)
In-Reply-To: <aUOQkY3s_D_REIsH@infradead.org>
On Wed, Dec 17, 2025 at 09:26:41PM -0800, Christoph Hellwig wrote:
> > +#define ADVANCE_ENV(envp, buf, buflen, written) \
> > + do { \
> > + ssize_t __written = (written); \
> > +\
> > + WARN_ON((buflen) < (__written) + 1); \
> > + *(envp) = (buf); \
> > + (envp)++; \
> > + (buf) += (__written) + 1; \
> > + (buflen) -= (__written) + 1; \
> > + } while (0)
>
> Any reason this is a macro vs an (inline?) function? Looking at this a
> bit more, could this simply use a seq_buf?
I'll change it to something like this:
seq_buf_init(&sbuf, buf, buflen);
envp = env;
/*
* Add a second null terminator on the end so the next printf can start
* printing at the second null terminator.
*/
seq_buf_get_buf(&sbuf, envp++);
seq_buf_printf(&sbuf, "TYPE=filesystem");
seq_buf_putc(&sbuf, 0);
seq_buf_get_buf(&sbuf, envp++);
seq_buf_printf(&sbuf, "SID=%s", sb->s_id);
seq_buf_putc(&sbuf, 0);
...
/* Add null terminator to strings array */
*envp = NULL;
That does look a lot cleaner than opencoding it.
--D
next prev parent reply other threads:[~2025-12-18 19:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 2:02 [PATCHSET V4 2/2] fs: send uevents on mount and unmount Darrick J. Wong
2025-12-18 2:04 ` [PATCH 1/4] fs: send uevents for filesystem mount events Darrick J. Wong
2025-12-18 5:26 ` Christoph Hellwig
2025-12-18 19:49 ` Darrick J. Wong [this message]
2025-12-18 23:33 ` [PATCH V4.1 " Darrick J. Wong
2025-12-24 12:47 ` [PATCH " Christian Brauner
2025-12-26 23:58 ` Ian Kent
2026-01-05 17:26 ` Darrick J. Wong
2026-01-05 17:25 ` Darrick J. Wong
2025-12-18 2:04 ` [PATCH 2/4] xfs: send uevents when major filesystem events happen Darrick J. Wong
2025-12-18 5:27 ` Christoph Hellwig
2025-12-18 2:05 ` [PATCH 3/4] ext4: convert ext4_root to a kset Darrick J. Wong
2025-12-18 5:27 ` Christoph Hellwig
2025-12-18 2:05 ` [PATCH 4/4] ext4: send uevents when major filesystem events happen Darrick J. Wong
2025-12-18 5:27 ` Christoph Hellwig
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=20251218194957.GZ7725@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=brauner@kernel.org \
--cc=hch@infradead.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox