*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lnet/selftest/conctl.c
*
unsigned int idx = LNET_NIDADDR(ndl->ndl_node->nd_id.nid) %
LST_NODE_HASHSIZE;
- list_del(&ndl->ndl_hlink);
- list_del(&ndl->ndl_link);
old->grp_nnode--;
- list_add_tail(&ndl->ndl_hlink, &new->grp_ndl_hash[idx]);
- list_add_tail(&ndl->ndl_link, &new->grp_ndl_list);
+ list_move_tail(&ndl->ndl_hlink, &new->grp_ndl_hash[idx]);
+ list_move_tail(&ndl->ndl_link, &new->grp_ndl_list);
new->grp_nnode++;
}
}
/* non-verbose query */
- LIBCFS_ALLOC(gentp, sizeof(struct lstcon_ndlist_ent));
+ CFS_ALLOC_PTR(gentp);
if (gentp == NULL) {
CERROR("Can't allocate ndlist_ent\n");
lstcon_group_decref(grp);
rc = copy_to_user(gents_p, gentp,
sizeof(struct lstcon_ndlist_ent)) ? -EFAULT : 0;
- LIBCFS_FREE(gentp, sizeof(struct lstcon_ndlist_ent));
+ CFS_FREE_PTR(gentp);
lstcon_group_decref(grp);
return -ENOMEM;
}
- LIBCFS_ALLOC(bat->bat_cli_hash,
- sizeof(struct list_head) * LST_NODE_HASHSIZE);
+ CFS_ALLOC_PTR_ARRAY(bat->bat_cli_hash, LST_NODE_HASHSIZE);
if (bat->bat_cli_hash == NULL) {
CERROR("Can't allocate hash for batch %s\n", name);
LIBCFS_FREE(bat, sizeof(*bat));
- return -ENOMEM;
- }
+ return -ENOMEM;
+ }
- LIBCFS_ALLOC(bat->bat_srv_hash,
- sizeof(struct list_head) * LST_NODE_HASHSIZE);
- if (bat->bat_srv_hash == NULL) {
- CERROR("Can't allocate hash for batch %s\n", name);
- LIBCFS_FREE(bat->bat_cli_hash, LST_NODE_HASHSIZE);
+ CFS_ALLOC_PTR_ARRAY(bat->bat_srv_hash, LST_NODE_HASHSIZE);
+ if (bat->bat_srv_hash == NULL) {
+ CERROR("Can't allocate hash for batch %s\n", name);
+ LIBCFS_FREE(bat->bat_cli_hash, LST_NODE_HASHSIZE);
LIBCFS_FREE(bat, sizeof(*bat));
- return -ENOMEM;
- }
+ return -ENOMEM;
+ }
if (strlen(name) > sizeof(bat->bat_name)-1) {
LIBCFS_FREE(bat->bat_srv_hash, LST_NODE_HASHSIZE);
}
/* non-verbose query */
- LIBCFS_ALLOC(entp, sizeof(struct lstcon_test_batch_ent));
+ CFS_ALLOC_PTR(entp);
if (entp == NULL)
return -ENOMEM;
rc = copy_to_user(ent_up, entp,
sizeof(struct lstcon_test_batch_ent)) ? -EFAULT : 0;
- LIBCFS_FREE(entp, sizeof(struct lstcon_test_batch_ent));
+ CFS_FREE_PTR(entp)
return rc;
}
lstcon_ndlist_stat(struct list_head *ndlist,
int timeout, struct list_head __user *result_up)
{
- struct list_head head;
+ LIST_HEAD(head);
struct lstcon_rpc_trans *trans;
- int rc;
-
- INIT_LIST_HEAD(&head);
+ int rc;
rc = lstcon_rpc_trans_ndlist(ndlist, &head,
LST_TRANS_STATQRY, NULL, NULL, &trans);
static void
lstcon_new_session_id(struct lst_sid *sid)
{
- struct lnet_process_id id;
+ struct lnet_processid id;
LASSERT(console_session.ses_state == LST_SESSION_NONE);
LNetGetId(1, &id);
- sid->ses_nid = id.nid;
+ sid->ses_nid = lnet_nid_to_nid4(&id.nid);
sid->ses_stamp = div_u64(ktime_get_ns(), NSEC_PER_MSEC);
}
INIT_LIST_HEAD(&console_session.ses_bat_list);
INIT_LIST_HEAD(&console_session.ses_trans_list);
- LIBCFS_ALLOC(console_session.ses_ndl_hash,
- sizeof(struct list_head) * LST_GLOBAL_HASHSIZE);
+ CFS_ALLOC_PTR_ARRAY(console_session.ses_ndl_hash,
+ LST_GLOBAL_HASHSIZE);
if (console_session.ses_ndl_hash == NULL)
return -ENOMEM;
rc = srpc_add_service(&lstcon_acceptor_service);
LASSERT(rc != -EBUSY);
if (rc != 0) {
- LIBCFS_FREE(console_session.ses_ndl_hash,
- sizeof(struct list_head) * LST_GLOBAL_HASHSIZE);
+ CFS_FREE_PTR_ARRAY(console_session.ses_ndl_hash,
+ LST_GLOBAL_HASHSIZE);
return rc;
}
srpc_shutdown_service(&lstcon_acceptor_service);
srpc_remove_service(&lstcon_acceptor_service);
- LIBCFS_FREE(console_session.ses_ndl_hash,
- sizeof(struct list_head) * LST_GLOBAL_HASHSIZE);
+ CFS_FREE_PTR_ARRAY(console_session.ses_ndl_hash, LST_GLOBAL_HASHSIZE);
srpc_wait_service_shutdown(&lstcon_acceptor_service);
for (i = 0; i < LST_NODE_HASHSIZE; i++)
LASSERT(list_empty(&console_session.ses_ndl_hash[i]));
- LIBCFS_FREE(console_session.ses_ndl_hash,
- sizeof(struct list_head) * LST_GLOBAL_HASHSIZE);
+ CFS_FREE_PTR_ARRAY(console_session.ses_ndl_hash,
+ LST_GLOBAL_HASHSIZE);
srpc_wait_service_shutdown(&lstcon_acceptor_service);