summaryrefslogtreecommitdiff
path: root/tools/tracing/rtla/tests/scripts/lib/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorJann Horn <jannh@google.com>2026-08-03 21:46:19 +0200
committerChristian Brauner <brauner@kernel.org>2026-08-12 11:36:39 +0200
commitbf6c571a80a1ae9141610ce94efcf4e5b93bb805 (patch)
tree6f8889ad2437144ee08d6a2244611e50b4f78116 /tools/tracing/rtla/tests/scripts/lib/git@git.tavy.me:linux.git
parent78db93943210df61c8446aae35af6836e2cf04aa (diff)
fs: document semantics of kstat::{uid,gid} fields
The uid stored in struct kstat is logically a vfsuid; file systems initialize it by converting a kuid (filesystem perspective) to a vfsuid (mount perspective), then use vfsuid_into_kuid(), which essentially just typecasts from vfsuid to kuid. For now, just add a comment to note this mismatch between C type and semantic type. Below are some notes for anyone who wants to refactor this in the future. There are probably two options to refactor this away: 1. Change the type of kstat::uid to vfsuid_t, and perform the conversion from vfsuid to userspace-uid in the VFS layer. This wouldn't change machine code, just be more semantically correct. 2. Change the semantics of kstat::uid to really be a kuid_t, and let the VFS layer take care of doing the translation from kuid to vfsuid that is currently done in filesystem code (or in generic_fillattr, on behalf of the filesystem code). Option 2 is probably neater since it moves more logic into the generic VFS layer, and this is something that is expected to work the same way in all file systems? The following coccinelle script: ``` virtual context @@ struct kstat *stat; @@ * stat->uid @@ struct kstat *stat; @@ * stat->gid @@ struct kstat stat; @@ * stat.uid @@ struct kstat stat; @@ * stat.gid ``` detects 43 field accesses to these uid/gid fields. Signed-off-by: Jann Horn <jannh@google.com> Link: https://patch.msgid.link/20260803-vfs-comment-stat-uid-v1-1-162d062b737c@google.com Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/tracing/rtla/tests/scripts/lib/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions