Re: [PATCH v2 02/15] ceph: add BLOG deserialization support
Xiubo Li <[email protected]> Tue, 14 Jul 2026 11:45:26 +0800
| Newsgroups | org.kernel.vger.ceph-devel |
|---|---|
| Message-ID | <CAOJNxRKg+PKtX=WKUDyQ1E+E+Sk9LtGcpLQOWfVzuSZDiRu5tw@mail.gmail.com> |
On Mon, 6 Jul 2026 at 22:38, Alex Markuze <[email protected]> wrote: > > Add blog_des.c implementing the binary record deserialization engine > used by the debugfs read paths. Supports %d, %i, %u, %o, %x, %X, > %s, %p, %c, and length modifiers (l, ll, h, hh, z). > > Signed-off-by: Alex Markuze <[email protected]> > --- > fs/ceph/blog_des.c | 332 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 332 insertions(+) > create mode 100644 fs/ceph/blog_des.c > > diff --git a/fs/ceph/blog_des.c b/fs/ceph/blog_des.c > new file mode 100644 > index 000000000000..e84ca3fa156c > --- /dev/null > +++ b/fs/ceph/blog_des.c > @@ -0,0 +1,332 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Binary Logging Deserialization > + */ > + [......] > + case 'p': { > + void *ptr; > + > + if (buf_ptr + sizeof(void *) > buf_end) > + return -EBADMSG; > + > + ptr = (void *)(unsigned long)get_unaligned((unsigned long *)buf_ptr); > + buf_ptr += sizeof(void *); > + > + /* > + * Skip kernel %p sub-specifiers (U, I, d, D, etc.). > + * bout/boutc do not support %p extensions; call sites > + * must pre-format them with snprintf and pass %s. > + */ > + while (fmt_ptr[1] && isalpha(fmt_ptr[1])) s/isalpha()/isalnum()/ ? Because %p can also include numbers, likes: sprintf(tbuf, "%pI4", n->key); <<== For IPv4 address > + fmt_ptr++; > + > + ret = snprintf(out_ptr, remaining, "%p", ptr); [......]