DragonFly BSD
DragonFly submit List (threaded) for 2004-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

patches to style(9) and sys/sys/*.h to address parameter names in prototypes


From: Chris Pressey <cpressey@xxxxxxxxxxxxxxx>
Date: Fri, 20 Feb 2004 19:54:25 -0800

Hi,

The attached patches:

1) update style(9) to reflect DragonFly's position on parameter names in
userland-visible prototypes and

2) remove the parameter names from all the unambiguously
userland-visible prototypes I could find in /usr/src/sys/sys/*.h .

I say "unambiguously" because there are some headers in sys/sys that do
not check the value of _KERNEL in any way, and look to be only of
interest to the kernel.  But maybe not?  With no check, it's impossible
to tell for certain without taking a survey of consumers (and who knows
what evil dost lurketh in ports...)  May I suggest that these headers,
if they really are kernel-only, follow sys/taskqueue.h's lead and cause
an #error if neither _KERNEL nor _KERNEL_STRUCTURES is defined?

Testing (make buildworld) is in progress, I'll let you know in a couple
of hours if these changes have caused any problems for me.

Thanks,
-Chris
Index: share/man/man9/style.9
===================================================================
RCS file: /home/dcvs/src/share/man/man9/style.9,v
retrieving revision 1.5
diff -u -r1.5 style.9
--- share/man/man9/style.9	5 Feb 2004 11:51:54 -0000	1.5
+++ share/man/man9/style.9	20 Feb 2004 19:25:27 -0000
@@ -274,28 +274,20 @@
 .Nm
 guidelines.
 .Pp
-The kernel has a name associated with parameter types, e.g., in the kernel
-use:
+Function prototypes for the kernel have parameter names associated
+with parameter types. E.g., in the kernel use:
 .Bd -literal
 void	function(int fd);
 .Ed
 .Pp
-In header files visible to userland applications, prototypes that are
-visible must use either
-.Dq protected
-names (ones beginning with an underscore)
-or no names with the types.
-It is preferable to use protected names.
-E.g., use:
+Prototypes that are visible to userland applications
+should not include parameter names with the types, to avoid
+possible collisions with defined macro names.
+I.e., use:
 .Bd -literal
 void	function(int);
 .Ed
 .Pp
-or:
-.Bd -literal
-void	function(int _fd);
-.Ed
-.Pp
 Prototypes may have an extra space after a tab to enable function names
 to line up:
 .Bd -literal
Index: sys/sys/acl.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/acl.h,v
retrieving revision 1.2
diff -u -r1.2 acl.h
--- sys/sys/acl.h	17 Jun 2003 04:28:58 -0000	1.2
+++ sys/sys/acl.h	20 Feb 2004 18:54:19 -0000
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/sys/acl.h,v 1.8 2000/01/28 15:22:51 rwatson Exp $
- * $DragonFly: src/sys/sys/acl.h,v 1.2 2003/06/17 04:28:58 dillon Exp $
+ * $DragonFly: src/sys/sys/acl.h,v 1.1 2003/06/16 06:46:56 dillon Exp $
  */
 
 /* 
@@ -108,15 +108,14 @@
  * have strict acl entry ordering requirements
  */
 __BEGIN_DECLS
-int	__acl_aclcheck_fd(int _filedes, acl_type_t _type, struct acl *_aclp);
-int	__acl_aclcheck_file(const char *_path, acl_type_t _type,
-	    struct acl *_aclp);
-int	__acl_delete_fd(int _filedes, acl_type_t _type);
-int	__acl_delete_file(const char *_path_p, acl_type_t _type);
-int	__acl_get_fd(int _filedes, acl_type_t _type, struct acl *_aclp);
-int	__acl_get_file(const char *_path, acl_type_t _type, struct acl *_aclp);
-int	__acl_set_fd(int _filedes, acl_type_t _type, struct acl *_aclp);
-int	__acl_set_file(const char *_path, acl_type_t _type, struct acl *_aclp);
+int	__acl_aclcheck_fd(int, acl_type_t, struct acl *);
+int	__acl_aclcheck_file(const char *, acl_type_t, struct acl *);
+int	__acl_delete_fd(int, acl_type_t);
+int	__acl_delete_file(const char *, acl_type_t);
+int	__acl_get_fd(int, acl_type_t, struct acl *);
+int	__acl_get_file(const char *, acl_type_t, struct acl *);
+int	__acl_set_fd(int, acl_type_t, struct acl *);
+int	__acl_set_file(const char *, acl_type_t, struct acl *);
 __END_DECLS
 
 /*
@@ -126,23 +125,23 @@
  * ACL type for different file systems (i.e., AFS)
  */
 __BEGIN_DECLS
