{
if (qemu_param[0] != '-') {
error (g, _("guestfs_config: parameter must begin with '-' character"));
{
if (qemu_param[0] != '-') {
error (g, _("guestfs_config: parameter must begin with '-' character"));
- supermin_name, supermin_hostfiles_name,
- "kmod.whitelist", NULL)) {
- if (build_supermin_appliance (g, ".", &kernel, &initrd) == -1)
- return -1;
- break;
+ supermin_name, supermin_hostfiles_name,
+ "kmod.whitelist", NULL)) {
+ if (build_supermin_appliance (g, ".", &kernel, &initrd) == -1)
+ return -1;
+ break;
- supermin_name, supermin_hostfiles_name,
- "kmod.whitelist", NULL)) {
- if (build_supermin_appliance (g, pelem, &kernel, &initrd) == -1)
- return -1;
- break;
+ supermin_name, supermin_hostfiles_name,
+ "kmod.whitelist", NULL)) {
+ if (build_supermin_appliance (g, pelem, &kernel, &initrd) == -1)
+ return -1;
+ break;
- if (g->verbose)
- fprintf (stderr,
- "looking for appliance in current directory\n");
- if (dir_contains_files (".", kernel_name, initrd_name, NULL)) {
- kernel = safe_strdup (g, kernel_name);
- initrd = safe_strdup (g, initrd_name);
- break;
- }
+ if (g->verbose)
+ fprintf (stderr,
+ "looking for appliance in current directory\n");
+ if (dir_contains_files (".", kernel_name, initrd_name, NULL)) {
+ kernel = safe_strdup (g, kernel_name);
+ initrd = safe_strdup (g, initrd_name);
+ break;
+ }
- if (g->verbose)
- fprintf (stderr, "looking for appliance in %s\n", pelem);
-
- if (dir_contains_files (pelem, kernel_name, initrd_name, NULL)) {
- kernel = safe_malloc (g, len + strlen (kernel_name) + 2);
- initrd = safe_malloc (g, len + strlen (initrd_name) + 2);
- sprintf (kernel, "%s/%s", pelem, kernel_name);
- sprintf (initrd, "%s/%s", pelem, initrd_name);
- break;
- }
+ if (g->verbose)
+ fprintf (stderr, "looking for appliance in %s\n", pelem);
+
+ if (dir_contains_files (pelem, kernel_name, initrd_name, NULL)) {
+ kernel = safe_malloc (g, len + strlen (kernel_name) + 2);
+ initrd = safe_malloc (g, len + strlen (initrd_name) + 2);
+ sprintf (kernel, "%s/%s", pelem, kernel_name);
+ sprintf (initrd, "%s/%s", pelem, initrd_name);
+ break;
+ }
if (kernel == NULL || initrd == NULL) {
error (g, _("cannot find %s or %s on LIBGUESTFS_PATH (current path = %s)"),
if (kernel == NULL || initrd == NULL) {
error (g, _("cannot find %s or %s on LIBGUESTFS_PATH (current path = %s)"),
"udevtimeout=300 " /* good for very slow systems (RHBZ#480319) */ \
"noapic " /* workaround for RHBZ#502058 - ok if not SMP */ \
"acpi=off " /* we don't need ACPI, turn it off */ \
"udevtimeout=300 " /* good for very slow systems (RHBZ#480319) */ \
"noapic " /* workaround for RHBZ#502058 - ok if not SMP */ \
"acpi=off " /* we don't need ACPI, turn it off */ \
/* Linux kernel command line. */
snprintf (append, sizeof append,
/* Linux kernel command line. */
snprintf (append, sizeof append,
- LINUX_CMDLINE "guestfs=%s:%d%s%s%s",
- VMCHANNEL_ADDR, VMCHANNEL_PORT,
- g->verbose ? " guestfs_verbose=1" : "",
- g->append ? " " : "", g->append ? g->append : "");
+ LINUX_CMDLINE "guestfs=%s:%d%s%s%s",
+ VMCHANNEL_ADDR, VMCHANNEL_PORT,
+ g->verbose ? " guestfs_verbose=1" : "",
+ g->append ? " " : "", g->append ? g->append : "");
snprintf (memsize_str, sizeof memsize_str, "%d", g->memsize);
snprintf (memsize_str, sizeof memsize_str, "%d", g->memsize);
* http://git.savannah.gnu.org/cgit/qemu.git/commit/?id=c92ef6a22d3c71538fcc48fb61ad353f7ba03b62
*/
snprintf (vmchannel, sizeof vmchannel,
* http://git.savannah.gnu.org/cgit/qemu.git/commit/?id=c92ef6a22d3c71538fcc48fb61ad353f7ba03b62
*/
snprintf (vmchannel, sizeof vmchannel,
- "user,vlan=0,guestfwd=tcp:%s:%d-unix:%s,server,nowait",
- VMCHANNEL_ADDR, VMCHANNEL_PORT, unixsock);
+ "user,vlan=0,guestfwd=tcp:%s:%d-unix:%s,server,nowait",
+ VMCHANNEL_ADDR, VMCHANNEL_PORT, unixsock);
* syntax, or if not then we'll get a quick failure.
*/
snprintf (vmchannel, sizeof vmchannel,
* syntax, or if not then we'll get a quick failure.
*/
snprintf (vmchannel, sizeof vmchannel,
- "channel,%d:unix:%s,server,nowait",
- VMCHANNEL_PORT, unixsock);
+ "channel,%d:unix:%s,server,nowait",
+ VMCHANNEL_PORT, unixsock);
if (g->verbose) {
fprintf (stderr, "%s", g->qemu);
for (i = 0; g->cmdline[i]; ++i)
if (g->verbose) {
fprintf (stderr, "%s", g->qemu);
for (i = 0; g->cmdline[i]; ++i)
g->stdout_watch =
g->main_loop->add_handle (g->main_loop, g, g->fd[1],
g->stdout_watch =
g->main_loop->add_handle (g->main_loop, g, g->fd[1],
if (g->stdout_watch == -1) {
error (g, _("could not watch qemu stdout"));
goto cleanup3;
if (g->stdout_watch == -1) {
error (g, _("could not watch qemu stdout"));
goto cleanup3;
snprintf (*initrd, len+8, "%s/initrd", g->tmpdir);
snprintf (cmd, sizeof cmd,
snprintf (*initrd, len+8, "%s/initrd", g->tmpdir);
snprintf (cmd, sizeof cmd,
- "PATH='%s':$PATH "
- "libguestfs-supermin-helper '%s' %s %s",
- path,
- path, *kernel, *initrd);
+ "PATH='%s':$PATH "
+ "libguestfs-supermin-helper '%s' %s %s",
+ path,
+ path, *kernel, *initrd);
*/
static void
stdout_event (struct guestfs_main_loop *ml, guestfs_h *g, void *data,
*/
static void
stdout_event (struct guestfs_main_loop *ml, guestfs_h *g, void *data,
- "stdout_event: %p g->state = %d, fd = %d, events = 0x%x\n",
- g, g->state, fd, events);
+ "stdout_event: %p g->state = %d, fd = %d, events = 0x%x\n",
+ g, g->state, fd, events);
*/
static void
sock_read_event (struct guestfs_main_loop *ml, guestfs_h *g, void *data,
*/
static void
sock_read_event (struct guestfs_main_loop *ml, guestfs_h *g, void *data,
- "sock_read_event: %p g->state = %d, fd = %d, events = 0x%x\n",
- g, g->state, fd, events);
+ "sock_read_event: %p g->state = %d, fd = %d, events = 0x%x\n",
+ g, g->state, fd, events);
if (g->sock != fd) {
error (g, _("sock_read_event: internal error: %d != %d"), g->sock, fd);
if (g->sock != fd) {
error (g, _("sock_read_event: internal error: %d != %d"), g->sock, fd);
g->msg_in = safe_realloc (g, g->msg_in, g->msg_in_allocated);
}
n = read (g->sock, g->msg_in + g->msg_in_size,
g->msg_in = safe_realloc (g, g->msg_in, g->msg_in_allocated);
}
n = read (g->sock, g->msg_in + g->msg_in_size,
if (len == GUESTFS_LAUNCH_FLAG) {
if (g->state != LAUNCHING)
error (g, _("received magic signature from guestfsd, but in state %d"),
if (len == GUESTFS_LAUNCH_FLAG) {
if (g->state != LAUNCHING)
error (g, _("received magic signature from guestfsd, but in state %d"),
else if (g->msg_in_size != 4)
error (g, _("received magic signature from guestfsd, but msg size is %d"),
else if (g->msg_in_size != 4)
error (g, _("received magic signature from guestfsd, but msg size is %d"),
*/
if (len > GUESTFS_MESSAGE_MAX) {
error (g, _("message length (%u) > maximum possible size (%d)"),
*/
if (len > GUESTFS_MESSAGE_MAX) {
error (g, _("message length (%u) > maximum possible size (%d)"),
for (i = 0; i < g->msg_in_size; i += 16) {
printf ("%04x: ", i);
for (j = i; j < MIN (i+16, g->msg_in_size); ++j)
for (i = 0; i < g->msg_in_size; i += 16) {
printf ("%04x: ", i);
for (j = i; j < MIN (i+16, g->msg_in_size); ++j)
- if (isprint (g->msg_in[j]))
- printf ("%c", g->msg_in[j]);
- else
- printf (".");
+ if (isprint (g->msg_in[j]))
+ printf ("%c", g->msg_in[j]);
+ else
+ printf (".");
*/
static void
sock_write_event (struct guestfs_main_loop *ml, guestfs_h *g, void *data,
*/
static void
sock_write_event (struct guestfs_main_loop *ml, guestfs_h *g, void *data,
- "sock_write_event: %p g->state = %d, fd = %d, events = 0x%x\n",
- g, g->state, fd, events);
+ "sock_write_event: %p g->state = %d, fd = %d, events = 0x%x\n",
+ g, g->state, fd, events);
if (g->sock != fd) {
error (g, _("sock_write_event: internal error: %d != %d"), g->sock, fd);
if (g->sock != fd) {
error (g, _("sock_write_event: internal error: %d != %d"), g->sock, fd);
g->sock_watch =
g->main_loop->add_handle (g->main_loop, g, g->sock,
g->sock_watch =
g->main_loop->add_handle (g->main_loop, g, g->sock,
- GUESTFS_HANDLE_WRITABLE,
- sock_write_event, NULL);
+ GUESTFS_HANDLE_WRITABLE,
+ sock_write_event, NULL);
if (g->sock_watch == -1) {
error (g, _("add_handle failed"));
return -1;
if (g->sock_watch == -1) {
error (g, _("add_handle failed"));
return -1;
g->sock_watch =
g->main_loop->add_handle (g->main_loop, g, g->sock,
g->sock_watch =
g->main_loop->add_handle (g->main_loop, g, g->sock,
- GUESTFS_HANDLE_READABLE,
- sock_read_event, NULL);
+ GUESTFS_HANDLE_READABLE,
+ sock_read_event, NULL);
if (g->sock_watch == -1) {
error (g, _("add_handle failed"));
return -1;
if (g->sock_watch == -1) {
error (g, _("add_handle failed"));
return -1;
err = send_file_data_sync (g, buf, r);
if (err < 0) {
if (err == -2) /* daemon sent cancellation */
err = send_file_data_sync (g, buf, r);
if (err < 0) {
if (err == -2) /* daemon sent cancellation */
if (!xdr_guestfs_chunk (&xdr, &chunk)) {
error (g, _("xdr_guestfs_chunk failed (buf = %p, buflen = %zu)"),
if (!xdr_guestfs_chunk (&xdr, &chunk)) {
error (g, _("xdr_guestfs_chunk failed (buf = %p, buflen = %zu)"),
if (flag != GUESTFS_CANCEL_FLAG) {
error (g, _("check_for_daemon_cancellation: read 0x%x from daemon, expected 0x%x\n"),
if (flag != GUESTFS_CANCEL_FLAG) {
error (g, _("check_for_daemon_cancellation: read 0x%x from daemon, expected 0x%x\n"),
xdrmem_create (&xdr, fbuf, sizeof fbuf, XDR_ENCODE);
xdr_uint32_t (&xdr, &flag);
xdrmem_create (&xdr, fbuf, sizeof fbuf, XDR_ENCODE);
xdr_uint32_t (&xdr, &flag);
*/
struct receive_file_ctx {
int count; /* 0 if receive_file_cb not called, or
*/
struct receive_file_ctx {
int count; /* 0 if receive_file_cb not called, or
/* Copy the chunk to the list. */
ctx->chunks = safe_realloc (g, ctx->chunks,
/* Copy the chunk to the list. */
ctx->chunks = safe_realloc (g, ctx->chunks,
if (buf) {
*buf = safe_realloc (g, *buf, len + ctx.chunks[i].data.data_len);
memcpy (*buf+len, ctx.chunks[i].data.data_val,
if (buf) {
*buf = safe_realloc (g, *buf, len + ctx.chunks[i].data.data_len);
memcpy (*buf+len, ctx.chunks[i].data.data_val,
static int
select_add_handle (guestfs_main_loop *mlv, guestfs_h *g, int fd, int events,
static int
select_add_handle (guestfs_main_loop *mlv, guestfs_h *g, int fd, int events,
- GUESTFS_HANDLE_WRITABLE |
- GUESTFS_HANDLE_HANGUP |
- GUESTFS_HANDLE_ERROR)) != 0) {
+ GUESTFS_HANDLE_WRITABLE |
+ GUESTFS_HANDLE_HANGUP |
+ GUESTFS_HANDLE_ERROR)) != 0) {
static int
select_add_timeout (guestfs_main_loop *mlv, guestfs_h *g, int interval,
static int
select_add_timeout (guestfs_main_loop *mlv, guestfs_h *g, int interval,
r = select (ml->max_fd+1, &rset2, &wset2, &xset2, NULL);
if (r == -1) {
if (errno == EINTR || errno == EAGAIN)
r = select (ml->max_fd+1, &rset2, &wset2, &xset2, NULL);
if (r == -1) {
if (errno == EINTR || errno == EAGAIN)
for (fd = 0; r > 0 && fd <= ml->max_fd; ++fd) {
events = 0;
if (FD_ISSET (fd, &rset2))
for (fd = 0; r > 0 && fd <= ml->max_fd; ++fd) {
events = 0;
if (FD_ISSET (fd, &rset2))
- r--;
- ml->handle_cb_data[fd].cb ((guestfs_main_loop *) ml,
- ml->handle_cb_data[fd].g,
- ml->handle_cb_data[fd].data,
- fd, fd, events);
+ r--;
+ ml->handle_cb_data[fd].cb ((guestfs_main_loop *) ml,
+ ml->handle_cb_data[fd].g,
+ ml->handle_cb_data[fd].data,
+ fd, fd, events);