blob: b3d298b612f2fa305b1af0dcd5020b4980960b9f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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
12#ifndef _LINUX_RXRPC_KRXTIMOD_H
13#define _LINUX_RXRPC_KRXTIMOD_H
14
15#include <rxrpc/types.h>
16
17struct rxrpc_timer_ops {
18 /* called when the front of the timer queue has timed out */
19 void (*timed_out)(struct rxrpc_timer *timer);
20};
21
22/*****************************************************************************/
23/*
24 * RXRPC timer/timeout record
25 */
26struct rxrpc_timer
27{
28 struct list_head link; /* link in timer queue */
29 unsigned long timo_jif; /* timeout time */
30 const struct rxrpc_timer_ops *ops; /* timeout expiry function */
31};
32
33static inline void rxrpc_timer_init(rxrpc_timer_t *timer, const struct rxrpc_timer_ops *ops)
34{
35 INIT_LIST_HEAD(&timer->link);
36 timer->ops = ops;
37}
38
39extern int rxrpc_krxtimod_start(void);
40extern void rxrpc_krxtimod_kill(void);
41
42extern void rxrpc_krxtimod_add_timer(rxrpc_timer_t *timer, unsigned long timeout);
43extern int rxrpc_krxtimod_del_timer(rxrpc_timer_t *timer);
44
45#endif /* _LINUX_RXRPC_KRXTIMOD_H */