2 * QEMU Guest Agent common/cross-platform common commands
4 * Copyright (c) 2020 Red Hat, Inc.
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
9 #ifndef QGA_COMMANDS_COMMON_H
10 #define QGA_COMMANDS_COMMON_H
12 #include "qga-qapi-types.h"
13 #include "guest-agent-core.h"
14 #include "qemu/queue.h"
16 #if defined(__linux__)
19 #define CONFIG_FSFREEZE
24 #endif /* __linux__ */
27 #include <ufs/ffs/fs.h>
29 #define CONFIG_FSFREEZE
31 #endif /* __FreeBSD__ */
33 #if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM)
34 typedef struct FsMount
{
37 unsigned int devmajor
, devminor
;
38 #if defined(__FreeBSD__)
42 QTAILQ_ENTRY(FsMount
) next
;
45 typedef QTAILQ_HEAD(FsMountList
, FsMount
) FsMountList
;
47 bool build_fs_mount_list(FsMountList
*mounts
, Error
**errp
);
48 void free_fs_mount_list(FsMountList
*mounts
);
49 #endif /* CONFIG_FSFREEZE || CONFIG_FSTRIM */
51 #if defined(CONFIG_FSFREEZE)
52 int64_t qmp_guest_fsfreeze_do_freeze_list(bool has_mountpoints
,
56 int qmp_guest_fsfreeze_do_thaw(Error
**errp
);
57 #endif /* CONFIG_FSFREEZE */
59 #ifdef HAVE_GETIFADDRS
61 bool guest_get_hw_addr(struct ifaddrs
*ifa
, unsigned char *buf
,
62 bool *obtained
, Error
**errp
);
65 typedef struct GuestFileHandle GuestFileHandle
;
67 GuestFileHandle
*guest_file_handle_find(int64_t id
, Error
**errp
);
69 GuestFileRead
*guest_file_read_unsafe(GuestFileHandle
*gfh
,
70 int64_t count
, Error
**errp
);
76 * Operating system agnostic way of querying host name.
77 * Compared to g_get_host_name(), it doesn't cache the result.
79 * Returns allocated hostname (caller should free), NULL on failure.
81 char *qga_get_host_name(Error
**errp
);