Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / lib / libsys / pci_slot_name.c
blobf63025a39f695181051d7e4425d94d99fd5650ab
1 /*
2 pci_slot_name.c
3 */
5 #include "pci.h"
6 #include "syslib.h"
7 #include <minix/sysutil.h>
9 /*===========================================================================*
10 * pci_slot_name *
11 *===========================================================================*/
12 char *pci_slot_name(devind)
13 int devind;
15 static char name[80]; /* We need a better interface for this */
17 int r;
18 cp_grant_id_t gid;
19 message m;
21 gid= cpf_grant_direct(pci_procnr, (vir_bytes)name, sizeof(name),
22 CPF_WRITE);
23 if (gid == -1)
25 printf("pci_dev_name: cpf_grant_direct failed: %d\n",
26 errno);
27 return NULL;
30 m.m_type= BUSC_PCI_SLOT_NAME_S;
31 m.m1_i1= devind;
32 m.m1_i2= sizeof(name);
33 m.m1_i3= gid;
35 r= ipc_sendrec(pci_procnr, &m);
36 cpf_revoke(gid);
37 if (r != 0)
38 panic("pci_slot_name: can't talk to PCI: %d", r);
40 if (m.m_type != 0)
41 panic("pci_slot_name: got bad reply from PCI: %d", m.m_type);
43 name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL
44 * terminated.
46 return name;