File: types.h

package info (click to toggle)
kernel-source-2.2.1 2.2.1-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 61,788 kB
  • ctags: 188,316
  • sloc: ansic: 1,114,164; asm: 49,922; makefile: 8,185; sh: 1,745; perl: 856; tcl: 409; lisp: 218; cpp: 186; awk: 133; sed: 72
file content (75 lines) | stat: -rw-r--r-- 1,627 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * linux/include/linux/sunrpc/types.h
 *
 * Generic types and misc stuff for RPC.
 *
 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
 */

#ifndef _LINUX_SUNRPC_TYPES_H_
#define _LINUX_SUNRPC_TYPES_H_

#include <linux/timer.h>
#include <linux/tqueue.h>
#include <linux/sunrpc/debug.h>

/*
 * These are the RPC list manipulation primitives used everywhere.
 */
struct rpc_listitem	{
	struct rpc_listitem *	prev;
	struct rpc_listitem *	next;
};

extern __inline__ void
__rpc_append_list(struct rpc_listitem **q, struct rpc_listitem *item)
{
	struct rpc_listitem	*next, *prev;

	if (!(next = *q)) {
		*q = item->next = item->prev = item;
	} else {
		prev = next->prev;
		prev->next = item;
		next->prev = item;
		item->next = next;
		item->prev = prev;
	}
}

extern __inline__ void
__rpc_insert_list(struct rpc_listitem **q, struct rpc_listitem *item)
{
	__rpc_append_list(q, item);
	*q = item;
}

extern __inline__ void
__rpc_remove_list(struct rpc_listitem **q, struct rpc_listitem *item)
{
	struct rpc_listitem	*prev = item->prev,
				*next = item->next;

	if (item != prev) {
		next->prev = prev;
		prev->next = next;
	} else {
		next = NULL;
	}
	if (*q == item)
		*q = next;
}

#define rpc_insert_list(q, i) \
      __rpc_insert_list((struct rpc_listitem **) q, (struct rpc_listitem *) i)
#define rpc_append_list(q, i) \
      __rpc_append_list((struct rpc_listitem **) q, (struct rpc_listitem *) i)
#define rpc_remove_list(q, i) \
      __rpc_remove_list((struct rpc_listitem **) q, (struct rpc_listitem *) i)

/*
 * Shorthands
 */
#define signalled()		(signal_pending(current))

#endif /* _LINUX_SUNRPC_TYPES_H_ */