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