mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Remo Senekowitsch" <remo@buenzli.dev>
To: "Petr Mladek" <pmladek@suse.com>
Cc: "Steven Rostedt" <rostedt@goodmis.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Sergey Senozhatsky" <senozhatsky@chromium.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: Exporting functions from vsprintf.c for Rust
Date: Fri, 11 Apr 2025 13:36:27 +0200	[thread overview]
Message-ID: <D93S1SHPJDDU.INJ3UWZUM1UY@buenzli.dev> (raw)
In-Reply-To: <Z_jj_8vvmWY-WuTU@pathway.suse.cz>

On Fri Apr 11, 2025 at 11:42 AM CEST, Petr Mladek wrote:
>
> Honestly, I do not have a good feeling about exporting the internal
> vsprintf() functions. They have a very specific semantic.
>
> Especially, they return pointer to the next-to-write character.
> And it might be even beyond the given *end pointer. It is because, for
> example, vsnprintf() returns the number of characters which would
> have been written to the buffer when it was big enough.
>
> Instead, I suggest to create a wrapper which would have a sane
> semantic and call scnprintf() internally. Something like:
>
> int fwnode_full_name_to_string(char *buf, size_t size,
> 			       struct fwnode_handle *fwnode)
> {
> 	return scnprintf(buf, size, "%pfwf", fwnode);
> }

That makes sense. I tried your suggestion and it works, thank you!

Best regards,
Remo

  reply	other threads:[~2025-04-11 11:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <D931ZH9KRY2E.2D7HN6QWELGFJ@buenzli.dev>
2025-04-11  9:42 ` Petr Mladek
2025-04-11 11:36   ` Remo Senekowitsch [this message]
     [not found]     ` <CAKwiHFi_egfePDdXQEtYNvO-U65O==MosHNQ7Vm4F6iudJs95g@mail.gmail.com>
2025-04-14  6:59       ` Andy Shevchenko
2025-04-14 11:47       ` Remo Senekowitsch

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=D93S1SHPJDDU.INJ3UWZUM1UY@buenzli.dev \
    --to=remo@buenzli.dev \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.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

all inboxes | Powered by JetHome®