1 /*
2  * Copyright (C) 2017      Aporeto
3  * Author Stefano Stabellini <stefano@aporeto.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published
7  * by the Free Software Foundation; version 2.1 only. with the special
8  * exception on linking described in file LICENSE.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  */
15 
16 #include "libxl_osdeps.h"
17 
18 #include "libxl_internal.h"
19 
libxl__device_p9_setdefault(libxl__gc * gc,uint32_t domid,libxl_device_p9 * p9,bool hotplug)20 static int libxl__device_p9_setdefault(libxl__gc *gc, uint32_t domid,
21                                        libxl_device_p9 *p9, bool hotplug)
22 {
23     return libxl__resolve_domid(gc, p9->backend_domname, &p9->backend_domid);
24 }
25 
libxl__set_xenstore_p9(libxl__gc * gc,uint32_t domid,libxl_device_p9 * p9,flexarray_t * back,flexarray_t * front,flexarray_t * ro_front)26 static int libxl__set_xenstore_p9(libxl__gc *gc, uint32_t domid,
27                                   libxl_device_p9 *p9,
28                                   flexarray_t *back, flexarray_t *front,
29                                   flexarray_t *ro_front)
30 {
31     flexarray_append_pair(back, "path", p9->path);
32     flexarray_append_pair(back, "security_model", p9->security_model);
33 
34     flexarray_append_pair(front, "tag", p9->tag);
35 
36     return 0;
37 }
38 
39 #define libxl__add_p9s NULL
40 #define libxl_device_p9_list NULL
41 #define libxl_device_p9_compare NULL
42 
43 static LIBXL_DEFINE_UPDATE_DEVID(p9)
44 static LIBXL_DEFINE_DEVICE_FROM_TYPE(p9)
45 
46 LIBXL_DEFINE_DEVICE_REMOVE(p9)
47 
48 DEFINE_DEVICE_TYPE_STRUCT(p9, 9PFS,
49     .skip_attach = 1,
50     .set_xenstore_config = (device_set_xenstore_config_fn_t)
51                            libxl__set_xenstore_p9,
52 );
53