当前位置: 首页>>代码示例>>C++>>正文


C++ Dmsg函数代码示例

本文整理汇总了C++中Dmsg函数的典型用法代码示例。如果您正苦于以下问题:C++ Dmsg函数的具体用法?C++ Dmsg怎么用?C++ Dmsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Dmsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleJobEnd

/*
 * At end of job report how inflate/deflate ratio was.
 */
static bRC handleJobEnd(bpContext *ctx)
{
   struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext;

   if (!p_ctx) {
      goto bail_out;
   }

   if (p_ctx->inflate_bytes_in) {
      Dmsg(ctx, dbglvl, "autoxflate-sd.c: inflate ratio: %lld/%lld = %0.2f%%\n" ,
           p_ctx->inflate_bytes_out, p_ctx->inflate_bytes_in,
          (p_ctx->inflate_bytes_out * 100.0 / p_ctx->inflate_bytes_in));
      Jmsg(ctx, M_INFO, _("autoxflate-sd.c: inflate ratio: %0.2f%%\n"),
           (p_ctx->inflate_bytes_out * 100.0 / p_ctx->inflate_bytes_in));
   }

   if (p_ctx->deflate_bytes_in) {
      Dmsg(ctx, dbglvl, "autoxflate-sd.c: deflate ratio: %lld/%lld =  %0.2f%%\n",
           p_ctx->deflate_bytes_out,
           p_ctx->deflate_bytes_in,
          (p_ctx->deflate_bytes_out * 100.0 / p_ctx->deflate_bytes_in));
      Jmsg(ctx, M_INFO, _("autoxflate-sd.c: deflate ratio: %0.2f%%\n"),
           (p_ctx->deflate_bytes_out * 100.0 / p_ctx->deflate_bytes_in));
   }

bail_out:
   return bRC_OK;
}
开发者ID:debfx,项目名称:bareos,代码行数:31,代码来源:autoxflate-sd.c

示例2: plugin_has_all_arguments

static bRC plugin_has_all_arguments(bpContext *ctx)
{
   bRC retval = bRC_OK;
   plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;

   if (!p_ctx) {
      retval = bRC_Error;
   }

   if (!p_ctx->fname) {
      Jmsg(ctx, M_FATAL, _("bpipe-fd: Plugin File argument not specified.\n"));
      Dmsg(ctx, dbglvl, "bpipe-fd: Plugin File argument not specified.\n");
      retval = bRC_Error;
   }

   if (!p_ctx->reader) {
      Jmsg(ctx, M_FATAL, _("bpipe-fd: Plugin Reader argument not specified.\n"));
      Dmsg(ctx, dbglvl, "bpipe-fd: Plugin Reader argument not specified.\n");
      retval = bRC_Error;
   }

   if (!p_ctx->writer) {
      Jmsg(ctx, M_FATAL, _("bpipe-fd: Plugin Writer argument not specified.\n"));
      Dmsg(ctx, dbglvl, "bpipe-fd: Plugin Writer argument not specified.\n");
      retval = bRC_Error;
   }

   return retval;
}
开发者ID:dl5rcw,项目名称:bareos,代码行数:29,代码来源:bpipe-fd.c

示例3: startBackupFile

/*
 * Start the backup of a specific file
 */
