struct_offset
#define DPMAC_COUNTER(counter_id, struct_name, struct_offset) \
.offset = offsetof(struct_name, struct_offset), \
#define DPMAC_RMON_COUNTER(counter_id, struct_offset) \
DPMAC_COUNTER(counter_id, struct ethtool_rmon_stats, struct_offset)
#define DPMAC_PAUSE_COUNTER(counter_id, struct_offset) \
DPMAC_COUNTER(counter_id, struct ethtool_pause_stats, struct_offset)
#define DPMAC_CTRL_COUNTER(counter_id, struct_offset) \
DPMAC_COUNTER(counter_id, struct ethtool_eth_ctrl_stats, struct_offset)
#define DPMAC_MAC_COUNTER(counter_id, struct_offset) \
DPMAC_COUNTER(counter_id, struct ethtool_eth_mac_stats, struct_offset)
size = struct_offset(entry, id) + cnt;
data->count = (data->size - struct_offset(data, data)) / sizeof(data->data[0]);
char *struct_offset, *tmp, name[32];
struct_offset = strstr(field->type, "struct ");
if (struct_offset == NULL)
struct_offset = strstr(field->type, "union ");
struct_offset++; // "union" is shorter
if (field->flags & TEP_FIELD_IS_POINTER && struct_offset) { /* struct or union (think BPF's attr arg) */
struct_offset += 6;
for (tmp = struct_offset, cnt = 0; *tmp != ' ' && *tmp != '\0'; ++tmp, ++cnt) {
strncpy(name, struct_offset, cnt);