Date: Wed, 12 Nov 2008 16:43:53 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 152874 for review Message-ID: <200811121643.mACGhrpT046710@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=152874 Change 152874 by rwatson@rwatson_cinnamon on 2008/11/12 16:43:29 BSM errors are stored in an 8-bit unsigned char, so tweak non-Solaris assignments down into that space, use u_char as the type, and don't worry about byte order conversions. Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#2 edit .. //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#2 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#2 (text+ko) ==== @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#1 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#2 $ */ #include <sys/types.h> @@ -56,7 +56,7 @@ * error numbers, and sometimes error numbers don't exist in more than one * operating system. These routines convert between BSM and local error * number spaces, subject to the above realities. BSM error numbers are - * always stored in network byte order. + * stored in a single 8-bit character, so don't have a byte order. */ struct bsm_errors { @@ -269,11 +269,10 @@ static const int bsm_errors_count = sizeof(bsm_errors) / sizeof(bsm_errors[0]); int -au_bsm_to_errno(int bsm_error) +au_bsm_to_errno(u_char bsm_error) { int i; - bsm_error = be32toh(bsm_error); for (i = 0; i < bsm_errors_count; i++) { if (bsm_errors[i].be_bsm_error == bsm_error) return (bsm_errors[i].be_os_error); @@ -286,7 +285,7 @@ return (EINVAL); } -int +u_char au_errno_to_bsm(int error) { int i; @@ -295,5 +294,5 @@ if (bsm_errors[i].be_os_error == error) return (htobe32(bsm_errors[i].be_bsm_error)); } - return (htobe32(BSM_UNKNOWNERR)); + return (BSM_UNKNOWNERR); } ==== //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#2 (text+ko) ==== @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#1 $ + * $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#2 $ */ #ifndef _BSM_AUDIT_ERRNO_H_ @@ -168,26 +168,26 @@ * that these errors are added to Solaris, we will deprecate the OpenBSM * numbers in the same way we do for audit event constants. */ -#define BSM_EPROCLIM 5000 /* FreeBSD-specific. */ -#define BSM_EBADRPC 5001 /* FreeBSD-specific. */ -#define BSM_ERPCMISMATCH 5002 /* FreeBSD-specific. */ -#define BSM_EPROGUNAVAIL 5003 /* FreeBSD-specific. */ -#define BSM_EPROGMISMATCH 5004 /* FreeBSD-specific. */ -#define BSM_EPROCUNAVAIL 5005 /* FreeBSD-specific. */ -#define BSM_EFTYPE 5006 /* FreeBSD-specific. */ -#define BSM_EAUTH 5007 /* FreeBSD-specific. */ -#define BSM_ENEEDAUTH 5008 /* FreeBSD-specific. */ -#define BSM_ENOATTR 5009 /* FreeBSD-specific. */ -#define BSM_EDOOFUS 5010 /* FreeBSD-specific. */ -#define BSM_ELAST 5011 /* FreeBSD-specific. */ -#define BSM_EJUSTRETURN 5012 /* FreeBSD-specific. */ -#define BSM_ENOIOCTL 5013 /* FreeBSD-specific. */ -#define BSM_EDIRIOCTL 5014 /* FreeBSD-specific. */ +#define BSM_EPROCLIM 200 /* FreeBSD-specific. */ +#define BSM_EBADRPC 201 /* FreeBSD-specific. */ +#define BSM_ERPCMISMATCH 202 /* FreeBSD-specific. */ +#define BSM_EPROGUNAVAIL 203 /* FreeBSD-specific. */ +#define BSM_EPROGMISMATCH 204 /* FreeBSD-specific. */ +#define BSM_EPROCUNAVAIL 205 /* FreeBSD-specific. */ +#define BSM_EFTYPE 206 /* FreeBSD-specific. */ +#define BSM_EAUTH 207 /* FreeBSD-specific. */ +#define BSM_ENEEDAUTH 208 /* FreeBSD-specific. */ +#define BSM_ENOATTR 209 /* FreeBSD-specific. */ +#define BSM_EDOOFUS 210 /* FreeBSD-specific. */ +#define BSM_ELAST 211 /* FreeBSD-specific. */ +#define BSM_EJUSTRETURN 212 /* FreeBSD-specific. */ +#define BSM_ENOIOCTL 213 /* FreeBSD-specific. */ +#define BSM_EDIRIOCTL 214 /* FreeBSD-specific. */ /* * In the event that OpenBSM doesn't have a file representation of a local * error number, use this. */ -#define BSM_UNKNOWNERR 10000 /* OpenBSM-specific. */ +#define BSM_UNKNOWNERR 245 /* OpenBSM-specific. */ #endif /* !_BSM_AUDIT_ERRNO_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811121643.mACGhrpT046710>