]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_cmds.c
Turn off debug
[bacula/bacula] / bacula / src / dird / ua_cmds.c
index 6739db320b1bd442810a0f8554e083ce47e22ce9..fa983bb370a40422ce4ca6c5502c4e66199318a4 100644 (file)
@@ -47,51 +47,53 @@ extern jobq_t job_queue;              /* job queue */
 
 
 /* Imported functions */
-extern int status_cmd(UAContext *ua, const char *cmd);
+extern int autodisplay_cmd(UAContext *ua, const char *cmd);
+extern int gui_cmd(UAContext *ua, const char *cmd);
+extern int label_cmd(UAContext *ua, const char *cmd);
 extern int list_cmd(UAContext *ua, const char *cmd);
 extern int llist_cmd(UAContext *ua, const char *cmd);
-extern int show_cmd(UAContext *ua, const char *cmd);
 extern int messagescmd(UAContext *ua, const char *cmd);
-extern int autodisplay_cmd(UAContext *ua, const char *cmd);
-extern int gui_cmd(UAContext *ua, const char *cmd);
-extern int sqlquerycmd(UAContext *ua, const char *cmd);
-extern int querycmd(UAContext *ua, const char *cmd);
-extern int retentioncmd(UAContext *ua, const char *cmd);
 extern int prunecmd(UAContext *ua, const char *cmd);
 extern int purgecmd(UAContext *ua, const char *cmd);
-extern int restore_cmd(UAContext *ua, const char *cmd);
-extern int label_cmd(UAContext *ua, const char *cmd);
+extern int querycmd(UAContext *ua, const char *cmd);
 extern int relabel_cmd(UAContext *ua, const char *cmd);
+extern int restore_cmd(UAContext *ua, const char *cmd);
+extern int retentioncmd(UAContext *ua, const char *cmd);
+extern int show_cmd(UAContext *ua, const char *cmd);
+extern int sqlquerycmd(UAContext *ua, const char *cmd);
+extern int status_cmd(UAContext *ua, const char *cmd);
 extern int update_cmd(UAContext *ua, const char *cmd);
 
 /* Forward referenced functions */
 static int add_cmd(UAContext *ua, const char *cmd);
-static int create_cmd(UAContext *ua, const char *cmd);
+static int automount_cmd(UAContext *ua, const char *cmd);
 static int cancel_cmd(UAContext *ua, const char *cmd);
-static int enable_cmd(UAContext *ua, const char *cmd);
+static int create_cmd(UAContext *ua, const char *cmd);
+static int delete_cmd(UAContext *ua, const char *cmd);
 static int disable_cmd(UAContext *ua, const char *cmd);
-static int setdebug_cmd(UAContext *ua, const char *cmd);
-static int trace_cmd(UAContext *ua, const char *cmd);
-static int var_cmd(UAContext *ua, const char *cmd);
+static int enable_cmd(UAContext *ua, const char *cmd);
 static int estimate_cmd(UAContext *ua, const char *cmd);
 static int help_cmd(UAContext *ua, const char *cmd);
-static int delete_cmd(UAContext *ua, const char *cmd);
-static int use_cmd(UAContext *ua, const char *cmd);
-static int unmount_cmd(UAContext *ua, const char *cmd);
-static int version_cmd(UAContext *ua, const char *cmd);
-static int automount_cmd(UAContext *ua, const char *cmd);
-static int time_cmd(UAContext *ua, const char *cmd);
-static int reload_cmd(UAContext *ua, const char *cmd);
-static int delete_volume(UAContext *ua);
-static int delete_pool(UAContext *ua);
-static void delete_job(UAContext *ua);
+static int memory_cmd(UAContext *ua, const char *cmd);
 static int mount_cmd(UAContext *ua, const char *cmd);
+static int python_cmd(UAContext *ua, const char *cmd);
 static int release_cmd(UAContext *ua, const char *cmd);
-static int wait_cmd(UAContext *ua, const char *cmd);
+static int reload_cmd(UAContext *ua, const char *cmd);
+static int setdebug_cmd(UAContext *ua, const char *cmd);
 static int setip_cmd(UAContext *ua, const char *cmd);
-static int python_cmd(UAContext *ua, const char *cmd);
+static int time_cmd(UAContext *ua, const char *cmd);
+static int trace_cmd(UAContext *ua, const char *cmd);
+static int unmount_cmd(UAContext *ua, const char *cmd);
+static int use_cmd(UAContext *ua, const char *cmd);
+static int var_cmd(UAContext *ua, const char *cmd);
+static int version_cmd(UAContext *ua, const char *cmd);
+static int wait_cmd(UAContext *ua, const char *cmd);
+
 static void do_job_delete(UAContext *ua, JobId_t JobId);
 static void delete_job_id_range(UAContext *ua, char *tok);
+static int delete_volume(UAContext *ua);
+static int delete_pool(UAContext *ua);
+static void delete_job(UAContext *ua);
 
 int qhelp_cmd(UAContext *ua, const char *cmd);
 int quit_cmd(UAContext *ua, const char *cmd);
@@ -114,6 +116,7 @@ static struct cmdstruct commands[] = {
  { NT_("list"),       list_cmd,      _("list [pools | jobs | jobtotals | media <pool=pool-name> | files <jobid=nn>]; from catalog")},
  { NT_("label"),      label_cmd,     _("label a tape")},
  { NT_("llist"),      llist_cmd,     _("full or long list like list command")},
+ { NT_("memory"),     memory_cmd,    _("print current memory usage")},
  { NT_("messages"),   messagescmd,   _("messages")},
  { NT_("mount"),      mount_cmd,     _("mount <storage-name>")},
  { NT_("prune"),      prunecmd,      _("prune expired records from catalog")},
@@ -697,7 +700,7 @@ static int setip_cmd(UAContext *ua, const char *cmd)
       return 1;
    }
    LockRes();
