Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Sep 2017 23:15:34 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324072 - head/sys/vm
Message-ID:  <201709272315.v8RNFY3D008986@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Sep 27 23:15:33 2017
New Revision: 324072
URL: https://svnweb.freebsd.org/changeset/base/324072

Log:
  Add UMA_ALIGNOF().
  
  This is a wrapper around _Alignof() that sets the alignment for a zone
  to the alignment required by a given type.  This allows the compiler to
  determine the proper alignment rather than having the programmer try to
  guess.
  
  Discussed on:	arch@
  MFC after:	1 week
  Sponsored by:	DARPA / AFRL

Modified:
  head/sys/vm/uma.h

Modified: head/sys/vm/uma.h
==============================================================================
--- head/sys/vm/uma.h	Wed Sep 27 19:48:34 2017	(r324071)
+++ head/sys/vm/uma.h	Wed Sep 27 23:15:33 2017	(r324072)
@@ -296,6 +296,7 @@ uma_zone_t uma_zcache_create(char *name, int size, uma
 #define UMA_ALIGN_SHORT	(sizeof(short) - 1)	/* "" short */
 #define UMA_ALIGN_CHAR	(sizeof(char) - 1)	/* "" char */
 #define UMA_ALIGN_CACHE	(0 - 1)			/* Cache line size align */
+#define	UMA_ALIGNOF(type) (_Alignof(type) - 1)	/* Alignment fit for 'type' */
 
 /*
  * Destroys an empty uma zone.  If the zone is not empty uma complains loudly.



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