Revision 7006b9cf
b/qga/guest-agent-commands.c | ||
---|---|---|
10 | 10 |
* See the COPYING file in the top-level directory. |
11 | 11 |
*/ |
12 | 12 |
|
13 |
#if defined(__linux__) |
|
14 |
#define CONFIG_FSFREEZE |
|
15 |
#endif |
|
16 |
|
|
13 | 17 |
#include <glib.h> |
18 |
#if defined(CONFIG_FSFREEZE) |
|
14 | 19 |
#include <mntent.h> |
20 |
#include <linux/fs.h> |
|
21 |
#endif |
|
15 | 22 |
#include <sys/types.h> |
16 | 23 |
#include <sys/ioctl.h> |
17 |
#include <linux/fs.h> |
|
18 | 24 |
#include "qga/guest-agent-core.h" |
19 | 25 |
#include "qga-qmp-commands.h" |
20 | 26 |
#include "qerror.h" |
... | ... | |
22 | 28 |
|
23 | 29 |
static GAState *ga_state; |
24 | 30 |
|
25 |
static void disable_logging(void) |
|
26 |
{ |
|
27 |
ga_disable_logging(ga_state); |
|
28 |
} |
|
29 |
|
|
30 |
static void enable_logging(void) |
|
31 |
{ |
|
32 |
ga_enable_logging(ga_state); |
|
33 |
} |
|
34 |
|
|
35 | 31 |
/* Note: in some situations, like with the fsfreeze, logging may be |
36 | 32 |
* temporarilly disabled. if it is necessary that a command be able |
37 | 33 |
* to log for accounting purposes, check ga_logging_enabled() beforehand, |
... | ... | |
323 | 319 |
QTAILQ_INIT(&guest_file_state.filehandles); |
324 | 320 |
} |
325 | 321 |
|
322 |
#if defined(CONFIG_FSFREEZE) |
|
323 |
static void disable_logging(void) |
|
324 |
{ |
|
325 |
ga_disable_logging(ga_state); |
|
326 |
} |
|
327 |
|
|
328 |
static void enable_logging(void) |
|
329 |
{ |
|
330 |
ga_enable_logging(ga_state); |
|
331 |
} |
|
332 |
|
|
326 | 333 |
typedef struct GuestFsfreezeMount { |
327 | 334 |
char *dirname; |
328 | 335 |
char *devtype; |
... | ... | |
508 | 515 |
} |
509 | 516 |
} |
510 | 517 |
} |
518 |
#else |
|
519 |
/* |
|
520 |
* Return status of freeze/thaw |
|
521 |
*/ |
|
522 |
GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err) |
|
523 |
{ |
|
524 |
error_set(err, QERR_COMMAND_NOT_FOUND, "guest_fsfreeze_status"); |
|
525 |
|
|
526 |
return 0; |
|
527 |
} |
|
528 |
|
|
529 |
/* |
|
530 |
* Walk list of mounted file systems in the guest, and freeze the ones which |
|
531 |
* are real local file systems. |
|
532 |
*/ |
|
533 |
int64_t qmp_guest_fsfreeze_freeze(Error **err) |
|
534 |
{ |
|
535 |
error_set(err, QERR_COMMAND_NOT_FOUND, "guest_fsfreeze_freeze"); |
|
536 |
|
|
537 |
return 0; |
|
538 |
} |
|
539 |
|
|
540 |
/* |
|
541 |
* Walk list of frozen file systems in the guest, and thaw them. |
|
542 |
*/ |
|
543 |
int64_t qmp_guest_fsfreeze_thaw(Error **err) |
|
544 |
{ |
|
545 |
error_set(err, QERR_COMMAND_NOT_FOUND, "guest_fsfreeze_thaw"); |
|
546 |
|
|
547 |
return 0; |
|
548 |
} |
|
549 |
#endif |
|
511 | 550 |
|
512 | 551 |
/* register init/cleanup routines for stateful command groups */ |
513 | 552 |
void ga_command_state_init(GAState *s, GACommandState *cs) |
514 | 553 |
{ |
515 | 554 |
ga_state = s; |
555 |
#if defined(CONFIG_FSFREEZE) |
|
516 | 556 |
ga_command_state_add(cs, guest_fsfreeze_init, guest_fsfreeze_cleanup); |
557 |
#endif |
|
517 | 558 |
ga_command_state_add(cs, guest_file_init, NULL); |
518 | 559 |
} |
Also available in: Unified diff