xref: /haiku/src/apps/devices/dm_wrapper.c (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 /*
2  * Copyright 2006 Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Jerome Duval (listdev)
7  */
8 
9 
10 #include <errno.h>
11 #include <fcntl.h>
12 #include <stdio.h>
13 #include <unistd.h>
14 
15 #include <drivers/device_manager.h>
16 #include <device_manager_defs.h>
17 #include <generic_syscall_defs.h>
18 #include <string.h>
19 #include <syscalls.h>
20 
21 #include "dm_wrapper.h"
22 
23 
24 status_t
25 init_dm_wrapper(void)
26 {
27 	uint32 version = 0;
28 	return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, B_SYSCALL_INFO,
29 		&version, sizeof(version));
30 }
31 
32 
33 status_t
34 uninit_dm_wrapper(void)
35 {
36 	return B_OK;
37 }
38 
39 
40 status_t
41 get_root(device_node_cookie *cookie)
42 {
43 	return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_ROOT, cookie,
44 		sizeof(device_node_cookie));
45 }
46 
47 
48 status_t
49 get_child(device_node_cookie *device)
50 {
51 	return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_CHILD, device,
52 		sizeof(device_node_cookie));
53 }
54 
55 
56 status_t
57 get_next_child(device_node_cookie *device)
58 {
59 	return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS, DM_GET_NEXT_CHILD,
60 		device, sizeof(device_node_cookie));
61 }
62 
63 
64 status_t
65 dm_get_next_attr(struct device_attr_info *attr)
66 {
67 	return _kern_generic_syscall(DEVICE_MANAGER_SYSCALLS,
68 		DM_GET_NEXT_ATTRIBUTE, attr, sizeof(struct device_attr_info));
69 }
70