aboutsummaryrefslogtreecommitdiffstats
path: root/include/rxrpc/message.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/rxrpc/message.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/rxrpc/message.h')
-rw-r--r--include/rxrpc/message.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/include/rxrpc/message.h b/include/rxrpc/message.h
new file mode 100644
index 000000000000..3a59df6870b2
--- /dev/null
+++ b/include/rxrpc/message.h
@@ -0,0 +1,71 @@
1/* message.h: Rx message caching
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_MESSAGE_H
13#define _LINUX_RXRPC_MESSAGE_H
14
15#include <rxrpc/packet.h>
16
17/*****************************************************************************/
18/*
19 * Rx message record
20 */
21struct rxrpc_message
22{
23 atomic_t usage;
24 struct list_head link; /* list link */
25 struct timeval stamp; /* time received or last sent */
26 rxrpc_seq_t seq; /* message sequence number */
27
28 int state; /* the state the message is currently in */
29#define RXRPC_MSG_PREPARED 0
30#define RXRPC_MSG_SENT 1
31#define RXRPC_MSG_ACKED 2 /* provisionally ACK'd */
32#define RXRPC_MSG_DONE 3 /* definitively ACK'd (msg->seq<ack.firstPacket) */
33#define RXRPC_MSG_RECEIVED 4
34#define RXRPC_MSG_ERROR -1
35 char rttdone; /* used for RTT */
36
37 struct rxrpc_transport *trans; /* transport received through */
38 struct rxrpc_connection *conn; /* connection received over */
39 struct sk_buff *pkt; /* received packet */
40 off_t offset; /* offset into pkt of next byte of data */
41
42 struct rxrpc_header hdr; /* message header */
43
44 int dcount; /* data part count */
45 size_t dsize; /* data size */
46#define RXRPC_MSG_MAX_IOCS 8
47 struct kvec data[RXRPC_MSG_MAX_IOCS]; /* message data */
48 unsigned long dfree; /* bit mask indicating kfree(data[x]) if T */
49};
50
51#define rxrpc_get_message(M) do { atomic_inc(&(M)->usage); } while(0)
52
53extern void __rxrpc_put_message(struct rxrpc_message *msg);
54static inline void rxrpc_put_message(struct rxrpc_message *msg)
55{
56 BUG_ON(atomic_read(&msg->usage)<=0);
57 if (atomic_dec_and_test(&msg->usage))
58 __rxrpc_put_message(msg);
59}
60
61extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
62 struct rxrpc_call *call,
63 uint8_t type,
64 int count,
65 struct kvec *diov,
66 int alloc_flags,
67 struct rxrpc_message **_msg);
68
69extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg);
70
71#endif /* _LINUX_RXRPC_MESSAGE_H */