-int	acl_delete_fd_np(int _filedes, acl_type_t _type);
-int	acl_delete_file_np(const char *_path_p, acl_type_t _type);
-int	acl_delete_def_file(const char *_path_p);
-acl_t	acl_dup(acl_t _acl);
-int	acl_free(void *_obj_p);
-acl_t	acl_from_text(const char *_buf_p);
-acl_t	acl_get_fd(int _fd);
-acl_t	acl_get_fd_np(int fd, acl_type_t _type);
-acl_t	acl_get_file(const char *_path_p, acl_type_t _type);
-acl_t	acl_init(int _count);
-int	acl_set_fd(int _fd, acl_t _acl);
-int	acl_set_fd_np(int _fd, acl_t _acl, acl_type_t _type);
-int	acl_set_file(const char *_path_p, acl_type_t _type, acl_t _acl);
-char	*acl_to_text(acl_t _acl, ssize_t *_len_p);
-int	acl_valid(acl_t _acl);
-int	acl_valid_fd_np(int _fd, acl_type_t _type, acl_t _acl);
-int	acl_valid_file_np(const char *_path_p, acl_type_t _type, acl_t _acl);
+int	acl_delete_fd_np(int, acl_type_t);
+int	acl_delete_file_np(const char *, acl_type_t);
+int	acl_delete_def_file(const char *);
+acl_t	acl_dup(acl_t);
+int	acl_free(void *);
+acl_t	acl_from_text(const char *);
+acl_t	acl_get_fd(int);
+acl_t	acl_get_fd_np(int, acl_type_t);
+acl_t	acl_get_file(const char *, acl_type_t);
+acl_t	acl_init(int);
+int	acl_set_fd(int, acl_t);
+int	acl_set_fd_np(int, acl_t, acl_type_t);
+int	acl_set_file(const char *, acl_type_t, acl_t);
+char	*acl_to_text(acl_t, ssize_t *);
+int	acl_valid(acl_t);
+int	acl_valid_fd_np(int, acl_type_t, acl_t);
+int	acl_valid_file_np(const char *, acl_type_t, acl_t);
 __END_DECLS
 
 #endif /* !_KERNEL */
Index: sys/sys/caps.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/caps.h,v
retrieving revision 1.3
diff -u -r1.3 caps.h
--- sys/sys/caps.h	18 Jan 2004 12:50:15 -0000	1.3
+++ sys/sys/caps.h	20 Feb 2004 18:56:27 -0000
@@ -3,7 +3,7 @@
  *
  *	Implements an architecture independant Capability Service API
  * 
- * $DragonFly: src/sys/sys/caps.h,v 1.3 2004/01/18 12:50:15 dillon Exp $
+ * $DragonFly$
  */
 
 #ifndef _SYS_CAPS_H_
@@ -164,20 +164,19 @@
 /*
  * Userland API (libcaps)
  */
-caps_port_t caps_service(const char *name, uid_t uid, gid_t gid, 
-			    mode_t modes, int flags);
-caps_port_t caps_client(const char *name, uid_t uid, gid_t gid, int flags);
+caps_port_t caps_service(const char *, uid_t, gid_t, mode_t, int);
+caps_port_t caps_client(const char *, uid_t, gid_t, int);
 
 /*
  * Syscall API
  */
-int caps_sys_service(const char *name, uid_t uid, gid_t gid, int upcid, int flags);
-int caps_sys_client(const char *name, uid_t uid, gid_t gid, int upcid, int flags);
-off_t caps_sys_put(int portid, void *msg, int msgsize);
-int caps_sys_reply(int portid, void *msg, int msgsize, off_t msgcid);
-int caps_sys_get(int portid, void *msg, int maxsize, caps_msgid_t msgid, caps_cred_t ccr);
-int caps_sys_wait(int portid, void *msg, int maxsize, caps_msgid_t msgid, caps_cred_t ccr);
-int caps_sys_abort(int portid, off_t msgcid, int flags);
+int caps_sys_service(const char *, uid_t, gid_t, int, int);
+int caps_sys_client(const char *, uid_t, gid_t, int, int);
+off_t caps_sys_put(int, void *, int);
+int caps_sys_reply(int, void *, int, off_t);
+int caps_sys_get(int, void *, int, caps_msgid_t, caps_cred_t);
+int caps_sys_wait(int, void *, int, caps_msgid_t, caps_cred_t);
+int caps_sys_abort(int, off_t, int);
 
 #endif
 
