Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Don't nest structure definitions.



details:   https://anonhg.NetBSD.org/src/rev/865e69bfbb1a
branches:  trunk
changeset: 332029:865e69bfbb1a
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Sep 05 05:42:50 2014 +0000

description:
Don't nest structure definitions.

diffstat:

 sys/sys/exec.h   |  11 ++++++-----
 sys/sys/file.h   |  34 ++++++++++++++++++----------------
 sys/sys/namei.h  |  41 ++++++++++++++++++++++++-----------------
 sys/sys/pool.h   |   5 +++--
 sys/sys/sysctl.h |  50 ++++++++++++++++++++++++++------------------------
 sys/sys/wapbl.h  |   5 +++--
 6 files changed, 80 insertions(+), 66 deletions(-)

diffs (277 lines):

diff -r a993ed4fe09c -r 865e69bfbb1a sys/sys/exec.h
--- a/sys/sys/exec.h    Fri Sep 05 05:39:52 2014 +0000
+++ b/sys/sys/exec.h    Fri Sep 05 05:42:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec.h,v 1.145 2014/03/06 09:30:37 matt Exp $  */
+/*     $NetBSD: exec.h,v 1.146 2014/09/05 05:42:50 matt Exp $  */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -181,6 +181,10 @@
 };
 
 #define        EXEC_DEFAULT_VMCMD_SETSIZE      9       /* # of cmds in set to start */
