File: types.h

package info (click to toggle)
kernel-source-2.4.10 2.4.10-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 137,328 kB
  • ctags: 423,898
  • sloc: ansic: 2,403,930; asm: 140,471; makefile: 8,170; sh: 3,099; perl: 2,077; yacc: 1,177; cpp: 755; tcl: 577; lex: 343; awk: 251; lisp: 218; sed: 72
file content (75 lines) | stat: -rw-r--r-- 1,627 bytes parent folder | download | duplicates (8)
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;
};

static __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;
	}
}

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

static __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_ */