drm/radeon: add missing ttm_eu_backoff_reservation to radeon_bo_list_validate
[dragonfly.git] / lib / libdevattr / devattr_test.c
blob18860be747f17a409c2498b487331b481f2500c6
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <err.h>
4 #include "devattr.h"
6 int main(void)
8 struct udev *udev;
9 struct udev_enumerate *udev_enum;
10 struct udev_list_entry *udev_le, *udev_le_first;
11 struct udev_monitor *udev_monitor;
12 struct udev_device *udev_dev;
13 prop_array_t pa;
14 prop_dictionary_t dict;
15 int ret;
17 printf("1\n");
18 udev = udev_new();
19 if(udev == NULL) {
20 perror("udev_new");
21 exit(1);
23 printf("2\n");
24 udev_enum = udev_enumerate_new(udev);
25 if(udev == NULL) {
26 perror("udev_enumerate_new");
27 exit(1);
29 printf("3\n");
31 ret = udev_enumerate_add_match_expr(udev_enum, "name", "da*");
32 if (ret != 0)
33 err(1, "udev_enumerate_add_match_expr, out, ret=%d\n", ret);
35 ret = udev_enumerate_add_match_regex(udev_enum, "name", "ad.*");
36 if (ret != 0)
37 err(1, "udev_enumerate_add_match_regex, out, ret=%d\n", ret);
39 ret = udev_enumerate_scan_devices(udev_enum);
40 printf("4\n");
41 if (ret != 0) {
42 printf("4 out...\n");
43 err(1, "udev_enumerate_scan_device ret = %d", ret);
46 printf("5\n");
47 udev_le_first = udev_enumerate_get_list_entry(udev_enum);
48 printf("6\n");
49 if (udev_le_first == NULL)
50 err(1, "udev_enumerate_get_list_entry error");
52 printf("7\n");
53 pa = udev_enumerate_get_array(udev_enum);
54 printf("8\n");
55 prop_array_externalize_to_file(pa, "array_out.xml");
56 printf("9\n");
57 udev_list_entry_foreach(udev_le, udev_le_first) {
58 dict = udev_list_entry_get_dictionary(udev_le);
59 printf("xml: %s\n\n\n", prop_dictionary_externalize(dict));
62 udev_enumerate_unref(udev_enum);
64 udev_monitor = udev_monitor_new(udev);
65 #if 1
66 ret = udev_monitor_filter_add_match_regex(udev_monitor, "name", "vn.*");
67 if (ret != 0)
68 err(1, "udev_monitor_filter_add_match_expr ret = %d", ret);
69 #endif
70 #if 0
71 ret = udev_monitor_filter_add_nomatch_expr(udev_monitor, "name", "vn*");
72 if (ret != 0)
73 err(1, "udev_monitor_filter_add_match_expr2 ret = %d", ret);
74 #endif
75 ret = udev_monitor_enable_receiving(udev_monitor);
76 if (ret != 0)
77 err(1, "udev_monitor_enable_receiving ret = %d", ret);
79 printf("meeh\n");
80 while ((udev_dev = udev_monitor_receive_device(udev_monitor))) {
81 printf("mooh\n");
82 if (udev_dev == NULL)
83 err(1, "udev_monitor_receive_device failed");
85 printf("foo\n");
86 dict = udev_device_get_dictionary(udev_dev);
87 printf("xml of new device: %s\n", prop_dictionary_externalize(dict));
89 udev_monitor_unref(udev_monitor);
90 udev_unref(udev);
91 return 0;