diff options
author | Alexey Zaytsev <alexey.zaytsev@nexenta.com> | 2012-06-18 21:48:00 -0400 |
---|---|---|
committer | Alexey Zaytsev <alexey.zaytsev@nexenta.com> | 2012-06-18 21:48:00 -0400 |
commit | 1d99877f5d809f065d76e8ab35d75ce6e4e128a9 (patch) | |
tree | 27b0787f5657d92cf04659e94bf1a648316e6db9 /usr/src | |
parent | bc220884124d127a3046646c2c9fb8d86fe654a9 (diff) | |
download | illumos-joyent-1d99877f5d809f065d76e8ab35d75ce6e4e128a9.tar.gz |
2044 Move container_of and ARRAY_SIZE to sys/sysmacros.h
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Dan McDonald <danmcd@nexenta.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h | 4 | ||||
-rw-r--r-- | usr/src/uts/common/sys/sysmacros.h | 14 |
2 files changed, 12 insertions, 6 deletions
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 <stddef.h> 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 } |