]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/filed_conf.c
Fix typo
[bacula/bacula] / bacula / src / filed / filed_conf.c
index dd4db8c282e66d105c30d3a8bae9552212da6f81..bade134359fccad47e3d6233b37293ff77b7af2c 100644 (file)
@@ -51,7 +51,6 @@
  */
 int r_first = R_FIRST;
 int r_last  = R_LAST;
-pthread_mutex_t res_mutex =  PTHREAD_MUTEX_INITIALIZER;
 
 /* Forward referenced subroutines */
 
@@ -61,8 +60,15 @@ pthread_mutex_t res_mutex =  PTHREAD_MUTEX_INITIALIZER;
  * then move it to allocated memory when the resource
  * scan is complete.
  */
+#if defined(HAVE_WIN32) && !defined(HAVE_CYGWIN)
+extern "C" { // work around visual compiler mangling variables
+    URES res_all;
+    int  res_all_size = sizeof(res_all);
+}
+#else
 URES res_all;
 int  res_all_size = sizeof(res_all);
+#endif
 
 /* Definition of records permitted within each
  * resource with the routine to process the record 
@@ -70,7 +76,7 @@ int  res_all_size = sizeof(res_all);
  */ 
 
 /* Client or File daemon "Global" resources */
-static struct res_items cli_items[] = {
+static RES_ITEM cli_items[] = {
    {"name",        store_name,  ITEM(res_client.hdr.name), 0, ITEM_REQUIRED, 0},
    {"description", store_str,   ITEM(res_client.hdr.desc), 0, 0, 0},
    {"fdport",      store_pint,  ITEM(res_client.FDport),  0, ITEM_DEFAULT, 9102},
@@ -83,11 +89,12 @@ static struct res_items cli_items[] = {
    {"messages",      store_res, ITEM(res_client.messages), R_MSGS, 0, 0},
    {"heartbeatinterval", store_time, ITEM(res_client.heartbeat_interval), 0, ITEM_DEFAULT, 0},
    {"sdconnecttimeout", store_time,ITEM(res_client.SDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
+   {"maximumnetworkbuffersize", store_pint, ITEM(res_client.max_network_buffer_size), 0, 0, 0},
    {NULL, NULL, NULL, 0, 0, 0} 
 };
 
 /* Directors that can use our services */
-static struct res_items dir_items[] = {
+static RES_ITEM dir_items[] = {
    {"name",        store_name,     ITEM(res_dir.hdr.name),  0, ITEM_REQUIRED, 0},
    {"description", store_str,      ITEM(res_dir.hdr.desc),  0, 0, 0},
    {"password",    store_password, ITEM(res_dir.password),  0, ITEM_REQUIRED, 0},
@@ -97,13 +104,13 @@ static struct res_items dir_items[] = {
 };
 
 /* Message resource */
-extern struct res_items msgs_items[];
+extern RES_ITEM msgs_items[];
 
 /* 
  * This is the master resource definition.  
  * It must have one item for each of the resources.
  */
-struct s_res resources[] = {
+RES_TABLE resources[] = {
    {"director",      dir_items,   R_DIRECTOR,  NULL},
    {"filedaemon",    cli_items,   R_CLIENT,    NULL},
    {"client",        cli_items,   R_CLIENT,    NULL}, /* alias for filedaemon */
@@ -156,13 +163,10 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, char *fmt, ...
  * resource chain is traversed.  Mainly we worry about freeing
  * allocated strings (names).
  */
-void free_resource(int type)
+void free_resource(RES *sres, int type)
 {
-   URES *res;
    RES *nres;
-   int rindex = type - r_first;
-
-   res = (URES *)resources[rindex].res_head;
+   URES *res = (URES *)sres;
 
    if (res == NULL) {
       return;
@@ -215,9 +219,8 @@ void free_resource(int type)
    if (res) {
       free(res);
    }
-   resources[rindex].res_head = nres;
    if (nres) {
-      free_resource(type);
+      free_resource(nres, type);
    }
 }
 
@@ -225,7 +228,7 @@ void free_resource(int type)
  * the resource. If this is pass 2, we update any resource
  * pointers (currently only in the Job resource).
  */
-void save_resource(int type, struct res_items *items, int pass)
+void save_resource(int type, RES_ITEM *items, int pass)
 {
    URES *res;
    int rindex = type - r_first;
@@ -308,8 +311,13 @@ void save_resource(int type, struct res_items *items, int pass)
       } else {
         RES *next;
         /* Add new res to end of chain */
-        for (next=resources[rindex].res_head; next->next; next=next->next)
-           { }
+        for (next=resources[rindex].res_head; next->next; next=next->next) {
+           if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
+              Emsg2(M_ERROR_TERM, 0,
+                  _("Attempt to define second %s resource named \"%s\" is not permitted.\n"),
+                 resources[rindex].name, res->res_dir.hdr.name);
+           }
+        }
         next->next = (RES *)res;
          Dmsg2(90, "Inserting %s res: %s\n", res_to_str(type),
               res->res_dir.hdr.name);