On Sat, Jul 27, 2019 at 12:41:24AM +0200, Mark Kettenis wrote:
> > Date: Sat, 27 Jul 2019 00:09:11 +0200
> > From: Alexander Bluhm <[email protected]>
> >
> > Hi,
> >
> > Can we move the unveil function prototypes into the namei.h header
> > file? This guarantees consistency. Protected by _KERNEL, survived
> > make build.
> >
> > ok?
>
> Why? If these are internal interfaces for the unveil subsystem it
> makes sense not to put them in a header file.
They are implemented in kern/kern_unveil.c and used in kern/vfs_lookup.c.
The usual way to keep caller and callee perameters synchronized is
to put a prototype into a header file.
bluhm
> > Index: kern/vfs_lookup.c
> > ===================================================================
> > RCS file: /data/mirror/openbsd/cvs/src/sys/kern/vfs_lookup.c,v
> > retrieving revision 1.80
> > diff -u -p -r1.80 vfs_lookup.c
> > --- kern/vfs_lookup.c 18 Jul 2019 18:06:17 -0000 1.80
> > +++ kern/vfs_lookup.c 26 Jul 2019 08:16:01 -0000
> > @@ -57,10 +57,6 @@
> > #include <sys/ktrace.h>
> > #endif
> >
> > -void unveil_start_relative(struct proc *p, struct nameidata *ni);
> > -void unveil_check_component(struct proc *p, struct nameidata *ni, struct
> > vnode *dp );
> > -int unveil_check_final(struct proc *p, struct nameidata *ni);
> > -
> > int
> > component_push(struct componentname *cnp, char *component, size_t len)
> > {
> > Index: sys/namei.h
> > ===================================================================
> > RCS file: /data/mirror/openbsd/cvs/src/sys/sys/namei.h,v
> > retrieving revision 1.40
> > diff -u -p -r1.40 namei.h
> > --- sys/namei.h 13 May 2019 22:55:27 -0000 1.40
> > +++ sys/namei.h 26 Jul 2019 08:17:03 -0000
> > @@ -204,6 +204,10 @@ void nchinit(void);
> > struct mount;
> > void cache_purgevfs(struct mount *);
> >
> > +void unveil_start_relative(struct proc *, struct nameidata *);
> > +void unveil_check_component(struct proc *, struct nameidata *, struct
> > vnode *);
> > +int unveil_check_final(struct proc *, struct nameidata *);
> > +
> > extern struct pool namei_pool;
> >
> > #endif
> >
> >