ia64/xen-unstable

view tools/xenstore/xenstored_core.h @ 19731:01748ccc4da3

Intel VT-d: fix Stoakley boot issue with iommu=1

Signed-off-by: Weidong Han <Weidong.han@intel.com>
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 05 09:25:50 2009 +0100 (2009-06-05)
parents a6c037d8cba3
children
line source
1 /*
2 Internal interfaces for Xen Store Daemon.
3 Copyright (C) 2005 Rusty Russell IBM Corporation
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
20 #ifndef _XENSTORED_CORE_H
21 #define _XENSTORED_CORE_H
23 #include <xenctrl.h>
25 #include <sys/types.h>
26 #include <dirent.h>
27 #include <stdbool.h>
28 #include <stdint.h>
29 #include <errno.h>
30 #include "xs_lib.h"
31 #include "list.h"
32 #include "tdb.h"
34 struct buffered_data
35 {
36 struct list_head list;
38 /* Are we still doing the header? */
39 bool inhdr;
41 /* How far are we? */
42 unsigned int used;
44 union {
45 struct xsd_sockmsg msg;
46 char raw[sizeof(struct xsd_sockmsg)];
47 } hdr;
49 /* The actual data. */
50 char *buffer;
51 };
53 struct connection;
54 typedef int connwritefn_t(struct connection *, const void *, unsigned int);
55 typedef int connreadfn_t(struct connection *, void *, unsigned int);
57 struct connection
58 {
59 struct list_head list;
61 /* The file descriptor we came in on. */
62 int fd;
64 /* Who am I? 0 for socket connections. */
65 unsigned int id;
67 /* Is this a read-only connection? */
68 bool can_write;
70 /* Buffered incoming data. */
71 struct buffered_data *in;
73 /* Buffered output data */
74 struct list_head out_list;
76 /* Transaction context for current request (NULL if none). */
77 struct transaction *transaction;
79 /* List of in-progress transactions. */
80 struct list_head transaction_list;
81 uint32_t next_transaction_id;
82 unsigned int transaction_started;
84 /* The domain I'm associated with, if any. */
85 struct domain *domain;
87 /* The target of the domain I'm associated with. */
88 struct connection *target;
90 /* My watches. */
91 struct list_head watches;
93 /* Methods for communicating over this connection: write can be NULL */
94 connwritefn_t *write;
95 connreadfn_t *read;
96 };
97 extern struct list_head connections;
99 struct node {
100 const char *name;
102 /* Database I came from */
103 TDB_CONTEXT *tdb;
105 /* Parent (optional) */
106 struct node *parent;
108 /* Permissions. */
109 unsigned int num_perms;
110 struct xs_permissions *perms;
112 /* Contents. */
113 unsigned int datalen;
114 void *data;
116 /* Children, each nul-terminated. */
117 unsigned int childlen;
118 char *children;
119 };
121 /* Break input into vectors, return the number, fill in up to num of them. */
122 unsigned int get_strings(struct buffered_data *data,
123 char *vec[], unsigned int num);
125 /* Is child node a child or equal to parent node? */
126 bool is_child(const char *child, const char *parent);
128 void send_reply(struct connection *conn, enum xsd_sockmsg_type type,
129 const void *data, unsigned int len);
131 /* Some routines (write, mkdir, etc) just need a non-error return */
132 void send_ack(struct connection *conn, enum xsd_sockmsg_type type);
134 /* Send an error: error is usually "errno". */
135 void send_error(struct connection *conn, int error);
137 /* Canonicalize this path if possible. */
138 char *canonicalize(struct connection *conn, const char *node);
140 /* Check if node is an event node. */
141 bool check_event_node(const char *node);
143 /* Get this node, checking we have permissions. */
144 struct node *get_node(struct connection *conn,
145 const char *name,
146 enum xs_perm_type perm);
148 /* Get TDB context for this connection */
149 TDB_CONTEXT *tdb_context(struct connection *conn);
151 /* Destructor for tdbs: required for transaction code */
152 int destroy_tdb(void *_tdb);
154 /* Replace the tdb: required for transaction code */
155 bool replace_tdb(const char *newname, TDB_CONTEXT *newtdb);
157 struct connection *new_connection(connwritefn_t *write, connreadfn_t *read);
160 /* Is this a valid node name? */
161 bool is_valid_nodename(const char *node);
163 /* Tracing infrastructure. */
164 void trace_create(const void *data, const char *type);
165 void trace_destroy(const void *data, const char *type);
166 void trace_watch_timeout(const struct connection *conn, const char *node, const char *token);
167 void trace(const char *fmt, ...);
168 void dtrace_io(const struct connection *conn, const struct buffered_data *data, int out);
170 extern int event_fd;
172 /* Map the kernel's xenstore page. */
173 void *xenbus_map(void);
175 /* Return the event channel used by xenbus. */
176 evtchn_port_t xenbus_evtchn(void);
178 /* Tell the kernel xenstored is running. */
179 void xenbus_notify_running(void);
181 #endif /* _XENSTORED_CORE_H */
183 /*
184 * Local variables:
185 * c-file-style: "linux"
186 * indent-tabs-mode: t
187 * c-indent-level: 8
188 * c-basic-offset: 8
189 * tab-width: 8
190 * End:
191 */