Subject: Re: VOP_SEEK / VOP_GETATTR attrocities/oddities
To: None <tech-kern@NetBSD.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 09/21/2006 09:17:48
--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Sep 21, 2006 at 02:38:42PM +0200, Reinoud Zandijk wrote:
> Dear folks,
>=20
> in my work on the SEEK_DATA/SEEK_HOLE lseek() extension i stubbled on the=
=20
> following:
>=20
> Firstly:
>=20
> miscfs/specfs/specdev.h:111:#define     spec_getattr    genfs_ebadf
> miscfs/specfs/specdev.h:123:#define     spec_seek       genfs_nullop
>=20
> wich i changed to :
>=20
> miscfs/specfs/specdev.h:123:#define     spec_seek       genfs_seek
>=20
> to not alter its behaviour.
>=20
> However, all lseek(fd, 0, SEEK_END) and the likes fail for the size that =
is=20
> requested by spec_getattr() is a bad op. Shouldn't spec_getattr() get its=
=20
> own function that does recognize its size and make up a profile for a blo=
ck=20
> device? On the other hand why is stat(3) working on a device node when=20
> spec_getattr is a ebadf ? Answer prolly: its not a specfs... but then i'm=
=20
> puzzled.

UTSL. If you run gid on spec_getattr, you will find that it is only used=20
by spec_vnops.c, which has the following comment:

/*
 * This vnode operations vector is used for two things only:
 * - special device nodes created from whole cloth by the kernel.
 * - as a temporary vnodeops replacement for vnodes which were found to
 *      be aliased by callers of checkalias().
 * For the ops vector for vnodes built from special devices found in a
 * filesystem, see (e.g) ffs_specop_entries[] in ffs_vnops.c or the
 * equivalent for other filesystems.
 */

To be honest, I see no reason to change this.

> Secondly:
>=20
> ufs/mfs/mfsnode.h:70:#define    mfs_seek        genfs_badop
>=20
> Does this mean no seek's are possible on MFS? or is this entry overwritte=
n=20
> by say UFS?

This means that seeks aren't possible ON THE MFS NODE, which is the node=20
used as a block device for the mfs file system. No seeking is needed on=20
that node.

Take care,

Bill

--IS0zKkzwUGydFO0o
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (NetBSD)

iD8DBQFFErssWz+3JHUci9cRArdYAJ0brJswSrH2eOgBWA/LSSGzguFlrwCZAT5k
rsrisRJ5fg2GjLCpiOPg4H4=
=Ivjc
-----END PGP SIGNATURE-----

--IS0zKkzwUGydFO0o--