From: Jean Guyader Date: Sat, 29 Aug 2009 21:24:37 +0000 (+0100) Subject: Move the flr calling script into the do_flr function. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3710eb5b59cb151bb079830e20cf59b48c39fa40;p=xenclient%2Ftoolstack.git Move the flr calling script into the do_flr function. Make the path fixed "/opt/xensource/libexec/pci-flr. --- diff --git a/xenops/device.ml b/xenops/device.ml index 3bdf973..40fe994 100644 --- a/xenops/device.ml +++ b/xenops/device.ml @@ -968,7 +968,17 @@ let write_string_to_file file s = let do_flr device = let doflr = "/sys/bus/pci/drivers/pciback/do_flr" in - try write_string_to_file doflr device with _ -> () + let script = "/opt/xensource/libexec/pci-flr" in + let callscript = + let f s devstr = + try ignore (Forkhelpers.execute_command_get_output ~withpath:true script [ s; devstr; ]) + with _ -> () + in + f + in + callscript "flr-pre" device; + ( try write_string_to_file doflr device with _ -> (); ); + callscript "flr-post" device let bind pcidevs = let bind_to_pciback device = @@ -1021,25 +1031,11 @@ let enumerate_devs ~xs (x: device) = ) [] (Array.to_list devs)) let reset ~xs (x: device) = - let backend_path = backend_path_of_device ~xs x in - let script = try Some (xs.Xs.read (backend_path ^ "/script")) with _ -> None in - let callscript = - match script with - | None -> (fun _ _ -> ()) - | Some script -> - let f s devstr = - try ignore (Forkhelpers.execute_command_get_output ~withpath:true script [ s; devstr; ]) - with _ -> () - in - f - in debug "Device.Pci.reset %s" (string_of_device x); let pcidevs = enumerate_devs ~xs x in List.iter (fun (domain, bus, slot, func) -> let devstr = sprintf "%.4x:%.2x:%.2x.%.1x" domain bus slot func in - callscript "flr-pre" devstr; - do_flr devstr; - callscript "flr-post" devstr + do_flr devstr ) pcidevs; ()