+struct exec_fakearg {
+       char *fa_arg;
+       size_t fa_len;
+};
 
 struct exec_package {
        const char *ep_name;            /* file's name */
@@ -205,10 +209,7 @@
        vaddr_t ep_vm_maxaddr;          /* top of process address space */
        u_int   ep_flags;               /* flags; see below. */
        size_t  ep_fa_len;              /* byte size of ep_fa */
-       struct exec_fakearg {
-               char *fa_arg;
-               size_t fa_len;
-       } *ep_fa;                       /* a fake args vector for scripts */
+       struct exec_fakearg *ep_fa;     /* a fake args vector for scripts */
        int     ep_fd;                  /* a file descriptor we're holding */
        void    *ep_emul_arg;           /* emulation argument */
        const struct    execsw *ep_esch;/* execsw entry */
diff -r a993ed4fe09c -r 865e69bfbb1a sys/sys/file.h
--- a/sys/sys/file.h    Fri Sep 05 05:39:52 2014 +0000
+++ b/sys/sys/file.h    Fri Sep 05 05:42:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.h,v 1.75 2013/01/02 19:35:43 dsl Exp $    */
+/*     $NetBSD: file.h,v 1.76 2014/09/05 05:42:50 matt Exp $   */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -78,6 +78,22 @@
 struct stat;
 struct knote;
 
+struct fileops {
+       int     (*fo_read)      (struct file *, off_t *, struct uio *,
+                                   kauth_cred_t, int);
+       int     (*fo_write)     (struct file *, off_t *, struct uio *,
+                                   kauth_cred_t, int);
+       int     (*fo_ioctl)     (struct file *, u_long, void *);
+       int     (*fo_fcntl)     (struct file *, u_int, void *);
+       int     (*fo_poll)      (struct file *, int);
+       int     (*fo_stat)      (struct file *, struct stat *);
+       int     (*fo_close)     (struct file *);
+       int     (*fo_kqfilter)  (struct file *, struct knote *);
+       void    (*fo_restart)   (struct file *);
+       void    (*fo_spare1)    (void);
+       void    (*fo_spare2)    (void);
+};
+
 /*
  * Kernel file descriptor.  One entry for each open kernel vnode and
  * socket.
@@ -88,21 +104,7 @@
 struct file {
        off_t           f_offset;       /* first, is 64-bit */
        kauth_cred_t    f_cred;         /* creds associated with descriptor */
-       const struct fileops {
-               int     (*fo_read)      (struct file *, off_t *, struct uio *,
-                                           kauth_cred_t, int);
-               int     (*fo_write)     (struct file *, off_t *, struct uio *,
-                                           kauth_cred_t, int);
-               int     (*fo_ioctl)     (struct file *, u_long, void *);
-               int     (*fo_fcntl)     (struct file *, u_int, void *);
-               int     (*fo_poll)      (struct file *, int);
-               int     (*fo_stat)      (struct file *, struct stat *);
-               int     (*fo_close)     (struct file *);
-               int     (*fo_kqfilter)  (struct file *, struct knote *);
-               void    (*fo_restart)   (struct file *);
-               void    (*fo_spare1)    (void);
-               void    (*fo_spare2)    (void);
-       } *f_ops;
+       const struct fileops *f_ops;
        void            *f_data;        /* descriptor data, e.g. vnode/socket */
        LIST_ENTRY(file) f_list;        /* list of active files */
        kmutex_t        f_lock;         /* lock on structure */
diff -r a993ed4fe09c -r 865e69bfbb1a sys/sys/namei.h
--- a/sys/sys/namei.h   Fri Sep 05 05:39:52 2014 +0000
+++ b/sys/sys/namei.h   Fri Sep 05 05:42:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namei.h,v 1.89 2014/06/03 21:16:37 joerg Exp $ */
+/*     $NetBSD: namei.h,v 1.90 2014/09/05 05:42:50 matt Exp $  */
 
 
 /*
@@ -85,6 +85,26 @@
 int pathbuf_maybe_copyin(const char *userpath, enum uio_seg seg, struct pathbuf **ret);
 
 /*
+ * Lookup parameters: this structure describes the subset of
+ * information from the nameidata structure that is passed
+ * through the VOP interface.
+ */
+struct componentname {
+       /*
+        * Arguments to lookup.
+        */
+       uint32_t        cn_nameiop;     /* namei operation */
+       uint32_t        cn_flags;       /* flags to namei */
+       kauth_cred_t    cn_cred;        /* credentials */
+       /*
+        * Shared between lookup and commit routines.
+        */
+       const char      *cn_nameptr;    /* pointer to looked up name */
+       size_t          cn_namelen;     /* length of looked up comp */
+       size_t          cn_consume;     /* chars to consume in lookup */
+};
+
+/*
  * Encapsulation of namei parameters.
  */
 struct nameidata {
@@ -115,20 +135,7 @@
         * information from the nameidata structure that is passed
         * through the VOP interface.
         */
-       struct componentname {
-               /*
-                * Arguments to lookup.
-                */
-               uint32_t        cn_nameiop;     /* namei operation */
-               uint32_t        cn_flags;       /* flags to namei */
-               kauth_cred_t    cn_cred;        /* credentials */
-               /*
-                * Shared between lookup and commit routines.
-                */
-               const char      *cn_nameptr;    /* pointer to looked up name */
-               size_t          cn_namelen;     /* length of looked up comp */
-               size_t          cn_consume;     /* chars to consume in lookup */
-       } ni_cnd;
+       struct componentname ni_cnd;
 };
 
 /*
@@ -229,8 +236,8 @@
 
 extern pool_cache_t pnbuf_cache;       /* pathname buffer cache */
 
-#define        PNBUF_GET()     pool_cache_get(pnbuf_cache, PR_WAITOK)
-#define        PNBUF_PUT(pnb)  pool_cache_put(pnbuf_cache, (pnb))
+#define        PNBUF_GET()     ((char *)pool_cache_get(pnbuf_cache, PR_WAITOK))
+#define        PNBUF_PUT(pnb)  pool_cache_put(pnbuf_cache, (void *)(pnb))
 
 /*
  * Typesafe flags for namei_simple/nameiat_simple.
diff -r a993ed4fe09c -r 865e69bfbb1a sys/sys/pool.h
--- a/sys/sys/pool.h    Fri Sep 05 05:39:52 2014 +0000
+++ b/sys/sys/pool.h    Fri Sep 05 05:42:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pool.h,v 1.76 2014/06/13 19:09:07 joerg Exp $  */
+/*     $NetBSD: pool.h,v 1.77 2014/09/05 05:42:50 matt Exp $   */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2007 The NetBSD Foundation, Inc.
@@ -97,6 +97,7 @@
 };
 
 LIST_HEAD(pool_pagelist,pool_item_header);
