PERFORCE change 75886 for review
Robert Watson
rwatson at FreeBSD.org
Sun Apr 24 15:58:57 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=75886
Change 75886 by rwatson at rwatson_paprika on 2005/04/24 15:58:48
Try to clean up the state of nested includes a bit:
- #ifdef KERNEL interfaces related to struct vattr, which is
kernel-only.
- Avoid nested includes from include files where possible, and
instead rely on forward declarations of structures. Include in
.c files only where necessary.
Affected files ...
.. //depot/projects/trustedbsd/openbsm/bsm/audit.h#4 edit
.. //depot/projects/trustedbsd/openbsm/bsm/audit_kernel.h#4 edit
.. //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#3 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#4 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_wrappers.c#4 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/libbsm.h#5 edit
Differences ...
==== //depot/projects/trustedbsd/openbsm/bsm/audit.h#4 (text+ko) ====
@@ -24,13 +24,6 @@
#ifndef _BSM_AUDIT_H
#define _BSM_AUDIT_H
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/ucred.h>
-#include <sys/ipc.h>
-#include <sys/socket.h>
-#include <sys/cdefs.h>
-
#define AUDIT_RECORD_MAGIC 0x828a0f1b
#define MAX_AUDIT_RECORDS 20
#define MAX_AUDIT_RECORD_SIZE 4096
==== //depot/projects/trustedbsd/openbsm/bsm/audit_kernel.h#4 (text+ko) ====
@@ -26,12 +26,6 @@
#if defined(_KERNEL) || defined(KERNEL)
-#include <bsm/audit.h>
-
-#include <sys/sysctl.h>
-#include <sys/eventvar.h>
-#include <sys/user.h>
-
/*
* Audit subsystem condition flags. The audit_enabled flag is set and
* removed automatically as a result of configuring log files, and
==== //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#3 (text+ko) ====
@@ -24,15 +24,6 @@
#ifndef _BSM_AUDIT_RECORD_H_
#define _BSM_AUDIT_RECORD_H_
-#include <sys/cdefs.h>
-#include <sys/vnode.h>
-#include <sys/ipc.h>
-#include <sys/un.h>
-#include <sys/event.h>
-#include <netinet/in_systm.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-
/* We could determined the header and trailer sizes by
* defining appropriate structures. We hold off that approach
* till we have a consistant way of using structures for all tokens.
@@ -228,6 +219,18 @@
__BEGIN_DECLS
+struct in_addr;
+struct in6_addr;
+struct ip;
+struct ipc_perm;
+struct kevent;
+struct sockaddr_in;
+struct sockaddr_in6;
+struct sockaddr_un;
+#if defined(_KERNEL) || defined(KERNEL)
+struct vattr;
+#endif
+
int au_open(void);
int au_write(int d, token_t *m);
int au_close(int d, int keep, short event);
@@ -243,9 +246,11 @@
token_t *au_to_arg(char n, char *text, u_int32_t v);
token_t *au_to_arg32(char n, char *text, u_int32_t v);
token_t *au_to_arg64(char n, char *text, u_int64_t v);
+#if defined(_KERNEL) || defined(KERNEL)
token_t *au_to_attr(struct vattr *attr);
token_t *au_to_attr32(struct vattr *attr);
token_t *au_to_attr64(struct vattr *attr);
+#endif
token_t *au_to_data(char unit_print, char unit_type,
char unit_count, char *p);
token_t *au_to_exit(int retval, int err);
==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#4 (text+ko) ====
@@ -27,8 +27,15 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/time.h>
+#include <sys/ipc.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@@ -125,6 +132,7 @@
return au_to_arg32(n, text, v);
}
+#if defined(_KERNEL) || defined(_KERNEL)
/*
* token ID 1 byte
* file access mode 4 bytes
@@ -186,7 +194,7 @@
return au_to_attr32(attr);
}
-
+#endif /* !(defined(_KERNEL) || defined(KERNEL) */
/*
* token ID 1 byte
==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_wrappers.c#4 (text+ko) ====
@@ -29,12 +29,12 @@
/*
* XXX lib_wrappers.c is a provisional name
*/
-#include <sys/types.h> /* [f]stat(), sysctl(), gete[ug]id(), getpid() */
-#include <sys/stat.h> /* [f]stat() */
-#include <sys/sysctl.h> /* sysctl() */
-#include <unistd.h> /* STDIN_FILENO, gete[ug]id(), getpid() */
-#include <syslog.h> /* syslog() */
-#include <stdarg.h> /* syslog() */
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/sysctl.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <stdarg.h>
#include <errno.h>
#include <libbsm.h>
==== //depot/projects/trustedbsd/openbsm/libbsm/libbsm.h#5 (text+ko) ====
@@ -38,13 +38,15 @@
#define MAX_ARGS 10
#define MAX_ENV 10
-#include <stdio.h>
#include <sys/types.h>
+#include <sys/cdefs.h>
#include <sys/queue.h>
-#include <sys/cdefs.h> /* __{BEGIN,END}_DECLS */
#include <bsm/audit.h>
#include <bsm/audit_record.h>
+
+#include <stdio.h>
+
#ifdef __APPLE__
#include <mach/mach.h> /* audit_token_t */
#endif
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list