int WriteLmgrConfigDefault( FILE * output ) { print_begin_block( output, 0, LMGR_CONFIG_BLOCK, NULL ); print_line( output, 1, "commit_behavior : autocommit" ); print_line( output, 1, "connect_retry_interval_min : 1s" ); print_line( output, 1, "connect_retry_interval_max : 30s" ); print_line( output, 1, "user_acct : enabled" ); print_line( output, 1, "group_acct : enabled" ); fprintf( output, "\n" ); #ifdef _MYSQL print_begin_block( output, 1, MYSQL_CONFIG_BLOCK, NULL ); print_line( output, 2, "server : localhost" ); print_line( output, 2, "db : [MANDATORY]" ); print_line( output, 2, "user : robinhood" ); print_line( output, 2, "password|password_file : [MANDATORY]" ); print_line( output, 2, "port : (MySQL default)" ); print_line( output, 2, "socket : NONE" ); print_line( output, 2, "innodb : disabled" ); print_end_block( output, 1 ); #elif defined (_SQLITE) print_begin_block( output, 1, SQLITE_CONFIG_BLOCK, NULL ); print_line( output, 2, "db_file : \"/var/robinhood/robinhood_sqlite_db\"" ); print_line( output, 2, "retry_delay_microsec : 1000 (1 millisec)" ); print_end_block( output, 1 ); #endif print_end_block( output, 0 ); return 0; }
static void lmgr_cfg_write_default(FILE *output) { print_begin_block(output, 0, LMGR_CONFIG_BLOCK, NULL); print_line(output, 1, "commit_behavior : transaction"); print_line(output, 1, "connect_retry_interval_min : 1s"); print_line(output, 1, "connect_retry_interval_max : 30s"); print_line(output, 1, "accounting : enabled"); fprintf(output, "\n"); #ifdef _MYSQL print_begin_block(output, 1, MYSQL_CONFIG_BLOCK, NULL); print_line(output, 2, "server : localhost"); print_line(output, 2, "db : [MANDATORY]"); print_line(output, 2, "user : robinhood"); print_line(output, 2, "password|password_file : [MANDATORY]"); print_line(output, 2, "port : (MySQL default)"); print_line(output, 2, "socket : NONE"); print_line(output, 2, "engine : InnoDB"); print_end_block(output, 1); #elif defined(_SQLITE) print_begin_block(output, 1, SQLITE_CONFIG_BLOCK, NULL); print_line(output, 2, "db_file : \"/var/robinhood/robinhood_sqlite_db\""); print_line(output, 2, "retry_delay_microsec : 1000 (1 millisec)"); print_end_block(output, 1); #endif print_end_block(output, 0); }
int Write_EntryProc_ConfigTemplate( FILE * output ) { int i; print_begin_block( output, 0, ENTRYPROC_CONFIG_BLOCK, NULL ); #ifndef _LUSTRE_HSM print_line( output, 1, "# Raise alerts for directories with too many entries" ); print_begin_block( output, 1, ALERT_BLOCK, "Too_many_entries_in_directory" ); print_line( output, 2, "type == directory" ); print_line( output, 2, "and" ); print_line( output, 2, "dircount > 10000" ); print_end_block( output, 1 ); fprintf( output, "\n" ); #endif print_line( output, 1, "# Raise alerts for large files" ); print_begin_block( output, 1, ALERT_BLOCK, "Large_file" ); #ifndef _LUSTRE_HSM print_line( output, 2, "type == file" ); print_line( output, 2, "and" ); #endif print_line( output, 2, "size > 100GB" ); print_end_block( output, 1 ); fprintf( output, "\n" ); print_line( output, 1, "# nbr of worker threads for processing pipeline tasks" ); print_line( output, 1, "nb_threads = 8 ;" ); fprintf( output, "\n" ); print_line( output, 1, "# Max number of operations in the Entry Processor pipeline." ); print_line( output, 1, "# If the number of pending operations exceeds this limit, " ); print_line( output, 1, "# info collectors are suspended until this count decreases" ); #ifdef _SQLITE print_line( output, 1, "max_pending_operations = 1000 ;" ); #else print_line( output, 1, "max_pending_operations = 10000 ;" ); #endif fprintf( output, "\n" ); print_line( output, 1, "# Optionnaly specify a maximum thread count for each stage of the pipeline:" ); print_line( output, 1, "# <stagename>_threads_max = <n> (0: use default)" ); for ( i = 0; i < PIPELINE_STAGE_COUNT; i++ ) { if ( entry_proc_pipeline[i].stage_flags & STAGE_FLAG_PARALLEL ) print_line( output, 1, "# %s_threads_max\t= 8 ;", entry_proc_pipeline[i].stage_name ); else if ( entry_proc_pipeline[i].stage_flags & STAGE_FLAG_MAX_THREADS ) print_line( output, 1, "%s_threads_max\t= %u ;", entry_proc_pipeline[i].stage_name, entry_proc_pipeline[i].max_thread_count ); } fprintf( output, "\n" ); print_line( output, 1, "# if set to FALSE, classes will only be matched"); print_line( output, 1, "# at policy application time (not during a scan or reading changelog)" ); print_line( output, 1, "match_classes = TRUE;"); print_end_block( output, 0 ); return 0; }
int FSScan_WriteConfigTemplate( FILE * output ) { print_begin_block( output, 0, FSSCAN_CONFIG_BLOCK, NULL ); print_line( output, 1, "# simple scan interval (fixed)" ); #ifdef HAVE_CHANGELOGS print_line( output, 1, "scan_interval = 2d ;" ); #else print_line( output, 1, "scan_interval = 6h ;" ); #endif fprintf( output, "\n" ); print_line( output, 1, "# min/max for adaptive scan interval:" ); print_line( output, 1, "# the more the filesystem is full, the more frequently it is scanned." ); #ifdef HAVE_CHANGELOGS print_line( output, 1, "#min_scan_interval = 24h ;" ); print_line( output, 1, "#max_scan_interval = 7d ;" ); #else print_line( output, 1, "#min_scan_interval = 2h ;" ); print_line( output, 1, "#max_scan_interval = 12h ;" ); #endif fprintf( output, "\n" ); print_line( output, 1, "# number of threads used for scanning the filesystem" ); print_line( output, 1, "nb_threads_scan = 2 ;" ); fprintf( output, "\n" ); print_line( output, 1, "# when a scan fails, this is the delay before retrying" ); print_line( output, 1, "scan_retry_delay = 1h ;" ); fprintf( output, "\n" ); print_line( output, 1, "# timeout for operations on the filesystem" ); print_line( output, 1, "scan_op_timeout = 1h ;" ); print_line( output, 1, "# exit if operation timeout is reached?" ); print_line( output, 1, "exit_on_timeout = TRUE ;" ); print_line( output, 1, "# external command called on scan termination"); print_line( output, 1, "# special arguments can be specified: {cfg} = config file path,"); print_line( output, 1, "# {fspath} = path to managed filesystem"); print_line( output, 1, "#completion_command = \"/path/to/my/script.sh -f {cfg} -p {fspath}\" ;" ); fprintf( output, "\n" ); print_line( output, 1, "# Internal scheduler granularity (for testing and of scan, hangs, ...)" ); print_line( output, 1, "spooler_check_interval = 1min ;" ); fprintf( output, "\n" ); print_line( output, 1, "# Memory preallocation parameters" ); print_line( output, 1, "nb_prealloc_tasks = 256 ;" ); fprintf( output, "\n" ); print_begin_block( output, 1, IGNORE_BLOCK, NULL ); print_line( output, 2, "# ignore \".snapshot\" and \".snapdir\" directories (don't scan them)" ); print_line( output, 2, "type == directory" ); print_line( output, 2, "and" ); print_line( output, 2, "( name == \".snapdir\" or name == \".snapshot\" )" ); print_end_block( output, 1 ); print_end_block( output, 0 ); return 0; }
static void dump_msft_func(int n) { int size, args_cnt, i, extra_attr, fkccic; print_begin_block_id("FuncRecord", n); size = print_short_hex("size"); print_short_hex("index"); print_hex("DataType"); print_hex("flags"); print_short_hex("VtableOffset"); print_short_hex("funcdescsize"); fkccic = print_hex("FKCCIC"); args_cnt = print_short_hex("nrargs"); print_short_hex("noptargs"); extra_attr = size/sizeof(INT) - 6 - args_cnt*(fkccic&0x1000 ? 4 : 3); if(extra_attr) print_hex("helpcontext"); if(extra_attr >= 2) print_hex("oHelpString"); if(extra_attr >= 3) print_hex("toEntry"); if(extra_attr >= 4) print_hex("res9"); if(extra_attr >= 5) print_hex("resA"); if(extra_attr >= 6) print_hex("HelpStringContext"); if(extra_attr >= 7) print_hex("oCustData"); for(i = 0; i < extra_attr-7; i++) print_hex_id("oArgCustData", i); if(fkccic & 0x1000) { for(i=0; i < args_cnt; i++) print_hex_id("default value[%d]", i); } for(i=0; i < args_cnt; i++) { print_begin_block_id("param", i); /* FIXME: Handle default values */ print_hex("data[0]"); print_hex("paramflags"); print_hex("data[2]"); print_end_block(); } print_end_block(); }
int WriteLmgrConfigTemplate( FILE * output ) { print_begin_block( output, 0, LMGR_CONFIG_BLOCK, NULL ); print_line( output, 1, "# Method for committing information to database." ); print_line( output, 1, "# Possible values are:" ); print_line( output, 1, "# - \"autocommit\": weak transactions (more efficient, but database inconsistencies may occur)" ); print_line( output, 1, "# - \"transaction\": manage operations in transactions (best consistency, lower performance)" ); print_line( output, 1, "# - \"periodic(<nb_transaction>)\": periodically commit (every <n> transactions)." ); #ifdef _MYSQL print_line( output, 1, "commit_behavior = autocommit ;" ); #elif defined (_SQLITE) print_line( output, 1, "commit_behavior = transaction ;" ); #endif fprintf( output, "\n" ); print_line( output, 1, "# Minimum time (in seconds) to wait before trying to reestablish a lost connection." ); print_line( output, 1, "# Then this time is multiplied by 2 until reaching connect_retry_interval_max" ); print_line( output, 1, "connect_retry_interval_min = 1 ;" ); print_line( output, 1, "connect_retry_interval_max = 30 ;" ); print_line( output, 1, "# disable the following options if your are not interested in" ); print_line( output, 1, "# user or group stats (to speed up scan)" ); print_line( output, 1, "user_acct = enabled ;" ); print_line( output, 1, "group_acct = enabled ;" ); fprintf( output, "\n" ); #ifdef _MYSQL print_begin_block( output, 1, MYSQL_CONFIG_BLOCK, NULL ); print_line( output, 2, "server = \"localhost\" ;" ); print_line( output, 2, "db = \"robinhood_db\" ;" ); print_line( output, 2, "user = \"robinhood\" ;" ); print_line( output, 2, "password_file = \"/etc/robinhood.d/.dbpassword\" ;" ); print_line( output, 2, "port = 3306 ;" ); print_line( output, 2, "socket = \"/tmp/mysql.sock\" ;" ); print_line( output, 2, "innodb = enabled ;" ); print_end_block( output, 1 ); #elif defined (_SQLITE) print_begin_block( output, 1, SQLITE_CONFIG_BLOCK, NULL ); print_line( output, 2, "db_file = \"/var/robinhood/robinhood_sqlite_db\" ;" ); print_line( output, 2, "retry_delay_microsec = 1000 ;" ); print_end_block( output, 1 ); #endif print_end_block( output, 0 ); return 0; }
static void dump_msft_typeinfobase(void) { print_begin_block_id("TypeInfoBase", msft_typeinfo_cnt); msft_typeinfo_kind[msft_typeinfo_cnt] = print_hex("typekind"); msft_typeinfo_offs[msft_typeinfo_cnt] = print_hex("memoffset"); print_hex("res2"); print_hex("res3"); print_hex("res4"); print_hex("res5"); msft_typeinfo_elemcnt[msft_typeinfo_cnt] = print_hex("cElement"); print_hex("res7"); print_hex("res8"); print_hex("res9"); print_hex("resA"); print_hex("posguid"); print_hex("flags"); print_hex("NameOffset"); print_hex("version"); print_hex("docstringoffs"); print_hex("docstringcontext"); print_hex("helpcontext"); print_hex("oCustData"); msft_typeinfo_impltypes[msft_typeinfo_cnt++] = print_short_hex("cImplTypes"); print_short_hex("bSizeVftt"); print_dec("size"); print_hex("datatype1"); print_hex("datatype2"); print_hex("res18"); print_hex("res19"); print_end_block(); }
static void dump_msft_header(void) { print_begin_block("Header"); print_hex("magic1"); print_hex("magic2"); print_hex("posguid"); print_hex("lcid"); print_hex("lsid2"); header_flags = print_hex("varflags"); print_hex("version"); print_hex("flags"); typeinfo_cnt = print_dec("ntypeinfos"); print_hex("helpstring"); print_hex("helpstringcontext"); print_hex("helpcontext"); print_dec("nametablecont"); print_dec("nametablechars"); print_hex("NameOffset"); print_hex("helpfile"); print_hex("CustomDataOffset"); print_hex("res44"); print_hex("res48"); print_hex("dispatchpos"); print_hex("res50"); print_end_block(); }
int WriteLogConfigTemplate( FILE * output ) { print_begin_block( output, 0, RBH_LOG_CONFIG_BLOCK, NULL ); print_line( output, 1, "# Log verbosity level" ); print_line( output, 1, "# Possible values are: CRIT, MAJOR, EVENT, VERB, DEBUG, FULL" ); print_line( output, 1, "debug_level = EVENT ;" ); fprintf( output, "\n" ); print_line( output, 1, "# Log file" ); print_line( output, 1, "log_file = \"/var/log/robinhood.log\" ;" ); fprintf( output, "\n" ); print_line( output, 1, "# File for reporting purge events" ); print_line( output, 1, "report_file = \"/var/log/robinhood_reports.log\" ;" ); fprintf( output, "\n" ); print_line( output, 1, "# set alert_file, alert_mail or both depending on the alert method you wish" ); print_line( output, 1, "alert_file = \"/var/log/robinhood_alerts.log\" ;" ); print_line( output, 1, "alert_mail = \"root@localhost\" ;" ); fprintf( output, "\n" ); print_line( output, 1, "# Interval for dumping stats (to logfile)" ); print_line( output, 1, "stats_interval = 20min ;" ); fprintf( output, "\n" ); print_line( output, 1, "# Alert batching (to send a digest instead of 1 alert per file)" ); print_line( output, 1, "# 0: unlimited batch size, 1: no batching (1 alert per file)," ); print_line( output, 1, "# N>1: batch N alerts per digest" ); print_line( output, 1, "batch_alert_max = 5000 ;" ); print_line( output, 1, "# Give the detail of entry attributes for each alert?" ); print_line( output, 1, "alert_show_attrs = FALSE ;" ); print_end_block( output, 0 ); return 0; }
static BOOL dump_msft_custdata(seg_t *seg) { unsigned short vt; unsigned i, n; print_begin_block("CustData"); for(i=0; offset < seg->offset+seg->length; i++) { print_offset(); vt = tlb_read_short(); printf("vt %d", vt); n = tlb_read_int(); switch(vt) { case 8 /* VT_BSTR */: printf(" len %d: ", n); dump_string(n, 2); printf("\n"); break; default: printf(": %x ", n); printf("\\%2.2x \\%2.2x\n", tlb_read_byte(), tlb_read_byte()); } } print_end_block(); return TRUE; }
static int dump_msft_res0f(seg_t *seg) { print_begin_block("res0f"); dump_binary(seg->length); print_end_block(); return -1; }
static BOOL dump_msft_res0e(seg_t *seg) { print_begin_block("res0e"); dump_binary(seg->length); print_end_block(); return TRUE; }
static int dump_msft_res07(seg_t *seg) { print_begin_block("res07"); dump_binary(seg->length); /* FIXME */ print_end_block(); return -1; }
static int dump_msft_arraydescs(seg_t *seg) { print_begin_block("ArrayDescriptions"); dump_binary(seg->length); /* FIXME */ print_end_block(); return -1; }
static int dump_msft_custdata(seg_t *seg) { print_begin_block("CustData"); dump_binary(seg->length); /* FIXME */ print_end_block(); return -1; }
static void dump_msft_typedesc(int n) { print_begin_block_id("TYPEDESC", n); print_hex("hreftype"); print_hex("vt"); print_end_block(); }
static BOOL dump_msft_namehashtab(seg_t *seg) { print_begin_block("NameHashTab"); dump_binary(seg->length); /* FIXME */ print_end_block(); return TRUE; }
int Write_Rmdir_ConfigDefault( FILE * output ) { print_begin_block( output, 0, RMDIR_PARAM_BLOCK, NULL ); print_line( output, 1, "runtime_interval : 6h" ); print_line( output, 1, "nb_threads_rmdir : 4" ); print_line( output, 1, "rmdir_queue_size : 256" ); print_end_block( output, 0 ); return 0; }
static void dump_msft_impinfo(int n) { print_begin_block_id("ImpInfo", n); print_hex("flags"); print_hex("oImpInfo"); print_hex("oGuid"); print_end_block(); }
static void dump_msft_guidentry(int n) { print_begin_block_id("GuidEntry", n); print_guid("guid"); print_hex("hreftype"); print_hex("next_hash"); print_end_block(); }
static void dump_msft_cdguid(int n) { print_begin_block_id("CGUid", n); print_hex("GuidOffset"); print_hex("DataOffset"); print_hex("next"); print_end_block(); }
static int dump_msft_stringtab(seg_t *seg) { print_begin_block("StringTab"); dump_binary(seg->length); /* FIXME */ print_end_block(); return -1; }
static int dump_msft_reftabs(seg_t *seg) { print_begin_block("RefTab"); dump_binary(seg->length); /* FIXME */ print_end_block(); return -1; }
int Write_EntryProc_ConfigDefault( FILE * output ) { print_begin_block( output, 0, ENTRYPROC_CONFIG_BLOCK, NULL ); print_line( output, 1, "nb_threads : 8" ); print_line( output, 1, "max_pending_operations : 10000" ); print_line( output, 1, "match_classes : TRUE" ); print_line( output, 1, "alert : NONE" ); print_end_block( output, 0 ); return 0; }
static int dump_msft_typeinfo(int n) { int i; print_begin_block_id("TypeInfo", n); if((msft_typeinfo_kind[n] & 0xf) == TKIND_COCLASS) { dump_msft_coclass(n); print_end_block(); return -1; } print_dec("size"); for(i = 0; i < LOWORD(msft_typeinfo_elemcnt[n]); i++) dump_msft_func(i); for(i = 0; i < HIWORD(msft_typeinfo_elemcnt[n]); i++) dump_msft_var(i); for(i = 0; i < LOWORD(msft_typeinfo_elemcnt[n]); i++) print_hex_id("func %d id", i); for(i = 0; i < HIWORD(msft_typeinfo_elemcnt[n]); i++) print_hex_id("var %d id", i); for(i = 0; i < LOWORD(msft_typeinfo_elemcnt[n]); i++) print_hex_id("func %d name", i); for(i = 0; i < HIWORD(msft_typeinfo_elemcnt[n]); i++) print_hex_id("var %d name", i); for(i = 0; i < LOWORD(msft_typeinfo_elemcnt[n]); i++) print_hex_id("func %d offset", i); for(i = 0; i < HIWORD(msft_typeinfo_elemcnt[n]); i++) print_hex_id("var %d offset", i); print_end_block(); return -1; }
static void dump_msft_segdir(void) { int i; print_begin_block("SegDir"); for(i=0; i < sizeof(segdir)/sizeof(segdir[0]); i++) dump_msft_seg(segdir+i); print_end_block(); }
static void dump_msft_seg(seg_t *seg) { print_begin_block(seg->name); seg->offset = print_hex("offset"); seg->length = print_dec("length"); print_hex("res08"); print_hex("res0c"); print_end_block(); }
static void dump_msft_ref(int n) { print_begin_block_id("RefRecord", n); print_hex("reftype"); print_hex("flags"); print_hex("oCustData"); print_hex("onext"); print_end_block(); }
static void dump_msft_impfile(int n) { print_begin_block_id("ImpFile", n); print_hex("guid"); print_hex("lcid"); print_hex("version"); print_ctl2("impfile"); print_end_block(); }
static int dump_msft_libtab(seg_t *seg) { print_begin_block("LibTab"); dump_binary(seg->length); /* FIXME */ print_end_block(); assert(offset == seg->offset+seg->length); return -1; }