krxtimod.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* krxtimod.h: RxRPC timeout daemon
  2. *
  3. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _LINUX_RXRPC_KRXTIMOD_H
  12. #define _LINUX_RXRPC_KRXTIMOD_H
  13. #include <rxrpc/types.h>
  14. struct rxrpc_timer_ops {
  15. /* called when the front of the timer queue has timed out */
  16. void (*timed_out)(struct rxrpc_timer *timer);
  17. };
  18. /*****************************************************************************/
  19. /*
  20. * RXRPC timer/timeout record
  21. */
  22. struct rxrpc_timer
  23. {
  24. struct list_head link; /* link in timer queue */
  25. unsigned long timo_jif; /* timeout time */
  26. const struct rxrpc_timer_ops *ops; /* timeout expiry function */
  27. };
  28. static inline void rxrpc_timer_init(rxrpc_timer_t *timer, const struct rxrpc_timer_ops *ops)
  29. {
  30. INIT_LIST_HEAD(&timer->link);
  31. timer->ops = ops;
  32. }
  33. extern int rxrpc_krxtimod_start(void);
  34. extern void rxrpc_krxtimod_kill(void);
  35. extern void rxrpc_krxtimod_add_timer(rxrpc_timer_t *timer, unsigned long timeout);
  36. extern int rxrpc_krxtimod_del_timer(rxrpc_timer_t *timer);
  37. #endif /* _LINUX_RXRPC_KRXTIMOD_H */