iPXE
Macros | 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.

Macros

#define VMCONSOLE_BUFSIZE   128
 VMware logfile console buffer size. More...
 
#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. More...
 
static void vmconsole_init (void)
 Initialise VMware logfile console. More...
 
struct init_fn vmconsole_init_fn __init_fn (INIT_CONSOLE)
 VMware logfile console initialisation function. More...
 

Variables

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

Detailed Description

VMware logfile console.

Definition in file vmconsole.c.

Macro Definition Documentation

◆ VMCONSOLE_BUFSIZE

#define VMCONSOLE_BUFSIZE   128

VMware logfile console buffer size.

Definition at line 40 of file vmconsole.c.

◆ CONSOLE_VMWARE

#define CONSOLE_VMWARE   ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )

Definition at line 45 of file vmconsole.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ vmconsole_putchar()

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.

81  {
82  int rc;
83 
84  /* Ignore if we are already mid-logging */
85  if ( vmconsole_entered )
86  return;
87 
88  /* Fill line buffer */
89  if ( line_putchar ( &vmconsole_line, character ) == 0 )
90  return;
91 
92  /* Guard against re-entry */
94 
95  /* Send log message */
97  vmconsole_buffer.prefix, NULL, 0 ) ) <0){
98  DBG ( "VMware console could not send log message: %s\n",
99  strerror ( rc ) );
100  }
101 
102  /* Clear re-entry flag */
103  vmconsole_entered = 0;
104 }
static struct @430 vmconsole_buffer
VMware logfile console line buffer.
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int vmconsole_channel
VMware logfile console GuestRPC channel.
Definition: vmconsole.c:49
static int vmconsole_entered
VMware logfile console recursion marker.
Definition: vmconsole.c:74
static struct line_console vmconsole_line
VMware logfile line console.
Definition: vmconsole.c:65
size_t line_putchar(struct line_console *line, int character)
Print a character to a line-based console.
Definition: lineconsole.c:43
int guestrpc_command(int channel, const char *command, char *reply, size_t reply_len)
Issue GuestRPC command.
Definition: guestrpc.c:242
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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

◆ vmconsole_init()

static void vmconsole_init ( void  )
static

Initialise VMware logfile console.

Definition at line 117 of file vmconsole.c.

117  {
118  int rc;
119 
120  /* Attempt to open console */
122  if ( vmconsole_channel < 0 ) {
124  DBG ( "VMware console could not be initialised: %s\n",
125  strerror ( rc ) );
126  return;
127  }
128 
129  /* Mark console as available */
130  vmconsole.disabled = 0;
131 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
int guestrpc_open(void)
Open GuestRPC channel.
Definition: guestrpc.c:67
static int vmconsole_channel
VMware logfile console GuestRPC channel.
Definition: vmconsole.c:49
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

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

◆ __init_fn()

struct init_fn vmconsole_init_fn __init_fn ( INIT_CONSOLE  )

VMware logfile console initialisation function.

Variable Documentation

◆ vmconsole_channel

int vmconsole_channel
static

VMware logfile console GuestRPC channel.

Definition at line 49 of file vmconsole.c.

Referenced by vmconsole_init(), and vmconsole_putchar().

◆ prefix

char prefix[4]

◆ message

char message[VMCONSOLE_BUFSIZE]

Definition at line 54 of file vmconsole.c.

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

◆ vmconsole_buffer

struct { ... } vmconsole_buffer
Initial value:
= {
.prefix = "log ",
}

VMware logfile console line buffer.

Referenced by vmconsole_putchar().

◆ vmconsole_handlers

struct ansiesc_handler vmconsole_handlers[]
static
Initial value:
= {
{ 0, NULL }
}
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

VMware logfile console ANSI escape sequence handlers.

Definition at line 60 of file vmconsole.c.

◆ vmconsole_line

struct line_console vmconsole_line
static
Initial value:
= {
.buffer = vmconsole_buffer.message,
.len = sizeof ( vmconsole_buffer.message ),
.ctx = {
.handlers = vmconsole_handlers,
},
}
static struct @430 vmconsole_buffer
VMware logfile console line buffer.
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
static struct ansiesc_handler vmconsole_handlers[]
VMware logfile console ANSI escape sequence handlers.
Definition: vmconsole.c:60

VMware logfile line console.

Definition at line 65 of file vmconsole.c.

Referenced by vmconsole_putchar().

◆ vmconsole_entered

int vmconsole_entered
static

VMware logfile console recursion marker.

Definition at line 74 of file vmconsole.c.

Referenced by vmconsole_putchar().

◆ __console_driver

struct console_driver vmconsole __console_driver
Initial value:
= {
.putchar = vmconsole_putchar,
.disabled = CONSOLE_DISABLED,
.usage = CONSOLE_VMWARE,
}
#define CONSOLE_DISABLED
Console is disabled for all uses.
Definition: console.h:111
#define CONSOLE_VMWARE
Definition: vmconsole.c:45
static void vmconsole_putchar(int character)
Print a character to VMware logfile console.
Definition: vmconsole.c:81

VMware logfile console driver.

Definition at line 107 of file vmconsole.c.