From owner-p4-projects@FreeBSD.ORG Wed Aug 5 18:03:25 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 997071065676; Wed, 5 Aug 2009 18:03:25 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56CF81065674 for ; Wed, 5 Aug 2009 18:03:25 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 426FD8FC15 for ; Wed, 5 Aug 2009 18:03:25 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n75I3PDK081848 for ; Wed, 5 Aug 2009 18:03:25 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n75I3PPS081846 for perforce@freebsd.org; Wed, 5 Aug 2009 18:03:25 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 5 Aug 2009 18:03:25 GMT Message-Id: <200908051803.n75I3PPS081846@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 167040 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2009 18:03:26 -0000 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 #include #include @@ -31,10 +35,8 @@ #include #include - -#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_ */