Index: sys/sys/event.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/event.h,v
retrieving revision 1.4
diff -u -r1.4 event.h
--- sys/sys/event.h	20 Aug 2003 07:31:21 -0000	1.4
+++ sys/sys/event.h	20 Feb 2004 19:28:15 -0000
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  *	$FreeBSD: src/sys/sys/event.h,v 1.5.2.6 2003/02/09 15:28:13 nectar Exp $
- *	$DragonFly: src/sys/sys/event.h,v 1.4 2003/08/20 07:31:21 rob Exp $
+ *	$DragonFly$
  */
 
 #ifndef _SYS_EVENT_H_
@@ -179,9 +179,8 @@
 
 __BEGIN_DECLS
 int     kqueue (void);
-int     kevent (int kq, const struct kevent *changelist, int nchanges,
-		    struct kevent *eventlist, int nevents,
-		    const struct timespec *timeout);
+int     kevent (int, const struct kevent *, int, struct kevent *,
+		int, const struct timespec *);
 __END_DECLS
 
 #endif /* !_KERNEL */
Index: sys/sys/extattr.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/extattr.h,v
retrieving revision 1.2
diff -u -r1.2 extattr.h
--- sys/sys/extattr.h	17 Jun 2003 04:28:58 -0000	1.2
+++ sys/sys/extattr.h	20 Feb 2004 19:02:11 -0000
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/sys/extattr.h,v 1.3 2000/01/19 06:07:34 rwatson Exp $
- * $DragonFly: src/sys/sys/extattr.h,v 1.2 2003/06/17 04:28:58 dillon Exp $
+ * $DragonFly: src/sys/sys/extattr.h,v 1.1 2003/06/16 06:47:39 dillon Exp $
  */
 /*
  * Userland/kernel interface for Extended File System Attributes
@@ -52,12 +52,12 @@
 struct iovec;
 
 __BEGIN_DECLS
-int	extattrctl(const char *path, int cmd, const char *attrname, char *arg);
-int	extattr_delete_file(const char *path, const char *attrname);
-int	extattr_get_file(const char *path, const char *attrname,
-	    struct iovec *iovp, unsigned iovcnt);
-int	extattr_set_file(const char *path, const char *attrname,
-	    struct iovec *iovp, unsigned iovcnt);
+int	extattrctl(const char *, int, const char *, char *);
+int	extattr_delete_file(const char *, const char *);
+int	extattr_get_file(const char *, const char *,
+	    struct iovec *, unsigned);
+int	extattr_set_file(const char *, const char *,
+	    struct iovec *, unsigned);
 __END_DECLS
 
 #endif /* !_KERNEL */
Index: sys/sys/interrupt.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/interrupt.h,v
retrieving revision 1.7
diff -u -r1.7 interrupt.h
--- sys/sys/interrupt.h	13 Jul 2003 05:45:12 -0000	1.7
+++ sys/sys/interrupt.h	20 Feb 2004 19:04:48 -0000
@@ -24,7 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/sys/interrupt.h,v 1.9.2.1 2001/10/14 20:05:50 luigi Exp $
- * $DragonFly: src/sys/sys/interrupt.h,v 1.7 2003/07/13 05:45:12 dillon Exp $
+ * $DragonFly: src/sys/sys/interrupt.h,v 1.6 2003/07/08 06:27:28 dillon Exp $
  */
 
 #ifndef _SYS_INTERRUPT_H_
@@ -32,8 +32,8 @@
 
 #define MAX_INTS	32
 
-typedef void inthand2_t (void *_cookie);
-typedef void ointhand2_t (int _device_id);
+typedef void inthand2_t (void *);
+typedef void ointhand2_t (int);
 
 #ifdef _KERNEL
 
Index: sys/sys/kernel.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/kernel.h,v
retrieving revision 1.8
diff -u -r1.8 kernel.h
--- sys/sys/kernel.h	30 Jan 2004 05:42:17 -0000	1.8
+++ sys/sys/kernel.h	20 Feb 2004 19:04:15 -0000
@@ -245,7 +245,7 @@
 	C_SYSUNINIT(uniquifier, subsystem, order,		\
 	(sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)ident)
 
