1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (c) 2003 Los Alamos National Laboratory (LANL)
6 * This file is part of Lustre, http://www.lustre.org/
8 * This file is free software; you can redistribute it and/or
9 * modify it under the terms of version 2.1 of the GNU Lesser General
10 * Public License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Portals; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <sys/types.h>
24 #include <sys/socket.h>
25 #include <netinet/tcp.h>
30 #include <sys/ioctl.h>
35 #include <portals/api-support.h>
36 #include <portals/list.h>
37 #include <portals/lib-types.h>
39 #define GMNAL_IOC_GET_GNID 1
44 return((len+7) & (~0x7));
47 int main(int argc, char **argv)
50 struct portal_ioctl_data data;
51 struct portals_cfg pcfg;
52 unsigned int nid = 0, len;
58 while ((c = getopt(argc, argv, "n:l")) != -1) {
64 printf("Get local id not implemented yet!\n");
67 printf("usage %s -n nodename [-p]\n", argv[0]);
72 printf("usage %s -n nodename [-p]\n", argv[0]);
79 PCFG_INIT(pcfg, GMNAL_IOC_GET_GNID);
80 pcfg.pcfg_nal = GMNAL;
85 len = strlen(name) + 1;
86 pcfg.pcfg_pbuf1 = malloc(len);
87 strcpy(pcfg.pcfg_pbuf1, name);
88 pcfg.pcfg_plen1 = len;
93 pcfg.pcfg_pbuf2 = (void*)&nid;
94 pcfg.pcfg_plen2 = sizeof(unsigned int*);
96 pfd = open("/dev/portals", O_RDWR);
98 perror("opening portals device");
99 free(pcfg.pcfg_pbuf1);
103 PORTAL_IOC_INIT(data);
104 data.ioc_pbuf1 = (char*)&pcfg;
105 data.ioc_plen1 = sizeof(pcfg);
107 rc = ioctl (pfd, IOC_PORTAL_NAL_CMD, &data);
110 perror ("Can't get my NID");
113 free(pcfg.pcfg_pbuf1);