* [9front] 9pfile walkfile: is this a bug?
@ 2024-10-22 9:06 sirjofri
0 siblings, 0 replies; only message in thread
From: sirjofri @ 2024-10-22 9:06 UTC (permalink / raw)
To: 9front
Hi all,
I'm in the middle of writing a filesystem and encountered some word behavior in 9pfile. That is, walkfile always decreases the reference counter for the filter to search from.
walkfile(f, "name");
The reference counter for f will always be decreased using closefile.
I found an incref in archfs, right before walkfile, but this whole situation makes me think if this is a bug or actually wanted behavior?
I understand walkfile as a means to navigate the filesystem, not change it. I wouldn't understand why this would close the file.
Does someone know more about this, maybe any reasoning? In any case, if that is wanted behavior it should be added to the man page, which currently only states that "reference counting is cumbersome".
Regarding a potential man page change, the following sentence or something similar could be added to the walkfile section:
> Walkfile also closes the directory dir. The user might want to use incref to control the reference counting.
However, looking at the code of walkfile, if you supply a whole path to walkfile, it seems to close all of the path elements, maybe even multiple times when using paths like path/to/../to/../to/file. With that, I understand why it's "cumbersome"...
Sorry for that weird unstructured mail. I hope you understand everything...
sirjofri
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-10-22 9:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-22 9:06 [9front] 9pfile walkfile: is this a bug? sirjofri
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).