linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: linux-man@vger.kernel.org
Cc: "Alejandro Colomar" <alx@kernel.org>,
	linux-fsdevel@vger.kernel.org, "Pali Rohár" <pali@kernel.org>
Subject: [RFC v1] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
Date: Wed, 28 May 2025 23:31:29 +0200	[thread overview]
Message-ID: <c27a2d7f80c7824918abe5958be6b5eb2dbe8278.1748467845.git.alx@kernel.org> (raw)
In-Reply-To: <h7mdd3ecjwbxjlrj2wdmoq4zw4ugwqclzonli5vslh6hob543w@hbay377rxnjd>

Suggested-by: Pali Rohár <pali@kernel.org>
Co-authored-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 man/man3/readdir.3      | 22 +++++++++++++++++++++-
 man/man3type/stat.3type | 16 +++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/man/man3/readdir.3 b/man/man3/readdir.3
index b9150160b..ad9c76595 100644
--- a/man/man3/readdir.3
+++ b/man/man3/readdir.3
@@ -58,7 +58,27 @@ .SH DESCRIPTION
 structure are as follows:
 .TP
 .I .d_ino
-This is the inode number of the file.
+This is the inode number of the file,
+which belongs to the filesystem
+.I .st_dev
+(see
+.BR stat (3type))
+of the directory on which
+.BR readdir ()
+was called.
+If the directory entry is the mount point,
+then
+.I .d_ino
+differs from
+.IR .st_ino :
+.I .d_ino
+is the inode number of the underlying mount point,
+while
+.I .st_ino
+is the inode number of the mounted file system.
+According to POSIX,
+this Linux behavior is considered to be a bug,
+but is nevertheless conforming.
 .TP
 .I .d_off
 The value returned in
diff --git a/man/man3type/stat.3type b/man/man3type/stat.3type
index ee801bcec..835626775 100644
--- a/man/man3type/stat.3type
+++ b/man/man3type/stat.3type
@@ -66,7 +66,21 @@ .SH DESCRIPTION
 macros may be useful to decompose the device ID in this field.)
 .TP
 .I .st_ino
-This field contains the file's inode number.
+This field contains the file's inode number,
+which belongs to the
+.IR .st_dev .
+If
+.BR stat (2)
+was called on the mount point,
+then
+.I .d_ino
+differs from
+.IR .st_ino :
+.I .d_ino
+is the inode number of the underlying mount point,
+while
+.I .st_ino
+is the inode number of the mounted file system.
 .TP
 .I .st_mode
 This field contains the file type and mode.

Range-diff against v0:
-:  --------- > 1:  c27a2d7f8 man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino
-- 
2.49.0


  reply	other threads:[~2025-05-28 21:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250525103344.fe27ugiytfyoadz5@pali>
     [not found] ` <juxbjjsnt5mvtyctd72fcnc4o2u5wamqz7yd5occuor4clzkhx@zvob6krj6sq3>
     [not found]   ` <20250528182519.l6kyy5ebiivev2u5@pali>
     [not found]     ` <m5drckhk4mkw3l6fzfqyelobscbrmx6jefpjik4nj4j5ala7ff@mrm6ds7a4lk2>
     [not found]       ` <20250528194105.dqc2bgfck6n3xfya@pali>
2025-05-28 19:59         ` Improving inode number documentation Alejandro Colomar
2025-05-28 21:31           ` Alejandro Colomar [this message]
2025-05-28 22:54             ` [RFC v1] man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_ino G. Branden Robinson
2025-10-31 10:44           ` [PATCH v3] " Alejandro Colomar
2025-10-31 10:56             ` Jan Kara
2025-10-31 11:31               ` Alejandro Colomar
2025-10-31 17:10                 ` Pali Rohár
2025-10-31 15:25             ` Darrick J. Wong
2025-11-02 21:17               ` Alejandro Colomar
2025-11-03 11:28                 ` Jan Kara
2025-11-09 12:07                   ` Alejandro Colomar

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=c27a2d7f80c7824918abe5958be6b5eb2dbe8278.1748467845.git.alx@kernel.org \
    --to=alx@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=pali@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;
as well as URLs for NNTP newsgroup(s).