-void	sysinit_add (struct sysinit **set, struct sysinit **set_end);
+void	sysinit_add (struct sysinit **, struct sysinit **);
 
 /*
  * Infrastructure for tunable 'constants'.  Value may be specified at compile
@@ -358,11 +358,11 @@
 
 struct intr_config_hook {
 	TAILQ_ENTRY(intr_config_hook) ich_links;
-	void	(*ich_func) (void *arg);
+	void	(*ich_func) (void *);
 	void	*ich_arg;
 };
 
-int	config_intrhook_establish (struct intr_config_hook *hook);
-void	config_intrhook_disestablish (struct intr_config_hook *hook);
+int	config_intrhook_establish (struct intr_config_hook *);
+void	config_intrhook_disestablish (struct intr_config_hook *);
 
 #endif /* !_SYS_KERNEL_H_*/
Index: sys/sys/linker.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/linker.h,v
retrieving revision 1.5
diff -u -r1.5 linker.h
--- sys/sys/linker.h	20 Nov 2003 22:07:34 -0000	1.5
+++ sys/sys/linker.h	20 Feb 2004 19:06:42 -0000
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/sys/linker.h,v 1.17.2.1 2002/03/11 01:13:53 dd Exp $
- * $DragonFly: src/sys/sys/linker.h,v 1.5 2003/11/20 22:07:34 dillon Exp $
+ * $DragonFly$
  */
 
 #ifndef _SYS_LINKER_H_
@@ -255,13 +255,13 @@
  * Module lookup
  */
 extern caddr_t		preload_metadata;
-extern caddr_t		preload_search_by_name(const char *_name);
-extern caddr_t		preload_search_by_type(const char *_type);
-extern caddr_t		preload_search_next_name(caddr_t _base);
-extern caddr_t		preload_search_info(caddr_t _mod, int _inf);
-extern void		preload_delete_name(const char *_name);
-extern void		preload_bootstrap_relocate(vm_offset_t _offset);
-extern struct mod_metadata *find_mod_metadata(const char *modname);
+extern caddr_t		preload_search_by_name(const char *);
+extern caddr_t		preload_search_by_type(const char *);
+extern caddr_t		preload_search_next_name(caddr_t);
+extern caddr_t		preload_search_info(caddr_t, int);
+extern void		preload_delete_name(const char *);
+extern void		preload_bootstrap_relocate(vm_offset_t);
+extern struct mod_metadata *find_mod_metadata(const char *);
 
 
 #ifdef KLD_DEBUG
@@ -282,8 +282,8 @@
 #endif
 
 /* Support functions */
-int	elf_reloc(linker_file_t _lf, const void *_rel, int _type,
-		  const char *_sym);
+int	elf_reloc(linker_file_t, const void *, int, const char *);
+
 /* values for type */
 #define ELF_RELOC_REL	1
 #define ELF_RELOC_RELA	2
@@ -312,13 +312,13 @@
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
-int	kldload(const char* _file);
-int	kldunload(int _fileid);
-int	kldfind(const char* _file);
-int	kldnext(int _fileid);
-int	kldstat(int _fileid, struct kld_file_stat* _stat);
-int	kldfirstmod(int _fileid);
-int	kldsym(int _fileid, int _cmd, void *_data);
+int	kldload(const char *);
+int	kldunload(int);
+int	kldfind(const char *);
+int	kldnext(int);
+int	kldstat(int, struct kld_file_stat *);
+int	kldfirstmod(int);
+int	kldsym(int, int, void *);
 __END_DECLS
 
 #endif
Index: sys/sys/module.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/module.h,v
retrieving revision 1.6
diff -u -r1.6 module.h
--- sys/sys/module.h	17 Jan 2004 03:24:48 -0000	1.6
+++ sys/sys/module.h	20 Feb 2004 19:07:33 -0000
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/sys/module.h,v 1.14.2.3 2002/03/17 11:07:45 alfred Exp $
- * $DragonFly: src/sys/sys/module.h,v 1.6 2004/01/17 03:24:48 dillon Exp $
+ * $DragonFly$
  */
 
 #ifndef _SYS_MODULE_H_
@@ -174,10 +174,10 @@
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
-int	modnext(int _modid);
-int	modfnext(int _modid);
-int	modstat(int _modid, struct module_stat* _stat);
-int	modfind(const char *_name);
+int	modnext(int);
+int	modfnext(int);
+int	modstat(int, struct module_stat *);
+int	modfind(const char *);
 __END_DECLS
 
 #endif
