9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Dir->type & Dir->dev
@ 2008-11-30 15:09 Eric Van Hensbergen
  2008-11-30 15:18 ` erik quanstrom
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Van Hensbergen @ 2008-11-30 15:09 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

The main pages are a little unclear as to the convention for
assignment of dir->type & dir->dev, particularly with respect to
synthetic file servers.  For devices I gather that type is the device
id (ie. 'c' for cons) and that dev is the instance (ie. #I2 for an
alternate IP stack).  Their use seems a bit more slippery when
implementing user space file servers -- particular since type,dev,qid
must(?) be unique per namespace.  Is there a best practices convention
that folks follow or is this something which most ignore and we are
just lucky most of the time?

             -eric



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

* Re: [9fans] Dir->type & Dir->dev
  2008-11-30 15:09 [9fans] Dir->type & Dir->dev Eric Van Hensbergen
@ 2008-11-30 15:18 ` erik quanstrom
  2008-11-30 16:26   ` Eric Van Hensbergen
  2008-11-30 19:07   ` Charles Forsyth
  0 siblings, 2 replies; 4+ messages in thread
From: erik quanstrom @ 2008-11-30 15:18 UTC (permalink / raw)
  To: 9fans

On Sun Nov 30 10:12:00 EST 2008, ericvh@gmail.com wrote:
> The main pages are a little unclear as to the convention for
> assignment of dir->type & dir->dev, particularly with respect to
> synthetic file servers.  For devices I gather that type is the device
> id (ie. 'c' for cons) and that dev is the instance (ie. #I2 for an
> alternate IP stack).  Their use seems a bit more slippery when
> implementing user space file servers -- particular since type,dev,qid
> must(?) be unique per namespace.  Is there a best practices convention
> that folks follow or is this something which most ignore and we are
> just lucky most of the time?
>
>              -eric

there is a dir.type and a dir.qid.type.  i believe these are different.
the comment above dir.type in /sys/include/libc.h says that it's
system modified.  and, e.g. /mail/fs shows up as from the mount
driver.  the instance is typically pretty big.  the mount driver is
pretty careful to count instances.

; ls -l /mail/fs
--rw-rw-rw- M 105920 quanstro quanstro 0 Nov 30 10:17 /mail/fs/ctl
d-r-xr-xr-x M 105920 quanstro quanstro 0 Nov 30 10:11 /mail/fs/mbox

- erik



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

* Re: [9fans] Dir->type & Dir->dev
  2008-11-30 15:18 ` erik quanstrom
@ 2008-11-30 16:26   ` Eric Van Hensbergen
  2008-11-30 19:07   ` Charles Forsyth
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Van Hensbergen @ 2008-11-30 16:26 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sun, Nov 30, 2008 at 9:18 AM, erik quanstrom <quanstro@quanstro.net> wrote:
>
> there is a dir.type and a dir.qid.type.  i believe these are different.
> the comment above dir.type in /sys/include/libc.h says that it's
> system modified.  and, e.g. /mail/fs shows up as from the mount
> driver.  the instance is typically pretty big.  the mount driver is
> pretty careful to count instances.
>
> ; ls -l /mail/fs
> --rw-rw-rw- M 105920 quanstro quanstro 0 Nov 30 10:17 /mail/fs/ctl
> d-r-xr-xr-x M 105920 quanstro quanstro 0 Nov 30 10:11 /mail/fs/mbox
>

That makes sense - any user space synthetic will have to be addressed
via mnt(3), so mnt(3) will assign/override type and instance data for
user space file servers as well as remote file servers.  Thanks.

               -eric



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

* Re: [9fans] Dir->type & Dir->dev
  2008-11-30 15:18 ` erik quanstrom
  2008-11-30 16:26   ` Eric Van Hensbergen
@ 2008-11-30 19:07   ` Charles Forsyth
  1 sibling, 0 replies; 4+ messages in thread
From: Charles Forsyth @ 2008-11-30 19:07 UTC (permalink / raw)
  To: 9fans

Qid.type is defined to be equal to the top 8 bits of mode (see stat(5))
and type and dev are defined to be for kernel use (also stat(5))
which is fine if you're not in the kernel.
but what if you are? type is just the device [unicode] letter,
and dev is assigned by the device, and might be the index of an instance
(eg, #I0 has dev 0, and #I1 has dev 1).  once exported and
mounted elsewhere such distinctions vanish because the mount driver
rewrites them, more or less thoroughly (ie, in both stat and read-on-directory).



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

end of thread, other threads:[~2008-11-30 19:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-30 15:09 [9fans] Dir->type & Dir->dev Eric Van Hensbergen
2008-11-30 15:18 ` erik quanstrom
2008-11-30 16:26   ` Eric Van Hensbergen
2008-11-30 19:07   ` Charles Forsyth

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).