-   client = (CLIENT *)GetResWithName(R_CLIENT, ua->cons->name());
+   client = GetClientResWithName(ua->cons->name());
 
    if (!client) {
       ua->error_msg(_("Client \"%s\" not found.\n"), ua->cons->name());
@@ -730,7 +733,7 @@ static void do_en_disable_cmd(UAContext *ua, bool setting)
       }
    } else {
       LockRes();
-      job = (JOB *)GetResWithName(R_JOB, ua->argv[i]);
+      job = GetJobResWithName(ua->argv[i]);
       UnlockRes();
    } 
    if (!job) {
@@ -946,7 +949,7 @@ static int setdebug_cmd(UAContext *ua, const char *cmd)
           strcasecmp(ua->argk[i], "fd") == 0) {
          client = NULL;
          if (ua->argv[i]) {
-            client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[i]);
+            client = GetClientResWithName(ua->argv[i]);
             if (client) {
                do_client_setdebug(ua, client, level, trace_flag);
                return 1;
@@ -964,7 +967,7 @@ static int setdebug_cmd(UAContext *ua, const char *cmd)
           strcasecmp(ua->argk[i], NT_("sd")) == 0) {
          store = NULL;
          if (ua->argv[i]) {
-            store = (STORE *)GetResWithName(R_STORAGE, ua->argv[i]);
+            store = GetStoreResWithName(ua->argv[i]);
             if (store) {
                do_storage_setdebug(ua, store, level, trace_flag);
                return 1;
@@ -1068,13 +1071,13 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
       if (strcasecmp(ua->argk[i], NT_("client")) == 0 ||
           strcasecmp(ua->argk[i], NT_("fd")) == 0) {
          if (ua->argv[i]) {
-            client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[i]);
+            client = GetClientResWithName(ua->argv[i]);
             continue;
          }
       }
       if (strcasecmp(ua->argk[i], NT_("job")) == 0) {
          if (ua->argv[i]) {
-            job = (JOB *)GetResWithName(R_JOB, ua->argv[i]);
+            job = GetJobResWithName(ua->argv[i]);
             if (job && !acl_access_ok(ua, Job_ACL, job->name())) {
                ua->error_msg(_("No authorization for Job \"%s\"\n"), job->name());
                return 1;
@@ -1084,7 +1087,7 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
       }
       if (strcasecmp(ua->argk[i], NT_("fileset")) == 0) {
          if (ua->argv[i]) {
-            fileset = (FILESET *)GetResWithName(R_FILESET, ua->argv[i]);
+            fileset = GetFileSetResWithName(ua->argv[i]);
             if (fileset && !acl_access_ok(ua, FileSet_ACL, fileset->name())) {
                ua->error_msg(_("No authorization for FileSet \"%s\"\n"), fileset->name());
                return 1;
@@ -1109,7 +1112,7 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
       }
    }
    if (!job) {
-      job = (JOB *)GetResWithName(R_JOB, ua->argk[1]);
+      job = GetJobResWithName(ua->argk[1]);
       if (!job) {
          ua->error_msg(_("No job specified.\n"));
          return 1;
@@ -1399,6 +1402,12 @@ static int delete_pool(UAContext *ua)
    return 1;
 }
 
+int memory_cmd(UAContext *ua, const char *cmd)
+{
+   list_dir_status_header(ua);
+   sm_dump(false);
+   return 1;
+}
 
 static void do_mount_cmd(UAContext *ua, const char *command)
 {
@@ -1715,7 +1724,7 @@ bool open_client_db(UAContext *ua)
          ua->error_msg(_("No authorization for Catalog \"%s\"\n"), ua->argv[i]);
          return false;
       }
-      catalog = (CAT *)GetResWithName(R_CATALOG, ua->argv[i]);
+      catalog = GetCatalogResWithName(ua->argv[i]);
       if (catalog) {
          if (ua->catalog && ua->catalog != catalog) {
             close_db(ua);
@@ -1732,7 +1741,7 @@ bool open_client_db(UAContext *ua)
          ua->error_msg(_("No authorization for Client \"%s\"\n"), ua->argv[i]);
          return false;
       }
-      client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[i]);
+      client = GetClientResWithName(ua->argv[i]);
       if (client) {
          catalog = client->catalog;
          if (ua->catalog && ua->catalog != catalog) {
@@ -1754,7 +1763,7 @@ bool open_client_db(UAContext *ua)
          ua->error_msg(_("No authorization for Job \"%s\"\n"), ua->argv[i]);
          return false;
       }
-      job = (JOB *)GetResWithName(R_JOB, ua->argv[i]);
+      job = GetJobResWithName(ua->argv[i]);
       if (job) {
          catalog = job->client->catalog;
          if (ua->catalog && ua->catalog != catalog) {
@@ -1791,7 +1800,7 @@ bool open_db(UAContext *ua)
 
    ua->jcr->catalog = ua->catalog;
 
-   Dmsg0(150, "Open database\n");
+   Dmsg0(100, "UA Open database\n");
    ua->db = db_init_database(ua->jcr, ua->catalog->db_name, ua->catalog->db_user,
                              ua->catalog->db_password, ua->catalog->db_address,
                              ua->catalog->db_port, ua->catalog->db_socket,