The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Larry McVoy <lm@mcvoy.com>
To: Paul Ruizendaal <pnr@planet.nl>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] VFS prior to 1984
Date: Mon, 29 Jun 2020 08:14:02 -0700	[thread overview]
Message-ID: <20200629151402.GE16252@mcvoy.com> (raw)
In-Reply-To: <294D0B70-CDBB-41FE-8F3D-035562863D44@planet.nl>

On Mon, Jun 29, 2020 at 04:53:50PM +0200, Paul Ruizendaal wrote:
> 
> > On 29 Jun 2020, at 16:45, Larry McVoy <lm@mcvoy.com> wrote:
> > 
> > On Mon, Jun 29, 2020 at 11:11:17AM +0200, Paul Ruizendaal wrote:
> >> As several people have observed in this topic, indeed there appears to be a close relationship between a device switch and a file system switch.
> > 
> > Yep.  If you think in objects, they are both objects with a set of methods.
> > Pretty much two instances of the same idea.
> 
> Phrased that way all OO programs have a close relationship between them. Maybe: "they are both rather similar objects with a rather similar set of methods"?

They are two different classes, similar, but not the same.  It's really
4 classes, vfs, vnode for FS and block/char for devices.  This is from
SunOS 4.1.1 that I happened to have an install image sitting around.
Took me forever to find the device definitions, I resorted to

find . -type f -name '*.h' -print | xargs grep strategy

It's in include/sys/conf.h because, well, that's obvious, right?

struct vfsops {
        int     (*vfs_mount)();         /* mount file system */
        int     (*vfs_unmount)();       /* unmount file system */
        int     (*vfs_root)();          /* get root vnode */
        int     (*vfs_statfs)();        /* get fs statistics */
        int     (*vfs_sync)();          /* flush fs buffers */
        int     (*vfs_vget)();          /* get vnode from fid */
        int     (*vfs_mountroot)();     /* mount the root filesystem */
        int     (*vfs_swapvp)();        /* return vnode for swap */
};

struct vnodeops {
        int     (*vn_open)();
        int     (*vn_close)();
        int     (*vn_rdwr)();
        int     (*vn_ioctl)();
        int     (*vn_select)();
        int     (*vn_getattr)();
        int     (*vn_setattr)();
        int     (*vn_access)();
        int     (*vn_lookup)();
        int     (*vn_create)();
        int     (*vn_remove)();
        int     (*vn_link)();
        int     (*vn_rename)();
        int     (*vn_mkdir)();
        int     (*vn_rmdir)();
        int     (*vn_readdir)();
        int     (*vn_symlink)();
        int     (*vn_readlink)();
        int     (*vn_fsync)();
        int     (*vn_inactive)();
        int     (*vn_lockctl)();
        int     (*vn_fid)();
        int     (*vn_getpage)();
        int     (*vn_putpage)();
        int     (*vn_map)();
        int     (*vn_dump)();
        int     (*vn_cmp)();
        int     (*vn_realvp)();
        int     (*vn_cntl)();
};

/* two different device classes, block and char */
struct bdevsw {
        int     (*d_open)();
        int     (*d_close)();
        int     (*d_strategy)();
        int     (*d_dump)();
        int     (*d_psize)();
        int     d_flags;
};

struct cdevsw {
        int     (*d_open)();
        int     (*d_close)();
        int     (*d_read)();
        int     (*d_write)();
        int     (*d_ioctl)();
        int     (*d_reset)();
        int     (*d_select)();
        int     (*d_mmap)();
        struct  streamtab *d_str;
        int     (*d_segmap)();
};

-- 
---
Larry McVoy            	     lm at mcvoy.com             http://www.mcvoy.com/lm 

  reply	other threads:[~2020-06-29 15:14 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29  9:11 Paul Ruizendaal
2020-06-29 14:45 ` Larry McVoy
2020-06-29 14:53   ` Paul Ruizendaal
2020-06-29 15:14     ` Larry McVoy [this message]
2020-06-29 16:34 ` Heinz Lycklama
  -- strict thread matches above, loose matches on Subject: below --
2020-06-25 20:25 Noel Chiappa
2020-06-26  5:49 ` Lars Brinkhoff
2020-06-26  8:34   ` Dave Horsfall
2020-06-26 11:13     ` arnold
2020-06-25 20:23 Noel Chiappa
2020-06-25 19:31 Noel Chiappa
2020-06-24 18:31 Norman Wilson
2020-06-25  6:22 ` arnold
2020-06-24 17:51 Noel Chiappa
2020-06-24 18:13 ` Richard Salz
2020-06-24 18:46   ` Lars Brinkhoff
2020-06-24 14:31 Noel Chiappa
2020-06-24 15:21 ` Clem Cole
2020-06-23 22:17 Norman Wilson
2020-06-23 22:24 ` Dave Horsfall
2020-06-24  4:09   ` Warner Losh
2020-06-24  5:10     ` Dave Horsfall
2020-06-24  5:33       ` Bakul Shah
2020-06-24  9:10         ` Andrew Warkentin
2020-06-23  9:09 Paul Ruizendaal
2020-06-23 14:01 ` Larry McVoy
2020-06-23 15:12   ` Clem Cole
2020-06-23 15:55     ` Rich Morin
2020-06-23 20:38     ` Rob Pike
2020-06-23 20:57       ` Larry McVoy
2020-06-24  5:14       ` arnold
2020-06-24 21:08         ` Dave Horsfall
2020-06-24 19:30       ` Clem Cole
2020-06-24 19:36     ` Larry McVoy
2020-06-25  6:52       ` Rob Gingell
2020-07-05  0:05       ` Dave Horsfall
2020-07-05  0:16         ` Larry McVoy
2020-07-06  4:42           ` Dave Horsfall
2020-07-06 16:51           ` Chris Torek
2020-07-07  1:07             ` Bakul Shah
2020-07-05  1:43         ` Clem Cole
2020-07-05 14:43           ` Larry McVoy
2020-07-05 18:40             ` Arthur Krewat
2020-07-05 20:08             ` Clem Cole
2020-07-05 20:42               ` John Cowan
2020-07-05 21:04                 ` Clem Cole
2020-07-05 21:14                   ` Dan Cross
2020-06-24 16:51 ` Anthony Martin
2020-06-24 17:31   ` Anthony Martin
2020-06-24 18:31   ` Paul Ruizendaal
2020-06-25  0:56     ` Rob Gingell via TUHS
2020-06-24 19:05   ` Paul Ruizendaal
2020-06-24 20:27 ` Derek Fawcus
2020-06-24 21:33 ` Greg A. Woods
2020-06-25  0:45   ` Adam Thornton
2020-06-25 19:40     ` Greg A. Woods

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=20200629151402.GE16252@mcvoy.com \
    --to=lm@mcvoy.com \
    --cc=pnr@planet.nl \
    --cc=tuhs@minnie.tuhs.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).