Project

General

Profile

Bug #3373 » illumos-3373-gcc-offsetof.patch

Igor Pashev, 2012-11-23 08:33 PM

View differences:

uts/usr/src/uts/common/sys/sysmacros.h 2012-11-23 10:09:02.103200130 +0000
370 370
#if defined(_KERNEL) && !defined(_KMEMUSER)
371 371

  
372 372
#if !defined(offsetof)
373
#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
373
# if defined(__GNUC__)
374
#  define	offsetof(s, m)	__builtin_offsetof(s, m)
375
# else
376
#  define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
377
# endif /* __GNUC__ */
374 378
#endif /* !offsetof */
375 379

  
376 380
#define	container_of(m, s, name)			\
uts/usr/src/uts/common/avs/ns/rdc/rdc.c 2012-11-23 17:18:08.514476819 +0000
25 25

  
26 26
#define	_RDC_
27 27
#include <sys/types.h>
28
#include <sys/sysmacros.h>
28 29
#include <sys/ksynch.h>
29 30
#include <sys/kmem.h>
30 31
#include <sys/errno.h>
......
523 524

  
524 525

  
525 526
/*
526
 * Yet another standard thing that is not standard ...
527
 */
528
#ifndef	offsetof
529
#define	offsetof(s, m)	((size_t)(&((s *)0)->m))
530
#endif
531

  
532
/*
533 527
 * Build a 32bit rdc_set structure and copyout to the user level.
534 528
 */
535 529
int
uts/usr/src/uts/common/avs/ns/rdc/rdc_io.c 2012-11-23 17:26:39.766815205 +0000
24 24
 */
25 25

  
26 26
#include <sys/types.h>
27
#include <sys/sysmacros.h>
27 28
#include <sys/ksynch.h>
28 29
#include <sys/cmn_err.h>
29 30
#include <sys/kmem.h>
......
5639 5640
	return (rc);
5640 5641
}
5641 5642

  
5642
/*
5643
 * Yet another standard thing that is not standard ...
5644
 */
5645
#ifndef offsetof
5646
#define	offsetof(s, m)	((size_t)(&((s *)0)->m))
5647
#endif
5648 5643

  
5649 5644
static int
5650 5645
rdc_status(void *arg, int mode, rdc_config_t *uparms, spcs_s_info_t kstatus)
uts/usr/src/uts/common/avs/ns/sv/sv.c 2012-11-23 17:26:04.033402527 +0000
54 54

  
55 55
#include <sys/debug.h>
56 56
#include <sys/types.h>
57
#include <sys/sysmacros.h>
57 58

  
58 59
#include <sys/ksynch.h>
59 60
#include <sys/kmem.h>
......
2416 2417
}
2417 2418

  
2418 2419

  
2419
#ifndef offsetof
2420
#define	offsetof(s, m)	((size_t)(&((s *)0)->m))
2421
#endif
2422

  
2423 2420
/*
2424 2421
 * re-write the size of the current partition
2425 2422
 */
uts/usr/src/uts/common/inet/ipf/netinet/ip_fil.h 2012-11-23 17:24:00.872704736 +0000
12 12
#ifndef	__IP_FIL_H__
13 13
#define	__IP_FIL_H__
14 14

  
15
#include <sys/sysmacros.h>
15 16
#include "netinet/ip_compat.h"
16 17

  
17 18
#ifndef	SOLARIS
......
667 668
#define	fr_rif		fr_tifs[1]
668 669

  
669 670
#define	FR_NOLOGTAG	0
670

  
671
#ifndef	offsetof
672
#define	offsetof(t,m)	(size_t)((&((t *)0)->m))
673
#endif
674 671
#define	FR_CMPSIZ	(sizeof(struct frentry) - \
675 672
			 offsetof(struct frentry, fr_func))
