aboutsummaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-04-22 15:20:46 +0000
committerBart Polot <bart@net.in.tum.de>2013-04-22 15:20:46 +0000
commite6a98706bcdbe18ca3432dbc234c17ff893e7097 (patch)
tree227ff3364106c9e9b7754aafdaa31ba363686fcb /src/regex
parentbf0fb9e89a461e7aa874f11f12c81bbd83fabfbd (diff)
downloadgnunet-e6a98706bcdbe18ca3432dbc234c17ff893e7097.tar.gz
gnunet-e6a98706bcdbe18ca3432dbc234c17ff893e7097.zip
- add disk scan
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/gnunet-daemon-regexprofiler.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c
index b7054e2c7..4fb620b57 100644
--- a/src/regex/gnunet-daemon-regexprofiler.c
+++ b/src/regex/gnunet-daemon-regexprofiler.c
@@ -267,6 +267,29 @@ load_regexes (const char *filename, char **rx)
267 return rx_cnt; 267 return rx_cnt;
268} 268}
269 269
270/**
271 * Scan through the policy_dir looking for the n-th filename.
272 *
273 * @param cls Closure (target number n).
274 * @param filename complete filename (absolute path).
275 * @return GNUNET_OK to continue to iterate,
276 * GNUNET_NO to stop when found
277 */
278static int
279scan (void *cls, const char *filename)
280{
281 long n = (long) cls;
282 static long c = 0;
283
284 if (c == n)
285 {
286 policy_filename = GNUNET_strdup (filename);
287 return GNUNET_NO;
288 }
289 c++;
290 return GNUNET_OK;
291}
292
270 293
271/** 294/**
272 * @brief Main function that will be run by the scheduler. 295 * @brief Main function that will be run by the scheduler.
@@ -363,6 +386,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
363 } 386 }
364 387
365 /* Read regexes from policy files */ 388 /* Read regexes from policy files */
389 GNUNET_assert (-1 != GNUNET_DISK_directory_scan (policy_dir, &scan, peer_id));
366 if (0 == load_regexes (policy_filename, &regex)) 390 if (0 == load_regexes (policy_filename, &regex))
367 { 391 {
368 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 392 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,