static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
{
    time_t now;
    POOL_MEM fname(PM_NAME);
    char dt[MAX_TIME_LENGTH];
    plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;

    if (!p_ctx) {
        return bRC_Error;
    }

    /*
     * If no explicit instance name given use the DEFAULT_INSTANCE.
     */
    if (!p_ctx->instance) {
        p_ctx->instance = bstrdup(DEFAULT_INSTANCE);
    }

    /*
     * If no explicit server address given use the DEFAULT_SERVER_ADDRESS.
     */
    if (!p_ctx->server_address) {
        p_ctx->server_address = bstrdup(DEFAULT_SERVER_ADDRESS);
    }

    now = time(NULL);
    switch (p_ctx->backup_level) {
    case L_FULL:
        Mmsg(fname, "/@MSSQL/%s/%s/db-full", p_ctx->instance, p_ctx->database);
        break;
    case L_DIFFERENTIAL:
        Mmsg(fname, "/@MSSQL/%s/%s/db-diff", p_ctx->instance, p_ctx->database);
        break;
    case L_INCREMENTAL:
        bstrutime(dt, sizeof(dt), now);
        Mmsg(fname, "/@MSSQL/%s/%s/log-%s", p_ctx->instance, p_ctx->database, dt);
        break;
    default:
        Jmsg(ctx, M_FATAL, "Unsuported backup level (%c).\n", p_ctx->backup_level);
        Dmsg(ctx, dbglvl, "Unsuported backup level (%c).\n", p_ctx->backup_level);
        return bRC_Error;
    }

    p_ctx->filename = bstrdup(fname.c_str());
    Dmsg(ctx, dbglvl, "startBackupFile: Generated filename %s\n", p_ctx->filename);

    sp->fname = p_ctx->filename;
    sp->type = FT_REG;
    sp->statp.st_mode = S_IFREG | S_IREAD | S_IWRITE | S_IEXEC;
    sp->statp.st_ctime = now;
    sp->statp.st_mtime = now;
    sp->statp.st_atime = now;
    sp->statp.st_size = 0;
    sp->statp.st_blksize = DEFAULT_BLOCKSIZE;
    sp->statp.st_blocks = 1;

    return bRC_OK;
}
开发者ID:karcaw,项目名称:bareos-contrib,代码行数:61,代码来源:mssqlvdi-fd.c

示例4: tear_down_vdi_device

/*
 * End of I/O tear down the VDI and check if everything did go to plan.
 */
static inline bool tear_down_vdi_device(bpContext *ctx, struct io_pkt *io)
{
   HRESULT hr = NOERROR;
   VDC_Command *cmd;
   plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;

   Dmsg(ctx, dbglvl, "mssqlvdi-fd: entering tear_down_vdi_device\n");

   /*
    * Check if the VDI device is closed.
    */
   if (p_ctx->VDIDevice) {
      hr = p_ctx->VDIDevice->GetCommand(VDI_WAIT_TIMEOUT , &cmd);
      if (hr != VD_E_CLOSE) {
         Jmsg(ctx, M_ERROR, "Abnormal termination, VDIDevice not closed.");
         Dmsg(ctx, dbglvl, "Abnormal termination, VDIDevice not closed.");
         goto bail_out;
      }
   }

   /*
    * Close and release the VDIDevice and VDIDeviceSet.
    */
   close_vdi_deviceset(p_ctx);

   /*
    * See if there is any error to report from the ADO layer.
    */
   if (p_ctx->AdoThreadStarted) {
      if (adoReportError(ctx)) {
         goto bail_out;
      }
   }

   io->status = 0;
   io->io_errno = 0;
   io->lerror = 0;
   io->win32 = false;

   Dmsg(ctx, dbglvl, "mssqlvdi-fd: leaving tear_down_vdi_device\n");

   return true;

bail_out:
   /*
    * Report any COM errors.
    */
   comReportError(ctx, hr);

   Dmsg(ctx, dbglvl, "mssqlvdi-fd: leaving tear_down_vdi_device\n");

   return false;
}
开发者ID:janstadler,项目名称:bareos,代码行数:56,代码来源:mssqlvdi-fd.c

示例5: handlePluginEvent

/*
 * Handle an event that was generated in Bareos
 */
