]>
git.proxmox.com Git - ceph.git/blob - ceph/src/msg/xio/XioInSeq.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
7 * Portions Copyright (C) 2013 CohortFS, LLC
9 * This is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License version 2.1, as published by the Free Software
12 * Foundation. See file COPYING.
19 #include <boost/intrusive/list.hpp>
20 #include "msg/SimplePolicyMessenger.h"
25 /* For inbound messages (Accelio-owned) ONLY, use the message's
26 * user_context as an SLIST */
35 XioInSeq() : cnt(0), sz(0), head(NULL
), tail(NULL
) {}
36 XioInSeq(const XioInSeq
& seq
) {
43 int count() { return cnt
; }
45 int size() { return sz
; }
47 bool p() { return !!head
; }
49 void set_count(int _cnt
) { cnt
= _cnt
; }
51 void append(struct xio_msg
* msg
) {
52 msg
->user_context
= NULL
;
56 tail
->user_context
= msg
;
63 struct xio_msg
* begin() { return head
; }
65 struct xio_msg
* end() { return NULL
; }
67 void next(struct xio_msg
** msg
) {
68 *msg
= static_cast<struct xio_msg
*>((*msg
)->user_context
);
71 struct xio_msg
* dequeue() {
72 struct xio_msg
* msgs
= head
;
84 #endif /* XIO_IN_SEQ_H */