]> git.proxmox.com Git - mirror_qemu.git/blame - fsdev/9p-marshal.c
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
[mirror_qemu.git] / fsdev / 9p-marshal.c
CommitLineData
829dd286
WL
1/*
2 * 9p backend
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 *
12 */
13
fbc04127 14#include "qemu/osdep.h"
829dd286
WL
15#include <glib.h>
16#include <glib/gprintf.h>
829dd286 17#include <dirent.h>
829dd286
WL
18#include <utime.h>
19#include <sys/uio.h>
829dd286 20
829dd286
WL
21#include "9p-marshal.h"
22
23void v9fs_string_free(V9fsString *str)
24{
25 g_free(str->data);
26 str->data = NULL;
27 str->size = 0;
28}
29
30void v9fs_string_null(V9fsString *str)
31{
32 v9fs_string_free(str);
33}
34
35void GCC_FMT_ATTR(2, 3)
36v9fs_string_sprintf(V9fsString *str, const char *fmt, ...)
37{
38 va_list ap;
39
40 v9fs_string_free(str);
41
42 va_start(ap, fmt);
43 str->size = g_vasprintf(&str->data, fmt, ap);
44 va_end(ap);
45}
46
47void v9fs_string_copy(V9fsString *lhs, V9fsString *rhs)
48{
49 v9fs_string_free(lhs);
50 v9fs_string_sprintf(lhs, "%s", rhs->data);
51}