/* * This tapset contains functions and parameters specific to the * memory management subsystem of the kernel. */ function fij_add_gfp_wait_param() { fij_add_option("ignore_gfp_wait",1, "inject failures only into non-sleep allocations") } function fij_get_gfp_wait() %{ THIS->__retvalue = __GFP_WAIT; %} function fij_should_fail_gfp_wait(flags:long) { GFPWAIT = fij_get_gfp_wait() if (fij_params["ignore_gfp_wait"] == 1) { if (flags&GFPWAIT) { fij_logger(100, sprintf("Skipping on ignore_gfp_wait %d", flags&GFPWAIT)) return 0 } else fij_logger(100, sprintf("Continuing on ignore_gfp_wait %d", flags&GFPWAIT)) } return 1 } function fij_add_gfp_highmem_param() { fij_add_option("ignore_gfp_highmem",1, "1 => inject failures highmem/user allocations") } function fij_get_gfp_highmem() %{ THIS->__retvalue = __GFP_HIGHMEM; %} function fij_should_fail_gfp_highmem(flags:long) { GFPHIGHMEM = fij_get_gfp_highmem() if (fij_params["ignore_gfp_highmem"] == 1) { if (flags&GFPHIGHMEM) { fij_logger(100, sprintf("Skipping on ignore_gfp_highmem %d", flags&GFPHIGHMEM)) return 0 } else fij_logger(100, sprintf("Continuing on ignore_gfp_highmem %d" ,flags&GFPHIGHMEM)) } return 1 }