Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Aug 2009 18:03:25 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 167040 for review
Message-ID:  <200908051803.n75I3PPS081846@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=167040

Change 167040 by rwatson@rwatson_cinnamon on 2009/08/05 18:03:06

	Minor style cleanups -- remove trailing whitespace, add
	punctuation, remove typedef for an in-kernel structure, clean up
	blank lines, comment formatting, and add header guards to help
	handle nested/multiple include problems.

Affected files ...

.. //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit_slice.h#8 edit

Differences ...

==== //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit_slice.h#8 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009 Ilias Marinos 
+ * Copyright (c) 2009 Ilias Marinos
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -24,6 +24,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *
  */
+
+#ifndef _SECURITY_AUDIT_SLICE_H_
+#define	_SECURITY_AUDIT_SLICE_H_
+
 #include <sys/param.h>
 #include <sys/lock.h>
 #include <sys/sx.h>
@@ -31,10 +35,8 @@
 #include <security/audit/audit.h>
 #include <security/audit/audit_private.h>
 
-
-#define AUDIT_SLICE_NAME_LEN 20
-#define AUDIT_DEV_NAME_LEN 20
-
+#define	AUDIT_SLICE_NAME_LEN	20
+#define	AUDIT_DEV_NAME_LEN	20
 
 struct kaudit_record;
 
@@ -45,10 +47,8 @@
  * XXX: Needs work.
  */
 struct audit_slice {
-
         char                            as_name[AUDIT_SLICE_NAME_LEN];
 
-
 	/*
 	 * Define the audit control flags.
 	 */
@@ -56,7 +56,7 @@
 	int				audit_suspended;
 
 	/*
-	 * The actual slice private queue 
+	 * The actual slice private queue.
 	 */
         struct kaudit_queue             audit_q;
         int                             audit_q_len;
@@ -64,7 +64,8 @@
 
 	/*
 	 * Flags controlling behavior in low storage situations.  Should we
-	 * panic if a write fails?  Should we fail stop if we're out of disk space?
+	 * panic if a write fails?  Should we fail stop if we're out of disk
+	 * space?
 	 */
 	int				audit_panic_on_write_fail;	
 	int				audit_fail_stop;	
@@ -77,7 +78,7 @@
 	int				audit_in_failure;
 	
 	/*
-	 *  Slice specific statistics
+	 * Slice specific statistics.
 	 */
 	struct audit_fstat		audit_fstat;
 	
@@ -87,8 +88,8 @@
 	struct au_mask			audit_nae_mask;
 	
 	/*
-	 * Mutex to protect global variables shared between various threads and
-	 * processes.
+	 * Mutex to protect global variables shared between various threads
+	 * and processes.
 	 */
 	struct mtx			audit_mtx;
 
@@ -109,15 +110,15 @@
 
 	
 	/*
-	 * Condition variable to flag when crossing the low watermark, meaning 
-	 * that threads blocked due to hitting the high watermark can wake up 
-	 * and continue to commit records.
+	 * Condition variable to flag when crossing the low watermark,
+	 * meaning that threads blocked due to hitting the high watermark can
+	 * wake up and continue to commit records.
 	 */
 	struct cv			audit_watermark_cv;
 	
 	/*
-	 * Condition variable for  auditing threads wait on when in fail-stop 
-	 * mode. Threads wait on this CV forever (and ever), never seeing the 
+	 * Condition variable for  auditing threads wait on when in fail-stop
+	 * mode. Threads wait on this CV forever (and ever), never seeing the
 	 * light of day again.
 	 */
 	struct cv			audit_fail_cv;
@@ -128,27 +129,26 @@
 	struct proc			*audit_thread;
 	
 	/*
-	 * audit_cred and audit_vp are the stored credential and vnode to use 
-	 * for active audit trail.  They are protected by the audit worker lock,
-	 * which will be held across all I/O and all rotation to prevent them 
-	 * from being replaced (rotated) while in use. The 
-	 * audit_file_rotate_wait flag is set when the kernel has delivered a 
-	 * trigger to auditd to rotate the trail, and is cleared when the next 
-	 * rotation takes place.  It is also protected by the audit worker lock.
+	 * audit_cred and audit_vp are the stored credential and vnode to use
+	 * for active audit trail.  They are protected by the audit worker
+	 * lock, which will be held across all I/O and all rotation to
+	 * prevent them from being replaced (rotated) while in use.  The
+	 * audit_file_rotate_wait flag is set when the kernel has delivered a
+	 * trigger to auditd to rotate the trail, and is cleared when the
+	 * next rotation takes place.  It is also protected by the audit
+	 * worker lock.
 	 */
 	int		 		audit_file_rotate_wait;
 	struct ucred			*audit_cred;
 	struct vnode			*audit_vp;
 	struct sx	 		audit_worker_lock;
 
-
-
 	/*
-	 * Applications need their slice device to submit their audit records.
-	 * Device specific variables here.
+	 * Applications need their slice device to submit their audit
+	 * records.  Device specific variables here.
 	 */
 	struct cdev			*as_dev;
-	char				as_dev_name[AUDIT_DEV_NAME_LEN]; 
+	char				as_dev_name[AUDIT_DEV_NAME_LEN];
 	int				unit;
 	uid_t				uid;
 	gid_t				gid;
@@ -157,22 +157,21 @@
 	struct mtx 			as_dev_mtx;
 	int 				as_dev_isopen;
 
-	/* 
-	 * Keep the several audit slices in a list 
+	/*
+	 * Keep the several audit slices in a list.
 	 */
 	TAILQ_ENTRY(audit_slice)	as_q;
 };
-typedef struct audit_slice		audit_slice_t;
 
 TAILQ_HEAD(audit_slice_queue, audit_slice);
 
-/* Static allocation of the base slice */
+/* Static allocation of the base slice. */
 extern struct audit_slice		*audit_base_slice;
 
-/* Audit slice ptr - helper */
+/* Audit slice ptr - helper. */
 extern struct audit_slice		*as_ptr;
 
-/* Audit slices queue */
+/* Audit slices queue. */
 extern struct audit_slice_queue		audit_slice_q;
 
 
@@ -181,16 +180,17 @@
  * records and require audit_slice struct as arguments.
  */
 struct kaudit_record	*audit_new(int event, struct thread *td,
-		struct audit_slice *as);
+			    struct audit_slice *as);
 
 /*
- * Audit related functions prototypes
+ * Audit related functions prototypes.
  */
-void			audit_rotate_vnode(struct ucred *cred, 
-				struct vnode *vp);
-void			audit_worker_init(void *arg);
-void			audit_slice_init(struct audit_slice *as, char *name);
-void			audit_slice_create(char *name);
-void			audit_slice_destroy(struct audit_slice *as);
-void			audit_slice_cdev_init(struct audit_slice *as);
-void			audit_slice_commit_rec(void *rec, struct audit_slice *as);
+void	audit_rotate_vnode(struct ucred *cred, struct vnode *vp);
+void	audit_worker_init(void *arg);
+void	audit_slice_init(struct audit_slice *as, char *name);
+void	audit_slice_create(char *name);
+void	audit_slice_destroy(struct audit_slice *as);
+void	audit_slice_cdev_init(struct audit_slice *as);
+void	audit_slice_commit_rec(void *rec, struct audit_slice *as);
+
+#endif /* ! _SECURITY_AUDIT_SLICE_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908051803.n75I3PPS081846>