1/* 2 * Copyright 2004-2008, Fran��ois Revol, <revol@free.fr>. 3 * Distributed under the terms of the MIT License. 4 */ 5 6#include <stdlib.h> 7#include <string.h> 8#include <driver_settings.h> 9#include <KernelExport.h> 10#include "settings.h" 11 12#include <stdio.h> 13 14#define DEFAULT_MAX_VNODES 5000 15uint32 max_vnodes = DEFAULT_MAX_VNODES; 16uint32 max_results = 50; 17bool sync_unlink_queries = false; 18 19status_t load_settings(void) 20{ 21 void *handle; 22 const char *val; 23 handle = load_driver_settings("websearchfs"); 24 if (!handle) 25 return ENOENT; 26 27 fprintf(stderr, "websearchfs: loaded settings\n"); 28 29 val = get_driver_parameter(handle, "max_nodes", "5000", "5000"); 30 max_vnodes = strtoul(val, NULL, 10); 31 max_vnodes = MIN(max_vnodes, 1000000); 32 max_vnodes = MAX(max_vnodes, 10); 33 34 val = get_driver_parameter(handle, "max_results", "50", "50"); 35 max_results = strtoul(val, NULL, 10); 36 max_results = MIN(max_results, 1000); 37 max_results = MAX(max_results, 5); 38 39 sync_unlink_queries = get_driver_boolean_parameter(handle, "sync_unlink", false, true); 40 41 fprintf(stderr, "websearchfs: settings: max_nodes = %" B_PRIu32 "\n", max_vnodes); 42 fprintf(stderr, "websearchfs: settings: max_results = %" B_PRIu32 " \n", max_results); 43 fprintf(stderr, "websearchfs: settings: sync_unlink = %c\n", sync_unlink_queries?'t':'f'); 44 unload_driver_settings(handle); 45 return B_OK; 46} 47 48