static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
{
   bRC retval = bRC_OK;
   struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext;

   if (!p_ctx) {
      return bRC_Error;
   }

   switch (event->eventType) {
   case bEventJobStart:
      Dmsg(ctx, dbglvl, "bpipe-fd: JobStart=%s\n", (char *)value);
      break;
   case bEventRestoreCommand:
      /*
       * Fall-through wanted
       */
   case bEventBackupCommand:
      /*
       * Fall-through wanted
       */
   case bEventEstimateCommand:
      /*
       * Fall-through wanted
       */
   case bEventPluginCommand:
      retval = parse_plugin_definition(ctx, value);
      break;
   case bEventNewPluginOptions:
      /*
       * Free any previous value.
       */
      if (p_ctx->plugin_options) {
         free(p_ctx->plugin_options);
         p_ctx->plugin_options = NULL;
      }

      retval = parse_plugin_definition(ctx, value);

      /*
       * Save that we got a plugin override.
       */
      p_ctx->plugin_options = bstrdup((char *)value);
      break;
   default:
      Jmsg(ctx, M_FATAL, "bpipe-fd: unknown event=%d\n", event->eventType);
      Dmsg(ctx, dbglvl, "bpipe-fd: unknown event=%d\n", event->eventType);
      retval = bRC_Error;
      break;
   }

   return retval;
}
开发者ID:dl5rcw,项目名称:bareos,代码行数:56,代码来源:bpipe-fd.c

示例6: freePlugin

/*
 * Free a plugin instance, i.e. release our private storage
 */
static bRC freePlugin(bpContext *ctx)
{
   plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;
   if (!p_ctx) {
      return bRC_Error;
   }

   Dmsg(ctx, dbglvl, "rados-fd: entering freePlugin\n");

   if (p_ctx->snap_id) {
      rados_ioctx_snap_remove(p_ctx->ioctx, p_ctx->rados_snapshotname);
      p_ctx->snap_id = 0;
   }

   if (p_ctx->cluster_initialized) {
      rados_shutdown(p_ctx->cluster);
      p_ctx->cluster_initialized = false;
   }

   free_pool_memory(p_ctx->next_filename);

   if (p_ctx->rados_snapshotname) {
      free(p_ctx->rados_snapshotname);
   }

#if defined(HAVE_RADOS_NAMESPACES) && defined(LIBRADOS_ALL_NSPACES)
   if (p_ctx->rados_namespace) {
      free(p_ctx->rados_namespace);
   }
#endif

   if (p_ctx->rados_poolname) {
      free(p_ctx->rados_poolname);
   }

   if (p_ctx->rados_conffile) {
      free(p_ctx->rados_conffile);
   }

   if (p_ctx->plugin_options) {
      free(p_ctx->plugin_options);
   }

   free(p_ctx);
   p_ctx = NULL;

   Dmsg(ctx, dbglvl, "rados-fd: leaving freePlugin\n");

   return bRC_OK;
}
开发者ID:karcaw,项目名称:bareos-contrib,代码行数:53,代码来源:rados-fd.c

示例7: end_restore_job

/*
 * See if we need to do any postprocessing after the restore.
 */
static bRC end_restore_job(bpContext *ctx, void *value)
{
   bRC retval = bRC_OK;
   plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;

   if (!p_ctx) {
      return bRC_Error;
   }

   Dmsg(ctx, dbglvl, "cephfs-fd: entering end_restore_job\n");

   Dmsg(ctx, dbglvl, "cephfs-fd: leaving end_restore_job\n");

   return retval;
}
开发者ID:debfx,项目名称:bareos,代码行数:18,代码来源:cephfs-fd.c

示例8: newPlugin

/*
 * The following entry points are accessed through the function
 * pointers we supplied to Bareos. Each plugin type (dir, fd, sd)
 * has its own set of entry points that the plugin must define.
 *
 * Create a new instance of the plugin i.e. allocate our private storage
 */
static bRC newPlugin(bpContext *ctx)
{
   int JobId = 0;
   struct plugin_ctx *p_ctx;

   bfuncs->getBareosValue(ctx, bsdVarJobId, (void *)&JobId);
   Dmsg(ctx, dbglvl, "autoxflate-sd: newPlugin JobId=%d\n", JobId);

   p_ctx = (struct plugin_ctx *)malloc(sizeof(struct plugin_ctx));
   if (!p_ctx) {
      return bRC_Error;
   }

   memset(p_ctx, 0, sizeof(struct plugin_ctx));
   ctx->pContext = (void *)p_ctx;        /* set our context pointer */

   /*
    * Only register plugin events we are interested in.
    *
    * bsdEventJobEnd - SD Job finished.
    * bsdEventSetupRecordTranslation - Setup the buffers for doing record translation.
    * bsdEventReadRecordTranslation - Perform read-side record translation.
    * bsdEventWriteRecordTranslation - Perform write-side record translantion.
    */
   bfuncs->registerBareosEvents(ctx,
                                4,
                                bsdEventJobEnd,
                                bsdEventSetupRecordTranslation,
                                bsdEventReadRecordTranslation,
                                bsdEventWriteRecordTranslation);

   return bRC_OK;
}
开发者ID:debfx,项目名称:bareos,代码行数:40,代码来源:autoxflate-sd.c

示例9: PySequence_Fast

/*
 * Callback function which is exposed as a part of the additional methods which allow
 * a Python plugin to issue a Register Event to register additional events it wants
 * to receive.
 */
static PyObject *PyBareosRegisterEvents(PyObject *self, PyObject *args)
{
   int len, event;
   bpContext *ctx;
   PyObject *pyCtx, *pyEvents, *pySeq, *pyEvent;

   if (!PyArg_ParseTuple(args, "OO:BareosRegisterEvents", &pyCtx, &pyEvents)) {
      return NULL;
   }

   pySeq = PySequence_Fast(pyEvents, "Expected a sequence of events");
   if (!pySeq) {
      return NULL;
   }

   len = PySequence_Fast_GET_SIZE(pySeq);

   ctx = PyGetbpContext(pyCtx);
   for (int i = 0; i < len; i++) {
      pyEvent = PySequence_Fast_GET_ITEM(pySeq, i);
      event = PyInt_AsLong(pyEvent);

      if (event >= bDirEventJobStart && event <= bDirEventGetScratch) {
         Dmsg(ctx, dbglvl, "PyBareosRegisterEvents: registering event %d\n", event);
         bfuncs->registerBareosEvents(ctx, 1, event);
      }
   }

   Py_DECREF(pySeq);

   Py_INCREF(Py_None);
   return Py_None;
}
开发者ID:bitroniq,项目名称:bareos,代码行数:38,代码来源:python-dir.c

示例10: startBackupFile

/* 
 * Start the backup of a specific file
 */
static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
{
   delta_test *self = get_self(ctx);
   if (!self) {
      return bRC_Error;
   }
   time_t now = time(NULL);
   sp->fname = (char *)"/delta.txt";
   sp->type = FT_REG;
   sp->statp.st_mode = 0700 | S_IFREG;
   sp->statp.st_ctime = now;
   sp->statp.st_mtime = now;
   sp->statp.st_atime = now;
   sp->statp.st_size = -1;
   sp->statp.st_blksize = 4096;
   sp->statp.st_blocks = 1;
   if (self->level == 'I' || self->level == 'D') {
      bRC state = bfuncs->checkChanges(ctx, sp);
      /* Should always be bRC_OK */
      sp->type = (state == bRC_Seen)? FT_NOCHG : FT_REG;
      sp->flags |= (FO_DELTA|FO_OFFSETS);
      self->delta = sp->delta_seq + 1;
   }
   pm_strcpy(self->fname, files[self->delta % nb_files]);
   Dmsg(ctx, dbglvl, "delta-test-fd: delta_seq=%i delta=%i fname=%s\n", 
        sp->delta_seq, self->delta, self->fname);
// Dmsg(ctx, dbglvl, "delta-test-fd: startBackupFile\n");
   return bRC_OK;
}
开发者ID:anarexia,项目名称:bacula,代码行数:32,代码来源:delta-test-fd.c

示例11: set_ado_connect_string

/*
 * Create a connection string for connecting to the master database.
 */
static void set_ado_connect_string(bpContext *ctx)
{
   POOL_MEM ado_connect_string(PM_NAME);
   plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;

   if (bstrcasecmp(p_ctx->instance, DEFAULT_INSTANCE)) {
      pm_strcpy(ado_connect_string,
                "Provider=SQLOLEDB.1;Data Source=localhost;Initial Catalog=master");
   } else {
      Mmsg(ado_connect_string,
           "Provider=SQLOLEDB.1;Data Source=localhost\\%s;Initial Catalog=master",
           p_ctx->instance);
   }

   /*
    * See if we need to use a username/password or a trusted connection.
    */
   if (p_ctx->username && p_ctx->password) {
      POOL_MEM temp(PM_NAME);

      Mmsg(temp, ";User Id=%s;Password=%s;",
            p_ctx->username, p_ctx->password);
      pm_strcat(ado_connect_string, temp.c_str());
   } else {
      pm_strcat(ado_connect_string, ";Integrated Security=SSPI;");
   }

   Dmsg(ctx, dbglvl, "set_ado_connect_string: ADO Connect String '%s'\n", ado_connect_string.c_str());

   if (p_ctx->ado_connect_string) {
      free(p_ctx->ado_connect_string);
   }
   p_ctx->ado_connect_string = bstrdup(ado_connect_string.c_str());
}
开发者ID:janstadler,项目名称:bareos,代码行数:37,代码来源:mssqlvdi-fd.c

示例12: freePlugin

/*
 * Free a plugin instance, i.e. release our private storage
 */
static bRC freePlugin(bpContext *ctx)
{
   plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;
   if (!p_ctx) {
      return bRC_Error;
   }

   Dmsg(ctx, dbglvl, "cephfs-fd: entering freePlugin\n");

   if (p_ctx->path_list) {
      free_path_list(p_ctx->path_list);
      p_ctx->path_list = NULL;
   }

   if (p_ctx->dir_stack) {
      p_ctx->dir_stack->destroy();
      delete p_ctx->dir_stack;
   }

   if (p_ctx->cmount) {
      ceph_shutdown(p_ctx->cmount);
      p_ctx->cmount = NULL;
   }

   free_pool_memory(p_ctx->xattr_list);
   free_pool_memory(p_ctx->link_target);
   free_pool_memory(p_ctx->next_filename);
   free_pool_memory(p_ctx->cwd);

   if (p_ctx->conffile) {
      free(p_ctx->conffile);
   }

   if (p_ctx->plugin_options) {
      free(p_ctx->plugin_options);
   }

   free(p_ctx);
   p_ctx = NULL;

   Dmsg(ctx, dbglvl, "cephfs-fd: leaving freePlugin\n");

   return bRC_OK;
}
开发者ID:debfx,项目名称:bareos,代码行数:47,代码来源:cephfs-fd.c

示例13: pluginIO

/*
 * Bareos is calling us to do the actual I/O
 */
static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
{
   DWORD completionCode = ERROR_BAD_ENVIRONMENT;
   plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;

   if (!p_ctx) {
      return bRC_Error;
   }

   switch(io->func) {
   case IO_OPEN:
      if (!setup_vdi_device(ctx, io)) {
         goto bail_out;
      }
      break;
   case IO_READ:
   case IO_WRITE:
      if (!p_ctx->VDIDevice) {
         return bRC_Error;
      }
      if (!perform_vdi_io(ctx, io, &completionCode)) {
         goto bail_out;
      }
      break;
   case IO_CLOSE:
      if (!tear_down_vdi_device(ctx, io)) {
         goto bail_out;
      }
      break;
   case IO_SEEK:
      Jmsg(ctx, M_ERROR, "Illegal Seek request on VDIDevice.");
      Dmsg(ctx, dbglvl, "Illegal Seek request on VDIDevice.");
      goto bail_out;
   }

   return bRC_OK;

bail_out:
   /*
    * Report any ADO errors.
    */
   adoReportError(ctx);

   /*
    * Generic error handling.
    */
   close_vdi_deviceset(p_ctx);

   io->io_errno = completionCode;
   io->lerror = completionCode;
   io->win32 = true;
   io->status = -1;

   return bRC_Error;
}
开发者ID:janstadler,项目名称:bareos,代码行数:58,代码来源:mssqlvdi-fd.c

示例14: freePlugin

/*
 * Free a plugin instance, i.e. release our private storage
 */
static bRC freePlugin(bpContext *ctx)
{
   int JobId = 0;
   struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext;

   bfuncs->getBareosValue(ctx, bsdVarJobId, (void *)&JobId);
   Dmsg(ctx, dbglvl, "autoxflate-sd: freePlugin JobId=%d\n", JobId);

   if (!p_ctx) {
      Dmsg(ctx, dbglvl, "autoxflate-sd: freePlugin JobId=%d\n", JobId);
      return bRC_Error;
   }

   if (p_ctx) {
      free(p_ctx);
   }
   ctx->pContext = NULL;

   return bRC_OK;
}
开发者ID:debfx,项目名称:bareos,代码行数:23,代码来源:autoxflate-sd.c

示例15: perform_ado_backup

/*
 * Generate a valid connect string and the backup command we should execute
 * in the seperate database controling thread.
 */
static inline void perform_ado_backup(bpContext *ctx)
{
    plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;
    POOL_MEM ado_connect_string(PM_NAME),
             ado_query(PM_NAME);
    POOLMEM *vdsname;

    /*
     * If no explicit instance name given usedthe DEFAULT_INSTANCE name.
     */
    if (!p_ctx->instance) {
        p_ctx->instance = bstrdup(DEFAULT_INSTANCE);
    }

    set_ado_connect_string(ctx);

    vdsname = get_pool_memory(PM_NAME);
    wchar_2_UTF8(&vdsname, p_ctx->vdsname);

    switch (p_ctx->backup_level) {
    case L_INCREMENTAL:
        Mmsg(ado_query,
             "BACKUP LOG %s TO VIRTUAL_DEVICE='%s' WITH BLOCKSIZE=%d, BUFFERCOUNT=%d, MAXTRANSFERSIZE=%d",
             p_ctx->database,
             vdsname,
             DEFAULT_BLOCKSIZE,
             DEFAULT_BUFFERS,
             DEFAULT_BLOCKSIZE);
        break;
    case L_DIFFERENTIAL:
        Mmsg(ado_query,
             "BACKUP DATABASE %s TO VIRTUAL_DEVICE='%s' WITH DIFFERENTIAL, BLOCKSIZE=%d, BUFFERCOUNT=%d, MAXTRANSFERSIZE=%d",
             p_ctx->database,
             vdsname,
             DEFAULT_BLOCKSIZE,
             DEFAULT_BUFFERS,
             DEFAULT_BLOCKSIZE);
        break;
    default:
        Mmsg(ado_query,
             "BACKUP DATABASE %s TO VIRTUAL_DEVICE='%s' WITH BLOCKSIZE=%d, BUFFERCOUNT=%d, MAXTRANSFERSIZE=%d",
             p_ctx->database,
             vdsname,
             DEFAULT_BLOCKSIZE,
             DEFAULT_BUFFERS,
             DEFAULT_BLOCKSIZE);
        break;
    }

    Dmsg(ctx, dbglvl, "perform_ado_backup: ADO Query '%s'\n", ado_query.c_str());

    p_ctx->ado_query = bstrdup(ado_query.c_str());
    free_pool_memory(vdsname);
}
开发者ID:karcaw,项目名称:bareos-contrib,代码行数:58,代码来源:mssqlvdi-fd.c


注:本文中的Dmsg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。