676 673

  
uts/usr/src/uts/common/io/drm/drmP.h 2012-11-23 17:32:57.431132559 +0000
326 326

  
327 327
#define	__OS_HAS_AGP	1
328 328

  
329
#define	__offsetof(type, field) ((size_t)(&((type *)0)->field))
330
#define	offsetof(type, field)   __offsetof(type, field)
331

  
332 329
typedef struct drm_pci_id_list
333 330
{
334 331
	int vendor;
uts/usr/src/uts/common/io/sfe/sfe_util.c 2012-11-23 17:27:55.949646560 +0000
40 40
 * System Header files.
41 41
 */
42 42
#include <sys/types.h>
43
#include <sys/sysmacros.h>
43 44
#include <sys/conf.h>
44 45
#include <sys/debug.h>
45 46
#include <sys/kmem.h>
......
106 107

  
107 108
#define	GET_TXBUF(dp, sn)	\
108 109
	&(dp)->tx_buf[SLOT((dp)->tx_slots_base + (sn), (dp)->gc.gc_tx_buf_size)]
109

  
110
#ifndef offsetof
111
#define	offsetof(t, m)	((long)&(((t *) 0)->m))
112
#endif
113 110
#define	TXFLAG_VTAG(flag)	\
114 111
	(((flag) & GEM_TXFLAG_VTAG) >> GEM_TXFLAG_VTAG_SHIFT)
115 112

  
uts/usr/src/uts/common/io/vscan/vscan_svc.c 2012-11-23 17:27:18.333932427 +0000
35 35
#include <sys/vnode.h>
36 36
#include <fs/fs_subr.h>
37 37
#include <sys/types.h>
38
#include <sys/sysmacros.h>
38 39
#include <sys/file.h>
39 40
#include <sys/disp.h>
40 41
#include <sys/sdt.h>
......
57 58
#define	VS_ACCESS_DENY		2	/* return EACCES */
58 59

  
59 60
#define	tolower(C)	(((C) >= 'A' && (C) <= 'Z') ? (C) - 'A' + 'a' : (C))
60
#define	offsetof(s, m)	(size_t)(&(((s *)0)->m))
61 61

  
62 62
/* global variables - tunable via /etc/system */
63 63
uint32_t vs_reqs_max = VS_REQS_DEFAULT;	/* max scan requests */
uts/usr/src/uts/common/sys/ecppvar.h 2012-11-23 17:30:14.815227296 +0000
513 513
 * Other useful macros
514 514
 */
515 515
#define	NELEM(a)	(sizeof (a) / sizeof (*(a)))
516
#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
517 516

  
518 517
#ifdef	__cplusplus
519 518
}
uts/usr/src/uts/common/sys/ib/clients/of/sol_ofs/sol_cma.h 2012-11-23 17:29:52.205923389 +0000
35 35
#include <sys/ib/clients/of/rdma/rdma_cm.h>
36 36
#include <sys/ib/clients/of/sol_ofs/sol_ib_cma.h> /* Transport Specific */
37 37

  
38
#if !defined(offsetof)
39
#define	offsetof(s, m)		(size_t)(&(((s *)0)->m))
40
#endif
41

  
42 38
#define	IS_UDP_CMID(idp)	((idp)->ps == RDMA_PS_UDP || \
43 39
	(idp)->ps == RDMA_PS_IPOIB)
44 40
#define	IS_VALID_SOCKADDR(sockaddrp) \
uts/usr/src/uts/common/sys/usb/clients/audio/usb_ac/usb_ac.h 2012-11-23 17:30:31.918220315 +0000
329 329
#define	USB_AH_PLUMBED	2
330 330
#define	UNKNOWN_PLUMBED	3
331 331

  
332
/* other useful macros */
333
#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
334

  
335 332

  
336 333

  
337 334

  
uts/usr/src/uts/common/sys/usb/clients/video/usbvc/usbvc_var.h 2012-11-23 17:30:44.658416601 +0000
173 173
#define	PRINT_MASK_DEVMAP	0x00000200
174 174
#define	PRINT_MASK_ALL		0xFFFFFFFF
175 175

  
176
#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
177

  
178 176
#define	USBVC_MAX_PKTS 40
179 177

  
180 178
#define	USBVC_DEFAULT_READ_BUF_NUM 3
uts/usr/src/uts/common/sys/uwb/uwba/uwba.h 2012-11-23 17:29:01.995744562 +0000
38 38
#include <sys/note.h>
39 39
#include <sys/sunddi.h>
40 40
#include <sys/types.h>
41
#include <sys/sysmacros.h>
41 42
#include <sys/list.h>
42 43
#include <sys/bitset.h>
43 44
#include <sys/bitmap.h>
......
50 51
#define	UWBA_LOG_LOG		1
51 52
#define	UWBA_LOG_CONSOLE	0
52 53

  
53
#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
54 54
#define	isdigit(ch) ((ch >= '0') && (ch <= '9'))
55 55

  
56 56
#define	UWB_RAW_RESULT_CODE_SIZE	5  /* size of RCEB + bResultCode */
uts/usr/src/uts/sun/io/scsi/adapters/sf.c 2012-11-23 17:31:22.646086183 +0000
56 56

  
57 57
static int sf_bus_config_debug = 0;
58 58

  
59
/* Why do I have to do this? */
60
#define	offsetof(s, m)  (size_t)(&(((s *)0)->m))
61

  
62 59
#include <sys/scsi/scsi.h>
63 60
#include <sys/fc4/fcal.h>
64 61
#include <sys/fc4/fcp.h>
......
77 74
#include <sys/devctl.h>
78 75
#include <sys/scsi/targets/ses.h>
79 76
#include <sys/callb.h>
77
#include <sys/sysmacros.h>
80 78

  
81 79
static int sf_info(dev_info_t *, ddi_info_cmd_t, void *, void **);
82 80
static int sf_attach(dev_info_t *, ddi_attach_cmd_t);
uts/usr/src/uts/sun4u/io/rmclomv.c 2012-11-23 17:38:47.344684681 +0000
26 26

  
27 27

  
28 28
#include <sys/types.h>
29
#include <sys/sysmacros.h>
29 30
#include <sys/stat.h>
30 31
#include <sys/conf.h>
31 32
#include <sys/modctl.h>
......
53 54
#include <sys/time.h>
54 55
#include <sys/promif.h>
55 56

  
56
#define	offsetof(s, m)	(size_t)(&(((s *)0)->m))
57 57
#define	RMCRESBUFLEN	1024
58 58
#define	DATE_TIME_MSG_SIZE	78
59 59
#define	RMCLOMV_WATCHDOG_MODE	"rmclomv-watchdog-mode"
(1-1/2)