* Version $Id$
*/
/*
- Copyright (C) 2000-2004 Kern Sibbald and John Walker
+ Copyright (C) 2000-2004 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
*/
for (i=0; i < MAX_STORE; i++) {
+ /*
+ * if storage[0] == NULL, storage was manually overridden in
+ * a Console run command.
+ */
if (jcr->storage[i]) {
storage = (STORE *)jcr->storage[i]->first();
- pm_strcpy(device_name, storage->dev_name);
- pm_strcpy(media_type, storage->media_type);
- pm_strcpy(pool_type, jcr->pool->pool_type);
- pm_strcpy(pool_name, jcr->pool->hdr.name);
- bash_spaces(device_name);
- bash_spaces(media_type);
- bash_spaces(pool_type);
- bash_spaces(pool_name);
- bnet_fsend(sd, use_device, device_name.c_str(),
- media_type.c_str(), pool_name.c_str(), pool_type.c_str());
- Dmsg1(110, ">stored: %s", sd->msg);
- status = response(jcr, sd, OK_device, "Use Device", NO_DISPLAY);
- if (!status) {
- pm_strcpy(pool_type, sd->msg); /* save message */
- Jmsg(jcr, M_FATAL, 0, _("\n"
- " Storage daemon didn't accept Device \"%s\" because:\n %s"),
- device_name.c_str(), pool_type.c_str()/* sd->msg */);
+ } else {
+ if (i == 0) {
+ storage = jcr->store;
+ } else {
+ continue;
}
}
+ pm_strcpy(device_name, storage->dev_name);
+ pm_strcpy(media_type, storage->media_type);
+ pm_strcpy(pool_type, jcr->pool->pool_type);
+ pm_strcpy(pool_name, jcr->pool->hdr.name);
+ bash_spaces(device_name);
+ bash_spaces(media_type);
+ bash_spaces(pool_type);
+ bash_spaces(pool_name);
+ bnet_fsend(sd, use_device, device_name.c_str(),
+ media_type.c_str(), pool_name.c_str(), pool_type.c_str());
+ Dmsg1(110, ">stored: %s", sd->msg);
+ status = response(jcr, sd, OK_device, "Use Device", NO_DISPLAY);
+ if (!status) {
+ pm_strcpy(pool_type, sd->msg); /* save message */
+ Jmsg(jcr, M_FATAL, 0, _("\n"
+ " Storage daemon didn't accept Device \"%s\" because:\n %s"),
+ device_name.c_str(), pool_type.c_str()/* sd->msg */);
+ }
}
return status;
}
*/
/*
- Copyright (C) 2001-2004 Kern Sibbald and John Walker
+ Copyright (C) 2001-2004 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
catalog_name = NULL;
for (i=1; i<ua->argc; i++) {
- Dmsg2(200, "Doing arg %d = %s\n", i, ua->argk[i]);
+ Dmsg2(800, "Doing arg %d = %s\n", i, ua->argk[i]);
kw_ok = false;
/* Keep looking until we find a good keyword */
for (j=0; !kw_ok && kw[j]; j++) {
bsendmsg(ua, _("Value missing for keyword %s\n"), ua->argk[i]);
return 1;
}
- Dmsg1(200, "Got keyword=%s\n", kw[j]);
+ Dmsg1(800, "Got keyword=%s\n", kw[j]);
switch (j) {
case 0: /* job */
if (job_name) {
}
} /* end argc loop */
- Dmsg0(200, "Done scan.\n");
+ Dmsg0(800, "Done scan.\n");
CAT *catalog = NULL;
if (catalog_name != NULL) {
return 0;
}
}
+ Dmsg1(200, "Using catalog=%s\n", catalog_name);
if (job_name) {
/* Find Job */
store->hdr.name);
return 0;
}
+ Dmsg1(200, "Using storage=%s\n", store->hdr.name);
if (pool_name) {
pool = (POOL *)GetResWithName(R_POOL, pool_name);
pool->hdr.name);
return 0;
}
+ Dmsg1(200, "Using pool\n", pool->hdr.name);
if (client_name) {
client = (CLIENT *)GetResWithName(R_CLIENT, client_name);
client->hdr.name);
return 0;
}
+ Dmsg1(200, "Using client=%s\n", client->hdr.name);
if (fileset_name) {
fileset = (FILESET *)GetResWithName(R_FILESET, fileset_name);
jcr->verify_job = verify_job;
jcr->store = store;
+ /* If specific name given, zap all other stores */
+ if (store_name) {
+ for (i=0; i < MAX_STORE; i++) {
+ jcr->storage[i] = NULL;
+ }
+ }
jcr->client = client;
jcr->fileset = fileset;
jcr->pool = pool;
* there is enough memory, simply call the check_pool_memory_size()
* with the desired size and it will adjust only if necessary.
*
- * Kern E. Sibbald
+ * Kern E. Sibbald
*
* Version $Id$
*/
/*
- Copyright (C) 2000-2004 Kern Sibbald and John Walker
+ Copyright (C) 2000-2004 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
#include "bacula.h"
struct s_pool_ctl {
- int32_t size; /* default size */
- int32_t max_allocated; /* max allocated */
- int32_t max_used; /* max buffers used */
- int32_t in_use; /* number in use */
- struct abufhead *free_buf; /* pointer to free buffers */
+ int32_t size; /* default size */
+ int32_t max_allocated; /* max allocated */
+ int32_t max_used; /* max buffers used */
+ int32_t in_use; /* number in use */
+ struct abufhead *free_buf; /* pointer to free buffers */
};
/* Bacula Name length plus extra */
* Define default Pool buffer sizes
*/
static struct s_pool_ctl pool_ctl[] = {
- { 256, 256, 0, 0, NULL }, /* PM_NOPOOL no pooling */
- { NLEN, NLEN,0, 0, NULL }, /* PM_NAME Bacula name */
- { 256, 256, 0, 0, NULL }, /* PM_FNAME filename buffers */
- { 512, 512, 0, 0, NULL }, /* PM_MESSAGE message buffer */
- { 1024, 1024, 0, 0, NULL } /* PM_EMSG error message buffer */
+ { 256, 256, 0, 0, NULL }, /* PM_NOPOOL no pooling */
+ { NLEN, NLEN,0, 0, NULL }, /* PM_NAME Bacula name */
+ { 256, 256, 0, 0, NULL }, /* PM_FNAME filename buffers */
+ { 512, 512, 0, 0, NULL }, /* PM_MESSAGE message buffer */
+ { 1024, 1024, 0, 0, NULL } /* PM_EMSG error message buffer */
};
#else
/* This is used ONLY when stress testing the code */
static struct s_pool_ctl pool_ctl[] = {
- { 20, 20, 0, 0, NULL }, /* PM_NOPOOL no pooling */
- { NLEN, NLEN,0, 0, NULL }, /* PM_NAME Bacula name */
- { 20, 20, 0, 0, NULL }, /* PM_FNAME filename buffers */
- { 20, 20, 0, 0, NULL }, /* PM_MESSAGE message buffer */
- { 20, 20, 0, 0, NULL } /* PM_EMSG error message buffer */
+ { 20, 20, 0, 0, NULL }, /* PM_NOPOOL no pooling */
+ { NLEN, NLEN,0, 0, NULL }, /* PM_NAME Bacula name */
+ { 20, 20, 0, 0, NULL }, /* PM_FNAME filename buffers */
+ { 20, 20, 0, 0, NULL }, /* PM_MESSAGE message buffer */
+ { 20, 20, 0, 0, NULL } /* PM_EMSG error message buffer */
};
#endif
/* Memory allocation control structures and storage. */
struct abufhead {
- int32_t ablen; /* Buffer length in bytes */
- int32_t pool; /* pool */
- struct abufhead *next; /* pointer to next free buffer */
+ int32_t ablen; /* Buffer length in bytes */
+ int32_t pool; /* pool */
+ struct abufhead *next; /* pointer to next free buffer */
};
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pool_ctl[pool].free_buf = buf->next;
pool_ctl[pool].in_use++;
if (pool_ctl[pool].in_use > pool_ctl[pool].max_used) {
- pool_ctl[pool].max_used = pool_ctl[pool].in_use;
+ pool_ctl[pool].max_used = pool_ctl[pool].in_use;
}
V(mutex);
- Dmsg3(300, "sm_get_pool_memory reuse %x to %s:%d\n", buf, fname, lineno);
+ Dmsg3(800, "sm_get_pool_memory reuse %x to %s:%d\n", buf, fname, lineno);
sm_new_owner(fname, lineno, (char *)buf);
return (POOLMEM *)((char *)buf+HEAD_SIZE);
}
pool_ctl[pool].max_used = pool_ctl[pool].in_use;
}
V(mutex);
- Dmsg3(300, "sm_get_pool_memory give %x to %s:%d\n", buf, fname, lineno);
+ Dmsg3(800, "sm_get_pool_memory give %x to %s:%d\n", buf, fname, lineno);
return (POOLMEM *)((char *)buf+HEAD_SIZE);
}
pool = buf->pool;
pool_ctl[pool].in_use--;
if (pool == 0) {
- free((char *)buf); /* free nonpooled memory */
- } else { /* otherwise link it to the free pool chain */
+ free((char *)buf); /* free nonpooled memory */
+ } else { /* otherwise link it to the free pool chain */
#ifdef DEBUG
struct abufhead *next;
/* Don't let him free the same buffer twice */
for (next=pool_ctl[pool].free_buf; next; next=next->next) {
- if (next == buf) {
- Dmsg4(300, "bad free_pool_memory %x pool=%d from %s:%d\n", buf, pool, fname, lineno);
- V(mutex); /* unblock the pool */
- ASSERT(next != buf); /* attempt to free twice */
- }
+ if (next == buf) {
+ Dmsg4(800, "bad free_pool_memory %x pool=%d from %s:%d\n", buf, pool, fname, lineno);
+ V(mutex); /* unblock the pool */
+ ASSERT(next != buf); /* attempt to free twice */
+ }
}
#endif
buf->next = pool_ctl[pool].free_buf;
pool_ctl[pool].free_buf = buf;
}
- Dmsg4(300, "free_pool_memory %x pool=%d from %s:%d\n", buf, pool, fname, lineno);
+ Dmsg4(800, "free_pool_memory %x pool=%d from %s:%d\n", buf, pool, fname, lineno);
V(mutex);
}
#else
-/* ========= NO SMARTALLOC ========================================= */
+/* ========= NO SMARTALLOC ========================================= */
POOLMEM *get_pool_memory(int pool)
{
pool = buf->pool;
pool_ctl[pool].in_use--;
if (pool == 0) {
- free((char *)buf); /* free nonpooled memory */
- } else { /* otherwise link it to the free pool chain */
+ free((char *)buf); /* free nonpooled memory */
+ } else { /* otherwise link it to the free pool chain */
#ifdef DEBUG
struct abufhead *next;
/* Don't let him free the same buffer twice */
for (next=pool_ctl[pool].free_buf; next; next=next->next) {
- if (next == buf) {
- V(mutex);
- ASSERT(next != buf); /* attempt to free twice */
- }
+ if (next == buf) {
+ V(mutex);
+ ASSERT(next != buf); /* attempt to free twice */
+ }
}
#endif
buf->next = pool_ctl[pool].free_buf;
pool_ctl[pool].free_buf = buf;
}
- Dmsg2(300, "free_pool_memory %x pool=%d\n", buf, pool);
+ Dmsg2(800, "free_pool_memory %x pool=%d\n", buf, pool);
V(mutex);
}
for (int i=1; i<=PM_MAX; i++) {
buf = pool_ctl[i].free_buf;
while (buf) {
- next = buf->next;
- free((char *)buf);
- buf = next;
+ next = buf->next;
+ free((char *)buf);
+ buf = next;
}
pool_ctl[i].free_buf = NULL;
}
Dmsg0(-1, "Pool Maxsize Maxused Inuse\n");
for (int i=0; i<=PM_MAX; i++)
Dmsg4(-1, "%5s %7d %7d %5d\n", pool_name(i), pool_ctl[i].max_allocated,
- pool_ctl[i].max_used, pool_ctl[i].in_use);
+ pool_ctl[i].max_used, pool_ctl[i].in_use);
Dmsg0(-1, "\n");
}