block: Fragment reads to max transfer length
[qemu/kevin.git] / fsdev / 9p-marshal.c
blob238dbf21b1d5b2636dfa5d48e4116ab3f843a644
1 /*
2 * 9p backend
4 * Copyright IBM, Corp. 2010
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "qemu/osdep.h"
15 #include <glib/gprintf.h>
16 #include <dirent.h>
17 #include <utime.h>
19 #include "9p-marshal.h"
21 void v9fs_string_free(V9fsString *str)
23 g_free(str->data);
24 str->data = NULL;
25 str->size = 0;
28 void v9fs_string_null(V9fsString *str)
30 v9fs_string_free(str);
33 void GCC_FMT_ATTR(2, 3)
34 v9fs_string_sprintf(V9fsString *str, const char *fmt, ...)
36 va_list ap;
38 v9fs_string_free(str);
40 va_start(ap, fmt);
41 str->size = g_vasprintf(&str->data, fmt, ap);
42 va_end(ap);
45 void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs)
47 v9fs_string_free(lhs);
48 v9fs_string_sprintf(lhs, "%s", rhs->data);