namei.h: move "struct componentname" definition outside "struct nameidata",

and provide a valid STDC/C++ definition for function NDINIT

queue.h libkern.h: put explicit casts from void * in insque, remque and memset

(for the records, these changes are necessary to let the files
compile with g++, which is used to build a FreeBSD module
for "Click" -- see www.pdos.lcs.mit.edu/click/ .
Given that they have zero impact on our code, it is worthwhile
to have them in.

MFC after: 3 days
This commit is contained in:
Luigi Rizzo 2001-09-28 00:05:11 +00:00
parent 7360079ab3
commit be8e1fea0e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=84061
3 changed files with 30 additions and 19 deletions

View File

@ -105,7 +105,7 @@ memset(void *b, int c, size_t len)
if (c == 0)
bzero(b, len);
else
for (bb = b; len--; )
for (bb = (char *)b; len--; )
*bb++ = c;
return (b);
}

View File

@ -40,6 +40,23 @@
#include <sys/queue.h>
#include <sys/uio.h>
struct componentname {
/*
* Arguments to lookup.
*/
u_long cn_nameiop; /* namei operation */
u_long cn_flags; /* flags to namei */
struct thread *cn_thread;/* thread requesting lookup */
struct ucred *cn_cred; /* credentials */
/*
* Shared between lookup and commit routines.
*/
char *cn_pnbuf; /* pathname buffer */
char *cn_nameptr; /* pointer to looked up name */
long cn_namelen; /* length of looked up component */
long cn_consume; /* chars to consume in lookup() */
};
/*
* Encapsulation of namei parameters.
*/
@ -75,22 +92,7 @@ struct nameidata {
* information from the nameidata structure that is passed
* through the VOP interface.
*/
struct componentname {
/*
* Arguments to lookup.
*/
u_long cn_nameiop; /* namei operation */
u_long cn_flags; /* flags to namei */
struct thread *cn_thread;/* thread requesting lookup */
struct ucred *cn_cred; /* credentials */
/*
* Shared between lookup and commit routines.
*/
char *cn_pnbuf; /* pathname buffer */
char *cn_nameptr; /* pointer to looked up name */
long cn_namelen; /* length of looked up component */
long cn_consume; /* chars to consume in lookup() */
} ni_cnd;
struct componentname ni_cnd;
};
#ifdef _KERNEL
@ -149,12 +151,20 @@ struct nameidata {
static void NDINIT __P((struct nameidata *, u_long, u_long, enum uio_seg,
const char *, struct thread *));
static __inline void
#if defined(__STDC__) || defined(__cplusplus)
NDINIT(struct nameidata *ndp,
u_long op, u_long flags,
enum uio_seg segflg,
const char *namep,
struct thread *td)
#else
NDINIT(ndp, op, flags, segflg, namep, td)
struct nameidata *ndp;
u_long op, flags;
enum uio_seg segflg;
const char *namep;
struct thread *td;
#endif
{
ndp->ni_cnd.cn_nameiop = op;
ndp->ni_cnd.cn_flags = flags;

View File

@ -422,7 +422,8 @@ struct quehead {
static __inline void
insque(void *a, void *b)
{
struct quehead *element = a, *head = b;
struct quehead *element = (struct quehead *)a,
*head = (struct quehead *)b;
element->qh_link = head->qh_link;
element->qh_rlink = head;
@ -433,7 +434,7 @@ insque(void *a, void *b)
static __inline void
remque(void *a)
{
struct quehead *element = a;
struct quehead *element = (struct quehead *)a;
element->qh_link->qh_rlink = element->qh_rlink;
element->qh_rlink->qh_link = element->qh_link;