qemu-ga: make names more generic for mount list functions
We will use these functions and types for more than FSFREEZE, so rename them. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
parent
47ecbdf07e
commit
af02203fbe
@ -314,17 +314,17 @@ static void guest_file_init(void)
|
|||||||
|
|
||||||
#if defined(CONFIG_FSFREEZE)
|
#if defined(CONFIG_FSFREEZE)
|
||||||
|
|
||||||
typedef struct GuestFsfreezeMount {
|
typedef struct FsMount {
|
||||||
char *dirname;
|
char *dirname;
|
||||||
char *devtype;
|
char *devtype;
|
||||||
QTAILQ_ENTRY(GuestFsfreezeMount) next;
|
QTAILQ_ENTRY(FsMount) next;
|
||||||
} GuestFsfreezeMount;
|
} FsMount;
|
||||||
|
|
||||||
typedef QTAILQ_HEAD(, GuestFsfreezeMount) GuestFsfreezeMountList;
|
typedef QTAILQ_HEAD(, FsMount) FsMountList;
|
||||||
|
|
||||||
static void guest_fsfreeze_free_mount_list(GuestFsfreezeMountList *mounts)
|
static void free_fs_mount_list(FsMountList *mounts)
|
||||||
{
|
{
|
||||||
GuestFsfreezeMount *mount, *temp;
|
FsMount *mount, *temp;
|
||||||
|
|
||||||
if (!mounts) {
|
if (!mounts) {
|
||||||
return;
|
return;
|
||||||
@ -341,10 +341,10 @@ static void guest_fsfreeze_free_mount_list(GuestFsfreezeMountList *mounts)
|
|||||||
/*
|
/*
|
||||||
* Walk the mount table and build a list of local file systems
|
* Walk the mount table and build a list of local file systems
|
||||||
*/
|
*/
|
||||||
static int guest_fsfreeze_build_mount_list(GuestFsfreezeMountList *mounts)
|
static int build_fs_mount_list(FsMountList *mounts)
|
||||||
{
|
{
|
||||||
struct mntent *ment;
|
struct mntent *ment;
|
||||||
GuestFsfreezeMount *mount;
|
FsMount *mount;
|
||||||
char const *mtab = "/proc/self/mounts";
|
char const *mtab = "/proc/self/mounts";
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ static int guest_fsfreeze_build_mount_list(GuestFsfreezeMountList *mounts)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mount = g_malloc0(sizeof(GuestFsfreezeMount));
|
mount = g_malloc0(sizeof(FsMount));
|
||||||
mount->dirname = g_strdup(ment->mnt_dir);
|
mount->dirname = g_strdup(ment->mnt_dir);
|
||||||
mount->devtype = g_strdup(ment->mnt_type);
|
mount->devtype = g_strdup(ment->mnt_type);
|
||||||
|
|
||||||
@ -398,15 +398,15 @@ GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
|
|||||||
int64_t qmp_guest_fsfreeze_freeze(Error **err)
|
int64_t qmp_guest_fsfreeze_freeze(Error **err)
|
||||||
{
|
{
|
||||||
int ret = 0, i = 0;
|
int ret = 0, i = 0;
|
||||||
GuestFsfreezeMountList mounts;
|
FsMountList mounts;
|
||||||
struct GuestFsfreezeMount *mount;
|
struct FsMount *mount;
|
||||||
int fd;
|
int fd;
|
||||||
char err_msg[512];
|
char err_msg[512];
|
||||||
|
|
||||||
slog("guest-fsfreeze called");
|
slog("guest-fsfreeze called");
|
||||||
|
|
||||||
QTAILQ_INIT(&mounts);
|
QTAILQ_INIT(&mounts);
|
||||||
ret = guest_fsfreeze_build_mount_list(&mounts);
|
ret = build_fs_mount_list(&mounts);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -447,11 +447,11 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
|
|||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
guest_fsfreeze_free_mount_list(&mounts);
|
free_fs_mount_list(&mounts);
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
guest_fsfreeze_free_mount_list(&mounts);
|
free_fs_mount_list(&mounts);
|
||||||
qmp_guest_fsfreeze_thaw(NULL);
|
qmp_guest_fsfreeze_thaw(NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -462,12 +462,12 @@ error:
|
|||||||
int64_t qmp_guest_fsfreeze_thaw(Error **err)
|
int64_t qmp_guest_fsfreeze_thaw(Error **err)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
GuestFsfreezeMountList mounts;
|
FsMountList mounts;
|
||||||
GuestFsfreezeMount *mount;
|
FsMount *mount;
|
||||||
int fd, i = 0, logged;
|
int fd, i = 0, logged;
|
||||||
|
|
||||||
QTAILQ_INIT(&mounts);
|
QTAILQ_INIT(&mounts);
|
||||||
ret = guest_fsfreeze_build_mount_list(&mounts);
|
ret = build_fs_mount_list(&mounts);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_set(err, QERR_QGA_COMMAND_FAILED,
|
error_set(err, QERR_QGA_COMMAND_FAILED,
|
||||||
"failed to enumerate filesystems");
|
"failed to enumerate filesystems");
|
||||||
@ -507,7 +507,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ga_unset_frozen(ga_state);
|
ga_unset_frozen(ga_state);
|
||||||
guest_fsfreeze_free_mount_list(&mounts);
|
free_fs_mount_list(&mounts);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user