Index: sys/sys/poll.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/poll.h,v
retrieving revision 1.5
diff -u -r1.5 poll.h
--- sys/sys/poll.h	22 Nov 2003 19:30:57 -0000	1.5
+++ sys/sys/poll.h	20 Feb 2004 19:08:18 -0000
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/sys/poll.h,v 1.6.2.1 2000/08/21 12:25:58 sheldonh Exp $
- * $DragonFly: src/sys/sys/poll.h,v 1.5 2003/11/22 19:30:57 asmodai Exp $
+ * $DragonFly$
  */
 
 #ifndef _SYS_POLL_H_
@@ -106,7 +106,7 @@
  * XXX poll() has "unsigned long" nfds on SVR4, not unsigned as on the
  * other BSDs.
  */
-int	poll (struct pollfd *_pfd, unsigned int _nfds, int _timeout);
+int	poll (struct pollfd *, unsigned int, int);
 __END_DECLS
 
 #endif /* !_KERNEL */
Index: sys/sys/protosw.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/protosw.h,v
retrieving revision 1.4
diff -u -r1.4 protosw.h
--- sys/sys/protosw.h	20 Aug 2003 07:31:21 -0000	1.4
+++ sys/sys/protosw.h	20 Feb 2004 19:17:50 -0000
@@ -32,7 +32,7 @@
  *
  *	@(#)protosw.h	8.1 (Berkeley) 6/2/93
  * $FreeBSD: src/sys/sys/protosw.h,v 1.28.2.2 2001/07/03 11:02:01 ume Exp $
- * $DragonFly: src/sys/sys/protosw.h,v 1.4 2003/08/20 07:31:21 rob Exp $
+ * $DragonFly$
  */
 
 #ifndef _SYS_PROTOSW_H_
@@ -74,9 +74,9 @@
 	short	pr_protocol;		/* protocol number */
 	short	pr_flags;		/* see below */
 /* protocol-protocol hooks */
-	void	(*pr_input) (struct mbuf *, int len);
+	void	(*pr_input) (struct mbuf *, int);
 					/* input to protocol (from below) */
-	int	(*pr_output)	(struct mbuf *m, struct socket *so);
+	int	(*pr_output)	(struct mbuf *, struct socket *);
 					/* output to protocol (from above) */
 	void	(*pr_ctlinput)(int, struct sockaddr *, void *);
 					/* control input (from below) */
Index: sys/sys/ptrace.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/ptrace.h,v
retrieving revision 1.4
diff -u -r1.4 ptrace.h
--- sys/sys/ptrace.h	20 Aug 2003 07:31:21 -0000	1.4
+++ sys/sys/ptrace.h	20 Feb 2004 19:18:22 -0000
@@ -32,7 +32,7 @@
  *
  *	@(#)ptrace.h	8.2 (Berkeley) 1/4/94
  * $FreeBSD: src/sys/sys/ptrace.h,v 1.10.2.2 2003/01/02 20:39:13 kan Exp $
- * $DragonFly: src/sys/sys/ptrace.h,v 1.4 2003/08/20 07:31:21 rob Exp $
+ * $DragonFly$
  */
 
 #ifndef	_SYS_PTRACE_H_
@@ -83,7 +83,7 @@
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
-int	ptrace (int _request, pid_t _pid, caddr_t _addr, int _data);
+int	ptrace (int, pid_t, caddr_t, int);
 __END_DECLS
 
 #endif /* !_KERNEL */
Index: sys/sys/resident.h
===================================================================
RCS file: /home/dcvs/src/sys/sys/resident.h,v
retrieving revision 1.1
diff -u -r1.1 resident.h
--- sys/sys/resident.h	20 Jan 2004 21:03:20 -0000	1.1
+++ sys/sys/resident.h	20 Feb 2004 19:18:42 -0000
@@ -3,7 +3,7 @@
  *
  *	Userland system calls for resident executable support.
  *
- * $DragonFly: src/sys/sys/resident.h,v 1.1 2004/01/20 21:03:20 dillon Exp $
+ * $DragonFly$
  */
 
 #ifndef _SYS_RESIDENT_H_
@@ -11,8 +11,8 @@
 
 #if !defined(_KERNEL)
 
-int exec_sys_register(void *entry);
-int exec_sys_unregister(int id);
+int exec_sys_register(void *);
+int exec_sys_unregister(int);
 
 #endif
 


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