summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2001-09-28 00:05:11 +0000
committerluigi <luigi@FreeBSD.org>2001-09-28 00:05:11 +0000
commite107fbbb1a6371a4d7841cd71acef3612f186f41 (patch)
tree8d701dd0ce3faebdd9a101554e23320374a9d5f7 /sys
parent21eb2e91b646074cbdfc4ce4b8796f3f1032636a (diff)
downloadFreeBSD-src-e107fbbb1a6371a4d7841cd71acef3612f186f41.zip
FreeBSD-src-e107fbbb1a6371a4d7841cd71acef3612f186f41.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/libkern.h2
-rw-r--r--sys/sys/namei.h42
-rw-r--r--sys/sys/queue.h5
3 files changed, 30 insertions, 19 deletions
diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h
index a1008b8..ccaf7e7 100644
--- a/sys/sys/libkern.h
+++ b/sys/sys/libkern.h
@@ -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);
}
diff --git a/sys/sys/namei.h b/sys/sys/namei.h
index 69daed1..5b133cc 100644
--- a/sys/sys/namei.h
+++ b/sys/sys/namei.h
@@ -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;
diff --git a/sys/sys/queue.h b/sys/sys/queue.h
index a4f09b1..be9b0c5 100644
--- a/sys/sys/queue.h
+++ b/sys/sys/queue.h
@@ -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;
OpenPOWER on IntegriCloud