1 /* config.c - bdb2 backend configuration file routine */
11 #include "back-bdb2.h"
14 bdb2i_back_config_internal(
22 struct ldbtype *lty = (struct ldbtype *) bi->bi_private;
25 fprintf( stderr, "%s: line %d: ldbm backend type info is null!\n",
30 /* directory where DB control files live */
31 if ( strcasecmp( argv[0], "home" ) == 0 ) {
34 "%s: line %d: missing dir in \"home <dir>\" line\n",
38 lty->lty_dbhome = ch_strdup( argv[1] );
40 /* size of the DB memory pool */
41 } else if ( strcasecmp( argv[0], "mpoolsize" ) == 0 ) {
44 "%s: line %d: missing size in \"mpoolsize <size>\" line\n",
48 lty->lty_mpsize = (size_t) atoi( argv[1] );
49 /* we should at least have the suggested 128k */
50 if ( lty->lty_mpsize < DEFAULT_DBCACHE_SIZE )
51 lty->lty_mpsize = DEFAULT_DBCACHE_SIZE;
56 "%s: line %d: unknown directive \"%s\" in ldbm backend definition (ignored)\n",
57 fname, lineno, argv[0] );
76 bdb2i_start_timing( bi, &time1 );
78 ret = bdb2i_back_config_internal( bi, fname, lineno, argc, argv );
79 bdb2i_stop_timing( bi, time1, "BE-CONFIG", NULL, NULL );
86 bdb2i_back_db_config_internal(
94 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
97 fprintf( stderr, "%s: line %d: ldbm database info is null!\n",
102 /* directory where database files live */
103 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
106 "%s: line %d: missing dir in \"directory <dir>\" line\n",
110 li->li_directory = ch_strdup( argv[1] );
113 ch_malloc( strlen(li->li_directory) + sizeof("/NEXTID") + 1 );
115 strcpy(li->li_nextid_file, li->li_directory);
116 strcat(li->li_nextid_file, "/NEXTID");
118 /* mode with which to create new database files */
119 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
122 "%s: line %d: missing mode in \"mode <mode>\" line\n",
126 li->li_mode = strtol( argv[1], NULL, 0 );
128 /* attribute to index */
129 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
132 "%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
135 } else if ( argc > 3 ) {
137 "%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line (ignored)\n",
140 bdb2i_attr_index_config( li, fname, lineno, argc - 1, &argv[1], 0 );
142 /* size of the cache in entries */
143 } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
146 "%s: line %d: missing size in \"cachesize <size>\" line\n",
150 li->li_cache.c_maxsize = atoi( argv[1] );
152 /* size of each dbcache in bytes */
153 } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
156 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
160 li->li_dbcachesize = atoi( argv[1] );
161 /* we should at least have the suggested 128k */
162 if ( li->li_dbcachesize < DEFAULT_DBCACHE_SIZE )
163 li->li_dbcachesize = DEFAULT_DBCACHE_SIZE;
166 } else if ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) {
167 li->li_dbcachewsync = 0;
172 "%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
173 fname, lineno, argv[0] );
189 struct timeval time1;
192 bdb2i_start_timing( be->bd_info, &time1 );
194 ret = bdb2i_back_db_config_internal( be, fname, lineno, argc, argv );
196 bdb2i_stop_timing( be->bd_info, time1, "DB-CONFIG", NULL, NULL );