From 1d99877f5d809f065d76e8ab35d75ce6e4e128a9 Mon Sep 17 00:00:00 2001 From: Alexey Zaytsev Date: Mon, 18 Jun 2012 21:48:00 -0400 Subject: 2044 Move container_of and ARRAY_SIZE to sys/sysmacros.h Reviewed by: Robert Mustacchi Reviewed by: Garrett D'Amore Approved by: Dan McDonald --- usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h | 4 +--- usr/src/uts/common/sys/sysmacros.h | 14 +++++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'usr/src') diff --git a/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h b/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h index 84eb2074df..c1407bfe00 100644 --- a/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h +++ b/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. */ #ifndef _RDSV3_IMPL_H @@ -120,9 +121,6 @@ uint_t rdsv3_one_sec_in_hz; #define jiffies 100 #define HZ (drv_hztousec(1)) -#define container_of(m, s, name) \ - (void *)((uintptr_t)(m) - (uintptr_t)offsetof(s, name)) -#define ARRAY_SIZE(x) (sizeof (x) / sizeof (x[0])) /* setting this to PAGESIZE throws build errors */ #define PAGE_SIZE 4096 /* xxx - fix this */ #define BITS_PER_LONG (sizeof (unsigned long) * 8) diff --git a/usr/src/uts/common/sys/sysmacros.h b/usr/src/uts/common/sys/sysmacros.h index 89a672db2f..71042eba85 100644 --- a/usr/src/uts/common/sys/sysmacros.h +++ b/usr/src/uts/common/sys/sysmacros.h @@ -25,6 +25,8 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2011, 2012 Nexenta Systems, Inc. All rights reserved. */ #ifndef _SYS_SYSMACROS_H @@ -364,12 +366,18 @@ extern unsigned char bcd_to_byte[256]; #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined #endif /* _BIT_FIELDS_LTOH */ -#if defined(_KERNEL) && !defined(_KMEMUSER) && !defined(offsetof) - /* avoid any possibility of clashing with version */ +#if defined(_KERNEL) && !defined(_KMEMUSER) +#if !defined(offsetof) #define offsetof(s, m) ((size_t)(&(((s *)0)->m))) -#endif +#endif /* !offsetof */ + +#define container_of(m, s, name) \ + (void *)((uintptr_t)(m) - (uintptr_t)offsetof(s, name)) + +#define ARRAY_SIZE(x) (sizeof (x) / sizeof (x[0])) +#endif /* _KERNEL, !_KMEMUSER */ #ifdef __cplusplus } -- cgit v1.2.3