iPXE
Defines | Functions | Variables
vmconsole.c File Reference

VMware logfile console. More...

#include <string.h>
#include <ipxe/console.h>
#include <ipxe/lineconsole.h>
#include <ipxe/init.h>
#include <ipxe/guestrpc.h>
#include <config/console.h>

Go to the source code of this file.

Defines

#define VMCONSOLE_BUFSIZE   128
 VMware logfile console buffer size.
#define CONSOLE_VMWARE   ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static void vmconsole_putchar (int character)
 Print a character to VMware logfile console.
static void vmconsole_init (void)
 Initialise VMware logfile console.
struct init_fn vmconsole_init_fn __init_fn (INIT_CONSOLE)
 VMware logfile console initialisation function.

Variables

static int vmconsole_channel
 VMware logfile console GuestRPC channel.
struct {
   char   prefix [4]
   char   message [VMCONSOLE_BUFSIZE]
vmconsole_buffer
 VMware logfile console line buffer.
static struct ansiesc_handler vmconsole_handlers []
 VMware logfile console ANSI escape sequence handlers.
static struct line_console vmconsole_line
 VMware logfile line console.
static int vmconsole_entered
 VMware logfile console recursion marker.
struct console_driver vmconsole __console_driver
 VMware logfile console driver.

Detailed Description

VMware logfile console.

Definition in file vmconsole.c.


Define Documentation

#define VMCONSOLE_BUFSIZE   128

VMware logfile console buffer size.

Definition at line 40 of file vmconsole.c.

Definition at line 45 of file vmconsole.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static void vmconsole_putchar ( int  character) [static]

Print a character to VMware logfile console.

Parameters:
characterCharacter to be printed

Definition at line 81 of file vmconsole.c.

References DBG, guestrpc_command(), line_putchar(), NULL, rc, strerror(), vmconsole_buffer, vmconsole_channel, and vmconsole_entered.

                                                {
        int rc;

        /* Ignore if we are already mid-logging */
        if ( vmconsole_entered )
                return;

        /* Fill line buffer */
        if ( line_putchar ( &vmconsole_line, character ) == 0 )
                return;

        /* Guard against re-entry */
        vmconsole_entered = 1;

        /* Send log message */
        if ( ( rc = guestrpc_command ( vmconsole_channel,
                                       vmconsole_buffer.prefix, NULL, 0 ) ) <0){
                DBG ( "VMware console could not send log message: %s\n",
                      strerror ( rc ) );
        }

        /* Clear re-entry flag */
        vmconsole_entered = 0;
}
static void vmconsole_init ( void  ) [static]

Initialise VMware logfile console.

Definition at line 117 of file vmconsole.c.

References DBG, guestrpc_open(), rc, strerror(), and vmconsole_channel.

                                    {
        int rc;

        /* Attempt to open console */
        vmconsole_channel = guestrpc_open();
        if ( vmconsole_channel < 0 ) {
                rc = vmconsole_channel;
                DBG ( "VMware console could not be initialised: %s\n",
                      strerror ( rc ) );
                return;
        }

        /* Mark console as available */
        vmconsole.disabled = 0;
}
struct init_fn vmconsole_init_fn __init_fn ( INIT_CONSOLE  ) [read]

VMware logfile console initialisation function.


Variable Documentation

int vmconsole_channel [static]

VMware logfile console GuestRPC channel.

Definition at line 49 of file vmconsole.c.

Referenced by vmconsole_init(), and vmconsole_putchar().

char prefix[4]

Definition at line 54 of file vmconsole.c.

Referenced by acm_intr_complete(), ecm_intr_complete(), and ncm_intr_complete().

struct { ... } vmconsole_buffer [static]

VMware logfile console line buffer.

Referenced by vmconsole_putchar().

Initial value:
 {
        { 0, NULL }
}

VMware logfile console ANSI escape sequence handlers.

Definition at line 60 of file vmconsole.c.

struct line_console vmconsole_line [static]
Initial value:
 {
        .buffer = vmconsole_buffer.message,
        .len = sizeof ( vmconsole_buffer.message ),
        .ctx = {
                .handlers = vmconsole_handlers,
        },
}

VMware logfile line console.

Definition at line 65 of file vmconsole.c.

int vmconsole_entered [static]

VMware logfile console recursion marker.

Definition at line 74 of file vmconsole.c.

Referenced by vmconsole_putchar().

struct console_driver vmconsole __console_driver
Initial value:
 {
        .putchar = vmconsole_putchar,
        .disabled = CONSOLE_DISABLED,
        .usage = CONSOLE_VMWARE,
}

VMware logfile console driver.

Definition at line 107 of file vmconsole.c.