kafstimod.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* AFS 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 AFS_KAFSTIMOD_H
  12. #define AFS_KAFSTIMOD_H
  13. #include "types.h"
  14. struct afs_timer;
  15. struct afs_timer_ops {
  16. /* called when the front of the timer queue has timed out */
  17. void (*timed_out)(struct afs_timer *);
  18. };
  19. /*
  20. * AFS timer/timeout record
  21. */
  22. struct afs_timer {
  23. struct list_head link; /* link in timer queue */
  24. unsigned long timo_jif; /* timeout time */
  25. const struct afs_timer_ops *ops; /* timeout expiry function */
  26. };
  27. static inline void afs_timer_init(struct afs_timer *timer,
  28. const struct afs_timer_ops *ops)
  29. {
  30. INIT_LIST_HEAD(&timer->link);
  31. timer->ops = ops;
  32. }
  33. extern int afs_kafstimod_start(void);
  34. extern void afs_kafstimod_stop(void);
  35. extern void afs_kafstimod_add_timer(struct afs_timer *, unsigned long);
  36. extern int afs_kafstimod_del_timer(struct afs_timer *);
  37. #endif /* AFS_KAFSTIMOD_H */