profile.c revision 79d16311c8d0c7188d73df77838fb1b4b6ff58db
1#include "fio.h" 2#include "profile.h" 3#include "debug.h" 4#include "flist.h" 5 6static FLIST_HEAD(profile_list); 7 8int load_profile(const char *profile) 9{ 10 struct profile_ops *ops; 11 struct flist_head *n; 12 13 dprint(FD_PROFILE, "loading profile '%s'\n", profile); 14 15 flist_for_each(n, &profile_list) { 16 ops = flist_entry(n, struct profile_ops, list); 17 if (!strcmp(profile, ops->name)) 18 break; 19 20 ops = NULL; 21 } 22 23 if (ops) { 24 add_job_opts(ops->def_ops); 25 return 0; 26 } 27 28 log_err("fio: profile '%s' not found\n", profile); 29 return 1; 30} 31 32void register_profile(struct profile_ops *ops) 33{ 34 dprint(FD_PROFILE, "register profile '%s'\n", ops->name); 35 flist_add_tail(&ops->list, &profile_list); 36} 37 38void unregister_profile(struct profile_ops *ops) 39{ 40 dprint(FD_PROFILE, "unregister profile '%s'\n", ops->name); 41 flist_del(&ops->list); 42} 43