+SPLAY_HEAD(phtree, pool_item_header);
 
 struct pool {
        TAILQ_ENTRY(pool)
@@ -158,7 +159,7 @@
        kcondvar_t      pr_cv;
        int             pr_ipl;
 
-       SPLAY_HEAD(phtree, pool_item_header) pr_phtree;
+       struct phtree   pr_phtree;
 
        int             pr_maxcolor;    /* Cache colouring */
        int             pr_curcolor;
diff -r a993ed4fe09c -r 865e69bfbb1a sys/sys/sysctl.h
--- a/sys/sys/sysctl.h  Fri Sep 05 05:39:52 2014 +0000
+++ b/sys/sys/sysctl.h  Fri Sep 05 05:42:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl.h,v 1.213 2014/07/12 09:57:25 njoly Exp $       */
+/*     $NetBSD: sysctl.h,v 1.214 2014/09/05 05:42:50 matt Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -415,34 +415,36 @@
 
 #if defined(_KERNEL) || defined(_KMEMUSER)
 
+struct eproc {
+       struct  proc *e_paddr;          /* address of proc */
+       struct  session *e_sess;        /* session pointer */
+       struct  ki_pcred e_pcred;       /* process credentials */
+       struct  ki_ucred e_ucred;       /* current credentials */
+       struct  vmspace e_vm;           /* address space */
+       pid_t   e_ppid;                 /* parent process id */
+       pid_t   e_pgid;                 /* process group id */
+       short   e_jobc;                 /* job control counter */
+       uint32_t e_tdev;                /* XXX: controlling tty dev */
+       pid_t   e_tpgid;                /* tty process group id */
+       struct  session *e_tsess;       /* tty session pointer */
+#define        WMESGLEN        8
+       char    e_wmesg[WMESGLEN];      /* wchan message */
+       segsz_t e_xsize;                /* text size */
+       short   e_xrssize;              /* text rss */
+       short   e_xccount;              /* text references */
+       short   e_xswrss;
+       long    e_flag;                 /* see p_eflag  below */
+       char    e_login[MAXLOGNAME];    /* setlogin() name */
+       pid_t   e_sid;                  /* session id */
+       long    e_spare[3];
+};
+
 /*
  * KERN_PROC subtype ops return arrays of augmented proc structures:
  */
 struct kinfo_proc {
        struct  proc kp_proc;                   /* proc structure */
-       struct  eproc {
-               struct  proc *e_paddr;          /* address of proc */
-               struct  session *e_sess;        /* session pointer */
-               struct  ki_pcred e_pcred;       /* process credentials */
-               struct  ki_ucred e_ucred;       /* current credentials */
-               struct  vmspace e_vm;           /* address space */
-               pid_t   e_ppid;                 /* parent process id */
-               pid_t   e_pgid;                 /* process group id */
-               short   e_jobc;                 /* job control counter */
-               uint32_t e_tdev;                /* XXX: controlling tty dev */
-               pid_t   e_tpgid;                /* tty process group id */
-               struct  session *e_tsess;       /* tty session pointer */
-#define        WMESGLEN        8
-               char    e_wmesg[WMESGLEN];      /* wchan message */
-               segsz_t e_xsize;                /* text size */
-               short   e_xrssize;              /* text rss */
-               short   e_xccount;              /* text references */
-               short   e_xswrss;
-               long    e_flag;                 /* see p_eflag  below */
-               char    e_login[MAXLOGNAME];    /* setlogin() name */
-               pid_t   e_sid;                  /* session id */
-               long    e_spare[3];
-       } kp_eproc;
+       struct  eproc kp_eproc;                 /* eproc structure */
 };
 #endif /* defined(_KERNEL) || defined(_KMEMUSER) */
 
diff -r a993ed4fe09c -r 865e69bfbb1a sys/sys/wapbl.h
--- a/sys/sys/wapbl.h   Fri Sep 05 05:39:52 2014 +0000
+++ b/sys/sys/wapbl.h   Fri Sep 05 05:42:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wapbl.h,v 1.15 2013/09/30 18:58:00 hannken Exp $       */
+/*     $NetBSD: wapbl.h,v 1.16 2014/09/05 05:42:50 matt Exp $  */
 
 /*-
  * Copyright (c) 2003,2008 The NetBSD Foundation, Inc.
@@ -215,6 +215,7 @@
 /* Replay support */
 
 #ifdef WAPBL_INTERNAL
+LIST_HEAD(wapbl_blk_head, wapbl_blk);
 struct wapbl_replay {
        struct vnode *wr_logvp;
        struct vnode *wr_devvp;
@@ -228,7 +229,7 @@
 
        void *wr_scratch;
 
-       LIST_HEAD(wapbl_blk_head, wapbl_blk) *wr_blkhash;
+       struct wapbl_blk_head *wr_blkhash;
        u_long wr_blkhashmask;
        int wr_blkhashcnt;
 



Home | Main Index | Thread Index | Old Index