From 4ea13c63f3d919282b12c64d0c014bfe9a67a5e6 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Wed, 23 Jul 2014 16:32:32 -0500 Subject: [PATCH] LU-5396 lnet: add sparse annotation __user wherever needed This fixes sparse warnings such as: .../api-ni.c:1639:33: warning: incorrect type in argument 3 (different address spaces) .../api-ni.c:1639:33: expected struct lnet_process_id_t [noderef] [usertype] *ids .../api-ni.c:1639:33: got struct lnet_process_id_t [usertype] * There is no code change. Change-Id: Iff822b1e6036709e3bd660fe14d8faa58b308995 Signed-off-by: frank zago Reviewed-on: http://review.whamcloud.com/11819 Tested-by: Jenkins Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Tested-by: Maloo Reviewed-by: Oleg Drokin --- lnet/include/lnet/lib-lnet.h | 16 ++++--- lnet/include/lnet/lnetst.h | 98 +++++++++++++++++++------------------- lnet/lnet/api-ni.c | 4 +- lnet/lnet/router_proc.c | 6 +-- lnet/selftest/conrpc.c | 14 +++--- lnet/selftest/conrpc.h | 5 +- lnet/selftest/console.c | 111 +++++++++++++++++++++++-------------------- lnet/selftest/console.h | 58 ++++++++++++---------- 8 files changed, 165 insertions(+), 147 deletions(-) diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index b002ade..8c09022 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -884,7 +884,7 @@ void lnet_copy_kiov2kiov (unsigned int ndkiov, lnet_kiov_t *dkiov, unsigned int soffset, unsigned int nob); static inline void -lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset, +lnet_copy_iov2flat(int dlen, __user void *dest, unsigned int doffset, unsigned int nsiov, struct iovec *siov, unsigned int soffset, unsigned int nob) { @@ -895,9 +895,9 @@ lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset, } static inline void -lnet_copy_kiov2flat(int dlen, void *dest, unsigned int doffset, - unsigned int nsiov, lnet_kiov_t *skiov, unsigned int soffset, - unsigned int nob) +lnet_copy_kiov2flat(int dlen, void __user *dest, unsigned int doffset, + unsigned int nsiov, lnet_kiov_t *skiov, + unsigned int soffset, unsigned int nob) { struct iovec diov = {/* .iov_base = */ dest, /* .iov_len = */ dlen}; @@ -907,7 +907,8 @@ lnet_copy_kiov2flat(int dlen, void *dest, unsigned int doffset, static inline void lnet_copy_flat2iov(unsigned int ndiov, struct iovec *diov, unsigned int doffset, - int slen, void *src, unsigned int soffset, unsigned int nob) + int slen, void __user *src, unsigned int soffset, + unsigned int nob) { struct iovec siov = {/*.iov_base = */ src, /*.iov_len = */slen}; lnet_copy_iov2iov(ndiov, diov, doffset, @@ -915,8 +916,9 @@ lnet_copy_flat2iov(unsigned int ndiov, struct iovec *diov, unsigned int doffset, } static inline void -lnet_copy_flat2kiov(unsigned int ndiov, lnet_kiov_t *dkiov, unsigned int doffset, - int slen, void *src, unsigned int soffset, unsigned int nob) +lnet_copy_flat2kiov(unsigned int ndiov, lnet_kiov_t *dkiov, + unsigned int doffset, int slen, void __user *src, + unsigned int soffset, unsigned int nob) { struct iovec siov = {/* .iov_base = */ src, /* .iov_len = */ slen}; lnet_copy_iov2kiov(ndiov, dkiov, doffset, diff --git a/lnet/include/lnet/lnetst.h b/lnet/include/lnet/lnetst.h index 803cfef..e019d7c7 100644 --- a/lnet/include/lnet/lnetst.h +++ b/lnet/include/lnet/lnetst.h @@ -242,20 +242,20 @@ typedef struct { int lstio_ses_force; /* IN: force create ? */ /** IN: session features */ unsigned lstio_ses_feats; - lst_sid_t *lstio_ses_idp; /* OUT: session id */ + lst_sid_t __user *lstio_ses_idp; /* OUT: session id */ int lstio_ses_nmlen; /* IN: name length */ - char *lstio_ses_namep; /* IN: session name */ + char __user *lstio_ses_namep; /* IN: session name */ } lstio_session_new_args_t; /* query current session */ typedef struct { - lst_sid_t *lstio_ses_idp; /* OUT: session id */ - int *lstio_ses_keyp; /* OUT: local key */ + lst_sid_t __user *lstio_ses_idp; /* OUT: session id */ + int __user *lstio_ses_keyp; /* OUT: local key */ /** OUT: session features */ - unsigned *lstio_ses_featp; - lstcon_ndlist_ent_t *lstio_ses_ndinfo; /* OUT: */ - int lstio_ses_nmlen; /* IN: name length */ - char *lstio_ses_namep; /* OUT: session name */ + unsigned __user *lstio_ses_featp; + lstcon_ndlist_ent_t __user *lstio_ses_ndinfo; /* OUT: */ + int lstio_ses_nmlen; /* IN: name length */ + char __user *lstio_ses_namep; /* OUT: session name */ } lstio_session_info_args_t; /* delete a session */ @@ -276,23 +276,23 @@ typedef struct { int lstio_dbg_timeout; /* IN: timeout of debug */ int lstio_dbg_nmlen; /* IN: len of name */ - char *lstio_dbg_namep; /* IN: name of group|batch */ + char __user *lstio_dbg_namep; /* IN: name of group|batch */ int lstio_dbg_count; /* IN: # of test nodes to debug */ - lnet_process_id_t *lstio_dbg_idsp; /* IN: id of test nodes */ + lnet_process_id_t __user *lstio_dbg_idsp; /* IN: id of test nodes */ /* OUT: list head of result buffer */ - struct list_head *lstio_dbg_resultp; + struct list_head __user *lstio_dbg_resultp; } lstio_debug_args_t; typedef struct { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + char __user *lstio_grp_namep; /* IN: group name */ } lstio_group_add_args_t; typedef struct { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + char __user *lstio_grp_namep; /* IN: group name */ } lstio_group_del_args_t; #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */ @@ -304,41 +304,41 @@ typedef struct { int lstio_grp_opc; /* IN: OPC */ int lstio_grp_args; /* IN: arguments */ int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + char __user *lstio_grp_namep; /* IN: group name */ int lstio_grp_count; /* IN: # of nodes id */ - lnet_process_id_t *lstio_grp_idsp; /* IN: array of nodes */ + lnet_process_id_t __user *lstio_grp_idsp; /* IN: array of nodes */ /* OUT: list head of result buffer */ - struct list_head *lstio_grp_resultp; + struct list_head __user *lstio_grp_resultp; } lstio_group_update_args_t; typedef struct { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name length */ - char *lstio_grp_namep; /* IN: group name */ + char __user *lstio_grp_namep; /* IN: group name */ int lstio_grp_count; /* IN: # of nodes */ /** OUT: session features */ - unsigned *lstio_grp_featp; - lnet_process_id_t *lstio_grp_idsp; /* IN: nodes */ + unsigned __user *lstio_grp_featp; + lnet_process_id_t __user *lstio_grp_idsp; /* IN: nodes */ /* OUT: list head of result buffer */ - struct list_head *lstio_grp_resultp; + struct list_head __user *lstio_grp_resultp; } lstio_group_nodes_args_t; typedef struct { int lstio_grp_key; /* IN: session key */ int lstio_grp_idx; /* IN: group idx */ int lstio_grp_nmlen; /* IN: name len */ - char *lstio_grp_namep; /* OUT: name */ + char __user *lstio_grp_namep; /* OUT: name */ } lstio_group_list_args_t; typedef struct { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name len */ - char *lstio_grp_namep; /* IN: name */ - lstcon_ndlist_ent_t *lstio_grp_entp; /* OUT: description of group */ + char __user *lstio_grp_namep; /* IN: name */ + lstcon_ndlist_ent_t __user *lstio_grp_entp; /* OUT: description of group */ - int *lstio_grp_idxp; /* IN/OUT: node index */ - int *lstio_grp_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t *lstio_grp_dentsp; /* OUT: nodent array */ + int __user *lstio_grp_idxp; /* IN/OUT: node index */ + int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */ + lstcon_node_ent_t __user *lstio_grp_dentsp; /* OUT: nodent array */ } lstio_group_info_args_t; #define LST_DEFAULT_BATCH "batch" /* default batch name */ @@ -346,13 +346,13 @@ typedef struct { typedef struct { int lstio_bat_key; /* IN: session key */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + char __user *lstio_bat_namep; /* IN: batch name */ } lstio_batch_add_args_t; typedef struct { int lstio_bat_key; /* IN: session key */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + char __user *lstio_bat_namep; /* IN: batch name */ } lstio_batch_del_args_t; typedef struct { @@ -363,9 +363,9 @@ typedef struct { /* IN: name length */ int lstio_bat_nmlen; /* IN: batch name */ - char *lstio_bat_namep; + char __user *lstio_bat_namep; /* OUT: list head of result buffer */ - struct list_head *lstio_bat_resultp; + struct list_head __user *lstio_bat_resultp; } lstio_batch_run_args_t; typedef struct { @@ -376,9 +376,9 @@ typedef struct { /* IN: name length */ int lstio_bat_nmlen; /* IN: batch name */ - char *lstio_bat_namep; + char __user *lstio_bat_namep; /* OUT: list head of result buffer */ - struct list_head *lstio_bat_resultp; + struct list_head __user *lstio_bat_resultp; } lstio_batch_stop_args_t; typedef struct { @@ -393,29 +393,29 @@ typedef struct { /* IN: name length */ int lstio_bat_nmlen; /* IN: batch name */ - char *lstio_bat_namep; + char __user *lstio_bat_namep; /* OUT: list head of result buffer */ - struct list_head *lstio_bat_resultp; + struct list_head __user *lstio_bat_resultp; } lstio_batch_query_args_t; typedef struct { int lstio_bat_key; /* IN: session key */ int lstio_bat_idx; /* IN: index */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: batch name */ + char __user *lstio_bat_namep; /* IN: batch name */ } lstio_batch_list_args_t; typedef struct { int lstio_bat_key; /* IN: session key */ int lstio_bat_nmlen; /* IN: name length */ - char *lstio_bat_namep; /* IN: name */ + char __user *lstio_bat_namep; /* IN: name */ int lstio_bat_server; /* IN: query server or not */ int lstio_bat_testidx; /* IN: test index */ - lstcon_test_batch_ent_t *lstio_bat_entp; /* OUT: batch ent */ + lstcon_test_batch_ent_t __user *lstio_bat_entp; /* OUT: batch ent */ - int *lstio_bat_idxp; /* IN/OUT: index of node */ - int *lstio_bat_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t *lstio_bat_dentsp; /* array of nodent */ + int __user *lstio_bat_idxp; /* IN/OUT: index of node */ + int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */ + lstcon_node_ent_t __user *lstio_bat_dentsp; /* array of nodent */ } lstio_batch_info_args_t; /* add stat in session */ @@ -427,13 +427,13 @@ typedef struct { /* IN: group name length */ int lstio_sta_nmlen; /* IN: group name */ - char *lstio_sta_namep; + char __user *lstio_sta_namep; /* IN: # of pid */ int lstio_sta_count; /* IN: pid */ - lnet_process_id_t *lstio_sta_idsp; + lnet_process_id_t __user *lstio_sta_idsp; /* OUT: list head of result buffer */ - struct list_head *lstio_sta_resultp; + struct list_head __user *lstio_sta_resultp; } lstio_stat_args_t; typedef enum { @@ -447,7 +447,7 @@ typedef enum { typedef struct { int lstio_tes_key; /* IN: session key */ int lstio_tes_bat_nmlen; /* IN: batch name len */ - char *lstio_tes_bat_name; /* IN: batch name */ + char __user *lstio_tes_bat_name; /* IN: batch name */ int lstio_tes_type; /* IN: test type */ int lstio_tes_oneside; /* IN: one sided test */ int lstio_tes_loop; /* IN: loop count */ @@ -456,9 +456,9 @@ typedef struct { int lstio_tes_dist; /* IN: node distribution in destination groups */ int lstio_tes_span; /* IN: node span in destination groups */ int lstio_tes_sgrp_nmlen; /* IN: source group name length */ - char *lstio_tes_sgrp_name; /* IN: group name */ + char __user *lstio_tes_sgrp_name; /* IN: group name */ int lstio_tes_dgrp_nmlen; /* IN: destination group name length */ - char *lstio_tes_dgrp_name; /* IN: group name */ + char __user *lstio_tes_dgrp_name; /* IN: group name */ /* IN: param buffer len */ int lstio_tes_param_len; @@ -466,11 +466,11 @@ typedef struct { lstio_bulk_param_t, lstio_ping_param_t, ... more */ - void *lstio_tes_param; + void __user *lstio_tes_param; /* OUT: private returned value */ - int *lstio_tes_retp; + int __user *lstio_tes_retp; /* OUT: list head of result buffer */ - struct list_head *lstio_tes_resultp; + struct list_head __user *lstio_tes_resultp; } lstio_test_args_t; typedef enum { diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index c5ab239..8e7bca3 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -2220,7 +2220,7 @@ LNetCtl(unsigned int cmd, void *arg) id.nid = data->ioc_nid; id.pid = data->ioc_u32[0]; rc = lnet_ping(id, data->ioc_u32[1], /* timeout */ - (lnet_process_id_t *)data->ioc_pbuf1, + (lnet_process_id_t __user *)data->ioc_pbuf1, data->ioc_plen1/sizeof(lnet_process_id_t)); if (rc < 0) return rc; @@ -2320,7 +2320,7 @@ LNetSnprintHandle(char *str, int len, lnet_handle_any_t h) EXPORT_SYMBOL(LNetSnprintHandle); static int -lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t *ids, +lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids, int n_ids) { lnet_handle_eq_t eqh; diff --git a/lnet/lnet/router_proc.c b/lnet/lnet/router_proc.c index edbc0ec..d151474 100644 --- a/lnet/lnet/router_proc.c +++ b/lnet/lnet/router_proc.c @@ -80,7 +80,7 @@ static struct ctl_table_header *lnet_table_header = NULL; #define LNET_PROC_VERSION(v) ((unsigned int)((v) & LNET_PROC_VER_MASK)) static int __proc_lnet_stats(void *data, int write, - loff_t pos, void *buffer, int nob) + loff_t pos, void __user *buffer, int nob) { int rc; lnet_counters_t *ctrs; @@ -568,7 +568,7 @@ proc_lnet_peers(struct ctl_table *table, int write, void __user *buffer, } static int __proc_lnet_buffers(void *data, int write, - loff_t pos, void *buffer, int nob) + loff_t pos, void __user *buffer, int nob) { char *s; char *tmpstr; @@ -793,7 +793,7 @@ static struct lnet_portal_rotors portal_rotors[] = { extern int portal_rotor; static int __proc_lnet_portal_rotor(void *data, int write, - loff_t pos, void *buffer, int nob) + loff_t pos, void __user *buffer, int nob) { const int buf_len = 128; char *buf; diff --git a/lnet/selftest/conrpc.c b/lnet/selftest/conrpc.c index 284f065..8db687a 100644 --- a/lnet/selftest/conrpc.c +++ b/lnet/selftest/conrpc.c @@ -470,11 +470,11 @@ lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat) int lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, - struct list_head *head_up, + struct list_head __user *head_up, lstcon_rpc_readent_func_t readent) { struct list_head tmp; - struct list_head *next; + struct list_head __user *next; lstcon_rpc_ent_t *ent; srpc_generic_reply_t *rep; lstcon_rpc_t *crpc; @@ -711,7 +711,7 @@ lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov) int i; i = idx / SFW_ID_PER_PAGE; - + LASSERT (i < nkiov); pid = (lnet_process_id_packed_t *)page_address(kiov[i].kiov_page); @@ -883,7 +883,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, trq->tsr_ndest = test->tes_span; trq->tsr_loop = test->tes_loop; - } + } trq->tsr_sid = console_session.ses_id; trq->tsr_bid = test->tes_hdr.tsb_id; @@ -1023,7 +1023,7 @@ lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg, return; } - if (bat_rep->bar_status == EPERM && + if (bat_rep->bar_status == EPERM && trans->tas_opc == LST_TRANS_TSBSTOP) { lstcon_tsbop_stat_success(stat, 1); return; @@ -1037,12 +1037,12 @@ lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg, case LST_TRANS_TSBSRVQRY: bat_rep = &msg->msg_body.bat_reply; - if (bat_rep->bar_active != 0) + if (bat_rep->bar_active != 0) lstcon_tsbqry_stat_run(stat, 1); else lstcon_tsbqry_stat_idle(stat, 1); - if (bat_rep->bar_status == 0) + if (bat_rep->bar_status == 0) return; lstcon_tsbqry_stat_failure(stat, 1); diff --git a/lnet/selftest/conrpc.h b/lnet/selftest/conrpc.h index 2181026..2018911 100644 --- a/lnet/selftest/conrpc.h +++ b/lnet/selftest/conrpc.h @@ -112,7 +112,8 @@ typedef struct lstcon_rpc_trans { #define LST_TRANS_STATQRY 0x21 typedef int (* lstcon_rpc_cond_func_t)(int, struct lstcon_node *, void *); -typedef int (* lstcon_rpc_readent_func_t)(int, srpc_msg_t *, lstcon_rpc_ent_t *); +typedef int (*lstcon_rpc_readent_func_t)(int, srpc_msg_t *, + lstcon_rpc_ent_t __user *); int lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, unsigned version, lstcon_rpc_t **crpc); @@ -134,7 +135,7 @@ int lstcon_rpc_trans_ndlist(struct list_head *ndlist, void lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat); int lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, - struct list_head *head_up, + struct list_head __user *head_up, lstcon_rpc_readent_func_t readent); void lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error); void lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans); diff --git a/lnet/selftest/console.c b/lnet/selftest/console.c index 73031a5..1367192 100644 --- a/lnet/selftest/console.c +++ b/lnet/selftest/console.c @@ -88,7 +88,7 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create) *ndpp = ndl->ndl_node; return 0; } - + if (!create) return -ENOENT; @@ -173,7 +173,7 @@ lstcon_ndlink_find(struct list_head *hash, lstcon_node_put(nd); return -ENOMEM; } - + *ndlpp = ndl; ndl->ndl_node = nd; @@ -382,7 +382,7 @@ lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg) int lstcon_sesrpc_readent(int transop, srpc_msg_t *msg, - lstcon_rpc_ent_t *ent_up) + lstcon_rpc_ent_t __user *ent_up) { srpc_debug_reply_t *rep; @@ -411,8 +411,8 @@ lstcon_sesrpc_readent(int transop, srpc_msg_t *msg, static int lstcon_group_nodes_add(lstcon_group_t *grp, - int count, lnet_process_id_t *ids_up, - unsigned *featp, struct list_head *result_up) + int count, lnet_process_id_t __user *ids_up, + unsigned *featp, struct list_head __user *result_up) { lstcon_rpc_trans_t *trans; lstcon_ndlink_t *ndl; @@ -478,8 +478,8 @@ lstcon_group_nodes_add(lstcon_group_t *grp, static int lstcon_group_nodes_remove(lstcon_group_t *grp, - int count, lnet_process_id_t *ids_up, - struct list_head *result_up) + int count, lnet_process_id_t __user *ids_up, + struct list_head __user *result_up) { lstcon_rpc_trans_t *trans; lstcon_ndlink_t *ndl; @@ -501,7 +501,7 @@ lstcon_group_nodes_remove(lstcon_group_t *grp, rc = -EFAULT; goto error; } - + /* move node to tmp group */ if (lstcon_group_ndlink_find(grp, id, &ndl, 0) == 0) lstcon_group_ndlink_move(grp, tmp, ndl); @@ -556,8 +556,8 @@ lstcon_group_add(char *name) } int -lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up, - unsigned *featp, struct list_head *result_up) +lstcon_nodes_add(char *name, int count, lnet_process_id_t __user *ids_up, + unsigned *featp, struct list_head __user *result_up) { lstcon_group_t *grp; int rc; @@ -661,7 +661,8 @@ lstcon_group_clean(char *name, int args) int lstcon_nodes_remove(char *name, int count, - lnet_process_id_t *ids_up, struct list_head *result_up) + lnet_process_id_t __user *ids_up, + struct list_head __user *result_up) { lstcon_group_t *grp = NULL; int rc; @@ -690,7 +691,7 @@ lstcon_nodes_remove(char *name, int count, } int -lstcon_group_refresh(char *name, struct list_head *result_up) +lstcon_group_refresh(char *name, struct list_head __user *result_up) { lstcon_rpc_trans_t *trans; lstcon_group_t *grp; @@ -751,7 +752,7 @@ lstcon_group_list(int index, int len, char __user *name_up) static int lstcon_nodes_getent(struct list_head *head, int *index_p, - int *count_p, lstcon_node_ent_t *dents_up) + int *count_p, lstcon_node_ent_t __user *dents_up) { lstcon_ndlink_t *ndl; lstcon_node_t *nd; @@ -790,8 +791,9 @@ lstcon_nodes_getent(struct list_head *head, int *index_p, } int -lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, - int *index_p, int *count_p, lstcon_node_ent_t *dents_up) +lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p, + int *index_p, int *count_p, + lstcon_node_ent_t __user *dents_up) { lstcon_ndlist_ent_t *gentp; lstcon_group_t *grp; @@ -937,9 +939,9 @@ lstcon_batch_list(int index, int len, char __user *name_up) } int -lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server, - int testidx, int *index_p, int *ndent_p, - lstcon_node_ent_t *dents_up) +lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, + int server, int testidx, int *index_p, int *ndent_p, + lstcon_node_ent_t __user *dents_up) { lstcon_test_batch_ent_t *entp; struct list_head *clilst; @@ -1035,7 +1037,7 @@ lstcon_batrpc_condition(int transop, lstcon_node_t *nd, void *arg) static int lstcon_batch_op(lstcon_batch_t *bat, int transop, - struct list_head *result_up) + struct list_head __user *result_up) { lstcon_rpc_trans_t *trans; int rc; @@ -1058,7 +1060,7 @@ lstcon_batch_op(lstcon_batch_t *bat, int transop, } int -lstcon_batch_run(char *name, int timeout, struct list_head *result_up) +lstcon_batch_run(char *name, int timeout, struct list_head __user *result_up) { lstcon_batch_t *bat; int rc; @@ -1080,7 +1082,7 @@ lstcon_batch_run(char *name, int timeout, struct list_head *result_up) } int -lstcon_batch_stop(char *name, int force, struct list_head *result_up) +lstcon_batch_stop(char *name, int force, struct list_head __user *result_up) { lstcon_batch_t *bat; int rc; @@ -1093,7 +1095,7 @@ lstcon_batch_stop(char *name, int force, struct list_head *result_up) bat->bat_arg = force; rc = lstcon_batch_op(bat, LST_TRANS_TSBSTOP, result_up); - + /* mark batch as stopped if all RPCs finished */ if (lstcon_tsbop_stat_failure(lstcon_trans_stat(), 0) == 0) bat->bat_state = LST_BATCH_IDLE; @@ -1179,7 +1181,7 @@ lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg) if (transop == LST_TRANS_TSBCLIADD) { hash = batch->bat_cli_hash; head = &batch->bat_cli_list; - + } else { LASSERT (transop == LST_TRANS_TSBSRVADD); @@ -1199,7 +1201,7 @@ lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg) } static int -lstcon_test_nodes_add(lstcon_test_t *test, struct list_head *result_up) +lstcon_test_nodes_add(lstcon_test_t *test, struct list_head __user *result_up) { lstcon_rpc_trans_t *trans; lstcon_group_t *grp; @@ -1297,7 +1299,7 @@ lstcon_test_add(char *batch_name, int type, int loop, int concur, int dist, int span, char *src_name, char *dst_name, void *param, int paramlen, int *retp, - struct list_head *result_up) + struct list_head __user *result_up) { lstcon_test_t *test = NULL; int rc; @@ -1401,7 +1403,7 @@ lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp) int lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg, - lstcon_rpc_ent_t *ent_up) + lstcon_rpc_ent_t __user *ent_up) { srpc_batch_reply_t *rep = &msg->msg_body.bat_reply; @@ -1418,7 +1420,7 @@ lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg, int lstcon_test_batch_query(char *name, int testidx, int client, - int timeout, struct list_head *result_up) + int timeout, struct list_head __user *result_up) { lstcon_rpc_trans_t *trans; struct list_head *translist; @@ -1447,11 +1449,11 @@ lstcon_test_batch_query(char *name, int testidx, int client, CDEBUG(D_NET, "Can't find test: %d\n", testidx); return rc; } - + translist = &test->tes_trans_list; ndlist = &test->tes_src_grp->grp_ndl_list; hdr = &test->tes_hdr; - } + } transop = client ? LST_TRANS_TSBCLIQRY : LST_TRANS_TSBSRVQRY; @@ -1480,19 +1482,21 @@ lstcon_test_batch_query(char *name, int testidx, int client, int lstcon_statrpc_readent(int transop, srpc_msg_t *msg, - lstcon_rpc_ent_t *ent_up) + lstcon_rpc_ent_t __user *ent_up) { - srpc_stat_reply_t *rep = &msg->msg_body.stat_reply; - sfw_counters_t *sfwk_stat; - srpc_counters_t *srpc_stat; - lnet_counters_t *lnet_stat; - + srpc_stat_reply_t *rep = &msg->msg_body.stat_reply; + sfw_counters_t __user *sfwk_stat; + srpc_counters_t __user *srpc_stat; + lnet_counters_t __user *lnet_stat; + if (rep->str_status != 0) return 0; - sfwk_stat = (sfw_counters_t *)&ent_up->rpe_payload[0]; - srpc_stat = (srpc_counters_t *)((char *)sfwk_stat + sizeof(*sfwk_stat)); - lnet_stat = (lnet_counters_t *)((char *)srpc_stat + sizeof(*srpc_stat)); + sfwk_stat = (sfw_counters_t __user *)&ent_up->rpe_payload[0]; + srpc_stat = (srpc_counters_t __user *) + ((char __user *)sfwk_stat + sizeof(*sfwk_stat)); + lnet_stat = (lnet_counters_t __user *) + ((char __user *)srpc_stat + sizeof(*srpc_stat)); if (copy_to_user(sfwk_stat, &rep->str_fw, sizeof(*sfwk_stat)) || copy_to_user(srpc_stat, &rep->str_rpc, sizeof(*srpc_stat)) || @@ -1504,7 +1508,7 @@ lstcon_statrpc_readent(int transop, srpc_msg_t *msg, int lstcon_ndlist_stat(struct list_head *ndlist, - int timeout, struct list_head *result_up) + int timeout, struct list_head __user *result_up) { struct list_head head; lstcon_rpc_trans_t *trans; @@ -1529,7 +1533,8 @@ lstcon_ndlist_stat(struct list_head *ndlist, } int -lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up) +lstcon_group_stat(char *grp_name, int timeout, + struct list_head __user *result_up) { lstcon_group_t *grp; int rc; @@ -1548,8 +1553,8 @@ lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up) } int -lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, - int timeout, struct list_head *result_up) +lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up, + int timeout, struct list_head __user *result_up) { lstcon_ndlink_t *ndl; lstcon_group_t *tmp; @@ -1594,7 +1599,7 @@ lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, int lstcon_debug_ndlist(struct list_head *ndlist, struct list_head *translist, - int timeout, struct list_head *result_up) + int timeout, struct list_head __user *result_up) { lstcon_rpc_trans_t *trans; int rc; @@ -1616,7 +1621,7 @@ lstcon_debug_ndlist(struct list_head *ndlist, } int -lstcon_session_debug(int timeout, struct list_head *result_up) +lstcon_session_debug(int timeout, struct list_head __user *result_up) { return lstcon_debug_ndlist(&console_session.ses_ndl_list, NULL, timeout, result_up); @@ -1624,7 +1629,7 @@ lstcon_session_debug(int timeout, struct list_head *result_up) int lstcon_batch_debug(int timeout, char *name, - int client, struct list_head *result_up) + int client, struct list_head __user *result_up) { lstcon_batch_t *bat; int rc; @@ -1642,7 +1647,7 @@ lstcon_batch_debug(int timeout, char *name, int lstcon_group_debug(int timeout, char *name, - struct list_head *result_up) + struct list_head __user *result_up) { lstcon_group_t *grp; int rc; @@ -1660,8 +1665,8 @@ lstcon_group_debug(int timeout, char *name, int lstcon_nodes_debug(int timeout, - int count, lnet_process_id_t *ids_up, - struct list_head *result_up) + int count, lnet_process_id_t __user *ids_up, + struct list_head __user *result_up) { lnet_process_id_t id; lstcon_ndlink_t *ndl; @@ -1725,7 +1730,7 @@ extern srpc_service_t lstcon_acceptor_service; int lstcon_session_new(char *name, int key, unsigned feats, - int timeout, int force, lst_sid_t *sid_up) + int timeout, int force, lst_sid_t __user *sid_up) { int rc = 0; int i; @@ -1793,8 +1798,10 @@ lstcon_session_new(char *name, int key, unsigned feats, } int -lstcon_session_info(lst_sid_t *sid_up, int *key_up, unsigned *featp, - lstcon_ndlist_ent_t *ndinfo_up, char *name_up, int len) +lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up, + unsigned __user *featp, + lstcon_ndlist_ent_t __user *ndinfo_up, + char __user *name_up, int len) { lstcon_ndlist_ent_t *entp; lstcon_ndlink_t *ndl; @@ -1837,7 +1844,7 @@ lstcon_session_end() LASSERT (console_session.ses_state == LST_SESSION_ACTIVE); - rc = lstcon_rpc_trans_ndlist(&console_session.ses_ndl_list, + rc = lstcon_rpc_trans_ndlist(&console_session.ses_ndl_list, NULL, LST_TRANS_SESEND, NULL, lstcon_sesrpc_condition, &trans); if (rc != 0) { diff --git a/lnet/selftest/console.h b/lnet/selftest/console.h index 571e1d8..3eeed21 100644 --- a/lnet/selftest/console.h +++ b/lnet/selftest/console.h @@ -200,51 +200,59 @@ lstcon_id2hash(lnet_process_id_t id, struct list_head *hash) extern int lstcon_session_match(lst_sid_t sid); extern int lstcon_session_new(char *name, int key, unsigned version, - int timeout, int flags, lst_sid_t *sid_up); -extern int lstcon_session_info(lst_sid_t *sid_up, int *key, unsigned *verp, - lstcon_ndlist_ent_t *entp, char *name_up, int len); + int timeout, int flags, lst_sid_t __user *sid_up); +extern int lstcon_session_info(lst_sid_t __user *sid_up, int __user *key, + unsigned __user *verp, + lstcon_ndlist_ent_t __user *entp, + char __user *name_up, int len); extern int lstcon_session_end(void); -extern int lstcon_session_debug(int timeout, struct list_head *result_up); +extern int lstcon_session_debug(int timeout, + struct list_head __user *result_up); extern int lstcon_session_feats_check(unsigned feats); extern int lstcon_batch_debug(int timeout, char *name, - int client, struct list_head *result_up); + int client, struct list_head __user *result_up); extern int lstcon_group_debug(int timeout, char *name, - struct list_head *result_up); -extern int lstcon_nodes_debug(int timeout, int nnd, lnet_process_id_t *nds_up, - struct list_head *result_up); + struct list_head __user *result_up); +extern int lstcon_nodes_debug(int timeout, int nnd, + lnet_process_id_t __user *nds_up, + struct list_head __user *result_up); extern int lstcon_group_add(char *name); extern int lstcon_group_del(char *name); extern int lstcon_group_clean(char *name, int args); -extern int lstcon_group_refresh(char *name, struct list_head *result_up); -extern int lstcon_nodes_add(char *name, int nnd, lnet_process_id_t *nds_up, - unsigned *featp, struct list_head *result_up); -extern int lstcon_nodes_remove(char *name, int nnd, lnet_process_id_t *nds_up, - struct list_head *result_up); -extern int lstcon_group_info(char *name, lstcon_ndlist_ent_t *gent_up, - int *index_p, int *ndent_p, lstcon_node_ent_t *ndents_up); +extern int lstcon_group_refresh(char *name, struct list_head __user *result_up); +extern int lstcon_nodes_add(char *name, int nnd, + lnet_process_id_t __user *nds_up, + unsigned *featp, + struct list_head __user *result_up); +extern int lstcon_nodes_remove(char *name, int nnd, + lnet_process_id_t __user *nds_up, + struct list_head __user *result_up); +extern int lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gent_up, + int *index_p, int *ndent_p, + lstcon_node_ent_t __user *ndents_up); extern int lstcon_group_list(int idx, int len, char __user *name_up); extern int lstcon_batch_add(char *name); extern int lstcon_batch_run(char *name, int timeout, - struct list_head *result_up); + struct list_head __user *result_up); extern int lstcon_batch_stop(char *name, int force, - struct list_head *result_up); + struct list_head __user *result_up); extern int lstcon_test_batch_query(char *name, int testidx, int client, int timeout, - struct list_head *result_up); + struct list_head __user *result_up); extern int lstcon_batch_del(char *name); extern int lstcon_batch_list(int idx, int namelen, char __user *name_up); -extern int lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, - int server, int testidx, int *index_p, - int *ndent_p, lstcon_node_ent_t *dents_up); +extern int lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, + int server, int testidx, int *index_p, + int *ndent_p, lstcon_node_ent_t __user *dents_up); extern int lstcon_group_stat(char *grp_name, int timeout, - struct list_head *result_up); -extern int lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, - int timeout, struct list_head *result_up); + struct list_head __user *result_up); +extern int lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up, + int timeout, struct list_head __user *result_up); extern int lstcon_test_add(char *batch_name, int type, int loop, int concur, int dist, int span, char *src_name, char *dst_name, void *param, int paramlen, int *retp, - struct list_head *result_up); + struct list_head __user *result_up); #endif #endif -- 1.8.3.1