Commit e416a893 authored by Rafaël Bocquet's avatar Rafaël Bocquet Committed by Greg Kroah-Hartman

Staging: lustre: config.c: fix a "do not add new typedefs" warning reported by checkpatch.pl

Signed-off-by: default avatarRafaël Bocquet <rafael.bocquet@ens.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3a338e20
...@@ -37,11 +37,11 @@ ...@@ -37,11 +37,11 @@
#define DEBUG_SUBSYSTEM S_LNET #define DEBUG_SUBSYSTEM S_LNET
#include "../../include/linux/lnet/lib-lnet.h" #include "../../include/linux/lnet/lib-lnet.h"
typedef struct { /* tmp struct for parsing routes */ struct lnet_text_buf_t { /* tmp struct for parsing routes */
struct list_head ltb_list; /* stash on lists */ struct list_head ltb_list; /* stash on lists */
int ltb_size; /* allocated size */ int ltb_size; /* allocated size */
char ltb_text[0]; /* text buffer */ char ltb_text[0]; /* text buffer */
} lnet_text_buf_t; };
static int lnet_tbnob; /* track text buf allocation */ static int lnet_tbnob; /* track text buf allocation */
#define LNET_MAX_TEXTBUF_NOB (64<<10) /* bound allocation */ #define LNET_MAX_TEXTBUF_NOB (64<<10) /* bound allocation */
...@@ -365,14 +365,14 @@ lnet_parse_networks(struct list_head *nilist, char *networks) ...@@ -365,14 +365,14 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
return -EINVAL; return -EINVAL;
} }
static lnet_text_buf_t * static struct lnet_text_buf_t *
lnet_new_text_buf(int str_len) lnet_new_text_buf(int str_len)
{ {
lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
int nob; int nob;
/* NB allocate space for the terminating 0 */ /* NB allocate space for the terminating 0 */
nob = offsetof(lnet_text_buf_t, ltb_text[str_len + 1]); nob = offsetof(struct lnet_text_buf_t, ltb_text[str_len + 1]);
if (nob > LNET_SINGLE_TEXTBUF_NOB) { if (nob > LNET_SINGLE_TEXTBUF_NOB) {
/* _way_ conservative for "route net gateway..." */ /* _way_ conservative for "route net gateway..." */
CERROR("text buffer too big\n"); CERROR("text buffer too big\n");
...@@ -395,7 +395,7 @@ lnet_new_text_buf(int str_len) ...@@ -395,7 +395,7 @@ lnet_new_text_buf(int str_len)
} }
static void static void
lnet_free_text_buf(lnet_text_buf_t *ltb) lnet_free_text_buf(struct lnet_text_buf_t *ltb)
{ {
lnet_tbnob -= ltb->ltb_size; lnet_tbnob -= ltb->ltb_size;
LIBCFS_FREE(ltb, ltb->ltb_size); LIBCFS_FREE(ltb, ltb->ltb_size);
...@@ -404,10 +404,10 @@ lnet_free_text_buf(lnet_text_buf_t *ltb) ...@@ -404,10 +404,10 @@ lnet_free_text_buf(lnet_text_buf_t *ltb)
static void static void
lnet_free_text_bufs(struct list_head *tbs) lnet_free_text_bufs(struct list_head *tbs)
{ {
lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
while (!list_empty(tbs)) { while (!list_empty(tbs)) {
ltb = list_entry(tbs->next, lnet_text_buf_t, ltb_list); ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list);
list_del(&ltb->ltb_list); list_del(&ltb->ltb_list);
lnet_free_text_buf(ltb); lnet_free_text_buf(ltb);
...@@ -421,7 +421,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str) ...@@ -421,7 +421,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str)
char *sep; char *sep;
int nob; int nob;
int i; int i;
lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
INIT_LIST_HEAD(&pending); INIT_LIST_HEAD(&pending);
...@@ -479,7 +479,7 @@ lnet_expand1tb(struct list_head *list, ...@@ -479,7 +479,7 @@ lnet_expand1tb(struct list_head *list,
{ {
int len1 = (int)(sep1 - str); int len1 = (int)(sep1 - str);
int len2 = strlen(sep2 + 1); int len2 = strlen(sep2 + 1);
lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
LASSERT(*sep1 == '['); LASSERT(*sep1 == '[');
LASSERT(*sep2 == ']'); LASSERT(*sep2 == ']');
...@@ -636,7 +636,7 @@ lnet_parse_route(char *str, int *im_a_router) ...@@ -636,7 +636,7 @@ lnet_parse_route(char *str, int *im_a_router)
struct list_head *tmp2; struct list_head *tmp2;
__u32 net; __u32 net;
lnet_nid_t nid; lnet_nid_t nid;
lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
int rc; int rc;
char *sep; char *sep;
char *token = str; char *token = str;
...@@ -692,7 +692,8 @@ lnet_parse_route(char *str, int *im_a_router) ...@@ -692,7 +692,8 @@ lnet_parse_route(char *str, int *im_a_router)
list_add_tail(tmp1, tmp2); list_add_tail(tmp1, tmp2);
while (tmp1 != tmp2) { while (tmp1 != tmp2) {
ltb = list_entry(tmp1, lnet_text_buf_t, ltb_list); ltb = list_entry(tmp1, struct lnet_text_buf_t,
ltb_list);
rc = lnet_str2tbs_expand(tmp1->next, ltb->ltb_text); rc = lnet_str2tbs_expand(tmp1->next, ltb->ltb_text);
if (rc < 0) if (rc < 0)
...@@ -732,12 +733,13 @@ lnet_parse_route(char *str, int *im_a_router) ...@@ -732,12 +733,13 @@ lnet_parse_route(char *str, int *im_a_router)
LASSERT(!list_empty(&gateways)); LASSERT(!list_empty(&gateways));
list_for_each(tmp1, &nets) { list_for_each(tmp1, &nets) {
ltb = list_entry(tmp1, lnet_text_buf_t, ltb_list); ltb = list_entry(tmp1, struct lnet_text_buf_t, ltb_list);
net = libcfs_str2net(ltb->ltb_text); net = libcfs_str2net(ltb->ltb_text);
LASSERT(net != LNET_NIDNET(LNET_NID_ANY)); LASSERT(net != LNET_NIDNET(LNET_NID_ANY));
list_for_each(tmp2, &gateways) { list_for_each(tmp2, &gateways) {
ltb = list_entry(tmp2, lnet_text_buf_t, ltb_list); ltb = list_entry(tmp2, struct lnet_text_buf_t,
ltb_list);
nid = libcfs_str2nid(ltb->ltb_text); nid = libcfs_str2nid(ltb->ltb_text);
LASSERT(nid != LNET_NID_ANY); LASSERT(nid != LNET_NID_ANY);
...@@ -770,10 +772,10 @@ lnet_parse_route(char *str, int *im_a_router) ...@@ -770,10 +772,10 @@ lnet_parse_route(char *str, int *im_a_router)
static int static int
lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router) lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router)
{ {
lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
while (!list_empty(tbs)) { while (!list_empty(tbs)) {
ltb = list_entry(tbs->next, lnet_text_buf_t, ltb_list); ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list);
if (lnet_parse_route(ltb->ltb_text, im_a_router) < 0) { if (lnet_parse_route(ltb->ltb_text, im_a_router) < 0) {
lnet_free_text_bufs(tbs); lnet_free_text_bufs(tbs);
...@@ -907,8 +909,8 @@ lnet_splitnets(char *source, struct list_head *nets) ...@@ -907,8 +909,8 @@ lnet_splitnets(char *source, struct list_head *nets)
int offset = 0; int offset = 0;
int offset2; int offset2;
int len; int len;
lnet_text_buf_t *tb; struct lnet_text_buf_t *tb;
lnet_text_buf_t *tb2; struct lnet_text_buf_t *tb2;
struct list_head *t; struct list_head *t;
char *sep; char *sep;
char *bracket; char *bracket;
...@@ -917,7 +919,7 @@ lnet_splitnets(char *source, struct list_head *nets) ...@@ -917,7 +919,7 @@ lnet_splitnets(char *source, struct list_head *nets)
LASSERT(!list_empty(nets)); LASSERT(!list_empty(nets));
LASSERT(nets->next == nets->prev); /* single entry */ LASSERT(nets->next == nets->prev); /* single entry */
tb = list_entry(nets->next, lnet_text_buf_t, ltb_list); tb = list_entry(nets->next, struct lnet_text_buf_t, ltb_list);
for (;;) { for (;;) {
sep = strchr(tb->ltb_text, ','); sep = strchr(tb->ltb_text, ',');
...@@ -953,7 +955,7 @@ lnet_splitnets(char *source, struct list_head *nets) ...@@ -953,7 +955,7 @@ lnet_splitnets(char *source, struct list_head *nets)
} }
list_for_each(t, nets) { list_for_each(t, nets) {
tb2 = list_entry(t, lnet_text_buf_t, ltb_list); tb2 = list_entry(t, struct lnet_text_buf_t, ltb_list);
if (tb2 == tb) if (tb2 == tb)
continue; continue;
...@@ -992,8 +994,8 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) ...@@ -992,8 +994,8 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
struct list_head current_nets; struct list_head current_nets;
struct list_head *t; struct list_head *t;
struct list_head *t2; struct list_head *t2;
lnet_text_buf_t *tb; struct lnet_text_buf_t *tb;
lnet_text_buf_t *tb2; struct lnet_text_buf_t *tb2;
__u32 net1; __u32 net1;
__u32 net2; __u32 net2;
int len; int len;
...@@ -1016,7 +1018,7 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) ...@@ -1016,7 +1018,7 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
rc = 0; rc = 0;
while (!list_empty(&raw_entries)) { while (!list_empty(&raw_entries)) {
tb = list_entry(raw_entries.next, lnet_text_buf_t, tb = list_entry(raw_entries.next, struct lnet_text_buf_t,
ltb_list); ltb_list);
strncpy(source, tb->ltb_text, sizeof(source)-1); strncpy(source, tb->ltb_text, sizeof(source)-1);
...@@ -1043,12 +1045,12 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) ...@@ -1043,12 +1045,12 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
dup = 0; dup = 0;
list_for_each(t, &current_nets) { list_for_each(t, &current_nets) {
tb = list_entry(t, lnet_text_buf_t, ltb_list); tb = list_entry(t, struct lnet_text_buf_t, ltb_list);
net1 = lnet_netspec2net(tb->ltb_text); net1 = lnet_netspec2net(tb->ltb_text);
LASSERT(net1 != LNET_NIDNET(LNET_NID_ANY)); LASSERT(net1 != LNET_NIDNET(LNET_NID_ANY));
list_for_each(t2, &matched_nets) { list_for_each(t2, &matched_nets) {
tb2 = list_entry(t2, lnet_text_buf_t, tb2 = list_entry(t2, struct lnet_text_buf_t,
ltb_list); ltb_list);
net2 = lnet_netspec2net(tb2->ltb_text); net2 = lnet_netspec2net(tb2->ltb_text);
LASSERT(net2 != LNET_NIDNET(LNET_NID_ANY)); LASSERT(net2 != LNET_NIDNET(LNET_NID_ANY));
...@@ -1069,7 +1071,7 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) ...@@ -1069,7 +1071,7 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
} }
list_for_each_safe(t, t2, &current_nets) { list_for_each_safe(t, t2, &current_nets) {
tb = list_entry(t, lnet_text_buf_t, ltb_list); tb = list_entry(t, struct lnet_text_buf_t, ltb_list);
list_del(&tb->ltb_list); list_del(&tb->ltb_list);
list_add_tail(&tb->ltb_list, &matched_nets); list_add_tail(&tb->ltb_list, &matched_nets);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment