本文整理汇总了C++中Pmsg1函数的典型用法代码示例。如果您正苦于以下问题:C++ Pmsg1函数的具体用法?C++ Pmsg1怎么用?C++ Pmsg1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Pmsg1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dump_volume
static inline void dump_volume(BSR_VOLUME *volume)
{
if (volume) {
Pmsg1(-1, _("VolumeName : %s\n"), volume->VolumeName);
Pmsg1(-1, _(" MediaType : %s\n"), volume->MediaType);
Pmsg1(-1, _(" Device : %s\n"), volume->device);
Pmsg1(-1, _(" Slot : %d\n"), volume->Slot);
dump_volume(volume->next);
}
}
示例2: sm_dump
/* SM_DUMP -- Print orphaned buffers (and dump them if BUFDUMP is
* True).
*/
void sm_dump(bool bufdump, bool in_use)
{
struct abufhead *ap;
P(mutex);
ap = (struct abufhead *)abqueue.qnext;
while (ap != (struct abufhead *) &abqueue) {
if ((ap == NULL) ||
(ap->abq.qnext->qprev != (struct b_queue *) ap) ||
(ap->abq.qprev->qnext != (struct b_queue *) ap)) {
Pmsg1(0, _(
"\nOrphaned buffers exist. Dump terminated following\n"
" discovery of bad links in chain of orphaned buffers.\n"
" Buffer address with bad links: %p\n"), ap);
break;
}
if (ap->abfname != NULL) {
char errmsg[500];
uint32_t memsize = ap->ablen - (HEAD_SIZE + 1);
char *cp = ((char *)ap) + HEAD_SIZE;
Pmsg6(0, "%s buffer: %s %d bytes at %p from %s:%d\n",
in_use?"In use":"Orphaned",
my_name, memsize, cp, get_basename(ap->abfname), ap->ablineno);
if (bufdump) {
char buf[20];
unsigned llen = 0;
errmsg[0] = EOS;
while (memsize) {
if (llen >= 16) {
bstrncat(errmsg, "\n", sizeof(errmsg));
llen = 0;
Pmsg1(0, "%s", errmsg);
errmsg[0] = EOS;
}
bsnprintf(buf, sizeof(buf), " %02X",
(*cp++) & 0xFF);
bstrncat(errmsg, buf, sizeof(errmsg));
llen++;
memsize--;
}
Pmsg1(0, "%s\n", errmsg);
}
}
ap = (struct abufhead *) ap->abq.qnext;
}
V(mutex);
}
示例3: record_cb
/*
* Called here for each record from read_records()
*
* Returns: true if OK
* false if error
*/
static bool record_cb(DCR *dcr, DEV_RECORD *rec)
{
JCR *jcr = dcr->jcr;
BSOCK *fd = jcr->file_bsock;
bool ok = true;
POOLMEM *save_msg;
char ec1[50], ec2[50];
if (rec->FileIndex < 0) {
return true;
}
Dmsg5(400, "Send to FD: SessId=%u SessTim=%u FI=%s Strm=%s, len=%d\n",
rec->VolSessionId, rec->VolSessionTime,
FI_to_ascii(ec1, rec->FileIndex),
stream_to_ascii(ec2, rec->Stream, rec->FileIndex),
rec->data_len);
/*
* Send record header to File daemon
*/
if (!fd->fsend(rec_header, rec->VolSessionId, rec->VolSessionTime,
rec->FileIndex, rec->Stream, rec->data_len)) {
Pmsg1(000, _(">filed: Error Hdr=%s"), fd->msg);
Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
fd->bstrerror());
return false;
} else {
Dmsg1(400, ">filed: Hdr=%s", fd->msg);
}
/*
* Send data record to File daemon
*/
save_msg = fd->msg; /* save fd message pointer */
fd->msg = rec->data; /* pass data directly to the FD */
fd->msglen = rec->data_len;
Dmsg1(400, ">filed: send %d bytes data.\n", fd->msglen);
if (!fd->send()) {
Pmsg1(000, _("Error sending to FD. ERR=%s\n"), fd->bstrerror());
Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
fd->bstrerror());
ok = false;
}
fd->msg = save_msg; /* restore fd message pointer */
return ok;
}
示例4: match_kw
/* Match a regexp and add the result to the items list
* This function is recursive
*/
static void match_kw(regex_t *preg, const char *what, int len, POOLMEM **buf)
{
int rc, size;
int nmatch=20;
regmatch_t pmatch[20];
if (len <= 0) {
return;
}
rc = regexec(preg, what, nmatch, pmatch, 0);
if (rc == 0) {
#if 0
Pmsg1(0, "\n\n%s\n0123456789012345678901234567890123456789\n 10 20 30\n", what);
Pmsg2(0, "%i-%i\n", pmatch[0].rm_so, pmatch[0].rm_eo);
Pmsg2(0, "%i-%i\n", pmatch[1].rm_so, pmatch[1].rm_eo);
Pmsg2(0, "%i-%i\n", pmatch[2].rm_so, pmatch[2].rm_eo);
Pmsg2(0, "%i-%i\n", pmatch[3].rm_so, pmatch[3].rm_eo);
#endif
size = pmatch[1].rm_eo - pmatch[1].rm_so;
*buf = check_pool_memory_size(*buf, size + 1);
memcpy(*buf, what+pmatch[1].rm_so, size);
(*buf)[size] = 0;
items->list.append(bstrdup(*buf));
/* We search for the next keyword in the line */
match_kw(preg, what + pmatch[1].rm_eo, len - pmatch[1].rm_eo, buf);
}
}
示例5: dump_client
static inline void dump_client(BSR_CLIENT *client)
{
if (client) {
Pmsg1(-1, _("Client : %s\n"), client->ClientName);
dump_client(client->next);
}
}
示例6: dump_job
static inline void dump_job(BSR_JOB *job)
{
if (job) {
Pmsg1(-1, _("Job : %s\n"), job->Job);
dump_job(job->next);
}
}
示例7: dump_sesstime
static inline void dump_sesstime(BSR_SESSTIME *sesstime)
{
if (sesstime) {
Pmsg1(-1, _("SessTime : %u\n"), sesstime->sesstime);
dump_sesstime(sesstime->next);
}
}
示例8: safer_unlink
/*
* This routine is a somewhat safer unlink in that it
* allows you to run a regex on the filename before
* excepting it. It also requires the file to be in
* the working directory.
*/
int safer_unlink(const char *pathname, const char *regx)
{
int rc;
regex_t preg1;
char prbuf[500];
const int nmatch = 30;
regmatch_t pmatch[nmatch];
int rtn;
/* Name must start with working directory */
if (strncmp(pathname, working_directory, strlen(working_directory)) != 0) {
Pmsg1(000, "Safe_unlink excluded: %s\n", pathname);
return EROFS;
}
/* Compile regex expression */
rc = regcomp(&preg1, regx, REG_EXTENDED);
if (rc != 0) {
regerror(rc, &preg1, prbuf, sizeof(prbuf));
Pmsg2(000, _("safe_unlink could not compile regex pattern \"%s\" ERR=%s\n"),
regx, prbuf);
return ENOENT;
}
/* Unlink files that match regexes */
if (regexec(&preg1, pathname, nmatch, pmatch, 0) == 0) {
Dmsg1(100, "safe_unlink unlinking: %s\n", pathname);
rtn = unlink(pathname);
} else {
Pmsg2(000, "safe_unlink regex failed: regex=%s file=%s\n", regx, pathname);
rtn = EROFS;
}
regfree(&preg1);
return rtn;
}
示例9: Mmsg0
/*
* Set the position of the device -- only for files and DVD
* For other devices, there is no generic way to do it.
* Returns: true on succes
* false on error
*/
bool DEVICE::update_pos(DCR *dcr)
{
boffset_t pos;
bool ok = true;
if (!is_open()) {
dev_errno = EBADF;
Mmsg0(errmsg, _("Bad device call. Device not open\n"));
Emsg1(M_FATAL, 0, "%s", errmsg);
return false;
}
if (is_file()) {
file = 0;
file_addr = 0;
pos = lseek(dcr, (boffset_t)0, SEEK_CUR);
if (pos < 0) {
berrno be;
dev_errno = errno;
Pmsg1(000, _("Seek error: ERR=%s\n"), be.bstrerror());
Mmsg2(errmsg, _("lseek error on %s. ERR=%s.\n"),
print_name(), be.bstrerror());
ok = false;
} else {
file_addr = pos;
block_num = (uint32_t)pos;
file = (uint32_t)(pos >> 32);
}
}
return ok;
}
示例10: tr
void mountDialog::accept()
{
QString scmd;
if (m_storageName == "") {
QMessageBox::warning(this, tr("No Storage name"), tr("No Storage name given"),
QMessageBox::Ok, QMessageBox::Ok);
return;
}
this->hide();
scmd = QString("mount storage=\"%1\" slot=%2")
.arg(m_storageName)
.arg(slotSpin->value());
if (mainWin->m_commandDebug) {
Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data());
}
m_console->display_text( tr("Context sensitive command :\n\n"));
m_console->display_text("**** ");
m_console->display_text(scmd + " ****\n");
m_console->display_text(tr("Director Response :\n\n"));
m_console->write_dir(scmd.toUtf8().data());
m_console->displayToPrompt(m_conn);
m_console->notify(m_conn, true);
delete this;
mainWin->resetFocus();
}
示例11: QString
void labelPage::okButtonPushed()
{
QString scmd;
if (volumeName->text().toUtf8().data()[0] == 0) {
QMessageBox::warning(this, "No Volume name", "No Volume name given",
QMessageBox::Ok, QMessageBox::Ok);
return;
}
this->hide();
scmd = QString("label volume=\"%1\" pool=\"%2\" storage=\"%3\" slot=%4\n")
.arg(volumeName->text())
.arg(poolCombo->currentText())
.arg(storageCombo->currentText())
.arg(slotSpin->value());
if (mainWin->m_commandDebug) {
Pmsg1(000, "sending command : %s\n", scmd.toUtf8().data());
}
if (m_console) {
m_console->write_dir(scmd.toUtf8().data());
m_console->displayToPrompt(m_conn);
m_console->notify(m_conn, true);
} else {
Pmsg0(000, "m_console==NULL !!!!!!\n");
}
closeStackPage();
mainWin->resetFocus();
}
示例12: QTextStream
void runPage::okButtonPushed()
{
this->hide();
QString cmd;
QTextStream(&cmd) << "run" <<
" job=\"" << jobCombo->currentText() << "\"" <<
" fileset=\"" << filesetCombo->currentText() << "\"" <<
" level=\"" << levelCombo->currentText() << "\"" <<
" client=\"" << clientCombo->currentText() << "\"" <<
" pool=\"" << poolCombo->currentText() << "\"" <<
" storage=\"" << storageCombo->currentText() << "\"" <<
" priority=\"" << prioritySpin->value() << "\""
" when=\"" << dateTimeEdit->dateTime().toString(mainWin->m_dtformat) << "\"";
#ifdef xxx
" messages=\"" << messagesCombo->currentText() << "\"";
/* FIXME when there is an option to modify the messages resource associated
* with a job */
#endif
if (bootstrap->text() != "") {
cmd += " bootstrap=\"" + bootstrap->text() + "\"";
}
cmd += " yes";
if (mainWin->m_commandDebug) {
Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
}
consoleCommand(cmd);
m_console->notify(m_conn, true);
closeStackPage();
mainWin->resetFocus();
}
示例13: dump_bsr
void dump_bsr(BSR *bsr, bool recurse)
{
int save_debug = debug_level;
debug_level = 1;
if (!bsr) {
Pmsg0(-1, _("BSR is NULL\n"));
debug_level = save_debug;
return;
}
Pmsg1(-1, _("Next : 0x%x\n"), bsr->next);
Pmsg1(-1, _("Root bsr : 0x%x\n"), bsr->root);
dump_volume(bsr->volume);
dump_sessid(bsr->sessid);
dump_sesstime(bsr->sesstime);
dump_volfile(bsr->volfile);
dump_volblock(bsr->volblock);
dump_voladdr(bsr->voladdr);
dump_client(bsr->client);
dump_jobid(bsr->JobId);
dump_job(bsr->job);
dump_findex(bsr->FileIndex);
if (bsr->count) {
Pmsg1(-1, _("count : %u\n"), bsr->count);
Pmsg1(-1, _("found : %u\n"), bsr->found);
}
Pmsg1(-1, _("done : %s\n"), bsr->done?_("yes"):_("no"));
Pmsg1(-1, _("positioning : %d\n"), bsr->use_positioning);
Pmsg1(-1, _("fast_reject : %d\n"), bsr->use_fast_rejection);
if (recurse && bsr->next) {
Pmsg0(-1, "\n");
dump_bsr(bsr->next, true);
}
debug_level = save_debug;
}
示例14: write_last_jobs_list
uint64_t write_last_jobs_list(int fd, uint64_t addr)
{
struct s_last_job *je;
uint32_t num;
ssize_t status;
Dmsg1(100, "write_last_jobs seek to %d\n", (int)addr);
if (lseek(fd, (boffset_t)addr, SEEK_SET) < 0) {
return 0;
}
if (last_jobs) {
lock_last_jobs_list();
/*
* First record is number of entires
*/
num = last_jobs->size();
if (write(fd, &num, sizeof(num)) != sizeof(num)) {
berrno be;
Pmsg1(000, "Error writing num_items: ERR=%s\n", be.bstrerror());
goto bail_out;
}
foreach_dlist(je, last_jobs) {
if (write(fd, je, sizeof(struct s_last_job)) != sizeof(struct s_last_job)) {
berrno be;
Pmsg1(000, "Error writing job: ERR=%s\n", be.bstrerror());
goto bail_out;
}
}
unlock_last_jobs_list();
}
/*
* Return current address
*/
status = lseek(fd, 0, SEEK_CUR);
if (status < 0) {
status = 0;
}
return status;
bail_out:
unlock_last_jobs_list();
return 0;
}
示例15: bsnprintf
void restorePage::fileDoubleClicked(QTreeWidgetItem *item, int column)
{
char cmd[1000];
statusLine->setText("");
if (column == 0) { /* mark/unmark */
mainWin->waitEnter();
if (item->data(0, Qt::UserRole).toBool()) {
bsnprintf(cmd, sizeof(cmd), "unmark \"%s\"", item->text(1).toUtf8().data());
item->setIcon(0, QIcon(QString::fromUtf8(":images/unchecked.png")));
item->setData(0, Qt::UserRole, false);
} else {
bsnprintf(cmd, sizeof(cmd), "mark \"%s\"", item->text(1).toUtf8().data());
item->setIcon(0, QIcon(QString::fromUtf8(":images/check.png")));
item->setData(0, Qt::UserRole, true);
}
m_console->write_dir(m_conn, cmd, false);
if (m_console->read(m_conn) > 0) {
strip_trailing_newline(m_console->msg(m_conn));
statusLine->setText(m_console->msg(m_conn));
}
m_console->displayToPrompt(m_conn);
mainWin->waitExit();
return;
}
/*
* Double clicking other than column 0 means to decend into
* the directory -- or nothing if it is not a directory.
*/
if (item->text(1).endsWith("/")) {
QString fullpath = m_cwd + item->text(1);
QTreeWidgetItem *item = m_dirPaths.value(fullpath);
if (mainWin->m_miscDebug) {
Pmsg1(dbglvl, "%s\n", fullpath.toUtf8().data());
}
if (item) {
directoryWidget->setCurrentItem(item);
} else {
QString msg = QString("DoubleClick else of item column %1 fullpath %2\n")
.arg(column,10)
.arg(fullpath);
if (mainWin->m_miscDebug) Pmsg1(dbglvl, "%s\n", msg.toUtf8().data());
}
}
}