1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * Copyright (c) 2001-2003 Cluster File Systems, Inc.
7 * Copyright (c) 2001-2002 Sandia National Laboratories
9 * This file is part of Lustre, http://www.sf.net/projects/lustre/
11 * Lustre is free software; you can redistribute it and/or
12 * modify it under the terms of version 2 of the GNU General Public
13 * License as published by the Free Software Foundation.
15 * Lustre is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Lustre; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #define DEBUG_SUBSYSTEM S_PORTALS
26 #include <portals/lib-p30.h>
27 #include <portals/lib-dispatch.h>
30 int (*fun) (nal_cb_t * nal, void *private, void *in, void *out);
34 static dispatch_table_t dispatch_table[] = {
35 [PTL_GETID] {do_PtlGetId, "PtlGetId"},
36 [PTL_NISTATUS] {do_PtlNIStatus, "PtlNIStatus"},
37 [PTL_NIDIST] {do_PtlNIDist, "PtlNIDist"},
38 [PTL_NIDEBUG] {do_PtlNIDebug, "PtlNIDebug"},
39 [PTL_MEATTACH] {do_PtlMEAttach, "PtlMEAttach"},
40 [PTL_MEINSERT] {do_PtlMEInsert, "PtlMEInsert"},
41 [PTL_MEUNLINK] {do_PtlMEUnlink, "PtlMEUnlink"},
42 [PTL_TBLDUMP] {do_PtlTblDump, "PtlTblDump"},
43 [PTL_MEDUMP] {do_PtlMEDump, "PtlMEDump"},
44 [PTL_MDATTACH] {do_PtlMDAttach, "PtlMDAttach"},
45 [PTL_MDBIND] {do_PtlMDBind, "PtlMDBind"},
46 [PTL_MDUPDATE] {do_PtlMDUpdate_internal, "PtlMDUpdate_internal"},
47 [PTL_MDUNLINK] {do_PtlMDUnlink, "PtlMDUnlink"},
48 [PTL_EQALLOC] {do_PtlEQAlloc_internal, "PtlEQAlloc_internal"},
49 [PTL_EQFREE] {do_PtlEQFree_internal, "PtlEQFree_internal"},
50 [PTL_PUT] {do_PtlPut, "PtlPut"},
51 [PTL_GET] {do_PtlGet, "PtlGet"},
52 [PTL_FAILNID] {do_PtlFailNid, "PtlFailNid"},
57 * This really should be elsewhere, but lib-p30/dispatch.c is
58 * an automatically generated file.
60 void lib_dispatch(nal_cb_t * nal, void *private, int index, void *arg_block,
63 lib_ni_t *ni = &nal->ni;
65 if (index < 0 || index > LIB_MAX_DISPATCH ||
66 !dispatch_table[index].fun) {
67 CDEBUG(D_NET, LPU64": Invalid API call %d\n", ni->nid, index);
71 CDEBUG(D_NET, LPU64": API call %s (%d)\n", ni->nid,
72 dispatch_table[index].name, index);
74 dispatch_table[index].fun(nal, private, arg_block, ret_block);
77 char *dispatch_name(int index)
79 return dispatch_table[index].name;