diff options
| author | Alexander Ivanov <alexander.ivanov@virtuozzo.com> | 2022-10-17 09:28:20 +0200 |
|---|---|---|
| committer | Konstantin Kostiuk <kkostiuk@redhat.com> | 2022-10-26 20:35:07 +0300 |
| commit | 518b0d800b5ab046b72fac423ace7549ab187329 (patch) | |
| tree | ede561824935ef6c2434be3b66aee631eeec4804 /qga/commands-common.h | |
| parent | c6cd588bb3a29a831c862780631a7d2145ade5de (diff) | |
| download | focaccia-qemu-518b0d800b5ab046b72fac423ace7549ab187329.tar.gz focaccia-qemu-518b0d800b5ab046b72fac423ace7549ab187329.zip | |
qga: Move Linux-specific FS freeze/thaw code to a separate file
In the next patches we are going to add FreeBSD support for QEMU Guest Agent. In the result, code in commands-posix.c will be too cumbersome. Move Linux-specific FS freeze/thaw code to a separate file commands-linux.c keeping common POSIX code in commands-posix.c. Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Diffstat (limited to 'qga/commands-common.h')
| -rw-r--r-- | qga/commands-common.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/qga/commands-common.h b/qga/commands-common.h index d0e4a9696f..cb51b1c6e9 100644 --- a/qga/commands-common.h +++ b/qga/commands-common.h @@ -10,6 +10,40 @@ #define QGA_COMMANDS_COMMON_H #include "qga-qapi-types.h" +#include "guest-agent-core.h" +#include "qemu/queue.h" + +#if defined(__linux__) +#include <linux/fs.h> +#ifdef FIFREEZE +#define CONFIG_FSFREEZE +#endif +#ifdef FITRIM +#define CONFIG_FSTRIM +#endif +#endif /* __linux__ */ + +#if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM) +typedef struct FsMount { + char *dirname; + char *devtype; + unsigned int devmajor, devminor; + QTAILQ_ENTRY(FsMount) next; +} FsMount; + +typedef QTAILQ_HEAD(FsMountList, FsMount) FsMountList; + +bool build_fs_mount_list(FsMountList *mounts, Error **errp); +void free_fs_mount_list(FsMountList *mounts); +#endif /* CONFIG_FSFREEZE || CONFIG_FSTRIM */ + +#if defined(CONFIG_FSFREEZE) +int64_t qmp_guest_fsfreeze_do_freeze_list(bool has_mountpoints, + strList *mountpoints, + FsMountList mounts, + Error **errp); +int qmp_guest_fsfreeze_do_thaw(Error **errp); +#endif /* CONFIG_FSFREEZE */ typedef struct GuestFileHandle GuestFileHandle; |