Make MIN/MAX code in rx/rx_packet.h more readable

Eventually all MIN/MAX code in the tree should be handled uniformly,
but until that day, make this chunk of it more readable and
document the odd exception case for Linux kernel builds.

Change-Id: I4afe5d99b63010df831943e6b82ff89733b08066
Reviewed-on: http://gerrit.openafs.org/8871
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
This commit is contained in:
Russ Allbery 2013-01-03 14:09:02 -08:00 committed by Derrick Brashear
parent fe2bae1c83
commit 0a98596cd3

View File

@ -33,20 +33,24 @@
#if defined(AFS_NT40_ENV)
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
# ifndef MIN
# define MIN(a,b) ((a)<(b)?(a):(b))
# endif
# ifndef MAX
# define MAX(a,b) ((a)>(b)?(a):(b))
# endif
#else /* AFS_NT40_ENV */
#if !defined(AFS_DARWIN_ENV) && !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_USR_FBSD_ENV) && !defined(AFS_USR_DFBSD_ENV) && !defined(AFS_LINUX20_ENV)
#include <sys/sysmacros.h> /* MIN, MAX on Solaris */
#endif
#if !(defined(AFS_LINUX26_ENV) && defined(KERNEL))
#include <sys/param.h> /* MIN, MAX elsewhere */
#endif
#endif /* AFS_NT40_ENV */
# if !defined(AFS_DARWIN_ENV) && !defined(AFS_USR_DARWIN_ENV) \
&& !defined(AFS_XBSD_ENV) && !defined(AFS_USR_FBSD_ENV) \
&& !defined(AFS_USR_DFBSD_ENV) && !defined(AFS_LINUX20_ENV)
# include <sys/sysmacros.h> /* MIN, MAX on most commercial UNIX */
# endif
/* Linux 3.7 doesn't have sys/param.h in kernel space, and afs/param.h ensures
* that MIN and MAX are available for kernel builds. */
# if !(defined(AFS_LINUX26_ENV) && defined(KERNEL))
# include <sys/param.h> /* MIN, MAX elsewhere */
# endif
#endif /* !AFS_NT40_ENV */
#define IPv6_HDR_SIZE 40 /* IPv6 Header */
#define IPv6_FRAG_HDR_SIZE 8 /* IPv6 Fragment Header */