From: Alejandro Colomar <alx@kernel.org>
To: Helge Kreutzmann <debian@helgefjell.de>
Cc: mario.blaettermann@gmail.com, linux-man@vger.kernel.org
Subject: Re: Issue in man page getdents.2
Date: Sat, 11 Nov 2023 20:45:59 +0100 [thread overview]
Message-ID: <ZU_Z9yO9JI9wIMtW@debian> (raw)
In-Reply-To: <ZUJxggFs7EE6uWgv@meinfjell.helgefjelltest.de>
[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]
Hi Helge,
On Wed, Nov 01, 2023 at 03:40:50PM +0000, Helge Kreutzmann wrote:
> Hello Alejandro,
> Am Wed, Nov 01, 2023 at 04:28:12PM +0100 schrieb Alejandro Colomar:
> > Hi Helge,
> >
> > On Wed, Nov 01, 2023 at 02:02:10PM +0000, Helge Kreutzmann wrote:
> > > Without further ado, the following was found:
> > >
> > > Issue: Zero padding byte → null padding byte?
> > >
> > > msgid ""
> > > "struct linux_dirent {\n"
> > > " unsigned long d_ino; /* Inode number */\n"
> > > " unsigned long d_off; /* Offset to next I<linux_dirent> */\n"
> > > " unsigned short d_reclen; /* Length of this I<linux_dirent> */\n"
> > > " char d_name[]; /* Filename (null-terminated) */\n"
> > > " /* length is actually (d_reclen - 2 -\n"
> > > " offsetof(struct linux_dirent, d_name)) */\n"
> > > " /*\n"
> > > " char pad; // Zero padding byte\n"
> >
> > Both seem good to me. Why not zero?
>
> I'm not a programmer. But I thought the term was null? If this is not
> the case, then disregard my proposal.
It isn't simple. Here's an overview of all the similar terms:
<https://lore.kernel.org/linux-man/ZU0eKrZprM5HSGt0@debian/>
- NULL is a null pointer constant (as well as 0 is another null pointer
constant; but don't use 0 for pointers, please).
- A null pointer is a more generic term that includes a run-time null
pointer as well.
- The null byte is 0.
- The null character, '\0', is composed of a null byte.
- The null wide character, L'\0' is composed of several null bytes.
- NUL is the ASCII name of the null byte, or maybe is it null character
here? It's a bit muddy.
For padding, you'd use either null bytes, or equivalently, 0s, or zeros.
Cheers,
Alex
>
> Greetings
>
> Helge
>
> --
> Dr. Helge Kreutzmann debian@helgefjell.de
> Dipl.-Phys. http://www.helgefjell.de/debian.php
> 64bit GNU powered gpg signed mail preferred
> Help keep free software "libre": http://www.ffii.de/
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-11-11 19:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-01 14:02 Issue in man page getdents.2 Helge Kreutzmann
2023-11-01 15:28 ` Alejandro Colomar
2023-11-01 15:40 ` Helge Kreutzmann
2023-11-11 19:45 ` Alejandro Colomar [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-11-17 10:46 Helge Kreutzmann
2024-11-17 15:24 ` Alejandro Colomar
2025-08-24 14:48 Helge Kreutzmann
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=ZU_Z9yO9JI9wIMtW@debian \
--to=alx@kernel.org \
--cc=debian@helgefjell.de \
--cc=linux-man@vger.kernel.org \
--cc=mario.blaettermann@gmail.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.