Commit | Line | Data |
---|---|---|
3cc64cba KB |
1 | /*- |
2 | * Copyright (c) 1983 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
6 | * | |
d2b7358e | 7 | * @(#)struct.h 5.2 (Berkeley) %G% |
e8453270 SL |
8 | */ |
9 | ||
d2b7358e KB |
10 | #ifndef _STRUCT_H_ |
11 | #define _STRUCT_H_ | |
12 | ||
3cc64cba KB |
13 | /* Offset of the field in the structure. */ |
14 | #define fldoff(name, field) \ | |
15 | ((int)&(((struct name *)0)->field)) | |
16 | ||
17 | /* Size of the field in the structure. */ | |
18 | #define fldsiz(name, field) \ | |
19 | (sizeof(((struct name *)0)->field)) | |
20 | ||
21 | /* Address of the structure from a field. */ | |
22 | #define strbase(name, addr, field) \ | |
23 | ((struct name *)((char *)(addr) - fldoff(name, field))) | |
d2b7358e KB |
24 | |
25 | #endif /* !_STRUCT_H_ */ |