slite style changes. There is an incoming patch that rewrites a

lot of this module and I want to get the style and whitespace changes in
a separate commit (or maybe more).

PR: 206185
Submitted by:	Dmitry Vagin
MFC after:	1 month
This commit is contained in:
Julian Elischer 2016-08-01 11:34:12 +00:00
parent 49a92cd4a5
commit bf909fc9a4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=303611
2 changed files with 28 additions and 25 deletions

View File

@ -1,5 +1,5 @@
/*-
* Copyright (C) 2010 by Maxim Ignatenko <gelraen.ua@gmail.com>
* Copyright (c) 2010 Maxim Ignatenko <gelraen.ua@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -50,11 +50,12 @@ static int
ng_patch_config_getlen(const struct ng_parse_type *type,
const u_char *start, const u_char *buf)
{
const struct ng_patch_config *p;
const struct ng_patch_config *conf;
p = (const struct ng_patch_config *)(buf -
conf = (const struct ng_patch_config *)(buf -
offsetof(struct ng_patch_config, ops));
return (p->count);
return (conf->count);
}
static const struct ng_parse_struct_field ng_patch_op_type_fields[]
@ -64,13 +65,13 @@ static const struct ng_parse_type ng_patch_op_type = {
&ng_patch_op_type_fields
};
static const struct ng_parse_array_info ng_patch_confarr_info = {
static const struct ng_parse_array_info ng_patch_ops_array_info = {
&ng_patch_op_type,
&ng_patch_config_getlen
};
static const struct ng_parse_type ng_patch_confarr_type = {
static const struct ng_parse_type ng_patch_ops_array_type = {
&ng_parse_array_type,
&ng_patch_confarr_info
&ng_patch_ops_array_info
};
static const struct ng_parse_struct_field ng_patch_config_type_fields[]
@ -137,6 +138,7 @@ static struct ng_type typestruct = {
.disconnect = ng_patch_disconnect,
.cmdlist = ng_patch_cmdlist,
};
NETGRAPH_INIT(patch, &typestruct);
union patch_val {
@ -146,6 +148,7 @@ union patch_val {
uint64_t v8;
};
/* private data */
struct ng_patch_priv {
hook_p in;
hook_p out;

View File

@ -57,7 +57,7 @@ enum {
NG_PATCH_MODE_DIV = 5,
NG_PATCH_MODE_NEG = 6,
NG_PATCH_MODE_AND = 7,
NG_PATCH_MODE_OR = 8,
NG_PATCH_MODE_OR = 8,
NG_PATCH_MODE_XOR = 9,
NG_PATCH_MODE_SHL = 10,
NG_PATCH_MODE_SHR = 11
@ -66,16 +66,16 @@ enum {
struct ng_patch_op {
uint64_t value;
uint32_t offset;
uint16_t length; /* 1,2,4 or 8 (bytes) */
uint16_t length; /* 1, 2, 4 or 8 (bytes) */
uint16_t mode;
};
#define NG_PATCH_OP_TYPE_INFO { \
{ "value", &ng_parse_uint64_type }, \
{ "offset", &ng_parse_uint32_type }, \
{ "length", &ng_parse_uint16_type }, \
{ "mode", &ng_parse_uint16_type }, \
{ NULL } \
#define NG_PATCH_OP_TYPE_INFO { \
{ "value", &ng_parse_uint64_type }, \
{ "offset", &ng_parse_uint32_type }, \
{ "length", &ng_parse_uint16_type }, \
{ "mode", &ng_parse_uint16_type }, \
{ NULL } \
}
struct ng_patch_config {
@ -84,11 +84,11 @@ struct ng_patch_config {
struct ng_patch_op ops[];
};
#define NG_PATCH_CONFIG_TYPE_INFO { \
{ "count", &ng_parse_uint32_type }, \
{ "csum_flags", &ng_parse_uint32_type }, \
{ "ops", &ng_patch_confarr_type }, \
{ NULL } \
#define NG_PATCH_CONFIG_TYPE_INFO { \
{ "count", &ng_parse_uint32_type }, \
{ "csum_flags", &ng_parse_uint64_type }, \
{ "ops", &ng_patch_ops_array_type }, \
{ NULL } \
}
struct ng_patch_stats {
@ -97,11 +97,11 @@ struct ng_patch_stats {
uint64_t dropped;
};
#define NG_PATCH_STATS_TYPE_INFO { \
{ "received", &ng_parse_uint64_type }, \
{ "patched", &ng_parse_uint64_type }, \
{ "dropped", &ng_parse_uint64_type }, \
{ NULL } \
#define NG_PATCH_STATS_TYPE_INFO { \
{ "Received", &ng_parse_uint64_type }, \
{ "Patched", &ng_parse_uint64_type }, \
{ "Dropped", &ng_parse_uint64_type }, \
{ NULL } \
}
#endif /* _NETGRAPH_NG_PATCH_H_ */