1 /* libguestfs generated file
2 * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3 * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
5 * Copyright (C) 2009 Red Hat Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 #include "guestfs_protocol.h"
30 #define error guestfs_error
33 print_strings (char * const* const argv)
38 for (argc = 0; argv[argc] != NULL; ++argc) {
39 if (argc > 0) printf (", ");
40 printf ("\"%s\"", argv[argc]);
45 /* The test0 function prints its parameters to stdout. */
46 int guestfs_test0 (guestfs_h *g,
49 char * const* const strlist,
56 printf ("%s\n", optstr ? optstr : "null");
57 print_strings (strlist);
58 printf ("%s\n", b ? "true" : "false");
59 printf ("%d\n", integer);
60 printf ("%s\n", filein);
61 printf ("%s\n", fileout);
62 /* Java changes stdout line buffering so we need this: */
67 /* Test normal return. */
68 int guestfs_test0rint (guestfs_h *g,
72 sscanf (val, "%d", &r);
76 /* Test error return. */
77 int guestfs_test0rinterr (guestfs_h *g)
83 /* Test normal return. */
84 int64_t guestfs_test0rint64 (guestfs_h *g,
88 sscanf (val, "%" SCNi64, &r);
92 /* Test error return. */
93 int64_t guestfs_test0rint64err (guestfs_h *g)
99 /* Test normal return. */
100 int guestfs_test0rbool (guestfs_h *g,
103 return strcmp (val, "true") == 0;
106 /* Test error return. */
107 int guestfs_test0rboolerr (guestfs_h *g)
113 /* Test normal return. */
114 const char *guestfs_test0rconststring (guestfs_h *g,
117 return "static string";
120 /* Test error return. */
121 const char *guestfs_test0rconststringerr (guestfs_h *g)
127 /* Test normal return. */
128 char *guestfs_test0rstring (guestfs_h *g,
134 /* Test error return. */
135 char *guestfs_test0rstringerr (guestfs_h *g)
141 /* Test normal return. */
142 char **guestfs_test0rstringlist (guestfs_h *g,
147 sscanf (val, "%d", &n);
148 strs = malloc ((n+1) * sizeof (char *));
149 for (i = 0; i < n; ++i) {
150 strs[i] = malloc (16);
151 snprintf (strs[i], 16, "%d", i);
157 /* Test error return. */
158 char **guestfs_test0rstringlisterr (guestfs_h *g)
164 /* Test normal return. */
165 struct guestfs_int_bool *guestfs_test0rintbool (guestfs_h *g,
168 struct guestfs_int_bool *r;
169 r = malloc (sizeof (struct guestfs_int_bool));
170 sscanf (val, "%" SCNi32, &r->i);
175 /* Test error return. */
176 struct guestfs_int_bool *guestfs_test0rintboolerr (guestfs_h *g)
182 /* Test normal return. */
183 struct guestfs_lvm_pv_list *guestfs_test0rpvlist (guestfs_h *g,
186 struct guestfs_lvm_pv_list *r;
188 r = malloc (sizeof (struct guestfs_lvm_pv_list));
189 sscanf (val, "%d", &r->len);
190 r->val = calloc (r->len, sizeof (struct guestfs_lvm_pv));
191 for (i = 0; i < r->len; ++i) {
192 r->val[i].pv_name = malloc (16);
193 snprintf (r->val[i].pv_name, 16, "%d", i);
198 /* Test error return. */
199 struct guestfs_lvm_pv_list *guestfs_test0rpvlisterr (guestfs_h *g)
205 /* Test normal return. */
206 struct guestfs_lvm_vg_list *guestfs_test0rvglist (guestfs_h *g,
209 struct guestfs_lvm_vg_list *r;
211 r = malloc (sizeof (struct guestfs_lvm_vg_list));
212 sscanf (val, "%d", &r->len);
213 r->val = calloc (r->len, sizeof (struct guestfs_lvm_vg));
214 for (i = 0; i < r->len; ++i) {
215 r->val[i].vg_name = malloc (16);
216 snprintf (r->val[i].vg_name, 16, "%d", i);
221 /* Test error return. */
222 struct guestfs_lvm_vg_list *guestfs_test0rvglisterr (guestfs_h *g)
228 /* Test normal return. */
229 struct guestfs_lvm_lv_list *guestfs_test0rlvlist (guestfs_h *g,
232 struct guestfs_lvm_lv_list *r;
234 r = malloc (sizeof (struct guestfs_lvm_lv_list));
235 sscanf (val, "%d", &r->len);
236 r->val = calloc (r->len, sizeof (struct guestfs_lvm_lv));
237 for (i = 0; i < r->len; ++i) {
238 r->val[i].lv_name = malloc (16);
239 snprintf (r->val[i].lv_name, 16, "%d", i);
244 /* Test error return. */
245 struct guestfs_lvm_lv_list *guestfs_test0rlvlisterr (guestfs_h *g)
251 /* Test normal return. */
252 struct guestfs_stat *guestfs_test0rstat (guestfs_h *g,
255 struct guestfs_stat *r;
256 r = calloc (1, sizeof (*r));
257 sscanf (val, "%" SCNi64, &r->dev);
261 /* Test error return. */
262 struct guestfs_stat *guestfs_test0rstaterr (guestfs_h *g)
268 /* Test normal return. */
269 struct guestfs_statvfs *guestfs_test0rstatvfs (guestfs_h *g,
272 struct guestfs_statvfs *r;
273 r = calloc (1, sizeof (*r));
274 sscanf (val, "%" SCNi64, &r->bsize);
278 /* Test error return. */
279 struct guestfs_statvfs *guestfs_test0rstatvfserr (guestfs_h *g)
285 /* Test normal return. */
286 char **guestfs_test0rhashtable (guestfs_h *g,
291 sscanf (val, "%d", &n);
292 strs = malloc ((n*2+1) * sizeof (char *));
293 for (i = 0; i < n; ++i) {
294 strs[i*2] = malloc (16);
295 strs[i*2+1] = malloc (16);
296 snprintf (strs[i*2], 16, "%d", i);
297 snprintf (strs[i*2+1], 16, "%d", i);
303 /* Test error return. */
304 char **guestfs_test0rhashtableerr (guestfs_h *g)