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>
32 #include <asm/byteorder.h>
37 #include <portals/api-support.h>
38 #include <portals/list.h>
39 #include <portals/lib-types.h>
41 #define GMNAL_IOC_GET_GNID 1
46 return((len+7) & (~0x7));
49 int main(int argc, char **argv)
52 struct portal_ioctl_data data;
53 struct portals_cfg pcfg;
54 unsigned int nid = 0, len;
60 while ((c = getopt(argc, argv, "n:l")) != -1) {
66 printf("Get local id not implemented yet!\n");
69 printf("usage %s -n nodename [-p]\n", argv[0]);
74 printf("usage %s -n nodename [-p]\n", argv[0]);
81 PCFG_INIT(pcfg, GMNAL_IOC_GET_GNID);
82 pcfg.pcfg_nal = GMNAL;
87 len = strlen(name) + 1;
88 pcfg.pcfg_pbuf1 = malloc(len);
89 strcpy(pcfg.pcfg_pbuf1, name);
90 pcfg.pcfg_plen1 = len;
95 pcfg.pcfg_pbuf2 = (void*)&nid;
96 pcfg.pcfg_plen2 = sizeof(unsigned int*);
98 pfd = open("/dev/portals", O_RDWR);
100 perror("opening portals device");
101 free(pcfg.pcfg_pbuf1);
105 PORTAL_IOC_INIT(data);
106 data.ioc_pbuf1 = (char*)&pcfg;
107 data.ioc_plen1 = sizeof(pcfg);
109 rc = ioctl (pfd, IOC_PORTAL_NAL_CMD, &data);
112 perror ("Can't get my NID");
115 free(pcfg.pcfg_pbuf1);