/// <summary> /// Checks if the given entry points can be paired. /// </summary> /// <returns>Boolean value</returns> /// <param name="ep1">first entry point</param> /// <param name="ep2">second entry point</param> private static bool CanBePaired(EntryPoint ep1, EntryPoint ep2) { if (ep1.IsCalledWithNetworkDisabled && DeviceDriver.IsNetworkAPI(ep2.API)) { if (ep1.IsClone) { return(true); } else { return(false); } } if (ep2.IsCalledWithNetworkDisabled && DeviceDriver.IsNetworkAPI(ep1.API)) { if (ep2.IsClone) { return(true); } else { return(false); } } if (ep1.IsGoingToDisableNetwork && DeviceDriver.IsNetworkAPI(ep2.API)) { if (ep1.IsClone) { return(true); } else { return(false); } } if (ep2.IsGoingToDisableNetwork && DeviceDriver.IsNetworkAPI(ep1.API)) { if (ep2.IsClone) { return(true); } else { return(false); } } if (ep1.IsClone || ep2.IsClone) { return(false); } return(true); }
public EntryPoint(string name, string api, string kernelFunc, Module module, bool whoopInit, bool isClone = false) { this.Id = kernelFunc.Equals("") ? name : name + "$" + kernelFunc; this.Name = name; this.API = api; this.KernelFunc = kernelFunc; this.Module = module; if ((api.Equals("probe") || api.Equals("port_probe")) && ((whoopInit && module.API.Equals("whoop_driver_ops")) || module.API.Equals("test_driver") || module.API.Equals("pci_driver") || module.API.Equals("usb_driver") || module.API.Equals("usb_serial_driver") || module.API.Equals("platform_driver") || module.API.Equals("ps3_system_bus_driver") || module.API.Equals("cx_drv"))) { this.IsInit = true; DeviceDriver.SetInitEntryPoint(name); } else { this.IsInit = false; } if ((api.Equals("remove") || api.Equals("port_remove")) && ((whoopInit && module.API.Equals("whoop_driver_ops")) || module.API.Equals("test_driver") || module.API.Equals("pci_driver") || module.API.Equals("usb_driver") || module.API.Equals("usb_serial_driver") || module.API.Equals("platform_driver") || module.API.Equals("ps3_system_bus_driver") || module.API.Equals("cx_drv"))) { this.IsExit = true; } else { this.IsExit = false; } this.IsClone = isClone; if (DeviceDriver.HasKernelImposedDeviceLock(api, module)) { this.IsDeviceLocked = true; } else { this.IsDeviceLocked = false; } if (DeviceDriver.HasKernelImposedPowerLock(api)) { this.IsPowerLocked = true; } else { this.IsPowerLocked = false; } if (DeviceDriver.HasKernelImposedRTNL(api)) { this.IsRtnlLocked = true; } else { this.IsRtnlLocked = false; } if (DeviceDriver.IsNetworkAPI(api)) { this.IsNetLocked = true; } else { this.IsNetLocked = false; } if (DeviceDriver.HasKernelImposedTxLock(api)) { this.IsTxLocked = true; } else { this.IsTxLocked = false; } if (DeviceDriver.IsGoingToDisableNetwork(api)) { this.IsGoingToDisableNetwork = true; } else { this.IsGoingToDisableNetwork = false; } if (DeviceDriver.IsCalledWithNetworkDisabled(api)) { this.IsCalledWithNetworkDisabled = true; } else { this.IsCalledWithNetworkDisabled = false; } this.IsInlined = false; this.IsCallingPowerLock = false; this.IsCallingRtnlLock = false; this.IsCallingNetLock = false; this.IsCallingTxLock = false; this.HasWriteAccess = new Dictionary <string, int>(); this.HasReadAccess = new Dictionary <string, int>(); this.ForceWriteResource = new HashSet <string>(); this.ForceReadResource = new HashSet <string>(); this.IsHoldingLock = false; this.IsEnablingDevice = false; this.IsDisablingDevice = false; }