From: sirjofri <sirjofri+ml-9front@sirjofri.de>
To: 9front@9front.org
Subject: [9front] 9pfile walkfile: is this a bug?
Date: Tue, 22 Oct 2024 11:06:51 +0200 (GMT+02:00) [thread overview]
Message-ID: <bcba3f1d-1ab9-4c6f-96db-fdfe85c3b0c4@sirjofri.de> (raw)
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
reply other threads:[~2024-10-22 9:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=bcba3f1d-1ab9-4c6f-96db-fdfe85c3b0c4@sirjofri.de \
--to=sirjofri+ml-9front@sirjofri.de \
--cc=9front@9front.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).