本文整理汇总了C++中pm_strcpy函数的典型用法代码示例。如果您正苦于以下问题:C++ pm_strcpy函数的具体用法?C++ pm_strcpy怎么用?C++ pm_strcpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pm_strcpy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup_backup
/*
* Generic setup for performing a backup.
*/
static bRC setup_backup(bpContext *ctx, void *value)
{
plugin_ctx *p_ctx = (plugin_ctx *)ctx->pContext;
if (!p_ctx || !value) {
return bRC_Error;
}
if (connect_to_cephfs(ctx) != bRC_OK) {
return bRC_Error;
}
/*
* Setup the directory we need to start scanning by setting the filetype
* to FT_DIRBEGIN e.g. same as recursing into directory and let the recurse
* logic do the rest of the work.
*/
p_ctx->type = FT_DIRBEGIN;
if (p_ctx->basedir && strlen(p_ctx->basedir) > 0) {
pm_strcpy(p_ctx->next_filename, p_ctx->basedir);
} else {
pm_strcpy(p_ctx->next_filename, "/");
}
return bRC_OK;
}
示例2: first_tree_node
/*
* Walk the tree of selected files for restore and lookup the
* correct fileid. Return the actual full pathname of the file
* corresponding to the given fileid.
*/
static inline char *lookup_fileindex(JCR *jcr, int32_t FileIndex)
{
TREE_NODE *node, *parent;
POOL_MEM restore_pathname, tmp;
node = first_tree_node(jcr->restore_tree_root);
while (node) {
/*
* See if this is the wanted FileIndex.
*/
if (node->FileIndex == FileIndex) {
pm_strcpy(restore_pathname, node->fname);
/*
* Walk up the parent until we hit the head of the list.
*/
for (parent = node->parent; parent; parent = parent->parent) {
pm_strcpy(tmp, restore_pathname.c_str());
Mmsg(restore_pathname, "%s/%s", parent->fname, tmp.c_str());
}
if (bstrncmp(restore_pathname.c_str(), "/@NDMP/", 7)) {
return bstrdup(restore_pathname.c_str());
}
}
node = next_tree_node(node);
}
return NULL;
}
示例3: result_handler
static int result_handler(void *ctx, int fields, char **row)
{
Bvfs *vfs = (Bvfs *)ctx;
ATTR *attr = vfs->get_attr();
char empty[] = "A A A A A A A A A A A A A A";
memset(&attr->statp, 0, sizeof(struct stat));
decode_stat((row[BVFS_LStat] && row[BVFS_LStat][0])?row[BVFS_LStat]:empty,
&attr->statp, sizeof(attr->statp), &attr->LinkFI);
if (bvfs_is_dir(row) || bvfs_is_file(row)) {
/* display clean stuffs */
if (bvfs_is_dir(row)) {
pm_strcpy(attr->ofname, bvfs_basename_dir(row[BVFS_Name]));
} else {
/* if we see the requested file, note his filenameid */
if (bstrcmp(row[BVFS_Name], file)) {
fnid = str_to_int64(row[BVFS_FilenameId]);
}
pm_strcpy(attr->ofname, row[BVFS_Name]);
}
print_ls_output(vfs->get_jcr(), attr);
} else {
Pmsg5(0, "JobId=%s FileId=%s\tMd5=%s\tVolName=%s\tVolInChanger=%s\n",
row[BVFS_JobId], row[BVFS_FileId], row[BVFS_Md5], row[BVFS_VolName],
row[BVFS_VolInchanger]);
pm_strcpy(attr->ofname, file);
print_ls_output(vfs->get_jcr(), attr);
}
return 0;
}
示例4: dir_update_changer
bool dir_update_changer(JCR *jcr, AUTOCHANGER *changer)
{
BSOCK *dir = jcr->dir_bsock;
POOL_MEM dev_name, MediaType;
DEVRES *device;
bool ok;
pm_strcpy(dev_name, changer->hdr.name);
bash_spaces(dev_name);
device = (DEVRES *)changer->device->first();
pm_strcpy(MediaType, device->media_type);
bash_spaces(MediaType);
/* This is mostly to indicate that we are here */
ok = dir->fsend(Device_update,
jcr->Job,
dev_name.c_str(), /* Changer name */
0, 0, 0, /* append, read, num_writers */
0, 0, 0, /* is_open, is_labeled, offline */
0, 0, /* reserved, max_writers */
0, /* Autoselect */
changer->device->size(), /* Number of devices */
"0", /* PoolId */
"*", /* ChangerName */
MediaType.c_str(), /* MediaType */
"*"); /* VolName */
Dmsg1(dbglvl, ">dird: %s\n", dir->msg);
return ok;
}
示例5: get_or_create_client_record
/*
* Get or create a Client record for this Job
*/
bool get_or_create_client_record(JCR *jcr)
{
CLIENT_DBR cr;
memset(&cr, 0, sizeof(cr));
bstrncpy(cr.Name, jcr->client->hdr.name, sizeof(cr.Name));
cr.AutoPrune = jcr->client->AutoPrune;
cr.FileRetention = jcr->client->FileRetention;
cr.JobRetention = jcr->client->JobRetention;
if (!jcr->client_name) {
jcr->client_name = get_pool_memory(PM_NAME);
}
pm_strcpy(jcr->client_name, jcr->client->hdr.name);
if (!db_create_client_record(jcr, jcr->db, &cr)) {
Jmsg(jcr, M_FATAL, 0, _("Could not create Client record. ERR=%s\n"),
db_strerror(jcr->db));
return false;
}
jcr->jr.ClientId = cr.ClientId;
if (cr.Uname[0]) {
if (!jcr->client_uname) {
jcr->client_uname = get_pool_memory(PM_NAME);
}
pm_strcpy(jcr->client_uname, cr.Uname);
}
Dmsg2(100, "Created Client %s record %d\n", jcr->client->hdr.name,
jcr->jr.ClientId);
return true;
}
示例6: make_spooled_dvd_filename
void make_spooled_dvd_filename(DEVICE *dev, POOL_MEM &archive_name)
{
/* Use the working directory if spool directory is not defined */
if (dev->device->spool_directory) {
pm_strcpy(archive_name, dev->device->spool_directory);
} else {
pm_strcpy(archive_name, working_directory);
}
add_file_and_part_name(dev, archive_name);
}
示例7: pm_strcpy
/* Convert ActionOnPurge to string (Truncate, Erase, Destroy)
*/
char *action_on_purge_to_string(int aop, POOL_MEM &ret)
{
if (aop & ON_PURGE_TRUNCATE) {
pm_strcpy(ret, _("Truncate"));
}
if (!aop) {
pm_strcpy(ret, _("None"));
}
return ret.c_str();
}
示例8: set_files_to_restore
/*
* See in the tree with selected files what files were selected to be restored.
*/
static inline int set_files_to_restore(JCR *jcr, struct ndm_job_param *job, int32_t FileIndex,
const char *restore_prefix, const char *ndmp_filesystem)
{
int len;
int cnt = 0;
TREE_NODE *node, *parent;
POOL_MEM restore_pathname, tmp;
node = first_tree_node(jcr->restore_tree_root);
while (node) {
/*
* See if this is the wanted FileIndex and the user asked to extract it.
*/
if (node->FileIndex == FileIndex && node->extract) {
pm_strcpy(restore_pathname, node->fname);
/*
* Walk up the parent until we hit the head of the list.
*/
for (parent = node->parent; parent; parent = parent->parent) {
pm_strcpy(tmp, restore_pathname.c_str());
Mmsg(restore_pathname, "%s/%s", parent->fname, tmp.c_str());
}
/*
* We only want to restore the non pseudo NDMP names e.g. not the full backup stream name.
*/
if (!bstrncmp(restore_pathname.c_str(), "/@NDMP/", 7)) {
/*
* See if we need to strip the prefix from the filename.
*/
len = strlen(ndmp_filesystem);
if (bstrncmp(restore_pathname.c_str(), ndmp_filesystem, len)) {
add_to_namelist(job, restore_pathname.c_str() + len, restore_prefix,
(char *)"", (char *)"", NDMP_INVALID_U_QUAD);
} else {
add_to_namelist(job, restore_pathname.c_str(), restore_prefix,
(char *)"", (char *)"", NDMP_INVALID_U_QUAD);
}
cnt++;
}
}
node = next_tree_node(node);
}
return cnt;
}
示例9: createFile
/*
* This is called during restore to create the file (if necessary)
* We must return in rp->create_status:
*
* CF_ERROR -- error
* CF_SKIP -- skip processing this file
* CF_EXTRACT -- extract the file (i.e.call i/o routines)
* CF_CREATED -- created, but no content to extract (typically directories)
*
*/
static bRC createFile(bpContext *ctx, struct restore_pkt *rp)
{
delta_test *self = get_self(ctx);
pm_strcpy(self->fname, rp->ofname);
rp->create_status = CF_EXTRACT;
return bRC_OK;
}
示例10: do_storage_resolve
/*
* resolve a host on a storage daemon
*/
bool do_storage_resolve(UAContext *ua, STORERES *store)
{
BSOCK *sd;
USTORERES lstore;
lstore.store = store;
pm_strcpy(lstore.store_source, _("unknown source"));
set_wstorage(ua->jcr, &lstore);
if (!(sd = open_sd_bsock(ua))) {
return false;
}
for (int i = 1; i < ua->argc; i++) {
if (!*ua->argk[i]) {
continue;
}
sd->fsend("resolve %s", ua->argk[i]);
while (sd->recv() >= 0) {
ua->send_msg("%s", sd->msg);
}
}
sd->signal(BNET_TERMINATE);
sd->close();
ua->jcr->store_bsock = NULL;
return true;
}
示例11: select_row_cb
/*
* User selected a row
*/
static void select_row_cb(GtkCList *item, gint row, gint column,
GdkEventButton *event, Window *restore)
{
char *file;
char *marked = NULL;
/* Column non-negative => double click */
if (column >= 0) {
gtk_clist_unselect_row(item, row, column);
/* Double click on column 0 means to mark or unmark */
if (column == 0) {
gtk_clist_get_text(restore->list, row, CHECK_COLUMN, &marked);
Dmsg1(200, "Marked=%s\n", marked);
if (!marked || strcmp(marked, "x") != 0) {
mark_row(row, true);
} else {
mark_row(row, false);
}
} else {
/* Double clicking on directory means to move to it */
int len;
gtk_clist_get_text(item, row, FILE_COLUMN, &file);
len = strlen(file);
if (len > 0 && file[len-1] == '/') {
/* Change to new directory */
pm_strcpy(restore->path, restore->fname);
if (*file == '*') {
Mmsg(restore->fname, "%s%s", restore->path, file+1);
} else {
Mmsg(restore->fname, "%s%s", restore->path, file);
}
FillDirectory(restore->fname, restore);
}
}
}
}
示例12: 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;
}
示例13: writecmd
void writecmd(monitoritem* item, const char* command) {
if (item->D_sock) {
item->D_sock->msglen = strlen(command);
pm_strcpy(&item->D_sock->msg, command);
item->D_sock->send();
}
}
示例14: tree_getpath_item
static void tree_getpath_item(TREE_NODE *node, POOLMEM **path)
{
if (!node) {
return;
}
tree_getpath_item(node->parent, path);
/*
* Fixup for Win32. If we have a Win32 directory and
* there is only a / in the buffer, remove it since
* win32 names don't generally start with /
*/
if (node->type == TN_DIR_NLS && IsPathSeparator((*path[0])) && (*path)[1] == '\0') {
pm_strcpy(path, "");
}
pm_strcat(path, node->fname);
/*
* Add a slash for all directories unless we are at the root,
* also add a slash to a soft linked file if it has children
* i.e. it is linked to a directory.
*/
if ((node->type != TN_FILE && !(IsPathSeparator((*path)[0]) && (*path)[1] == '\0')) ||
(node->soft_link && tree_node_has_child(node))) {
pm_strcat(path, "/");
}
}
示例15: s_warn
/*
* Format a scanner warning message
*/
static void s_warn(const char *file, int line, LEX *lc, const char *msg, ...)
{
va_list ap;
int len, maxlen;
POOL_MEM buf(PM_NAME),
more(PM_NAME);
while (1) {
maxlen = buf.size() - 1;
va_start(ap, msg);
len = bvsnprintf(buf.c_str(), maxlen, msg, ap);
va_end(ap);
if (len < 0 || len >= (maxlen - 5)) {
buf.realloc_pm(maxlen + maxlen / 2);
continue;
}
break;
}
if (lc->line_no > lc->begin_line_no) {
Mmsg(more, _("Problem probably begins at line %d.\n"), lc->begin_line_no);
} else {
pm_strcpy(more, "");
}
if (lc->line_no > 0) {
p_msg(file, line, 0, _("Config warning: %s\n"
" : line %d, col %d of file %s\n%s\n%s"),
buf.c_str(), lc->line_no, lc->col_no, lc->fname, lc->line, more.c_str());
} else {
p_msg(file, line, 0, _("Config warning: %s\n"), buf.c_str());
}
}