9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] 9p(2) and walk1
@ 2021-02-15 17:59 pouya+lists.9fans
  2021-02-15 21:35 ` [9fans] " Anthony Martin
  0 siblings, 1 reply; 2+ messages in thread
From: pouya+lists.9fans @ 2021-02-15 17:59 UTC (permalink / raw)
  To: 9fans

9p(2) says the following about

char* (*walk1)(Fid *fid, char *name, Qid *qid);

| Because implementing the full walk message is intricate and prone to
| error, the helper routine walkandclone will handle the request given
| pointers to two functions walk1 and (optionally) clone.  [...] Walk1
| should walk fid to name, initializing fid->qid to the new path's
| qid.Both should return nil on success or an error message on error.

And later:

| If the client provides functions srv->walk1 and (optionally)
| srv->clone, the 9P service loop will call walkandclone with these
| functions to handle the request.  Unlike the walk1 above, srv->walk1
| must fill in both fid->qid and *qid with the new qid on a successful
| walk.

I think the distinction being made is that if walk1 is populated in a
struct served by srv(2) it needs to set *qid, but not if it's used
instead to construct a walk function explicitly using walkandclone.  A
quick look at the source code of lib9p seems to confirm this.

I looked at the implementation of nntpfs(4) and webfs(4), which both
set walk1.  The former sets both fid->qid and *qid and the latter only
*qid, which seems it could be ok from a quick look at the source of
lib9p, but goes against the above instructions AFAICS.

Are these subtle differences (the two in the man page and the third in
code) intentional?  It's my first time implementing a 9P file system
so apologies if I'm missing something basic.

Thanks,
Pouya



------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb39d71a5497bba2d-M226ea8444212b13fc9a35ab2
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [9fans] Re: 9p(2) and walk1
  2021-02-15 17:59 [9fans] 9p(2) and walk1 pouya+lists.9fans
@ 2021-02-15 21:35 ` Anthony Martin
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Martin @ 2021-02-15 21:35 UTC (permalink / raw)
  To: 9fans

pouya+lists.9fans@nohup.io once said:
> Are these subtle differences (the two in the man page and the third in
> code) intentional?  It's my first time implementing a 9P file system
> so apologies if I'm missing something basic.

It's actually just a case of forgetting to update the man page.

In early February 2003, Russ was cleaning up lib9p and changed
the code to check that fid->qid and qid were exactly the same.
He updated the man page accordingly. However, Dan Cross noticed
that it broke some existing code. Russ then relaxed the client
requirements and had lib9p just assign qid to fid->qid. The man
page wasn't updated to reflect the change.

        To: 9fans@cse.psu.edu
        Subject: Re: [9fans] Okay, who's been playing with the cheese wiz?
        From: "Russ Cox" <rsc@plan9.bell-labs.com>
        Date: Sun, 9 Feb 2003 16:51:01 -0500
        Message-ID: <fb9812bf58e9e8395b3b3635a229e708@plan9.bell-labs.com>

        [...]

        I changed lib9p to do a few more checks that the
        client code is behaving, and your execnet crash
        shows that lib9p thinks execnet is not behaving.
        It turns out that actually lib9p is not behaving -- I was
        trying to clean up this particular detail (whether a
        walk function should set both fid->qid and *qid),
        because it always confuses me, and I got confused.
        I just put out a new srv.c that makes reasonable
        demands of the clients.

        [...]

Cheers,
  Anthony

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb39d71a5497bba2d-M26c5e627eb106c505ce67b9b
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-15 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 17:59 [9fans] 9p(2) and walk1 pouya+lists.9fans
2021-02-15 21:35 ` [9fans] " Anthony Martin

9fans - fans of the OS Plan 9 from Bell Labs

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9fans

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9fans 9fans/ http://inbox.vuxu.org/9fans \
		9fans@9fans.net
	public-inbox-index 9fans

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9fans


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git