PERFORCE change 76270 for review

Robert Watson rwatson at FreeBSD.org
Sat Apr 30 13:12:28 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=76270

Change 76270 by rwatson at rwatson_paprika on 2005/04/30 13:11:27

	Darwin 8.0 has 64-bit file ID's, so improve support for that.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#9 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#9 (text+ko) ====

@@ -181,12 +181,20 @@
 	ADD_U_INT32(dptr, attr->va_gid);
 	ADD_U_INT32(dptr, attr->va_fsid);
 
-	/* 
-	 * Darwin defines the size for fileid 
-	 * as 4 bytes; BSM defines 8 so pad with 0
-	 */    
-	ADD_U_INT32(dptr, pad0_32);
-	ADD_U_INT32(dptr, attr->va_fileid);
+	/*
+	 * Some systems use 32-bit file ID's, other's use 64-bit file IDs.
+	 * Attempt to handle both, and let the compiler sort it out.  If we
+	 * could pick this out at compile-time, it would be better, so as to
+	 * avoid the else case below.
+	 */
+	if (sizeof(attr->va_fileid) == sizeof(uint32_t)) {
+		ADD_U_INT32(dptr, pad0_32);
+		ADD_U_INT32(dptr, attr->va_fileid);
+	} else if (sizeof(attr->va_fileid) == sizeof(uint64_t)) {
+		ADD_U_INT64(dptr, attr->va_fileid);
+	} else {
+		ADD_U_INT64(dptr, 0LL);
+	}
 
 	ADD_U_INT32(dptr, attr->va_rdev);
 	
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