Ejemplo n.º 1
0
static void
xmitFile(char *filename) //IN : file to be transmitted.
{
   FILE *fp;
   size_t readLen;
   char buf[BUF_BASE64_SIZE];

   /*
    * We have a unique identifier saying that this is guest dumping the
    * output of logs and not any other logging information from the guest.
    */
   char base64B[BUF_BASE64_SIZE * 2] = ">";
   char *base64Buf = base64B + 1;

   if (!(fp = fopen(filename, "rb"))) {
      Warning("Unable to open file %s with errno %d\n", filename, errno);
      exit(-1);
   }

   //XXX the format below is hardcoded and used by extractFile
   RpcVMX_Log("%s: %s: ver - %d", LOG_START_MARK, filename, LOG_VERSION);
   while ((readLen = fread(buf, 1, sizeof buf, fp)) > 0 ) {
      if (Base64_Encode(buf, readLen, base64Buf, sizeof base64B - 1, NULL)) {
         RpcVMX_Log("%s", base64B);
      } else {
         Warning("Error in Base64_Encode\n");
         goto exit;
      }
   }
exit:
   RpcVMX_Log(LOG_END_MARK);
   fclose(fp);
}
Ejemplo n.º 2
0
void
RpcVMX_ReportDriverVersion(const char *drivername, const char *versionString)
{
   char setVersionCmd[128];
   Str_Sprintf(setVersionCmd, sizeof(setVersionCmd),
               "info-set guestinfo.driver.%s.version %s",
               drivername, versionString);
   RpcOut_sendOne(NULL, NULL, setVersionCmd);
   RpcVMX_Log("Driver=%s, Version=%s", drivername, versionString);
}