VM: simplify slab allocator
[minix.git] / lib / libsys / pci_set_acl.c
blob1f7a7492b238c142c239a55b57154be330399399
1 /*
2 pci_set_acl.c
3 */
5 #include "pci.h"
6 #include "syslib.h"
7 #include <unistd.h>
8 #include <minix/rs.h>
9 #include <minix/ds.h>
10 #include <minix/sysutil.h>
12 /*===========================================================================*
13 * pci_set_acl *
14 *===========================================================================*/
15 int pci_set_acl(rs_pci)
16 struct rs_pci *rs_pci;
18 int r;
19 cp_grant_id_t gid;
20 message m;
21 endpoint_t endpoint;
23 if (pci_procnr == ANY)
25 r= ds_retrieve_label_endpt("pci", &endpoint);
26 if (r != 0)
28 panic("pci_set_acl: ds_retrieve_label_endpt failed for 'pci': %d", r);
30 pci_procnr = endpoint;
34 gid= cpf_grant_direct(pci_procnr, (vir_bytes)rs_pci, sizeof(*rs_pci),
35 CPF_READ);
36 if (gid == -1)
38 printf("pci_set_acl: cpf_grant_direct failed: %d\n",
39 errno);
40 return EINVAL;
43 m.m_type= BUSC_PCI_SET_ACL;
44 m.m1_i1= gid;
46 r= sendrec(pci_procnr, &m);
47 cpf_revoke(gid);
48 if (r != 0)
49 panic("pci_set_acl: can't talk to PCI: %d", r);
51 return m.m_type;