Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

fault.h 616B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef _IPXE_FAULT_H
  2. #define _IPXE_FAULT_H
  3. /** @file
  4. *
  5. * Fault injection
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <config/fault.h>
  10. extern int inject_fault_nonzero ( unsigned int rate );
  11. /**
  12. * Inject fault with a specified probability
  13. *
  14. * @v rate Reciprocal of fault probability (zero for no faults)
  15. * @ret rc Return status code
  16. */
  17. static inline __attribute__ (( always_inline )) int
  18. inject_fault ( unsigned int rate ) {
  19. /* Force dead code elimination in non-fault-injecting builds */
  20. if ( rate == 0 )
  21. return 0;
  22. return inject_fault_nonzero ( rate );
  23. }
  24. #endif /* _IPXE_FAULT_H */