1 /* config.c - bdb2 backend configuration file routine */
12 #include "back-bdb2.h"
15 bdb2i_back_config_internal(
23 struct ldbtype *lty = (struct ldbtype *) bi->bi_private;
26 fprintf( stderr, "%s: line %d: ldbm backend type info is null!\n",
31 /* directory where DB control files live */
32 if ( strcasecmp( argv[0], "home" ) == 0 ) {
35 "%s: line %d: missing dir in \"home <dir>\" line\n",
39 lty->lty_dbhome = ch_strdup( argv[1] );
41 /* size of the DB memory pool */
42 } else if ( strcasecmp( argv[0], "mpoolsize" ) == 0 ) {
45 "%s: line %d: missing size in \"mpoolsize <size>\" line\n",
49 lty->lty_mpsize = (size_t) atoi( argv[1] );
50 /* we should at least have the suggested 128k */
51 if ( lty->lty_mpsize < DEFAULT_DBCACHE_SIZE )
52 lty->lty_mpsize = DEFAULT_DBCACHE_SIZE;
57 "%s: line %d: unknown directive \"%s\" in ldbm backend definition (ignored)\n",
58 fname, lineno, argv[0] );
77 bdb2i_start_timing( bi, &time1 );
79 ret = bdb2i_back_config_internal( bi, fname, lineno, argc, argv );
80 bdb2i_stop_timing( bi, time1, "BE-CONFIG", NULL, NULL );
87 bdb2i_back_db_config_internal(
95 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
98 fprintf( stderr, "%s: line %d: ldbm database info is null!\n",
103 /* directory where database files live */
104 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
107 "%s: line %d: missing dir in \"directory <dir>\" line\n",
111 li->li_directory = ch_strdup( argv[1] );
114 ch_malloc( strlen(li->li_directory) + sizeof("/NEXTID") + 1 );
116 strcpy(li->li_nextid_file, li->li_directory);
117 strcat(li->li_nextid_file, "/NEXTID");
119 /* mode with which to create new database files */
120 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
123 "%s: line %d: missing mode in \"mode <mode>\" line\n",
127 li->li_mode = strtol( argv[1], NULL, 0 );
129 /* attribute to index */
130 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
133 "%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
136 } else if ( argc > 3 ) {
138 "%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line (ignored)\n",
141 bdb2i_attr_index_config( li, fname, lineno, argc - 1, &argv[1], 0 );
143 /* size of the cache in entries */
144 } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
147 "%s: line %d: missing size in \"cachesize <size>\" line\n",
151 li->li_cache.c_maxsize = atoi( argv[1] );
153 /* size of each dbcache in bytes */
154 } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
157 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
161 li->li_dbcachesize = atoi( argv[1] );
162 /* we should at least have the suggested 128k */
163 if ( li->li_dbcachesize < DEFAULT_DBCACHE_SIZE )
164 li->li_dbcachesize = DEFAULT_DBCACHE_SIZE;
167 } else if ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) {
168 li->li_dbcachewsync = 0;
173 "%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
174 fname, lineno, argv[0] );
190 struct timeval time1;
193 bdb2i_start_timing( be->bd_info, &time1 );
195 ret = bdb2i_back_db_config_internal( be, fname, lineno, argc, argv );
197 bdb2i_stop_timing( be->bd_info, time1, "DB-CONFIG", NULL, NULL );