rhmessaging commits: r1868 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-04-08 14:48:17 -0400 (Tue, 08 Apr 2008)
New Revision: 1868
Modified:
store/trunk/cpp/lib/jrnl/data_tok.hpp
store/trunk/cpp/lib/jrnl/deq_hdr.hpp
store/trunk/cpp/lib/jrnl/deq_rec.cpp
store/trunk/cpp/lib/jrnl/deq_rec.hpp
store/trunk/cpp/lib/jrnl/enq_hdr.hpp
store/trunk/cpp/lib/jrnl/enq_rec.cpp
store/trunk/cpp/lib/jrnl/enq_rec.hpp
store/trunk/cpp/lib/jrnl/file_hdr.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/jdir.cpp
store/trunk/cpp/lib/jrnl/jexception.cpp
store/trunk/cpp/lib/jrnl/jexception.hpp
store/trunk/cpp/lib/jrnl/jinf.cpp
store/trunk/cpp/lib/jrnl/jinf.hpp
store/trunk/cpp/lib/jrnl/jrec.cpp
store/trunk/cpp/lib/jrnl/jrec.hpp
store/trunk/cpp/lib/jrnl/nlfh.cpp
store/trunk/cpp/lib/jrnl/nlfh.hpp
store/trunk/cpp/lib/jrnl/pmgr.cpp
store/trunk/cpp/lib/jrnl/rcvdat.hpp
store/trunk/cpp/lib/jrnl/rec_hdr.hpp
store/trunk/cpp/lib/jrnl/rec_tail.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/lib/jrnl/rmgr.hpp
store/trunk/cpp/lib/jrnl/rrfc.cpp
store/trunk/cpp/lib/jrnl/rrfc.hpp
store/trunk/cpp/lib/jrnl/slock.hpp
store/trunk/cpp/lib/jrnl/time_ns.hpp
store/trunk/cpp/lib/jrnl/txn_hdr.hpp
store/trunk/cpp/lib/jrnl/txn_rec.cpp
store/trunk/cpp/lib/jrnl/txn_rec.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/lib/jrnl/wrfc.cpp
store/trunk/cpp/lib/jrnl/wrfc.hpp
Log:
F9 tidyup. Rather intrusive change to make use of C++ C lib definitions consistently, which means switching the headers to use the <cstring> version instead of <string.h>, and then switching all function calls to namespace std.
Modified: store/trunk/cpp/lib/jrnl/data_tok.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/data_tok.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/data_tok.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -41,7 +41,8 @@
}
}
-#include <assert.h>
+#include <cassert>
+#include <cstddef>
#include <pthread.h>
#include <string>
#include <sys/types.h>
@@ -98,7 +99,7 @@
u_int64_t _icnt;
write_state _wstate; ///< Enqueued / dequeued state of data
read_state _rstate; ///< Read state of data
- size_t _dsize; ///< Data size in bytes
+ std::size_t _dsize; ///< Data size in bytes
u_int32_t _dblks_written; ///< Data blocks read/written
u_int32_t _dblks_read; ///< Data blocks read/written
u_int32_t _pg_cnt; ///< Page counter - incr for each page containing part of data
@@ -126,8 +127,8 @@
inline bool is_dequeueable() const { return _wstate == ENQ || _wstate == DEQ_PART; }
inline void set_wstate(const write_state wstate) { _wstate = wstate; }
void set_rstate(const read_state rstate);
- inline size_t dsize() const { return _dsize; }
- inline void set_dsize(size_t dsize) { _dsize = dsize; }
+ inline std::size_t dsize() const { return _dsize; }
+ inline void set_dsize(std::size_t dsize) { _dsize = dsize; }
inline u_int32_t dblocks_written() const { return _dblks_written; }
inline void incr_dblocks_written(u_int32_t dblks_written)
@@ -155,7 +156,7 @@
inline const std::string& xid() const { return _xid; }
inline void clear_xid() { _xid.clear(); }
inline void set_xid(const std::string& xid) { _xid.assign(xid); }
- inline void set_xid(const void* xidp, const size_t xid_len)
+ inline void set_xid(const void* xidp, const std::size_t xid_len)
{ _xid.assign((const char*)xidp, xid_len); }
void reset();
Modified: store/trunk/cpp/lib/jrnl/deq_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/deq_hdr.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/deq_hdr.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -33,6 +33,7 @@
#ifndef rhm_journal_deq_hdr_hpp
#define rhm_journal_deq_hdr_hpp
+#include <cstddef>
#include <jrnl/rec_hdr.hpp>
namespace rhm
@@ -82,7 +83,7 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Big-endian filler for 32-bit size_t
#endif
- size_t _xidsize; ///< XID size
+ std::size_t _xidsize; ///< XID size
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Little-endian filler for 32-bit size_t
#endif
@@ -104,7 +105,7 @@
* \brief Convenience constructor which initializes values during construction.
*/
inline deq_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
- const u_int64_t deq_rid, const size_t xidsize, const bool owi):
+ const u_int64_t deq_rid, const std::size_t xidsize, const bool owi):
rec_hdr(magic, version, rid, owi), _deq_rid(deq_rid),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
@@ -118,7 +119,7 @@
/**
* \brief Returns the size of the header in bytes.
*/
- inline static size_t size() { return sizeof(deq_hdr); }
+ inline static std::size_t size() { return sizeof(deq_hdr); }
};
#pragma pack()
Modified: store/trunk/cpp/lib/jrnl/deq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/deq_rec.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/deq_rec.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -30,12 +30,14 @@
#include <jrnl/deq_rec.hpp>
-#include <assert.h>
-#include <errno.h>
+#include <cassert>
+#include <cerrno>
+#include <cstdlib>
+#include <cstring>
#include <iomanip>
-#include <sstream>
#include <jrnl/jerrno.hpp>
#include <jrnl/jexception.hpp>
+#include <sstream>
namespace rhm
{
@@ -50,7 +52,7 @@
{}
deq_rec::deq_rec(const u_int64_t rid, const u_int64_t drid, const void* const xidp,
- const size_t xidlen, const bool owi):
+ const std::size_t xidlen, const bool owi):
_deq_hdr(RHM_JDAT_DEQ_MAGIC, RHM_JDAT_VERSION, rid, drid, xidlen, owi),
_xidp(xidp),
_buff(0),
@@ -75,7 +77,7 @@
void
deq_rec::reset(const u_int64_t rid, const u_int64_t drid, const void* const xidp,
- const size_t xidlen, const bool owi)
+ const std::size_t xidlen, const bool owi)
{
_deq_hdr._rid = rid;
_deq_hdr.set_owi(owi);
@@ -94,21 +96,21 @@
if (_xidp == 0)
assert(_deq_hdr._xidsize == 0);
- size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
- size_t rem = max_size_dblks * JRNL_DBLK_SIZE;
- size_t wr_cnt = 0;
+ std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ std::size_t rem = max_size_dblks * JRNL_DBLK_SIZE;
+ std::size_t wr_cnt = 0;
if (rec_offs_dblks) // Continuation of split dequeue record (over 2 or more pages)
{
if (size_dblks(rec_size()) - rec_offs_dblks > max_size_dblks) // Further split required
{
rec_offs -= sizeof(_deq_hdr);
- size_t wsize = _deq_hdr._xidsize > rec_offs ? _deq_hdr._xidsize - rec_offs : 0;
- size_t wsize2 = wsize;
+ std::size_t wsize = _deq_hdr._xidsize > rec_offs ? _deq_hdr._xidsize - rec_offs : 0;
+ std::size_t wsize2 = wsize;
if (wsize)
{
if (wsize > rem)
wsize = rem;
- ::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
+ std::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -121,7 +123,7 @@
{
if (wsize > rem)
wsize = rem;
- ::memcpy((char*)wptr + wr_cnt, (char*)&_deq_tail + rec_offs, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (char*)&_deq_tail + rec_offs, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -133,22 +135,22 @@
else // No further split required
{
rec_offs -= sizeof(_deq_hdr);
- size_t wsize = _deq_hdr._xidsize > rec_offs ? _deq_hdr._xidsize - rec_offs : 0;
+ std::size_t wsize = _deq_hdr._xidsize > rec_offs ? _deq_hdr._xidsize - rec_offs : 0;
if (wsize)
{
- ::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
+ std::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
wr_cnt += wsize;
}
rec_offs -= _deq_hdr._xidsize - wsize;
wsize = sizeof(_deq_tail) > rec_offs ? sizeof(_deq_tail) - rec_offs : 0;
if (wsize)
{
- ::memcpy((char*)wptr + wr_cnt, (char*)&_deq_tail + rec_offs, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (char*)&_deq_tail + rec_offs, wsize);
wr_cnt += wsize;
#ifdef RHM_CLEAN
- size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
- size_t dblk_rec_size = size_dblks(rec_size() - rec_offs) * JRNL_DBLK_SIZE;
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
+ std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ std::size_t dblk_rec_size = size_dblks(rec_size() - rec_offs) * JRNL_DBLK_SIZE;
+ std::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
#endif
}
rec_offs -= sizeof(_deq_tail) - wsize;
@@ -158,23 +160,23 @@
else // Start at beginning of data record
{
// Assumption: the header will always fit into the first dblk
- ::memcpy(wptr, (void*)&_deq_hdr, sizeof(_deq_hdr));
+ std::memcpy(wptr, (void*)&_deq_hdr, sizeof(_deq_hdr));
wr_cnt = sizeof(_deq_hdr);
if (size_dblks(rec_size()) > max_size_dblks) // Split required - can only occur with xid
{
- size_t wsize;
+ std::size_t wsize;
rem -= sizeof(_deq_hdr);
if (rem)
{
wsize = rem >= _deq_hdr._xidsize ? _deq_hdr._xidsize : rem;
- ::memcpy((char*)wptr + wr_cnt, _xidp, wsize);
+ std::memcpy((char*)wptr + wr_cnt, _xidp, wsize);
wr_cnt += wsize;
rem -= wsize;
}
if (rem)
{
wsize = rem >= sizeof(_deq_tail) ? sizeof(_deq_tail) : rem;
- ::memcpy((char*)wptr + wr_cnt, (void*)&_deq_tail, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (void*)&_deq_tail, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -184,14 +186,14 @@
{
if (_deq_hdr._xidsize)
{
- ::memcpy((char*)wptr + wr_cnt, _xidp, _deq_hdr._xidsize);
+ std::memcpy((char*)wptr + wr_cnt, _xidp, _deq_hdr._xidsize);
wr_cnt += _deq_hdr._xidsize;
- ::memcpy((char*)wptr + wr_cnt, (void*)&_deq_tail, sizeof(_deq_tail));
+ std::memcpy((char*)wptr + wr_cnt, (void*)&_deq_tail, sizeof(_deq_tail));
wr_cnt += sizeof(_deq_tail);
}
#ifdef RHM_CLEAN
- size_t dblk_rec_size = size_dblks(rec_size()) * JRNL_DBLK_SIZE;
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
+ std::size_t dblk_rec_size = size_dblks(rec_size()) * JRNL_DBLK_SIZE;
+ std::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
#endif
}
}
@@ -204,13 +206,13 @@
assert(rptr != 0);
assert(max_size_dblks > 0);
- size_t rd_cnt = 0;
+ std::size_t rd_cnt = 0;
if (rec_offs_dblks) // Continuation of record on new page
{
const u_int32_t hdr_xid_dblks = size_dblks(deq_hdr::size() + _deq_hdr._xidsize);
const u_int32_t hdr_xid_tail_dblks = size_dblks(deq_hdr::size() + _deq_hdr._xidsize +
rec_tail::size());
- const size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ const std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
if (hdr_xid_tail_dblks - rec_offs_dblks <= max_size_dblks)
{
@@ -218,20 +220,20 @@
if (rec_offs - deq_hdr::size() < _deq_hdr._xidsize)
{
// Part of xid still outstanding, copy remainder of xid and tail
- const size_t xid_offs = rec_offs - deq_hdr::size();
- const size_t xid_rem = _deq_hdr._xidsize - xid_offs;
- ::memcpy((char*)_buff + xid_offs, rptr, xid_rem);
+ const std::size_t xid_offs = rec_offs - deq_hdr::size();
+ const std::size_t xid_rem = _deq_hdr._xidsize - xid_offs;
+ std::memcpy((char*)_buff + xid_offs, rptr, xid_rem);
rd_cnt = xid_rem;
- ::memcpy((void*)&_deq_tail, ((char*)rptr + rd_cnt), sizeof(_deq_tail));
+ std::memcpy((void*)&_deq_tail, ((char*)rptr + rd_cnt), sizeof(_deq_tail));
chk_tail();
rd_cnt += sizeof(_deq_tail);
}
else
{
// Tail or part of tail only outstanding, complete tail
- const size_t tail_offs = rec_offs - deq_hdr::size() - _deq_hdr._xidsize;
- const size_t tail_rem = rec_tail::size() - tail_offs;
- ::memcpy((char*)&_deq_tail + tail_offs, rptr, tail_rem);
+ const std::size_t tail_offs = rec_offs - deq_hdr::size() - _deq_hdr._xidsize;
+ const std::size_t tail_rem = rec_tail::size() - tail_offs;
+ std::memcpy((char*)&_deq_tail + tail_offs, rptr, tail_rem);
chk_tail();
rd_cnt = tail_rem;
}
@@ -239,22 +241,22 @@
else if (hdr_xid_dblks - rec_offs_dblks <= max_size_dblks)
{
// Remainder of xid fits within this page, tail split
- const size_t xid_offs = rec_offs - deq_hdr::size();
- const size_t xid_rem = _deq_hdr._xidsize - xid_offs;
- ::memcpy((char*)_buff + xid_offs, rptr, xid_rem);
+ const std::size_t xid_offs = rec_offs - deq_hdr::size();
+ const std::size_t xid_rem = _deq_hdr._xidsize - xid_offs;
+ std::memcpy((char*)_buff + xid_offs, rptr, xid_rem);
rd_cnt += xid_rem;
- const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ const std::size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
if (tail_rem)
{
- ::memcpy((void*)&_deq_tail, ((char*)rptr + xid_rem), tail_rem);
+ std::memcpy((void*)&_deq_tail, ((char*)rptr + xid_rem), tail_rem);
rd_cnt += tail_rem;
}
}
else
{
// Remainder of xid split
- const size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE);
- ::memcpy((char*)_buff + rec_offs - deq_hdr::size(), rptr, xid_cp_size);
+ const std::size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE);
+ std::memcpy((char*)_buff + rec_offs - deq_hdr::size(), rptr, xid_cp_size);
rd_cnt += xid_cp_size;
}
}
@@ -268,12 +270,12 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
rd_cnt += sizeof(u_int32_t); // Filler 0
#endif
- _deq_hdr._xidsize = *(size_t*)((char*)rptr + rd_cnt);
+ _deq_hdr._xidsize = *(std::size_t*)((char*)rptr + rd_cnt);
rd_cnt = _deq_hdr.size();
chk_hdr();
if (_deq_hdr._xidsize)
{
- _buff = ::malloc(_deq_hdr._xidsize);
+ _buff = std::malloc(_deq_hdr._xidsize);
MALLOC_CHK(_buff, "_buff", "deq_rec", "decode");
const u_int32_t hdr_xid_dblks = size_dblks(deq_hdr::size() + _deq_hdr._xidsize);
const u_int32_t hdr_xid_tail_dblks = size_dblks(deq_hdr::size() + _deq_hdr._xidsize +
@@ -284,29 +286,29 @@
if (hdr_xid_tail_dblks <= max_size_dblks)
{
// Entire header, xid and tail fits within this page
- ::memcpy(_buff, (char*)rptr + rd_cnt, _deq_hdr._xidsize);
+ std::memcpy(_buff, (char*)rptr + rd_cnt, _deq_hdr._xidsize);
rd_cnt += _deq_hdr._xidsize;
- ::memcpy((void*)&_deq_tail, (char*)rptr + rd_cnt, sizeof(_deq_tail));
+ std::memcpy((void*)&_deq_tail, (char*)rptr + rd_cnt, sizeof(_deq_tail));
rd_cnt += sizeof(_deq_tail);
chk_tail();
}
else if (hdr_xid_dblks <= max_size_dblks)
{
// Entire header and xid fit within this page, tail split
- ::memcpy(_buff, (char*)rptr + rd_cnt, _deq_hdr._xidsize);
+ std::memcpy(_buff, (char*)rptr + rd_cnt, _deq_hdr._xidsize);
rd_cnt += _deq_hdr._xidsize;
- const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ const std::size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
if (tail_rem)
{
- ::memcpy((void*)&_deq_tail, (char*)rptr + rd_cnt, tail_rem);
+ std::memcpy((void*)&_deq_tail, (char*)rptr + rd_cnt, tail_rem);
rd_cnt += tail_rem;
}
}
else
{
// Header fits within this page, xid split
- const size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
- ::memcpy(_buff, (char*)rptr + rd_cnt, xid_cp_size);
+ const std::size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ std::memcpy(_buff, (char*)rptr + rd_cnt, xid_cp_size);
rd_cnt += xid_cp_size;
}
}
@@ -315,7 +317,7 @@
}
bool
-deq_rec::rcv_decode(rec_hdr h, std::ifstream* ifsp, size_t& rec_offs)
+deq_rec::rcv_decode(rec_hdr h, std::ifstream* ifsp, std::size_t& rec_offs)
{
if (rec_offs == 0)
{
@@ -324,7 +326,7 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
ifsp->ignore(sizeof(u_int32_t)); // _filler0
#endif
- ifsp->read((char*)&_deq_hdr._xidsize, sizeof(size_t));
+ ifsp->read((char*)&_deq_hdr._xidsize, sizeof(std::size_t));
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
ifsp->ignore(sizeof(u_int32_t)); // _filler0
#endif
@@ -332,16 +334,16 @@
// Read header, allocate (if req'd) for xid
if (_deq_hdr._xidsize)
{
- _buff = ::malloc(_deq_hdr._xidsize);
+ _buff = std::malloc(_deq_hdr._xidsize);
MALLOC_CHK(_buff, "_buff", "enq_rec", "rcv_decode");
}
}
if (rec_offs < sizeof(_deq_hdr) + _deq_hdr._xidsize)
{
// Read xid (or continue reading xid)
- size_t offs = rec_offs - sizeof(_deq_hdr);
+ std::size_t offs = rec_offs - sizeof(_deq_hdr);
ifsp->read((char*)_buff + offs, _deq_hdr._xidsize - offs);
- size_t size_read = ifsp->gcount();
+ std::size_t size_read = ifsp->gcount();
rec_offs += size_read;
if (size_read < _deq_hdr._xidsize - offs)
{
@@ -353,9 +355,9 @@
(_deq_hdr._xidsize ? _deq_hdr._xidsize + sizeof(rec_tail) : 0))
{
// Read tail (or continue reading tail)
- size_t offs = rec_offs - sizeof(_deq_hdr) - _deq_hdr._xidsize;
+ std::size_t offs = rec_offs - sizeof(_deq_hdr) - _deq_hdr._xidsize;
ifsp->read((char*)&_deq_tail + offs, sizeof(rec_tail) - offs);
- size_t size_read = ifsp->gcount();
+ std::size_t size_read = ifsp->gcount();
rec_offs += size_read;
if (size_read < sizeof(rec_tail) - offs)
{
@@ -369,7 +371,7 @@
return true;
}
-size_t
+std::size_t
deq_rec::get_xid(void** const xidpp)
{
if (!_buff)
@@ -395,13 +397,13 @@
return str;
}
-size_t
+std::size_t
deq_rec::xid_size() const
{
return _deq_hdr._xidsize;
}
-size_t
+std::size_t
deq_rec::rec_size() const
{
return deq_hdr::size() + (_deq_hdr._xidsize ? _deq_hdr._xidsize + rec_tail::size() : 0);
Modified: store/trunk/cpp/lib/jrnl/deq_rec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/deq_rec.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/deq_rec.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -41,6 +41,7 @@
}
}
+#include <cstddef>
#include <jrnl/deq_hdr.hpp>
#include <jrnl/jrec.hpp>
@@ -66,27 +67,27 @@
deq_rec();
// constructor used for write operations, where xid already exists
deq_rec(const u_int64_t rid, const u_int64_t drid, const void* const xidp,
- const size_t xidlen, const bool owi);
+ const std::size_t xidlen, const bool owi);
virtual ~deq_rec();
// Prepare instance for use in reading data from journal
void reset();
// Prepare instance for use in writing data to journal
void reset(const u_int64_t rid, const u_int64_t drid, const void* const xidp,
- const size_t xidlen, const bool owi);
+ const std::size_t xidlen, const bool owi);
u_int32_t encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks);
u_int32_t decode(rec_hdr& h, void* rptr, u_int32_t rec_offs_dblks,
u_int32_t max_size_dblks);
// Decode used for recover
- bool rcv_decode(rec_hdr h, std::ifstream* ifsp, size_t& rec_offs);
+ bool rcv_decode(rec_hdr h, std::ifstream* ifsp, std::size_t& rec_offs);
inline u_int64_t rid() const { return _deq_hdr._rid; }
inline u_int64_t deq_rid() const { return _deq_hdr._deq_rid; }
- size_t get_xid(void** const xidpp);
+ std::size_t get_xid(void** const xidpp);
std::string& str(std::string& str) const;
- inline size_t data_size() const { return 0; } // This record never carries data
- size_t xid_size() const;
- size_t rec_size() const;
+ inline std::size_t data_size() const { return 0; } // This record never carries data
+ std::size_t xid_size() const;
+ std::size_t rec_size() const;
private:
virtual void chk_hdr() const;
Modified: store/trunk/cpp/lib/jrnl/enq_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_hdr.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/enq_hdr.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -33,6 +33,7 @@
#ifndef rhm_journal_enq_hdr_hpp
#define rhm_journal_enq_hdr_hpp
+#include <cstddef>
#include <jrnl/rec_hdr.hpp>
namespace rhm
@@ -77,14 +78,14 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Big-endian filler for 32-bit size_t
#endif
- size_t _xidsize; ///< XID size
+ std::size_t _xidsize; ///< XID size
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Little-endian filler for 32-bit size_t
#endif
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler1; ///< Big-endian filler for 32-bit size_t
#endif
- size_t _dsize; ///< Record data size
+ std::size_t _dsize; ///< Record data size
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler1; ///< Little-endian filler for 32-bit size_t
#endif
@@ -115,7 +116,7 @@
* \brief Convenience constructor which initializes values during construction.
*/
inline enq_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
- const size_t xidsize, const size_t dsize, const bool owi,
+ const std::size_t xidsize, const std::size_t dsize, const bool owi,
const bool transient = false): rec_hdr(magic, version, rid, owi),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
@@ -153,7 +154,7 @@
/**
* \brief Returns the size of the header in bytes.
*/
- inline static size_t size() { return sizeof(enq_hdr); }
+ inline static std::size_t size() { return sizeof(enq_hdr); }
};
#pragma pack()
Modified: store/trunk/cpp/lib/jrnl/enq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/enq_rec.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -30,8 +30,10 @@
#include <jrnl/enq_rec.hpp>
-#include <assert.h>
-#include <errno.h>
+#include <cassert>
+#include <cerrno>
+#include <cstdlib>
+#include <cstring>
#include <iomanip>
#include <jrnl/jerrno.hpp>
#include <jrnl/jexception.hpp>
@@ -53,8 +55,8 @@
{}
// Constructor used for transactional write operations, where dbuf contains data to be written.
-enq_rec::enq_rec(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const void* const xidp, const size_t xidlen, const bool owi, const bool transient):
+enq_rec::enq_rec(const u_int64_t rid, const void* const dbuf, const std::size_t dlen,
+ const void* const xidp, const std::size_t xidlen, const bool owi, const bool transient):
jrec(), // superclass
_enq_hdr(RHM_JDAT_ENQ_MAGIC, RHM_JDAT_VERSION, rid, xidlen, dlen, owi, transient),
_xidp(xidp),
@@ -87,8 +89,8 @@
// Prepare instance for use in writing transactional data to journal, where dbuf contains data to
// be written.
void
-enq_rec::reset(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const void* const xidp, const size_t xidlen, const bool owi, const bool transient,
+enq_rec::reset(const u_int64_t rid, const void* const dbuf, const std::size_t dlen,
+ const void* const xidp, const std::size_t xidlen, const bool owi, const bool transient,
const bool external)
{
_enq_hdr._rid = rid;
@@ -111,21 +113,21 @@
if (_xidp == 0)
assert(_enq_hdr._xidsize == 0);
- size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
- size_t rem = max_size_dblks * JRNL_DBLK_SIZE;
- size_t wr_cnt = 0;
+ std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ std::size_t rem = max_size_dblks * JRNL_DBLK_SIZE;
+ std::size_t wr_cnt = 0;
if (rec_offs_dblks) // Continuation of split data record (over 2 or more pages)
{
if (size_dblks(rec_size()) - rec_offs_dblks > max_size_dblks) // Further split required
{
rec_offs -= sizeof(_enq_hdr);
- size_t wsize = _enq_hdr._xidsize > rec_offs ? _enq_hdr._xidsize - rec_offs : 0;
- size_t wsize2 = wsize;
+ std::size_t wsize = _enq_hdr._xidsize > rec_offs ? _enq_hdr._xidsize - rec_offs : 0;
+ std::size_t wsize2 = wsize;
if (wsize)
{
if (wsize > rem)
wsize = rem;
- ::memcpy(wptr, (const char*)_xidp + rec_offs, wsize);
+ std::memcpy(wptr, (const char*)_xidp + rec_offs, wsize);
wr_cnt = wsize;
rem -= wsize;
}
@@ -138,7 +140,7 @@
{
if (wsize > rem)
wsize = rem;
- ::memcpy((char*)wptr + wr_cnt, (char*)_data + rec_offs, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (char*)_data + rec_offs, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -152,7 +154,7 @@
{
if (wsize > rem)
wsize = rem;
- ::memcpy((char*)wptr + wr_cnt, (char*)&_enq_tail + rec_offs, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (char*)&_enq_tail + rec_offs, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -164,29 +166,29 @@
else // No further split required
{
rec_offs -= sizeof(_enq_hdr);
- size_t wsize = _enq_hdr._xidsize > rec_offs ? _enq_hdr._xidsize - rec_offs : 0;
+ std::size_t wsize = _enq_hdr._xidsize > rec_offs ? _enq_hdr._xidsize - rec_offs : 0;
if (wsize)
{
- ::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
+ std::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
wr_cnt += wsize;
}
rec_offs -= _enq_hdr._xidsize - wsize;
wsize = _enq_hdr._dsize > rec_offs ? _enq_hdr._dsize - rec_offs : 0;
if (wsize && !_enq_hdr.is_external())
{
- ::memcpy((char*)wptr + wr_cnt, (char*)_data + rec_offs, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (char*)_data + rec_offs, wsize);
wr_cnt += wsize;
}
rec_offs -= _enq_hdr._dsize - wsize;
wsize = sizeof(_enq_tail) > rec_offs ? sizeof(_enq_tail) - rec_offs : 0;
if (wsize)
{
- ::memcpy((char*)wptr + wr_cnt, (char*)&_enq_tail + rec_offs, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (char*)&_enq_tail + rec_offs, wsize);
wr_cnt += wsize;
#ifdef RHM_CLEAN
- size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
- size_t dblk_rec_size = size_dblks(rec_size() - rec_offs) * JRNL_DBLK_SIZE;
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
+ std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ std::size_t dblk_rec_size = size_dblks(rec_size() - rec_offs) * JRNL_DBLK_SIZE;
+ std::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
#endif
}
rec_offs -= sizeof(_enq_tail) - wsize;
@@ -196,30 +198,30 @@
else // Start at beginning of data record
{
// Assumption: the header will always fit into the first dblk
- ::memcpy(wptr, (void*)&_enq_hdr, sizeof(_enq_hdr));
+ std::memcpy(wptr, (void*)&_enq_hdr, sizeof(_enq_hdr));
wr_cnt = sizeof(_enq_hdr);
if (size_dblks(rec_size()) > max_size_dblks) // Split required
{
- size_t wsize;
+ std::size_t wsize;
rem -= sizeof(_enq_hdr);
if (rem)
{
wsize = rem >= _enq_hdr._xidsize ? _enq_hdr._xidsize : rem;
- ::memcpy((char*)wptr + wr_cnt, _xidp, wsize);
+ std::memcpy((char*)wptr + wr_cnt, _xidp, wsize);
wr_cnt += wsize;
rem -= wsize;
}
if (rem && !_enq_hdr.is_external())
{
wsize = rem >= _enq_hdr._dsize ? _enq_hdr._dsize : rem;
- ::memcpy((char*)wptr + wr_cnt, _data, wsize);
+ std::memcpy((char*)wptr + wr_cnt, _data, wsize);
wr_cnt += wsize;
rem -= wsize;
}
if (rem)
{
wsize = rem >= sizeof(_enq_tail) ? sizeof(_enq_tail) : rem;
- ::memcpy((char*)wptr + wr_cnt, (void*)&_enq_tail, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (void*)&_enq_tail, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -229,19 +231,19 @@
{
if (_enq_hdr._xidsize)
{
- ::memcpy((char*)wptr + wr_cnt, _xidp, _enq_hdr._xidsize);
+ std::memcpy((char*)wptr + wr_cnt, _xidp, _enq_hdr._xidsize);
wr_cnt += _enq_hdr._xidsize;
}
if (!_enq_hdr.is_external())
{
- ::memcpy((char*)wptr + wr_cnt, _data, _enq_hdr._dsize);
+ std::memcpy((char*)wptr + wr_cnt, _data, _enq_hdr._dsize);
wr_cnt += _enq_hdr._dsize;
}
- ::memcpy((char*)wptr + wr_cnt, (void*)&_enq_tail, sizeof(_enq_tail));
+ std::memcpy((char*)wptr + wr_cnt, (void*)&_enq_tail, sizeof(_enq_tail));
wr_cnt += sizeof(_enq_tail);
#ifdef RHM_CLEAN
- size_t dblk_rec_size = size_dblks(rec_size()) * JRNL_DBLK_SIZE;
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
+ std::size_t dblk_rec_size = size_dblks(rec_size()) * JRNL_DBLK_SIZE;
+ std::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
#endif
}
}
@@ -254,15 +256,15 @@
assert(rptr != 0);
assert(max_size_dblks > 0);
- size_t rd_cnt = 0;
+ std::size_t rd_cnt = 0;
if (rec_offs_dblks) // Continuation of record on new page
{
const u_int32_t hdr_data_dblks = size_dblks(enq_hdr::size() + _enq_hdr._xidsize +
_enq_hdr._dsize);
const u_int32_t hdr_tail_dblks = size_dblks(enq_hdr::size() + _enq_hdr._xidsize +
_enq_hdr._dsize + rec_tail::size());
- const size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
- const size_t offs = rec_offs - enq_hdr::size();
+ const std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ const std::size_t offs = rec_offs - enq_hdr::size();
if (hdr_tail_dblks - rec_offs_dblks <= max_size_dblks)
{
@@ -270,31 +272,31 @@
if (offs < _enq_hdr._xidsize)
{
// some XID still outstanding, copy remainder of XID, data and tail
- const size_t rem = _enq_hdr._xidsize + _enq_hdr._dsize - offs;
- ::memcpy((char*)_buff + offs, rptr, rem);
+ const std::size_t rem = _enq_hdr._xidsize + _enq_hdr._dsize - offs;
+ std::memcpy((char*)_buff + offs, rptr, rem);
rd_cnt += rem;
- ::memcpy((void*)&_enq_tail, ((char*)rptr + rd_cnt), sizeof(_enq_tail));
+ std::memcpy((void*)&_enq_tail, ((char*)rptr + rd_cnt), sizeof(_enq_tail));
chk_tail();
rd_cnt += sizeof(_enq_tail);
}
else if (offs < _enq_hdr._xidsize + _enq_hdr._dsize)
{
// some data still outstanding, copy remainder of data and tail
- const size_t data_offs = offs - _enq_hdr._xidsize;
- const size_t data_rem = _enq_hdr._dsize - data_offs;
- ::memcpy((char*)_buff + offs, rptr, data_rem);
+ const std::size_t data_offs = offs - _enq_hdr._xidsize;
+ const std::size_t data_rem = _enq_hdr._dsize - data_offs;
+ std::memcpy((char*)_buff + offs, rptr, data_rem);
rd_cnt += data_rem;
- ::memcpy((void*)&_enq_tail, ((char*)rptr + rd_cnt), sizeof(_enq_tail));
+ std::memcpy((void*)&_enq_tail, ((char*)rptr + rd_cnt), sizeof(_enq_tail));
chk_tail();
rd_cnt += sizeof(_enq_tail);
}
else
{
// Tail or part of tail only outstanding, complete tail
- const size_t tail_offs = rec_offs - enq_hdr::size() - _enq_hdr._xidsize -
+ const std::size_t tail_offs = rec_offs - enq_hdr::size() - _enq_hdr._xidsize -
_enq_hdr._dsize;
- const size_t tail_rem = rec_tail::size() - tail_offs;
- ::memcpy((char*)&_enq_tail + tail_offs, rptr, tail_rem);
+ const std::size_t tail_rem = rec_tail::size() - tail_offs;
+ std::memcpy((char*)&_enq_tail + tail_offs, rptr, tail_rem);
chk_tail();
rd_cnt = tail_rem;
}
@@ -305,30 +307,30 @@
if (offs < _enq_hdr._xidsize)
{
// some XID still outstanding, copy remainder of XID and data
- const size_t rem = _enq_hdr._xidsize + _enq_hdr._dsize - offs;
- ::memcpy((char*)_buff + offs, rptr, rem);
+ const std::size_t rem = _enq_hdr._xidsize + _enq_hdr._dsize - offs;
+ std::memcpy((char*)_buff + offs, rptr, rem);
rd_cnt += rem;
}
else if (offs < _enq_hdr._xidsize + _enq_hdr._dsize)
{
// some data still outstanding, copy remainder of data
- const size_t data_offs = offs - _enq_hdr._xidsize;
- const size_t data_rem = _enq_hdr._dsize - data_offs;
- ::memcpy((char*)_buff + offs, rptr, data_rem);
+ const std::size_t data_offs = offs - _enq_hdr._xidsize;
+ const std::size_t data_rem = _enq_hdr._dsize - data_offs;
+ std::memcpy((char*)_buff + offs, rptr, data_rem);
rd_cnt += data_rem;
}
- const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ const std::size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
if (tail_rem)
{
- ::memcpy((void*)&_enq_tail, ((char*)rptr + rd_cnt), tail_rem);
+ std::memcpy((void*)&_enq_tail, ((char*)rptr + rd_cnt), tail_rem);
rd_cnt += tail_rem;
}
}
else
{
// Since xid and data are contiguous, both fit within current page - copy whole page
- const size_t data_cp_size = (max_size_dblks * JRNL_DBLK_SIZE);
- ::memcpy((char*)_buff + offs, rptr, data_cp_size);
+ const std::size_t data_cp_size = (max_size_dblks * JRNL_DBLK_SIZE);
+ std::memcpy((char*)_buff + offs, rptr, data_cp_size);
rd_cnt += data_cp_size;
}
}
@@ -340,20 +342,20 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
rd_cnt += sizeof(u_int32_t); // Filler 0
#endif
- _enq_hdr._xidsize = *(size_t*)((char*)rptr + rd_cnt);
- rd_cnt += sizeof(size_t);
+ _enq_hdr._xidsize = *(std::size_t*)((char*)rptr + rd_cnt);
+ rd_cnt += sizeof(std::size_t);
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
rd_cnt += sizeof(u_int32_t); // Filler 0
#endif
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
rd_cnt += sizeof(u_int32_t); // Filler 1
#endif
- _enq_hdr._dsize = *(size_t*)((char*)rptr + rd_cnt);
+ _enq_hdr._dsize = *(std::size_t*)((char*)rptr + rd_cnt);
rd_cnt = _enq_hdr.size();
chk_hdr();
if (_enq_hdr._xidsize + (_enq_hdr.is_external() ? 0 : _enq_hdr._dsize))
{
- _buff = ::malloc(_enq_hdr._xidsize + (_enq_hdr.is_external() ? 0 : _enq_hdr._dsize));
+ _buff = std::malloc(_enq_hdr._xidsize + (_enq_hdr.is_external() ? 0 : _enq_hdr._dsize));
MALLOC_CHK(_buff, "_buff", "enq_rec", "decode");
const u_int32_t hdr_xid_dblks = size_dblks(enq_hdr::size() + _enq_hdr._xidsize);
@@ -368,16 +370,16 @@
// Header, xid, data and tail fits within this page
if (_enq_hdr._xidsize)
{
- ::memcpy(_buff, (char*)rptr + rd_cnt, _enq_hdr._xidsize);
+ std::memcpy(_buff, (char*)rptr + rd_cnt, _enq_hdr._xidsize);
rd_cnt += _enq_hdr._xidsize;
}
if (_enq_hdr._dsize && !_enq_hdr.is_external())
{
- ::memcpy((char*)_buff + _enq_hdr._xidsize, (char*)rptr + rd_cnt,
+ std::memcpy((char*)_buff + _enq_hdr._xidsize, (char*)rptr + rd_cnt,
_enq_hdr._dsize);
rd_cnt += _enq_hdr._dsize;
}
- ::memcpy((void*)&_enq_tail, (char*)rptr + rd_cnt, sizeof(_enq_tail));
+ std::memcpy((void*)&_enq_tail, (char*)rptr + rd_cnt, sizeof(_enq_tail));
chk_tail();
rd_cnt += sizeof(_enq_tail);
}
@@ -386,19 +388,19 @@
// Header, xid and data fit within this page, tail split or separated
if (_enq_hdr._xidsize)
{
- ::memcpy(_buff, (char*)rptr + rd_cnt, _enq_hdr._xidsize);
+ std::memcpy(_buff, (char*)rptr + rd_cnt, _enq_hdr._xidsize);
rd_cnt += _enq_hdr._xidsize;
}
if (_enq_hdr._dsize && !_enq_hdr.is_external())
{
- ::memcpy((char*)_buff + _enq_hdr._xidsize, (char*)rptr + rd_cnt,
+ std::memcpy((char*)_buff + _enq_hdr._xidsize, (char*)rptr + rd_cnt,
_enq_hdr._dsize);
rd_cnt += _enq_hdr._dsize;
}
- const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ const std::size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
if (tail_rem)
{
- ::memcpy((void*)&_enq_tail, (char*)rptr + rd_cnt, tail_rem);
+ std::memcpy((void*)&_enq_tail, (char*)rptr + rd_cnt, tail_rem);
rd_cnt += tail_rem;
}
}
@@ -407,21 +409,21 @@
// Header and xid fits within this page, data split or separated
if (_enq_hdr._xidsize)
{
- ::memcpy(_buff, (char*)rptr + rd_cnt, _enq_hdr._xidsize);
+ std::memcpy(_buff, (char*)rptr + rd_cnt, _enq_hdr._xidsize);
rd_cnt += _enq_hdr._xidsize;
}
if (_enq_hdr._dsize && !_enq_hdr.is_external())
{
- const size_t data_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
- ::memcpy((char*)_buff + _enq_hdr._xidsize, (char*)rptr + rd_cnt, data_cp_size);
+ const std::size_t data_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ std::memcpy((char*)_buff + _enq_hdr._xidsize, (char*)rptr + rd_cnt, data_cp_size);
rd_cnt += data_cp_size;
}
}
else
{
// Header fits within this page, xid split or separated
- const size_t data_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
- ::memcpy(_buff, (char*)rptr + rd_cnt, data_cp_size);
+ const std::size_t data_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ std::memcpy(_buff, (char*)rptr + rd_cnt, data_cp_size);
rd_cnt += data_cp_size;
}
}
@@ -430,7 +432,7 @@
}
bool
-enq_rec::rcv_decode(rec_hdr h, std::ifstream* ifsp, size_t& rec_offs)
+enq_rec::rcv_decode(rec_hdr h, std::ifstream* ifsp, std::size_t& rec_offs)
{
if (rec_offs == 0)
{
@@ -439,30 +441,30 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
ifsp->ignore(sizeof(u_int32_t)); // _filler0
#endif
- ifsp->read((char*)&_enq_hdr._xidsize, sizeof(size_t));
+ ifsp->read((char*)&_enq_hdr._xidsize, sizeof(std::size_t));
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
ifsp->ignore(sizeof(u_int32_t)); // _filler0
#endif
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
ifsp->ignore(sizeof(u_int32_t)); // _filler1
#endif
- ifsp->read((char*)&_enq_hdr._dsize, sizeof(size_t));
+ ifsp->read((char*)&_enq_hdr._dsize, sizeof(std::size_t));
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
ifsp->ignore(sizeof(u_int32_t)); // _filler1
#endif
rec_offs = sizeof(_enq_hdr);
if (_enq_hdr._xidsize)
{
- _buff = ::malloc(_enq_hdr._xidsize);
+ _buff = std::malloc(_enq_hdr._xidsize);
MALLOC_CHK(_buff, "_buff", "enq_rec", "rcv_decode");
}
}
if (rec_offs < sizeof(_enq_hdr) + _enq_hdr._xidsize)
{
// Read xid (or continue reading xid)
- size_t offs = rec_offs - sizeof(_enq_hdr);
+ std::size_t offs = rec_offs - sizeof(_enq_hdr);
ifsp->read((char*)_buff + offs, _enq_hdr._xidsize - offs);
- size_t size_read = ifsp->gcount();
+ std::size_t size_read = ifsp->gcount();
rec_offs += size_read;
if (size_read < _enq_hdr._xidsize - offs)
{
@@ -475,9 +477,9 @@
if (rec_offs < sizeof(_enq_hdr) + _enq_hdr._xidsize + _enq_hdr._dsize)
{
// Ignore data (or continue ignoring data)
- size_t offs = rec_offs - sizeof(_enq_hdr) - _enq_hdr._xidsize;
+ std::size_t offs = rec_offs - sizeof(_enq_hdr) - _enq_hdr._xidsize;
ifsp->ignore(_enq_hdr._dsize - offs);
- size_t size_read = ifsp->gcount();
+ std::size_t size_read = ifsp->gcount();
rec_offs += size_read;
if (size_read < _enq_hdr._dsize - offs)
{
@@ -490,11 +492,11 @@
(_enq_hdr.is_external() ? 0 : _enq_hdr._dsize) + sizeof(rec_tail))
{
// Read tail (or continue reading tail)
- size_t offs = rec_offs - sizeof(_enq_hdr) - _enq_hdr._xidsize;
+ std::size_t offs = rec_offs - sizeof(_enq_hdr) - _enq_hdr._xidsize;
if (!_enq_hdr.is_external())
offs -= _enq_hdr._dsize;
ifsp->read((char*)&_enq_tail + offs, sizeof(rec_tail) - offs);
- size_t size_read = ifsp->gcount();
+ std::size_t size_read = ifsp->gcount();
rec_offs += size_read;
if (size_read < sizeof(rec_tail) - offs)
{
@@ -507,7 +509,7 @@
return true;
}
-size_t
+std::size_t
enq_rec::get_xid(void** const xidpp)
{
if (!_buff)
@@ -519,7 +521,7 @@
return _enq_hdr._xidsize;
}
-size_t
+std::size_t
enq_rec::get_data(void** const datapp)
{
if (!_buff)
@@ -548,14 +550,14 @@
return str;
}
-size_t
+std::size_t
enq_rec::rec_size() const
{
return rec_size(_enq_hdr._xidsize, _enq_hdr._dsize, _enq_hdr.is_external());
}
-size_t
-enq_rec::rec_size(const size_t xidsize, const size_t dsize, const bool external)
+std::size_t
+enq_rec::rec_size(const std::size_t xidsize, const std::size_t dsize, const bool external)
{
if (external)
return enq_hdr::size() + xidsize + rec_tail::size();
Modified: store/trunk/cpp/lib/jrnl/enq_rec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/enq_rec.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -39,6 +39,7 @@
}
}
+#include <cstddef>
#include <jrnl/enq_hdr.hpp>
#include <jrnl/jrec.hpp>
@@ -69,8 +70,8 @@
/**
* \brief Constructor used for write operations, where mbuf contains data to be written.
*/
- enq_rec(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const void* const xidp, const size_t xidlen, const bool owi, const bool transient);
+ enq_rec(const u_int64_t rid, const void* const dbuf, const std::size_t dlen,
+ const void* const xidp, const std::size_t xidlen, const bool owi, const bool transient);
/**
* \brief Destructor
@@ -80,25 +81,25 @@
// Prepare instance for use in reading data from journal, xid and data will be allocated
void reset();
// Prepare instance for use in writing data to journal
- void reset(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const void* const xidp, const size_t xidlen, const bool owi, const bool transient,
+ void reset(const u_int64_t rid, const void* const dbuf, const std::size_t dlen,
+ const void* const xidp, const std::size_t xidlen, const bool owi, const bool transient,
const bool external);
u_int32_t encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks);
u_int32_t decode(rec_hdr& h, void* rptr, u_int32_t rec_offs_dblks,
u_int32_t max_size_dblks);
// Decode used for recover
- bool rcv_decode(rec_hdr h, std::ifstream* ifsp, size_t& rec_offs);
+ bool rcv_decode(rec_hdr h, std::ifstream* ifsp, std::size_t& rec_offs);
- size_t get_xid(void** const xidpp);
- size_t get_data(void** const datapp);
+ std::size_t get_xid(void** const xidpp);
+ std::size_t get_data(void** const datapp);
inline bool is_transient() const { return _enq_hdr.is_transient(); }
inline bool is_external() const { return _enq_hdr.is_external(); }
std::string& str(std::string& str) const;
- inline size_t data_size() const { return _enq_hdr._dsize; }
- inline size_t xid_size() const { return _enq_hdr._xidsize; }
- size_t rec_size() const;
- static size_t rec_size(const size_t xidsize, const size_t dsize, const bool external);
+ inline std::size_t data_size() const { return _enq_hdr._dsize; }
+ inline std::size_t xid_size() const { return _enq_hdr._xidsize; }
+ std::size_t rec_size() const;
+ static std::size_t rec_size(const std::size_t xidsize, const std::size_t dsize, const bool external);
inline u_int64_t rid() const { return _enq_hdr._rid; }
void set_rid(const u_int64_t rid);
Modified: store/trunk/cpp/lib/jrnl/file_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/file_hdr.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/file_hdr.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -34,7 +34,8 @@
#ifndef rhm_journal_file_hdr_hpp
#define rhm_journal_file_hdr_hpp
-#include <errno.h>
+#include <cerrno>
+#include <ctime>
#include <jrnl/rec_hdr.hpp>
#include <jrnl/jerrno.hpp>
#include <jrnl/jexception.hpp>
@@ -91,14 +92,14 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Big-endian filler for 32-bit size_t
#endif
- size_t _fro; ///< First record offset
+ std::size_t _fro; ///< First record offset
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Little-endian filler for 32-bit size_t
#endif
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler1; ///< Big-endian filler for 32-bit time_t
#endif
- time_t _ts_sec; ///< Timestamp of journal initilailization
+ std::time_t _ts_sec; ///< Timestamp of journal initilailization
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler1; ///< Little-endian filler for 32-bit time_t
#endif
@@ -141,7 +142,7 @@
* \brief Convenience constructor which initializes values during construction.
*/
inline file_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
- const u_int32_t fid, const size_t fro, const bool owi, const bool settime = false):
+ const u_int32_t fid, const std::size_t fro, const bool owi, const bool settime = false):
rec_hdr(magic, version, rid, owi), _fid(fid), _res(0),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
@@ -196,7 +197,7 @@
/**
* \brief Returns the size of the header in bytes.
*/
- inline static size_t size() { return sizeof(file_hdr); }
+ inline static std::size_t size() { return sizeof(file_hdr); }
}; // struct file_hdr
#pragma pack()
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -32,8 +32,10 @@
#include <jrnl/jcntl.hpp>
#include <algorithm>
-#include <assert.h>
+#include <cassert>
#include <cerrno>
+#include <cstdlib>
+#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
@@ -121,7 +123,7 @@
_datafh = new lfh*[_num_jfiles];
// Zero the pointer array first because new() can throw exceptions
- ::memset(_datafh, 0, sizeof(lfh*) * _num_jfiles);
+ std::memset(_datafh, 0, sizeof(lfh*) * _num_jfiles);
for (u_int16_t i=0; i<_num_jfiles; i++)
{
std::ostringstream oss;
@@ -185,7 +187,7 @@
_datafh = new lfh*[_num_jfiles];
// 0 the pointer array first because new() can throw exceptions
- ::memset(_datafh, 0, sizeof(lfh*) * _num_jfiles);
+ std::memset(_datafh, 0, sizeof(lfh*) * _num_jfiles);
for (u_int16_t i=0; i<_num_jfiles; i++)
{
std::ostringstream oss;
@@ -228,35 +230,35 @@
iores
-jcntl::enqueue_data_record(const void* const data_buff, const size_t tot_data_len,
- const size_t this_data_len, data_tok* dtokp, const bool transient)
+jcntl::enqueue_data_record(const void* const data_buff, const std::size_t tot_data_len,
+ const std::size_t this_data_len, data_tok* dtokp, const bool transient)
{
check_wstatus("enqueue_data_record");
{
slock s(&_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, 0,
- 0, transient, false), r, dtokp));
+ 0, transient, false), r, dtokp)) ;
return r;
}
}
iores
-jcntl::enqueue_extern_data_record(const size_t tot_data_len, data_tok* dtokp, const bool transient)
+jcntl::enqueue_extern_data_record(const std::size_t tot_data_len, data_tok* dtokp, const bool transient)
{
check_wstatus("enqueue_extern_data_record");
{
slock s(&_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(0, tot_data_len, 0, dtokp, 0, 0, transient,
- true), r, dtokp));
+ true), r, dtokp)) ;
return r;
}
}
iores
-jcntl::enqueue_txn_data_record(const void* const data_buff, const size_t tot_data_len,
- const size_t this_data_len, data_tok* dtokp, const std::string& xid,
+jcntl::enqueue_txn_data_record(const void* const data_buff, const std::size_t tot_data_len,
+ const std::size_t this_data_len, data_tok* dtokp, const std::string& xid,
const bool transient)
{
check_wstatus("enqueue_tx_data_record");
@@ -264,13 +266,13 @@
slock s(&_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp,
- xid.data(), xid.size(), transient, false), r, dtokp));
+ xid.data(), xid.size(), transient, false), r, dtokp)) ;
return r;
}
}
iores
-jcntl::enqueue_extern_txn_data_record(const size_t tot_data_len, data_tok* dtokp,
+jcntl::enqueue_extern_txn_data_record(const std::size_t tot_data_len, data_tok* dtokp,
const std::string& xid, const bool transient)
{
check_wstatus("enqueue_extern_txn_data_record");
@@ -278,14 +280,14 @@
slock s(&_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(0, tot_data_len, 0, dtokp, xid.data(), xid.size(),
- transient, true), r, dtokp));
+ transient, true), r, dtokp)) ;
return r;
}
}
/* TODO
iores
-jcntl::get_data_record(const u_int64_t& rid, const size_t& dsize, const size_t& dsize_avail,
+jcntl::get_data_record(const u_int64_t& rid, const std::size_t& dsize, const std::size_t& dsize_avail,
const void** const data, bool auto_discard)
{
check_rstatus("get_data_record");
@@ -303,7 +305,7 @@
#define MAX_RCINVALID_CNT 50
#define RCINVALID_SLEEP_TIME_MS 2
iores
-jcntl::read_data_record(void** const datapp, size_t& dsize, void** const xidpp, size_t& xidsize,
+jcntl::read_data_record(void** const datapp, std::size_t& dsize, void** const xidpp, std::size_t& xidsize,
bool& transient, bool& external, data_tok* const dtokp)
{
check_rstatus("read_data");
@@ -332,7 +334,7 @@
{
slock s(&_wr_mutex);
iores r;
- while (handle_aio_wait(_wmgr.dequeue(dtokp, 0, 0), r, dtokp));
+ while (handle_aio_wait(_wmgr.dequeue(dtokp, 0, 0), r, dtokp)) ;
return r;
}
}
@@ -344,7 +346,7 @@
{
slock s(&_wr_mutex);
iores r;
- while (handle_aio_wait(_wmgr.dequeue(dtokp, xid.data(), xid.size()), r, dtokp));
+ while (handle_aio_wait(_wmgr.dequeue(dtokp, xid.data(), xid.size()), r, dtokp)) ;
return r;
}
}
@@ -356,7 +358,7 @@
{
slock s(&_wr_mutex);
iores r;
- while (handle_aio_wait(_wmgr.abort(dtokp, xid.data(), xid.size()), r, dtokp));
+ while (handle_aio_wait(_wmgr.abort(dtokp, xid.data(), xid.size()), r, dtokp)) ;
return r;
}
}
@@ -368,7 +370,7 @@
{
slock s(&_wr_mutex);
iores r;
- while (handle_aio_wait(_wmgr.commit(dtokp, xid.data(), xid.size()), r, dtokp));
+ while (handle_aio_wait(_wmgr.commit(dtokp, xid.data(), xid.size()), r, dtokp)) ;
return r;
}
}
@@ -589,7 +591,7 @@
u_int16_t fid = rd._ffid;
std::ifstream ifs;
bool lowi = rd._owi; // local copy of owi to be used during analysis
- while (rcvr_get_next_record(fid, &ifs, lowi, rd));
+ while (rcvr_get_next_record(fid, &ifs, lowi, rd)) ;
// Check for journal full condition
u_int16_t next_wr_fid = (rd._lfid + 1) % _num_jfiles;
@@ -613,7 +615,7 @@
bool
jcntl::rcvr_get_next_record(u_int16_t& fid, std::ifstream* ifsp, bool& lowi, rcvdat& rd)
{
- size_t cum_size_read = 0;
+ std::size_t cum_size_read = 0;
void* xidp = 0;
rec_hdr h;
if (!jfile_cycle(fid, ifsp, lowi, rd, true))
@@ -636,7 +638,7 @@
assert(xidp != 0);
std::string xid((char*)xidp, er.xid_size());
_tmap.insert_txn_data(xid, txn_data(h._rid, 0, fid, true));
- ::free(xidp);
+ std::free(xidp);
}
else
_emap.insert_fid(h._rid, fid);
@@ -660,7 +662,7 @@
assert(xidp != 0);
std::string xid((char*)xidp, dr.xid_size());
_tmap.insert_txn_data(xid, txn_data(dr.rid(), dr.deq_rid(), fid, false));
- ::free(xidp);
+ std::free(xidp);
}
else
{
@@ -706,7 +708,7 @@
{
if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
}
- ::free(xidp);
+ std::free(xidp);
}
break;
case RHM_JDAT_TXC_MAGIC:
@@ -743,7 +745,7 @@
{
if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
}
- ::free(xidp);
+ std::free(xidp);
}
break;
case RHM_JDAT_EMPTY_MAGIC:
@@ -764,7 +766,7 @@
}
bool
-jcntl::decode(jrec& rec, u_int16_t& fid, std::ifstream* ifsp, size_t& cum_size_read, rec_hdr& h,
+jcntl::decode(jrec& rec, u_int16_t& fid, std::ifstream* ifsp, std::size_t& cum_size_read, rec_hdr& h,
bool& lowi, rcvdat& rd, std::streampos& file_offs)
{
u_int16_t start_fid = fid;
@@ -889,13 +891,13 @@
if (!ofsp.good())
throw jexception(jerrno::JERR__FILEIO, oss.str(), "jcntl", "check_journal_alignment");
ofsp.seekp(file_pos);
- void* buff = ::malloc(JRNL_DBLK_SIZE);
+ void* buff = std::malloc(JRNL_DBLK_SIZE);
assert(buff != 0);
- ::memcpy(buff, (void*)&xmagic, sizeof(xmagic));
+ std::memcpy(buff, (void*)&xmagic, sizeof(xmagic));
// Normally, RHM_CLEAN must be set before these fills are done, but this is a recover
// situation (i.e. performance is not an issue), and it makes the location of the write
// clear should inspection of the file be required.
- ::memset((char*)buff + sizeof(xmagic), RHM_CLEAN_CHAR, JRNL_DBLK_SIZE - sizeof(xmagic));
+ std::memset((char*)buff + sizeof(xmagic), RHM_CLEAN_CHAR, JRNL_DBLK_SIZE - sizeof(xmagic));
while (file_pos % (JRNL_DBLK_SIZE * JRNL_SBLK_SIZE))
{
@@ -907,7 +909,7 @@
file_pos = ofsp.tellp();
}
ofsp.close();
- ::free(buff);
+ std::free(buff);
this->log(LOG_INFO, "Bad record alignment fixed.");
}
}
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -39,6 +39,7 @@
}
}
+#include <cstddef>
#include <deque>
#include <jrnl/jdir.hpp>
#include <jrnl/lfh.hpp>
@@ -272,10 +273,10 @@
*
* \exception TODO
*/
- iores enqueue_data_record(const void* const data_buff, const size_t tot_data_len,
- const size_t this_data_len, data_tok* dtokp, const bool transient = false);
+ iores enqueue_data_record(const void* const data_buff, const std::size_t tot_data_len,
+ const std::size_t this_data_len, data_tok* dtokp, const bool transient = false);
- iores enqueue_extern_data_record(const size_t tot_data_len, data_tok* dtokp,
+ iores enqueue_extern_data_record(const std::size_t tot_data_len, data_tok* dtokp,
const bool transient = false);
/**
@@ -291,10 +292,10 @@
*
* \exception TODO
*/
- iores enqueue_txn_data_record(const void* const data_buff, const size_t tot_data_len,
- const size_t this_data_len, data_tok* dtokp, const std::string& xid,
+ iores enqueue_txn_data_record(const void* const data_buff, const std::size_t tot_data_len,
+ const std::size_t this_data_len, data_tok* dtokp, const std::string& xid,
const bool transient = false);
- iores enqueue_extern_txn_data_record(const size_t tot_data_len, data_tok* dtokp,
+ iores enqueue_extern_txn_data_record(const std::size_t tot_data_len, data_tok* dtokp,
const std::string& xid, const bool transient = false);
/* TODO
@@ -356,8 +357,8 @@
* \exception TODO
*
// *** NOT YET IMPLEMENTED ***
- iores get_data_record(const u_int64_t& rid, const size_t& dsize,
- const size_t& dsize_avail, const void** const data, bool auto_discard = false);
+ iores get_data_record(const u_int64_t& rid, const std::size_t& dsize,
+ const std::size_t& dsize_avail, const void** const data, bool auto_discard = false);
*/
/* TODO
@@ -403,8 +404,8 @@
*
* \exception TODO
*/
- iores read_data_record(void** const datapp, size_t& dsize, void** const xidpp,
- size_t& xidsize, bool& transient, bool& external, data_tok* const dtokp);
+ iores read_data_record(void** const datapp, std::size_t& dsize, void** const xidpp,
+ std::size_t& xidsize, bool& transient, bool& external, data_tok* const dtokp);
/**
* \brief Dequeues (marks as no longer needed) data record in journal.
@@ -633,7 +634,7 @@
bool rcvr_get_next_record(u_int16_t& fid, std::ifstream* ifsp, bool& lowi, rcvdat& rd);
- bool decode(jrec& rec, u_int16_t& fid, std::ifstream* ifsp, size_t& cum_size_read,
+ bool decode(jrec& rec, u_int16_t& fid, std::ifstream* ifsp, std::size_t& cum_size_read,
rec_hdr& h, bool& lowi, rcvdat& rd, std::streampos& rec_offset);
bool jfile_cycle(u_int16_t& fid, std::ifstream* ifsp, bool& lowi, rcvdat& rd,
Modified: store/trunk/cpp/lib/jrnl/jdir.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jdir.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/jdir.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -31,6 +31,7 @@
#include <jrnl/jdir.hpp>
+#include <cstring>
#include <dirent.h>
#include <cerrno>
#include <iomanip>
@@ -72,7 +73,7 @@
void
jdir::create_dir(const std::string& dirname)
{
- size_t fdp = dirname.find_last_of('/');
+ std::size_t fdp = dirname.find_last_of('/');
if (fdp != std::string::npos)
{
std::string parent_dir = dirname.substr(0, fdp);
@@ -132,11 +133,11 @@
while ((entry = ::readdir(dir)) != 0)
{
// Ignore . and ..
- if (::strcmp(entry->d_name, ".") != 0 && ::strcmp(entry->d_name, "..") != 0)
+ if (std::strcmp(entry->d_name, ".") != 0 && std::strcmp(entry->d_name, "..") != 0)
{
- if (::strlen(entry->d_name) > base_filename.size())
+ if (std::strlen(entry->d_name) > base_filename.size())
{
- if (::strncmp(entry->d_name, base_filename.c_str(), base_filename.size()) == 0)
+ if (std::strncmp(entry->d_name, base_filename.c_str(), base_filename.size()) == 0)
{
if (!found)
{
@@ -250,7 +251,7 @@
while ((entry = ::readdir(dir)) != 0)
{
// Ignore . and ..
- if (::strcmp(entry->d_name, ".") != 0 && ::strcmp(entry->d_name, "..") != 0)
+ if (std::strcmp(entry->d_name, ".") != 0 && std::strcmp(entry->d_name, "..") != 0)
{
std::string full_name(dirname + "/" + entry->d_name);
if (::stat(full_name.c_str(), &s))
@@ -326,15 +327,15 @@
while ((entry = ::readdir(dir)) != 0)
{
// Ignore . and ..
- if (::strcmp(entry->d_name, ".") != 0 && ::strcmp(entry->d_name, "..") != 0)
+ if (std::strcmp(entry->d_name, ".") != 0 && std::strcmp(entry->d_name, "..") != 0)
{
- if (::strlen(entry->d_name) == base_filename.size() + 10) // Format: basename.bak.XXXX
+ if (std::strlen(entry->d_name) == base_filename.size() + 10) // Format: basename.bak.XXXX
{
std::ostringstream oss;
oss << "_" << base_filename << ".bak.";
- if (::strncmp(entry->d_name, oss.str().c_str(), base_filename.size() + 6) == 0)
+ if (std::strncmp(entry->d_name, oss.str().c_str(), base_filename.size() + 6) == 0)
{
- long this_dir_num = ::strtol(entry->d_name + base_filename.size() + 6, 0, 16);
+ long this_dir_num = std::strtol(entry->d_name + base_filename.size() + 6, 0, 16);
if (this_dir_num > dir_num)
dir_num = this_dir_num;
}
Modified: store/trunk/cpp/lib/jrnl/jexception.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jexception.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/jexception.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -36,7 +36,7 @@
#include <sstream>
#include <jrnl/jerrno.hpp>
-#define CATLEN(p) MAX_MSG_SIZE - ::strlen(p) - 1
+#define CATLEN(p) MAX_MSG_SIZE - std::strlen(p) - 1
namespace rhm
{
Modified: store/trunk/cpp/lib/jrnl/jexception.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jexception.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/jexception.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -43,11 +43,10 @@
#include <exception>
#include <string>
-#include <string.h>
#include <sys/types.h>
// Macro for formatting commom system errors
-#define FORMAT_SYSERR(errno) " errno=" << errno << " (" << strerror(errno) << ")"
+#define FORMAT_SYSERR(errno) " errno=" << errno << " (" << std::strerror(errno) << ")"
#define MALLOC_CHK(ptr, var, cls, fn) if(ptr == 0) { \
clean(); \
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -31,6 +31,9 @@
#include <jrnl/jinf.hpp>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
#include <fstream>
#include <jrnl/file_hdr.hpp>
#include <jrnl/jcntl.hpp>
@@ -80,7 +83,7 @@
_wmgr_num_pages(JRNL_WMGR_PAGES),
_rmgr_page_size_dblks(JRNL_RMGR_PAGE_SIZE),
_rmgr_num_pages(JRNL_RMGR_PAGES),
- _tm_ptr(::localtime(&ts.tv_sec)),
+ _tm_ptr(std::localtime(&ts.tv_sec)),
_valid_flag(false),
_analyzed_flag(false),
_start_file(0),
@@ -325,36 +328,36 @@
while (jinfs.good())
{
jinfs.getline(buff, 1024);
- if (::strstr(buff, "journal_version"))
+ if (std::strstr(buff, "journal_version"))
_jver = u_int16_value(buff);
- else if(::strstr(buff, "id_string"))
+ else if(std::strstr(buff, "id_string"))
string_value(_jid, buff);
- else if(::strstr(buff, "directory"))
+ else if(std::strstr(buff, "directory"))
string_value(_jdir, buff);
- else if(::strstr(buff, "base_filename"))
+ else if(std::strstr(buff, "base_filename"))
string_value(_base_filename, buff);
- else if(::strstr(buff, "number_jrnl_files"))
+ else if(std::strstr(buff, "number_jrnl_files"))
_num_jfiles = u_int16_value(buff);
- else if(::strstr(buff, "jrnl_file_size_sblks"))
+ else if(std::strstr(buff, "jrnl_file_size_sblks"))
_jfsize_sblks = u_int32_value(buff);
- else if(::strstr(buff, "JRNL_SBLK_SIZE"))
+ else if(std::strstr(buff, "JRNL_SBLK_SIZE"))
_sblk_size_dblks = u_int16_value(buff);
- else if(::strstr(buff, "JRNL_DBLK_SIZE"))
+ else if(std::strstr(buff, "JRNL_DBLK_SIZE"))
_dblk_size = u_int32_value(buff);
- else if(::strstr(buff, "JRNL_WMGR_PAGE_SIZE"))
+ else if(std::strstr(buff, "JRNL_WMGR_PAGE_SIZE"))
_wmgr_page_size_dblks = u_int32_value(buff);
- else if(::strstr(buff, "JRNL_WMGR_PAGES"))
+ else if(std::strstr(buff, "JRNL_WMGR_PAGES"))
_wmgr_num_pages = u_int32_value(buff);
- else if(::strstr(buff, "JRNL_RMGR_PAGE_SIZE"))
+ else if(std::strstr(buff, "JRNL_RMGR_PAGE_SIZE"))
_rmgr_page_size_dblks = u_int32_value(buff);
- else if(::strstr(buff, "JRNL_RMGR_PAGES"))
+ else if(std::strstr(buff, "JRNL_RMGR_PAGES"))
_rmgr_num_pages = u_int32_value(buff);
- else if(::strstr(buff, "nanoseconds"))
+ else if(std::strstr(buff, "nanoseconds"))
_ts.tv_nsec = u_int32_value(buff);
- else if(::strstr(buff, "seconds"))
+ else if(std::strstr(buff, "seconds"))
{
_ts.tv_sec = u_int32_value(buff);
- _tm_ptr = ::localtime(&_ts.tv_sec);
+ _tm_ptr = std::localtime(&_ts.tv_sec);
}
}
jinfs.close();
@@ -363,13 +366,13 @@
u_int16_t
jinf::u_int16_value(char* line) const
{
- return ::atoi(find_value(line));
+ return std::atoi(find_value(line));
}
u_int32_t
jinf::u_int32_value(char* line) const
{
- return ::atol(find_value(line));
+ return std::atol(find_value(line));
}
const std::string&
@@ -384,12 +387,12 @@
{
const char* target1_str = "value=\"";
int target2_char = '\"';
- char* t1 = ::strstr(line, target1_str);
+ char* t1 = std::strstr(line, target1_str);
if (t1 == 0)
throw jexception(jerrno::JERR_JINF_NOVALUESTR, line, "jinf", "find_value");
- t1 += ::strlen(target1_str);
+ t1 += std::strlen(target1_str);
- char* t2 = ::strchr(t1, target2_char);
+ char* t2 = std::strchr(t1, target2_char);
if (t2 == 0)
throw jexception(jerrno::JERR_JINF_BADVALUESTR, line, "jinf", "find_value");
*t2 = '\0';
Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -32,6 +32,7 @@
#ifndef rhm_journal_jinf_hpp
#define rhm_journal_jinf_hpp
+#include <ctime>
#include <string>
#include <sys/types.h>
@@ -59,7 +60,7 @@
u_int32_t _wmgr_num_pages;
u_int32_t _rmgr_page_size_dblks;
u_int32_t _rmgr_num_pages;
- tm* _tm_ptr;
+ std::tm* _tm_ptr;
bool _valid_flag;
bool _analyzed_flag;
u_int16_t _start_file;
Modified: store/trunk/cpp/lib/jrnl/jrec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jrec.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/jrec.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -32,7 +32,6 @@
#include <jrnl/jrec.hpp>
-// #include <errno.h>
#include <iomanip>
#include <sstream>
#include <jrnl/jerrno.hpp>
Modified: store/trunk/cpp/lib/jrnl/jrec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jrec.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/jrec.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -41,6 +41,7 @@
}
}
+#include <cstddef>
#include <fstream>
#include <jrnl/rec_hdr.hpp>
#include <jrnl/rec_tail.hpp>
@@ -151,18 +152,18 @@
virtual u_int32_t decode(rec_hdr& h, void* rptr, u_int32_t rec_offs_dblks,
u_int32_t max_size_dblks) = 0;
- virtual bool rcv_decode(rec_hdr h, std::ifstream* ifsp, size_t& rec_offs) = 0;
+ virtual bool rcv_decode(rec_hdr h, std::ifstream* ifsp, std::size_t& rec_offs) = 0;
virtual std::string& str(std::string& str) const = 0;
- virtual size_t data_size() const = 0;
- virtual size_t xid_size() const = 0;
- virtual size_t rec_size() const = 0;
+ virtual std::size_t data_size() const = 0;
+ virtual std::size_t xid_size() const = 0;
+ virtual std::size_t rec_size() const = 0;
inline virtual u_int32_t rec_size_dblks() const { return size_dblks(rec_size()); }
- static inline u_int32_t size_dblks(const size_t size)
+ static inline u_int32_t size_dblks(const std::size_t size)
{ return size_blks(size, JRNL_DBLK_SIZE); }
- static inline u_int32_t size_sblks(const size_t size)
+ static inline u_int32_t size_sblks(const std::size_t size)
{ return size_blks(size, JRNL_DBLK_SIZE * JRNL_SBLK_SIZE); }
- static inline u_int32_t size_blks(const size_t size, const size_t blksize)
+ static inline u_int32_t size_blks(const std::size_t size, const std::size_t blksize)
{ return (size + blksize - 1)/blksize; }
protected:
Modified: store/trunk/cpp/lib/jrnl/nlfh.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/nlfh.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -31,8 +31,8 @@
#include <jrnl/nlfh.hpp>
-#include <assert.h>
#include <cerrno>
+#include <cstring>
#include <fcntl.h>
#include <iomanip>
#include <sstream>
@@ -137,8 +137,8 @@
}
else // Normal initialization: create empty journal files
{
- const size_t sblksize = JRNL_DBLK_SIZE * JRNL_SBLK_SIZE;
- const size_t writesize = sblksize * JRNL_WMGR_PAGE_SIZE;
+ const std::size_t sblksize = JRNL_DBLK_SIZE * JRNL_SBLK_SIZE;
+ const std::size_t writesize = sblksize * JRNL_WMGR_PAGE_SIZE;
// NOTE: The journal file size is always one sblock bigger than the specified journal
// file size, which is the data content size. The extra block is for the journal file
@@ -153,7 +153,7 @@
oss << " errno=" << errno;
throw jexception(jerrno::JERR__MALLOC, oss.str(), "nlfh", "initialize");
}
- ::memset(nullbuf, 0, writesize);
+ std::memset(nullbuf, 0, writesize);
int fh = ::open(_fname.c_str(), O_WRONLY | O_CREAT | O_DIRECT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); // 0644 -rw-r--r--
@@ -161,7 +161,7 @@
{
std::ostringstream oss;
oss << ": open() failed:" << "\" errno=" << errno;
- ::free(nullbuf);
+ std::free(nullbuf);
throw jexception(jerrno::JERR_NLFH_OPENWR, oss.str(), "nlfh", "initialize");
}
@@ -174,7 +174,7 @@
std::ostringstream oss;
oss << ": wr_size=" << (this_write_sblks * sblksize) << " errno=" << errno;
::close(fh);
- ::free(nullbuf);
+ std::free(nullbuf);
throw jexception(jerrno::JERR_NLFH_WRITE, oss.str(), "nlfh",
"initialize");
}
@@ -182,7 +182,7 @@
}
// Clean up
- ::free(nullbuf);
+ std::free(nullbuf);
if (::close(fh))
{
std::ostringstream oss;
Modified: store/trunk/cpp/lib/jrnl/nlfh.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/nlfh.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -40,6 +40,7 @@
}
}
+#include <cstddef>
#include <string>
#include <jrnl/rcvdat.hpp>
#include <sys/types.h>
@@ -90,19 +91,19 @@
u_int32_t subtr_enqcnt(u_int32_t s);
inline u_int32_t rd_subm_cnt_dblks() const { return _rd_subm_cnt_dblks; }
- inline size_t rd_subm_offs() const { return _rd_subm_cnt_dblks * JRNL_DBLK_SIZE; }
+ inline std::size_t rd_subm_offs() const { return _rd_subm_cnt_dblks * JRNL_DBLK_SIZE; }
u_int32_t add_rd_subm_cnt_dblks(u_int32_t a);
inline u_int32_t rd_cmpl_cnt_dblks() const { return _rd_cmpl_cnt_dblks; }
- inline size_t rd_cmpl_offs() const { return _rd_cmpl_cnt_dblks * JRNL_DBLK_SIZE; }
+ inline std::size_t rd_cmpl_offs() const { return _rd_cmpl_cnt_dblks * JRNL_DBLK_SIZE; }
u_int32_t add_rd_cmpl_cnt_dblks(u_int32_t a);
inline u_int32_t wr_subm_cnt_dblks() const { return _wr_subm_cnt_dblks; }
- inline size_t wr_subm_offs() const { return _wr_subm_cnt_dblks * JRNL_DBLK_SIZE; }
+ inline std::size_t wr_subm_offs() const { return _wr_subm_cnt_dblks * JRNL_DBLK_SIZE; }
u_int32_t add_wr_subm_cnt_dblks(u_int32_t a);
inline u_int32_t wr_cmpl_cnt_dblks() const { return _wr_cmpl_cnt_dblks; }
- inline size_t wr_cmpl_offs() const { return _wr_cmpl_cnt_dblks * JRNL_DBLK_SIZE; }
+ inline std::size_t wr_cmpl_offs() const { return _wr_cmpl_cnt_dblks * JRNL_DBLK_SIZE; }
u_int32_t add_wr_cmpl_cnt_dblks(u_int32_t a);
inline u_int16_t aio_cnt() const { return _aio_cnt; }
Modified: store/trunk/cpp/lib/jrnl/pmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/pmgr.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -31,6 +31,8 @@
#include <jrnl/pmgr.hpp>
#include <cerrno>
+#include <cstdlib>
+#include <cstring>
#include <sstream>
#include <jrnl/jcfg.hpp>
#include <jrnl/jerrno.hpp>
@@ -109,7 +111,7 @@
pmgr::clean();
// 1. Allocate page memory (as a single block)
- size_t pagesize = _pages * _pagesize * _sblksize;
+ std::size_t pagesize = _pages * _pagesize * _sblksize;
if (::posix_memalign(&_page_base_ptr, _sblksize, pagesize))
{
clean();
@@ -119,16 +121,16 @@
throw jexception(jerrno::JERR__MALLOC, oss.str(), "pmgr", "initialize");
}
// 2. Allocate array of page pointers
- _page_ptr_arr = (void**)::malloc(_pages * sizeof(void*));
+ _page_ptr_arr = (void**)std::malloc(_pages * sizeof(void*));
MALLOC_CHK(_page_ptr_arr, "_page_ptr_arr", "pmgr", "initialize");
// 3. Allocate and initilaize page control block (page_cb) array
- _page_cb_arr = (page_cb*)::malloc(_pages * sizeof(page_cb));
+ _page_cb_arr = (page_cb*)std::malloc(_pages * sizeof(page_cb));
MALLOC_CHK(_page_cb_arr, "_page_cb_arr", "pmgr", "initialize");
- ::memset(_page_cb_arr, 0, _pages * sizeof(page_cb));
+ std::memset(_page_cb_arr, 0, _pages * sizeof(page_cb));
// 5. Allocate IO control block (iocb) array
- _iocb_arr = (iocb*)::malloc(_pages * sizeof(iocb));
+ _iocb_arr = (iocb*)std::malloc(_pages * sizeof(iocb));
MALLOC_CHK(_iocb_arr, "_iocb_arr", "pmgr", "initialize");
// 6. Set page pointers in _page_ptr_arr, _page_cb_arr and iocbs to pages within page block
@@ -145,14 +147,14 @@
// 7. Allocate io_event array, max one event per cache page in rmgr and wmgr
const u_int16_t max_aio_evts = JRNL_RMGR_PAGES + JRNL_WMGR_PAGES;
- _ioevt_arr = (io_event*)::malloc(max_aio_evts * sizeof(io_event));
+ _ioevt_arr = (io_event*)std::malloc(max_aio_evts * sizeof(io_event));
MALLOC_CHK(_ioevt_arr, "_ioevt_arr", "pmgr", "initialize");
// 8. Initialize AIO context
if (int ret = ::io_queue_init(max_aio_evts, &_ioctx))
{
std::ostringstream oss;
- oss << "io_queue_init() failed: " << strerror(-ret) << " (" << ret << ")";
+ oss << "io_queue_init() failed: " << std::strerror(-ret) << " (" << ret << ")";
throw jexception(jerrno::JERR__AIO, oss.str(), "pmgr", "initialize");
}
}
@@ -165,24 +167,24 @@
if (_ioctx)
::io_queue_release(_ioctx);
- ::free(_page_base_ptr);
+ std::free(_page_base_ptr);
_page_base_ptr = 0;
if (_page_cb_arr)
{
for (int i=0; i<_pages; i++)
delete _page_cb_arr[i]._pdtokl;
- ::free(_page_ptr_arr);
+ std::free(_page_ptr_arr);
_page_ptr_arr = 0;
}
- ::free(_page_cb_arr);
+ std::free(_page_cb_arr);
_page_cb_arr = 0;
- ::free(_iocb_arr);
+ std::free(_iocb_arr);
_iocb_arr = 0;
- ::free(_ioevt_arr);
+ std::free(_ioevt_arr);
_ioevt_arr = 0;
}
Modified: store/trunk/cpp/lib/jrnl/rcvdat.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rcvdat.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/rcvdat.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -32,6 +32,7 @@
#ifndef rhm_journal_rcvdat_hpp
#define rhm_journal_rcvdat_hpp
+#include <cstddef>
#include <iomanip>
#include <map>
#include <sstream>
@@ -50,9 +51,9 @@
bool _frot; ///< First rotation flag
bool _empty; ///< Journal data files empty
u_int16_t _ffid; ///< First file id
- size_t _fro; ///< First record offset in ffid
+ std::size_t _fro; ///< First record offset in ffid
u_int16_t _lfid; ///< Last file id
- size_t _eo; ///< End offset (first byte past last record)
+ std::size_t _eo; ///< End offset (first byte past last record)
u_int64_t _h_rid; ///< Highest rid found
bool _full; ///< Journal is full
std::vector<u_int32_t> _enq_cnt_list; ///< Number enqueued records found for each file
Modified: store/trunk/cpp/lib/jrnl/rec_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rec_hdr.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/rec_hdr.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -34,6 +34,7 @@
#ifndef rhm_journal_rec_hdr_hpp
#define rhm_journal_rec_hdr_hpp
+#include <cstddef>
#include <jrnl/jcfg.hpp>
#include <sys/types.h>
@@ -131,7 +132,7 @@
/**
* \brief Returns the size of the header in bytes.
*/
- inline static size_t size() { return sizeof(rec_hdr); }
+ inline static std::size_t size() { return sizeof(rec_hdr); }
}; // struct rec_hdr
#pragma pack()
Modified: store/trunk/cpp/lib/jrnl/rec_tail.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rec_tail.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/rec_tail.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -34,7 +34,7 @@
#ifndef rhm_journal_rec_tail_hpp
#define rhm_journal_rec_tail_hpp
-
+#include <cstddef>
#include <jrnl/jcfg.hpp>
namespace rhm
@@ -87,7 +87,7 @@
/**
* \brief Returns the size of the header in bytes.
*/
- inline static size_t size() { return sizeof(rec_tail); }
+ inline static std::size_t size() { return sizeof(rec_tail); }
};
#pragma pack()
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -30,11 +30,11 @@
#include <jrnl/rmgr.hpp>
+#include <cassert>
+#include <cerrno>
#include <jrnl/jcntl.hpp>
-#include <assert.h>
-#include <cerrno>
+#include <jrnl/jerrno.hpp>
#include <sstream>
-#include <jrnl/jerrno.hpp>
namespace rhm
{
@@ -57,7 +57,7 @@
}
void
-rmgr::initialize(const rd_aio_cb rd_cb, const size_t fro)
+rmgr::initialize(const rd_aio_cb rd_cb, const std::size_t fro)
{
_cb = rd_cb;
initialize();
@@ -82,13 +82,13 @@
throw jexception(jerrno::JERR__MALLOC, oss.str(), "rmgr", "initialize");
}
_iocbp = new iocb;
- ::memset(_iocbp, 0, sizeof(iocb*));
+ std::memset(_iocbp, 0, sizeof(iocb*));
}
void
rmgr::clean()
{
- ::free(_fhdr_buffer);
+ std::free(_fhdr_buffer);
_fhdr_buffer = 0;
if (_iocbp)
@@ -99,7 +99,7 @@
}
iores
-rmgr::read(void** const datapp, size_t& dsize, void** const xidpp, size_t& xidsize, bool& transient,
+rmgr::read(void** const datapp, std::size_t& dsize, void** const xidpp, std::size_t& xidsize, bool& transient,
bool& external, data_tok* dtokp)
{
iores res = pre_read_check(dtokp);
@@ -153,7 +153,7 @@
}
void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
(_pg_offset_dblks * JRNL_DBLK_SIZE));
- ::memcpy(&_hdr, rptr, sizeof(rec_hdr));
+ std::memcpy(&_hdr, rptr, sizeof(rec_hdr));
switch (_hdr._magic)
{
case RHM_JDAT_ENQ_MAGIC:
@@ -269,7 +269,7 @@
if (ret == -EINTR) // No events
return 0;
std::ostringstream oss;
- oss << "io_getevents() failed: " << strerror(-ret) << " (" << ret << ")";
+ oss << "io_getevents() failed: " << std::strerror(-ret) << " (" << ret << ")";
throw jexception(jerrno::JERR__AIO, oss.str(), "rmgr", "get_events");
}
@@ -290,7 +290,7 @@
if (aioret < 0)
{
std::ostringstream oss;
- oss << "AIO read operation failed: " << strerror(-aioret) << " (" << aioret << ")";
+ oss << "AIO read operation failed: " << std::strerror(-aioret) << " (" << aioret << ")";
oss << " [pg=" << pcbp->_index << " buf=" << iocbp->u.c.buf;
oss << " rsize=0x" << std::hex << iocbp->u.c.nbytes;
oss << " offset=0x" << iocbp->u.c.offset << std::dec;
@@ -310,9 +310,9 @@
}
else // File header reads have no pcb
{
- ::memcpy(&_fhdr, _fhdr_buffer, sizeof(file_hdr));
+ std::memcpy(&_fhdr, _fhdr_buffer, sizeof(file_hdr));
_rrfc.add_cmpl_cnt_dblks(JRNL_SBLK_SIZE);
- size_t fro_dblks = _fhdr._fro / JRNL_DBLK_SIZE;
+ std::size_t fro_dblks = _fhdr._fro / JRNL_DBLK_SIZE;
_pg_offset_dblks += fro_dblks - JRNL_SBLK_SIZE;
_fhdr_rd_outstanding = false;
_valid = true;
@@ -326,7 +326,7 @@
}
void
-rmgr::recover_complete(size_t fro)
+rmgr::recover_complete(std::size_t fro)
{
if (fro)
{
@@ -451,7 +451,7 @@
if (h._magic == RHM_JDAT_ENQ_MAGIC)
{
enq_hdr ehdr;
- ::memcpy(&ehdr, rptr, sizeof(enq_hdr));
+ std::memcpy(&ehdr, rptr, sizeof(enq_hdr));
if (ehdr.is_external())
dtokp->set_dsize(ehdr._xidsize + sizeof(enq_hdr) + sizeof(rec_tail));
else
@@ -460,7 +460,7 @@
else if (h._magic == RHM_JDAT_DEQ_MAGIC)
{
deq_hdr dhdr;
- ::memcpy(&dhdr, rptr, sizeof(deq_hdr));
+ std::memcpy(&dhdr, rptr, sizeof(deq_hdr));
if (dhdr._xidsize)
dtokp->set_dsize(dhdr._xidsize + sizeof(deq_hdr) + sizeof(rec_tail));
else
@@ -469,7 +469,7 @@
else if (h._magic == RHM_JDAT_TXA_MAGIC || h._magic == RHM_JDAT_TXC_MAGIC)
{
txn_hdr thdr;
- ::memcpy(&thdr, rptr, sizeof(txn_hdr));
+ std::memcpy(&thdr, rptr, sizeof(txn_hdr));
dtokp->set_dsize(thdr._xidsize + sizeof(txn_hdr) + sizeof(rec_tail));
}
else
@@ -655,7 +655,7 @@
}
void
-rmgr::set_params_null(void** const datapp, size_t& dsize, void** const xidpp, size_t& xidsize)
+rmgr::set_params_null(void** const datapp, std::size_t& dsize, void** const xidpp, std::size_t& xidsize)
{
*datapp = 0;
dsize = 0;
@@ -677,7 +677,7 @@
/* TODO (sometime in the future)
const iores
-rmgr::get(const u_int64_t& rid, const size_t& dsize, const size_t& dsize_avail,
+rmgr::get(const u_int64_t& rid, const std::size_t& dsize, const std::size_t& dsize_avail,
const void** const data, bool auto_discard)
{
iores res = pre_read_check(0);
@@ -700,17 +700,17 @@
}
void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
(_pg_offset_dblks * JRNL_DBLK_SIZE));
- ::memcpy(&_hdr, rptr, sizeof(hdr));
+ std::memcpy(&_hdr, rptr, sizeof(hdr));
switch (_hdr._magic)
{
case RHM_JDAT_ENQ_MAGIC:
{
- size_t xid_size = *((size_t*)((char*)rptr + sizeof(hdr)
+ std::size_t xid_size = *((std::size_t*)((char*)rptr + sizeof(hdr)
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
+ sizeof(u_int32_t) // filler0
#endif
));
- size_t data_size = *((size_t*)((char*)rptr + sizeof(hdr) + sizeof(u_int64_t)
+ std::size_t data_size = *((std::size_t*)((char*)rptr + sizeof(hdr) + sizeof(u_int64_t)
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
+ sizeof(u_int32_t) // filler1
#endif
@@ -790,7 +790,7 @@
}
void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
(_pg_offset_dblks * JRNL_DBLK_SIZE));
- ::memcpy(&_hdr, rptr, sizeof(hdr));
+ std::memcpy(&_hdr, rptr, sizeof(hdr));
switch (_hdr._magic)
{
case RHM_JDAT_ENQ_MAGIC:
Modified: store/trunk/cpp/lib/jrnl/rmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/rmgr.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -39,6 +39,7 @@
}
}
+#include <cstring>
#include <jrnl/aio_cb.hpp>
#include <jrnl/enums.hpp>
#include <jrnl/file_hdr.hpp>
@@ -74,17 +75,17 @@
rmgr(jcntl* jc, enq_map& emap, txn_map& tmap, rrfc& rrfc);
virtual ~rmgr();
- void initialize(const rd_aio_cb rd_cb, const size_t fro);
- iores read(void** const datapp, size_t& dsize, void** const xidpp, size_t& xidsize,
+ void initialize(const rd_aio_cb rd_cb, const std::size_t fro);
+ iores read(void** const datapp, std::size_t& dsize, void** const xidpp, std::size_t& xidsize,
bool& transient, bool& external, data_tok* dtokp);
u_int32_t get_events(page_state state = AIO_COMPLETE);
- void recover_complete(size_t fro);
+ void recover_complete(std::size_t fro);
inline bool is_valid() const {return _valid; }
inline void synchronize() { if (!_valid) aio_cycle(); }
void invalidate();
/* TODO (if required)
- const iores get(const u_int64_t& rid, const size_t& dsize, const size_t& dsize_avail,
+ const iores get(const u_int64_t& rid, const std::size_t& dsize, const std::size_t& dsize_avail,
const void** const data, bool auto_discard);
const iores discard(data_tok* dtok);
*/
@@ -102,18 +103,18 @@
void consume_fhdr();
void rotate_page();
u_int32_t dblks_rem() const;
- void set_params_null(void** const datapp, size_t& dsize, void** const xidpp,
- size_t& xidsize);
+ void set_params_null(void** const datapp, std::size_t& dsize, void** const xidpp,
+ std::size_t& xidsize);
void init_file_header_read(u_int16_t fid);
// Special version of libaio's io_prep_pread() which preserves the value of the data
// pointer. This allows iocbs to be initialized with a pointer that can be re-used. Note
// that C++ does not support type long long, this has been replaced with int64_t.
- static inline void rhm_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count,
+ static inline void rhm_prep_pread(struct iocb *iocb, int fd, void *buf, std::size_t count,
int64_t offset)
{
- ::memset((void*)((char*)iocb + sizeof(void*)), 0, sizeof(*iocb) - sizeof(void*));
+ std::memset((void*)((char*)iocb + sizeof(void*)), 0, sizeof(*iocb) - sizeof(void*));
iocb->aio_fildes = fd;
iocb->aio_lio_opcode = IO_CMD_PREAD;
iocb->aio_reqprio = 0;
Modified: store/trunk/cpp/lib/jrnl/rrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/rrfc.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -29,7 +29,7 @@
*/
-#include <assert.h>
+#include <cassert>
#include <jrnl/rrfc.hpp>
#include <jrnl/jerrno.hpp>
#include <jrnl/jexception.hpp>
Modified: store/trunk/cpp/lib/jrnl/rrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/rrfc.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -41,6 +41,7 @@
}
}
+#include <cstddef>
#include <jrnl/nlfh.hpp>
namespace rhm
@@ -114,12 +115,12 @@
{ return _fh_arr[fid]->subtr_enqcnt(s); }
inline u_int32_t subm_cnt_dblks() const { return _curr_fh->rd_subm_cnt_dblks(); }
- inline size_t subm_offs() const { return _curr_fh->rd_subm_offs(); }
+ inline std::size_t subm_offs() const { return _curr_fh->rd_subm_offs(); }
inline u_int32_t add_subm_cnt_dblks(u_int32_t a)
{ return _curr_fh->add_rd_subm_cnt_dblks(a); }
inline u_int32_t cmpl_cnt_dblks() const { return _curr_fh->rd_cmpl_cnt_dblks(); }
- inline size_t cmpl_offs() const { return _curr_fh->rd_cmpl_offs(); }
+ inline std::size_t cmpl_offs() const { return _curr_fh->rd_cmpl_offs(); }
inline u_int32_t add_cmpl_cnt_dblks(u_int32_t a)
{ return _curr_fh->add_rd_cmpl_cnt_dblks(a); }
Modified: store/trunk/cpp/lib/jrnl/slock.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/slock.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/slock.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -3,7 +3,7 @@
*
* Red Hat Messaging - Message Journal
*
-* Messaging journal scoped lock class rhm::journal::slock and scoped try-clock
+* Messaging journal scoped lock class rhm::journal::slock and scoped try-lock
* class rhm::journal::stlock.
*
* Copyright 2007, 2008 Red Hat, Inc.
@@ -31,7 +31,7 @@
#ifndef rhm_journal_slock_hpp
#define rhm_journal_slock_hpp
-#include <errno.h>
+#include <cerrno>
#include <jrnl/jerrno.hpp>
#include <jrnl/jexception.hpp>
#include <pthread.h>
Modified: store/trunk/cpp/lib/jrnl/time_ns.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/time_ns.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/time_ns.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -25,9 +25,9 @@
#ifndef rhm_jtt_time_ns_hpp
#define rhm_jtt_time_ns_hpp
-#include <errno.h>
+#include <cerrno>
+#include <ctime>
#include <string>
-#include <time.h>
namespace rhm
{
@@ -37,7 +37,7 @@
struct time_ns : public timespec
{
inline time_ns() { tv_sec = 0; tv_nsec = 0; }
- inline time_ns(const time_t sec, const long nsec = 0) { tv_sec = sec; tv_nsec = nsec; }
+ inline time_ns(const std::time_t sec, const long nsec = 0) { tv_sec = sec; tv_nsec = nsec; }
inline time_ns(const time_ns& t) { tv_sec = t.tv_sec; tv_nsec = t.tv_nsec; }
inline void set_zero() { tv_sec = 0; tv_nsec = 0; }
Modified: store/trunk/cpp/lib/jrnl/txn_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_hdr.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/txn_hdr.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -33,9 +33,8 @@
#ifndef rhm_journal_txn_hdr_hpp
#define rhm_journal_txn_hdr_hpp
+#include <cstddef>
#include <jrnl/rec_hdr.hpp>
-//#include <jrnl/jcfg.hpp>
-//#include <sys/types.h>
namespace rhm
{
@@ -80,7 +79,7 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Big-endian filler for 32-bit size_t
#endif
- size_t _xidsize; ///< XID size
+ std::size_t _xidsize; ///< XID size
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Little-endian filler for 32-bit size_t
#endif
@@ -102,7 +101,7 @@
* \brief Convenience constructor which initializes values during construction.
*/
txn_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
- const size_t xidsize, const bool owi): rec_hdr(magic, version, rid, owi),
+ const std::size_t xidsize, const bool owi): rec_hdr(magic, version, rid, owi),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
#endif
@@ -115,7 +114,7 @@
/**
* \brief Returns the size of the header in bytes.
*/
- inline static size_t size() { return sizeof(txn_hdr); }
+ inline static std::size_t size() { return sizeof(txn_hdr); }
};
#pragma pack()
Modified: store/trunk/cpp/lib/jrnl/txn_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_rec.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/txn_rec.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -30,12 +30,14 @@
#include <jrnl/txn_rec.hpp>
-#include <assert.h>
-#include <errno.h>
+#include <cassert>
+#include <cerrno>
+#include <cstdlib>
+#include <cstring>
#include <iomanip>
-#include <sstream>
#include <jrnl/jerrno.hpp>
#include <jrnl/jexception.hpp>
+#include <sstream>
namespace rhm
{
@@ -52,7 +54,7 @@
}
txn_rec::txn_rec(const u_int32_t magic, const u_int64_t rid, const void* const xidp,
- const size_t xidlen, const bool owi):
+ const std::size_t xidlen, const bool owi):
_txn_hdr(magic, RHM_JDAT_VERSION, rid, xidlen, owi),
_xidp(xidp),
_buff(0),
@@ -78,7 +80,7 @@
void
txn_rec::reset(const u_int32_t magic, const u_int64_t rid, const void* const xidp,
- const size_t xidlen, const bool owi)
+ const std::size_t xidlen, const bool owi)
{
_txn_hdr._magic = magic;
_txn_hdr._rid = rid;
@@ -97,21 +99,21 @@
assert(max_size_dblks > 0);
assert(_xidp != 0 && _txn_hdr._xidsize > 0);
- size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
- size_t rem = max_size_dblks * JRNL_DBLK_SIZE;
- size_t wr_cnt = 0;
+ std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ std::size_t rem = max_size_dblks * JRNL_DBLK_SIZE;
+ std::size_t wr_cnt = 0;
if (rec_offs_dblks) // Continuation of split dequeue record (over 2 or more pages)
{
if (size_dblks(rec_size()) - rec_offs_dblks > max_size_dblks) // Further split required
{
rec_offs -= sizeof(_txn_hdr);
- size_t wsize = _txn_hdr._xidsize > rec_offs ? _txn_hdr._xidsize - rec_offs : 0;
- size_t wsize2 = wsize;
+ std::size_t wsize = _txn_hdr._xidsize > rec_offs ? _txn_hdr._xidsize - rec_offs : 0;
+ std::size_t wsize2 = wsize;
if (wsize)
{
if (wsize > rem)
wsize = rem;
- ::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
+ std::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -124,7 +126,7 @@
{
if (wsize > rem)
wsize = rem;
- ::memcpy((char*)wptr + wr_cnt, (char*)&_txn_tail + rec_offs, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (char*)&_txn_tail + rec_offs, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -136,22 +138,22 @@
else // No further split required
{
rec_offs -= sizeof(_txn_hdr);
- size_t wsize = _txn_hdr._xidsize > rec_offs ? _txn_hdr._xidsize - rec_offs : 0;
+ std::size_t wsize = _txn_hdr._xidsize > rec_offs ? _txn_hdr._xidsize - rec_offs : 0;
if (wsize)
{
- ::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
+ std::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
wr_cnt += wsize;
}
rec_offs -= _txn_hdr._xidsize - wsize;
wsize = sizeof(_txn_tail) > rec_offs ? sizeof(_txn_tail) - rec_offs : 0;
if (wsize)
{
- ::memcpy((char*)wptr + wr_cnt, (char*)&_txn_tail + rec_offs, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (char*)&_txn_tail + rec_offs, wsize);
wr_cnt += wsize;
#ifdef RHM_CLEAN
- size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
- size_t dblk_rec_size = size_dblks(rec_size() - rec_offs) * JRNL_DBLK_SIZE;
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
+ std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ std::size_t dblk_rec_size = size_dblks(rec_size() - rec_offs) * JRNL_DBLK_SIZE;
+ std::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
#endif
}
rec_offs -= sizeof(_txn_tail) - wsize;
@@ -161,23 +163,23 @@
else // Start at beginning of data record
{
// Assumption: the header will always fit into the first dblk
- ::memcpy(wptr, (void*)&_txn_hdr, sizeof(_txn_hdr));
+ std::memcpy(wptr, (void*)&_txn_hdr, sizeof(_txn_hdr));
wr_cnt = sizeof(_txn_hdr);
if (size_dblks(rec_size()) > max_size_dblks) // Split required
{
- size_t wsize;
+ std::size_t wsize;
rem -= sizeof(_txn_hdr);
if (rem)
{
wsize = rem >= _txn_hdr._xidsize ? _txn_hdr._xidsize : rem;
- ::memcpy((char*)wptr + wr_cnt, _xidp, wsize);
+ std::memcpy((char*)wptr + wr_cnt, _xidp, wsize);
wr_cnt += wsize;
rem -= wsize;
}
if (rem)
{
wsize = rem >= sizeof(_txn_tail) ? sizeof(_txn_tail) : rem;
- ::memcpy((char*)wptr + wr_cnt, (void*)&_txn_tail, wsize);
+ std::memcpy((char*)wptr + wr_cnt, (void*)&_txn_tail, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -185,13 +187,13 @@
}
else // No split required
{
- ::memcpy((char*)wptr + wr_cnt, _xidp, _txn_hdr._xidsize);
+ std::memcpy((char*)wptr + wr_cnt, _xidp, _txn_hdr._xidsize);
wr_cnt += _txn_hdr._xidsize;
- ::memcpy((char*)wptr + wr_cnt, (void*)&_txn_tail, sizeof(_txn_tail));
+ std::memcpy((char*)wptr + wr_cnt, (void*)&_txn_tail, sizeof(_txn_tail));
wr_cnt += sizeof(_txn_tail);
#ifdef RHM_CLEAN
- size_t dblk_rec_size = size_dblks(rec_size()) * JRNL_DBLK_SIZE;
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
+ std::size_t dblk_rec_size = size_dblks(rec_size()) * JRNL_DBLK_SIZE;
+ std::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
#endif
}
}
@@ -204,13 +206,13 @@
assert(rptr != 0);
assert(max_size_dblks > 0);
- size_t rd_cnt = 0;
+ std::size_t rd_cnt = 0;
if (rec_offs_dblks) // Continuation of record on new page
{
const u_int32_t hdr_xid_dblks = size_dblks(txn_hdr::size() + _txn_hdr._xidsize);
const u_int32_t hdr_xid_tail_dblks = size_dblks(txn_hdr::size() + _txn_hdr._xidsize +
rec_tail::size());
- const size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ const std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
if (hdr_xid_tail_dblks - rec_offs_dblks <= max_size_dblks)
{
@@ -218,20 +220,20 @@
if (rec_offs - txn_hdr::size() < _txn_hdr._xidsize)
{
// Part of xid still outstanding, copy remainder of xid and tail
- const size_t xid_offs = rec_offs - txn_hdr::size();
- const size_t xid_rem = _txn_hdr._xidsize - xid_offs;
- ::memcpy((char*)_buff + xid_offs, rptr, xid_rem);
+ const std::size_t xid_offs = rec_offs - txn_hdr::size();
+ const std::size_t xid_rem = _txn_hdr._xidsize - xid_offs;
+ std::memcpy((char*)_buff + xid_offs, rptr, xid_rem);
rd_cnt = xid_rem;
- ::memcpy((void*)&_txn_tail, ((char*)rptr + rd_cnt), sizeof(_txn_tail));
+ std::memcpy((void*)&_txn_tail, ((char*)rptr + rd_cnt), sizeof(_txn_tail));
chk_tail();
rd_cnt += sizeof(_txn_tail);
}
else
{
// Tail or part of tail only outstanding, complete tail
- const size_t tail_offs = rec_offs - txn_hdr::size() - _txn_hdr._xidsize;
- const size_t tail_rem = rec_tail::size() - tail_offs;
- ::memcpy((char*)&_txn_tail + tail_offs, rptr, tail_rem);
+ const std::size_t tail_offs = rec_offs - txn_hdr::size() - _txn_hdr._xidsize;
+ const std::size_t tail_rem = rec_tail::size() - tail_offs;
+ std::memcpy((char*)&_txn_tail + tail_offs, rptr, tail_rem);
chk_tail();
rd_cnt = tail_rem;
}
@@ -239,22 +241,22 @@
else if (hdr_xid_dblks - rec_offs_dblks <= max_size_dblks)
{
// Remainder of xid fits within this page, tail split
- const size_t xid_offs = rec_offs - txn_hdr::size();
- const size_t xid_rem = _txn_hdr._xidsize - xid_offs;
- ::memcpy((char*)_buff + xid_offs, rptr, xid_rem);
+ const std::size_t xid_offs = rec_offs - txn_hdr::size();
+ const std::size_t xid_rem = _txn_hdr._xidsize - xid_offs;
+ std::memcpy((char*)_buff + xid_offs, rptr, xid_rem);
rd_cnt += xid_rem;
- const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ const std::size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
if (tail_rem)
{
- ::memcpy((void*)&_txn_tail, ((char*)rptr + xid_rem), tail_rem);
+ std::memcpy((void*)&_txn_tail, ((char*)rptr + xid_rem), tail_rem);
rd_cnt += tail_rem;
}
}
else
{
// Remainder of xid split
- const size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE);
- ::memcpy((char*)_buff + rec_offs - txn_hdr::size(), rptr, xid_cp_size);
+ const std::size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE);
+ std::memcpy((char*)_buff + rec_offs - txn_hdr::size(), rptr, xid_cp_size);
rd_cnt += xid_cp_size;
}
}
@@ -266,10 +268,10 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
rd_cnt += sizeof(u_int32_t); // Filler 0
#endif
- _txn_hdr._xidsize = *(size_t*)((char*)rptr + rd_cnt);
+ _txn_hdr._xidsize = *(std::size_t*)((char*)rptr + rd_cnt);
rd_cnt = _txn_hdr.size();
chk_hdr();
- _buff = ::malloc(_txn_hdr._xidsize);
+ _buff = std::malloc(_txn_hdr._xidsize);
MALLOC_CHK(_buff, "_buff", "txn_rec", "decode");
const u_int32_t hdr_xid_dblks = size_dblks(txn_hdr::size() + _txn_hdr._xidsize);
const u_int32_t hdr_xid_tail_dblks = size_dblks(txn_hdr::size() + _txn_hdr._xidsize +
@@ -280,29 +282,29 @@
if (hdr_xid_tail_dblks <= max_size_dblks)
{
// Entire header, xid and tail fits within this page
- ::memcpy(_buff, (char*)rptr + rd_cnt, _txn_hdr._xidsize);
+ std::memcpy(_buff, (char*)rptr + rd_cnt, _txn_hdr._xidsize);
rd_cnt += _txn_hdr._xidsize;
- ::memcpy((void*)&_txn_tail, (char*)rptr + rd_cnt, sizeof(_txn_tail));
+ std::memcpy((void*)&_txn_tail, (char*)rptr + rd_cnt, sizeof(_txn_tail));
rd_cnt += sizeof(_txn_tail);
chk_tail();
}
else if (hdr_xid_dblks <= max_size_dblks)
{
// Entire header and xid fit within this page, tail split
- ::memcpy(_buff, (char*)rptr + rd_cnt, _txn_hdr._xidsize);
+ std::memcpy(_buff, (char*)rptr + rd_cnt, _txn_hdr._xidsize);
rd_cnt += _txn_hdr._xidsize;
- const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ const std::size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
if (tail_rem)
{
- ::memcpy((void*)&_txn_tail, (char*)rptr + rd_cnt, tail_rem);
+ std::memcpy((void*)&_txn_tail, (char*)rptr + rd_cnt, tail_rem);
rd_cnt += tail_rem;
}
}
else
{
// Header fits within this page, xid split
- const size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
- ::memcpy(_buff, (char*)rptr + rd_cnt, xid_cp_size);
+ const std::size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ std::memcpy(_buff, (char*)rptr + rd_cnt, xid_cp_size);
rd_cnt += xid_cp_size;
}
}
@@ -310,7 +312,7 @@
}
bool
-txn_rec::rcv_decode(rec_hdr h, std::ifstream* ifsp, size_t& rec_offs)
+txn_rec::rcv_decode(rec_hdr h, std::ifstream* ifsp, std::size_t& rec_offs)
{
if (rec_offs == 0)
{
@@ -319,20 +321,20 @@
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
ifsp->ignore(sizeof(u_int32_t)); // _filler0
#endif
- ifsp->read((char*)&_txn_hdr._xidsize, sizeof(size_t));
+ ifsp->read((char*)&_txn_hdr._xidsize, sizeof(std::size_t));
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
ifsp->ignore(sizeof(u_int32_t)); // _filler0
#endif
rec_offs = sizeof(_txn_hdr);
- _buff = ::malloc(_txn_hdr._xidsize);
+ _buff = std::malloc(_txn_hdr._xidsize);
MALLOC_CHK(_buff, "_buff", "txn_rec", "rcv_decode");
}
if (rec_offs < sizeof(_txn_hdr) + _txn_hdr._xidsize)
{
// Read xid (or continue reading xid)
- size_t offs = rec_offs - sizeof(_txn_hdr);
+ std::size_t offs = rec_offs - sizeof(_txn_hdr);
ifsp->read((char*)_buff + offs, _txn_hdr._xidsize - offs);
- size_t size_read = ifsp->gcount();
+ std::size_t size_read = ifsp->gcount();
rec_offs += size_read;
if (size_read < _txn_hdr._xidsize - offs)
{
@@ -343,9 +345,9 @@
if (rec_offs < sizeof(_txn_hdr) + _txn_hdr._xidsize + sizeof(rec_tail))
{
// Read tail (or continue reading tail)
- size_t offs = rec_offs - sizeof(_txn_hdr) - _txn_hdr._xidsize;
+ std::size_t offs = rec_offs - sizeof(_txn_hdr) - _txn_hdr._xidsize;
ifsp->read((char*)&_txn_tail + offs, sizeof(rec_tail) - offs);
- size_t size_read = ifsp->gcount();
+ std::size_t size_read = ifsp->gcount();
rec_offs += size_read;
if (size_read < sizeof(rec_tail) - offs)
{
@@ -358,7 +360,7 @@
return true;
}
-size_t
+std::size_t
txn_rec::get_xid(void** const xidpp)
{
if (!_buff)
@@ -385,13 +387,13 @@
return str;
}
-size_t
+std::size_t
txn_rec::xid_size() const
{
return _txn_hdr._xidsize;
}
-size_t
+std::size_t
txn_rec::rec_size() const
{
return txn_hdr::size() + _txn_hdr._xidsize + rec_tail::size();
Modified: store/trunk/cpp/lib/jrnl/txn_rec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_rec.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/txn_rec.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -41,6 +41,7 @@
}
}
+#include <cstddef>
#include <jrnl/jrec.hpp>
#include <jrnl/txn_hdr.hpp>
@@ -66,25 +67,25 @@
txn_rec();
// constructor used for write operations, where xid already exists
txn_rec(const u_int32_t magic, const u_int64_t rid, const void* const xidp,
- const size_t xidlen, const bool owi);
+ const std::size_t xidlen, const bool owi);
virtual ~txn_rec();
// Prepare instance for use in reading data from journal
void reset(const u_int32_t magic);
// Prepare instance for use in writing data to journal
void reset(const u_int32_t magic, const u_int64_t rid, const void* const xidp,
- const size_t xidlen, const bool owi);
+ const std::size_t xidlen, const bool owi);
u_int32_t encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks);
u_int32_t decode(rec_hdr& h, void* rptr, u_int32_t rec_offs_dblks,
u_int32_t max_size_dblks);
// Decode used for recover
- bool rcv_decode(rec_hdr h, std::ifstream* ifsp, size_t& rec_offs);
+ bool rcv_decode(rec_hdr h, std::ifstream* ifsp, std::size_t& rec_offs);
- size_t get_xid(void** const xidpp);
+ std::size_t get_xid(void** const xidpp);
std::string& str(std::string& str) const;
- inline size_t data_size() const { return 0; } // This record never carries data
- size_t xid_size() const;
- size_t rec_size() const;
+ inline std::size_t data_size() const { return 0; } // This record never carries data
+ std::size_t xid_size() const;
+ std::size_t rec_size() const;
private:
void chk_hdr() const;
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -30,12 +30,13 @@
#include <jrnl/wmgr.hpp>
-#include <assert.h>
+#include <cassert>
#include <cerrno>
-#include <sstream>
+#include <cstdlib>
#include <jrnl/file_hdr.hpp>
#include <jrnl/jcntl.hpp>
#include <jrnl/jerrno.hpp>
+#include <sstream>
namespace rhm
{
@@ -88,7 +89,7 @@
void
wmgr::initialize(const wr_aio_cb wr_cb, const u_int32_t max_dtokpp, const u_int32_t max_iowait_us,
- size_t eo)
+ std::size_t eo)
{
_enq_busy = false;
_deq_busy = false;
@@ -113,8 +114,8 @@
}
iores
-wmgr::enqueue(const void* const data_buff, const size_t tot_data_len, const size_t this_data_len,
- data_tok* dtokp, const void* const xid_ptr, const size_t xid_len, const bool transient,
+wmgr::enqueue(const void* const data_buff, const std::size_t tot_data_len, const std::size_t this_data_len,
+ data_tok* dtokp, const void* const xid_ptr, const std::size_t xid_len, const bool transient,
const bool external)
{
if (xid_len)
@@ -207,7 +208,7 @@
u_int32_t rec_dblks_rem = _enq_rec.rec_size_dblks() - data_offs_dblks;
bool file_fit = rec_dblks_rem <= _jfsize_dblks;
bool file_full = rec_dblks_rem == _jfsize_dblks;
- size_t fro = 0;
+ std::size_t fro = 0;
if (cont)
{
if (file_fit && !file_full)
@@ -252,7 +253,7 @@
}
iores
-wmgr::dequeue(data_tok* dtokp, const void* const xid_ptr, const size_t xid_len)
+wmgr::dequeue(data_tok* dtokp, const void* const xid_ptr, const std::size_t xid_len)
{
if (xid_len)
assert(xid_ptr != 0);
@@ -350,7 +351,7 @@
u_int32_t rec_dblks_rem = _deq_rec.rec_size_dblks() - data_offs_dblks;
bool file_fit = rec_dblks_rem <= _jfsize_dblks;
bool file_full = rec_dblks_rem == _jfsize_dblks;
- size_t fro = 0;
+ std::size_t fro = 0;
if (cont)
{
if (file_fit && !file_full)
@@ -395,7 +396,7 @@
}
iores
-wmgr::abort(data_tok* dtokp, const void* const xid_ptr, const size_t xid_len)
+wmgr::abort(data_tok* dtokp, const void* const xid_ptr, const std::size_t xid_len)
{
// commit and abort MUST have a valid xid
assert(xid_ptr != 0 && xid_len > 0);
@@ -491,7 +492,7 @@
u_int32_t rec_dblks_rem = _txn_rec.rec_size_dblks() - data_offs_dblks;
bool file_fit = rec_dblks_rem <= _jfsize_dblks;
bool file_full = rec_dblks_rem == _jfsize_dblks;
- size_t fro = 0;
+ std::size_t fro = 0;
if (cont)
{
if (file_fit && !file_full)
@@ -536,7 +537,7 @@
}
iores
-wmgr::commit(data_tok* dtokp, const void* const xid_ptr, const size_t xid_len)
+wmgr::commit(data_tok* dtokp, const void* const xid_ptr, const std::size_t xid_len)
{
// commit and abort MUST have a valid xid
assert(xid_ptr != 0 && xid_len > 0);
@@ -628,7 +629,7 @@
u_int32_t rec_dblks_rem = _txn_rec.rec_size_dblks() - data_offs_dblks;
bool file_fit = rec_dblks_rem <= _jfsize_dblks;
bool file_full = rec_dblks_rem == _jfsize_dblks;
- size_t fro = 0;
+ std::size_t fro = 0;
if (cont)
{
if (file_fit && !file_full)
@@ -710,7 +711,7 @@
// if necessary.
dblk_roundup();
- size_t pg_offs = (_pg_offset_dblks - _cached_offset_dblks) * JRNL_DBLK_SIZE;
+ std::size_t pg_offs = (_pg_offset_dblks - _cached_offset_dblks) * JRNL_DBLK_SIZE;
rhm_prep_pwrite(&_iocb_arr[_pg_index], _wrfc.fh(),
(char*)_page_ptr_arr[_pg_index] + pg_offs, _cached_offset_dblks * JRNL_DBLK_SIZE,
_wrfc.subm_offs());
@@ -752,7 +753,7 @@
if ((ret = ::io_getevents(_ioctx, 0, JRNL_RMGR_PAGES + JRNL_WMGR_PAGES, _ioevt_arr, 0)) < 0)
{
std::ostringstream oss;
- oss << "io_getevents() failed: " << strerror(-ret) << " (" << ret << ")";
+ oss << "io_getevents() failed: " << std::strerror(-ret) << " (" << ret << ")";
throw jexception(jerrno::JERR__AIO, oss.str(), "wmgr", "get_events");
}
@@ -772,7 +773,7 @@
if (aioret < 0)
{
std::ostringstream oss;
- oss << "AIO write operation failed: " << strerror(-aioret) << " (" << aioret << ") [";
+ oss << "AIO write operation failed: " << std::strerror(-aioret) << " (" << aioret << ") [";
if (pcbp)
oss << "pg=" << pcbp->_index;
else
@@ -919,11 +920,11 @@
oss << " errno=" << errno;
throw jexception(jerrno::JERR__MALLOC, oss.str(), "wmgr", "initialize");
}
- _fhdr_ptr_arr = (void**)::malloc(_num_jfiles * sizeof(void*));
+ _fhdr_ptr_arr = (void**)std::malloc(_num_jfiles * sizeof(void*));
MALLOC_CHK(_fhdr_ptr_arr, "_fhdr_ptr_arr", "wmgr", "initialize");
- _iocba = (iocb**)::malloc(sizeof(iocb*) * _num_jfiles);
+ _iocba = (iocb**)std::malloc(sizeof(iocb*) * _num_jfiles);
MALLOC_CHK(_iocba, "_iocba", "wmgr", "initialize");
- ::memset(_iocba, 0, sizeof(iocb*) * _num_jfiles);
+ std::memset(_iocba, 0, sizeof(iocb*) * _num_jfiles);
for (u_int16_t i=0; i<_num_jfiles; i++)
{
_fhdr_ptr_arr[i] = (void*)((char*)_fhdr_base_ptr + _sblksize * i);
@@ -938,9 +939,9 @@
iores
wmgr::pre_write_check(const _op_type op, const data_tok* const dtokp,
#if defined(RHM_WRONLY)
- const size_t /*xidsize*/, const size_t /*dsize*/, const bool /*external*/
+ const std::size_t /*xidsize*/, const std::size_t /*dsize*/, const bool /*external*/
#else
- const size_t xidsize, const size_t dsize, const bool external
+ const std::size_t xidsize, const std::size_t dsize, const bool external
#endif
) const
{
@@ -1029,9 +1030,9 @@
while (_cached_offset_dblks < wdblks)
{
void* wptr = (void*)((char*)_page_ptr_arr[_pg_index] + _pg_offset_dblks * JRNL_DBLK_SIZE);
- ::memcpy(wptr, (void*)&xmagic, sizeof(xmagic));
+ std::memcpy(wptr, (void*)&xmagic, sizeof(xmagic));
#ifdef RHM_CLEAN
- ::memset((char*)wptr + sizeof(xmagic), RHM_CLEAN_CHAR, JRNL_DBLK_SIZE - sizeof(xmagic));
+ std::memset((char*)wptr + sizeof(xmagic), RHM_CLEAN_CHAR, JRNL_DBLK_SIZE - sizeof(xmagic));
#endif
_pg_offset_dblks++;
_cached_offset_dblks++;
@@ -1039,12 +1040,12 @@
}
void
-wmgr::write_fhdr(u_int64_t rid, u_int32_t fid, size_t fro)
+wmgr::write_fhdr(u_int64_t rid, u_int32_t fid, std::size_t fro)
{
file_hdr fhdr(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, rid, fid, fro, _wrfc.owi(), true);
- ::memcpy(_fhdr_ptr_arr[fid], &fhdr, sizeof(fhdr));
+ std::memcpy(_fhdr_ptr_arr[fid], &fhdr, sizeof(fhdr));
#ifdef RHM_CLEAN
- ::memset((char*)_fhdr_ptr_arr[fid] + sizeof(fhdr), RHM_CLEAN_CHAR, _sblksize - sizeof(fhdr));
+ std::memset((char*)_fhdr_ptr_arr[fid] + sizeof(fhdr), RHM_CLEAN_CHAR, _sblksize - sizeof(fhdr));
#endif
iocb* iocbp = _iocba[fid];
::io_prep_pwrite(iocbp, _wrfc.fh(), _fhdr_ptr_arr[fid], _sblksize, 0);
@@ -1070,17 +1071,17 @@
void
wmgr::clean()
{
- ::free(_fhdr_base_ptr);
+ std::free(_fhdr_base_ptr);
_fhdr_base_ptr = 0;
- ::free(_fhdr_ptr_arr);
+ std::free(_fhdr_ptr_arr);
_fhdr_ptr_arr = 0;
if (_iocba)
{
for (u_int32_t i=0; i<_num_jfiles; i++)
delete _iocba[i];
- ::free(_iocba);
+ std::free(_iocba);
_iocba = 0;
}
}
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -39,6 +39,7 @@
}
}
+#include <cstring>
#include <jrnl/aio_cb.hpp>
#include <jrnl/enums.hpp>
#include <jrnl/pmgr.hpp>
@@ -104,13 +105,13 @@
virtual ~wmgr();
void initialize(wr_aio_cb wr_cb, const u_int32_t max_dtokpp, const u_int32_t max_iowait_us,
- size_t eo = 0);
- iores enqueue(const void* const data_buff, const size_t tot_data_len,
- const size_t this_data_len, data_tok* dtokp, const void* const xid_ptr,
- const size_t xid_len, const bool transient, const bool external);
- iores dequeue(data_tok* dtokp, const void* const xid_ptr, const size_t xid_len);
- iores abort(data_tok* dtokp, const void* const xid_ptr, const size_t xid_len);
- iores commit(data_tok* dtokp, const void* const xid_ptr, const size_t xid_len);
+ std::size_t eo = 0);
+ iores enqueue(const void* const data_buff, const std::size_t tot_data_len,
+ const std::size_t this_data_len, data_tok* dtokp, const void* const xid_ptr,
+ const std::size_t xid_len, const bool transient, const bool external);
+ iores dequeue(data_tok* dtokp, const void* const xid_ptr, const std::size_t xid_len);
+ iores abort(data_tok* dtokp, const void* const xid_ptr, const std::size_t xid_len);
+ iores commit(data_tok* dtokp, const void* const xid_ptr, const std::size_t xid_len);
iores flush();
u_int32_t get_events(page_state state);
bool is_txn_synced(const std::string& xid);
@@ -124,13 +125,13 @@
private:
void initialize();
iores pre_write_check(const _op_type op, const data_tok* const dtokp,
- const size_t xidsize = 0, const size_t dsize = 0, const bool external = false)
+ const std::size_t xidsize = 0, const std::size_t dsize = 0, const bool external = false)
const;
void dequeue_check(const std::string& xid, const u_int64_t drid);
iores write_flush();
iores rotate_file();
void dblk_roundup();
- void write_fhdr(u_int64_t rid, u_int32_t fid, size_t fro);
+ void write_fhdr(u_int64_t rid, u_int32_t fid, std::size_t fro);
void rotate_page();
void clean();
@@ -138,9 +139,9 @@
// pointer. This allows iocbs to be initialized with a pointer that can be re-used. Note
// that C++ does not support type long long, this has been replaced with int64_t.
static inline void rhm_prep_pwrite(struct iocb *iocb, int fd, void *buf,
- size_t count, int64_t offset)
+ std::size_t count, int64_t offset)
{
- ::memset((void*)((char*)iocb + sizeof(void*)), 0, sizeof(*iocb) - sizeof(void*));
+ std::memset((void*)((char*)iocb + sizeof(void*)), 0, sizeof(*iocb) - sizeof(void*));
iocb->aio_fildes = fd;
iocb->aio_lio_opcode = IO_CMD_PWRITE;
iocb->aio_reqprio = 0;
Modified: store/trunk/cpp/lib/jrnl/wrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.cpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/wrfc.cpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -79,7 +79,7 @@
}
_fsize_sblks = fsize_sblks;
_fsize_dblks = fsize_sblks * JRNL_SBLK_SIZE;
- _enq_cap_offs_dblks = (u_int32_t)::ceil(_fsize_dblks * _nfiles *
+ _enq_cap_offs_dblks = (u_int32_t)std::ceil(_fsize_dblks * _nfiles *
(100.0 - JRNL_ENQ_THRESHOLD) / 100);
// Check the offset is at least one file; if not, make it so
if (_enq_cap_offs_dblks < _fsize_dblks)
Modified: store/trunk/cpp/lib/jrnl/wrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.hpp 2008-04-08 18:45:21 UTC (rev 1867)
+++ store/trunk/cpp/lib/jrnl/wrfc.hpp 2008-04-08 18:48:17 UTC (rev 1868)
@@ -39,6 +39,7 @@
}
}
+#include <cstddef>
#include <jrnl/enums.hpp>
#include <jrnl/rrfc.hpp>
@@ -103,12 +104,12 @@
inline int fh() const { return _curr_fh->wr_fh(); }
inline u_int32_t subm_cnt_dblks() const { return _curr_fh->wr_subm_cnt_dblks(); }
- inline size_t subm_offs() const { return _curr_fh->wr_subm_offs(); }
+ inline std::size_t subm_offs() const { return _curr_fh->wr_subm_offs(); }
inline u_int32_t add_subm_cnt_dblks(u_int32_t a)
{ return _curr_fh->add_wr_subm_cnt_dblks(a); }
inline u_int32_t cmpl_cnt_dblks() const { return _curr_fh->wr_cmpl_cnt_dblks(); }
- inline size_t cmpl_offs() const { return _curr_fh->wr_cmpl_offs(); }
+ inline std::size_t cmpl_offs() const { return _curr_fh->wr_cmpl_offs(); }
inline u_int32_t add_cmpl_cnt_dblks(u_int32_t a)
{ return _curr_fh->add_wr_cmpl_cnt_dblks(a); }
16 years, 9 months
rhmessaging commits: r1867 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-08 14:45:21 -0400 (Tue, 08 Apr 2008)
New Revision: 1867
Modified:
mgmt/cumin/python/cumin/client.py
Log:
Modernize ClientView and add a details tab
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-04-08 18:39:06 UTC (rev 1866)
+++ mgmt/cumin/python/cumin/client.py 2008-04-08 18:45:21 UTC (rev 1867)
@@ -205,27 +205,26 @@
def __init__(self, app, name):
super(ClientView, self).__init__(app, name)
- self.status = ClientStatus(app, "status")
- self.add_child(self.status)
+ status = ClientStatus(app, "status")
+ self.add_child(status)
- self.tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.tabs)
+ self.__tabs = TabbedModeSet(app, "tabs")
+ self.add_child(self.__tabs)
- self.tabs.add_tab(ClientStatistics(app, "stats"))
+ self.__tabs.add_tab(ClientStatistics(app, "stats"))
- self.sessions = ClientSessionSet(app, "sessions")
- self.tabs.add_tab(self.sessions)
+ self.__sessions = ClientSessionSet(app, "sessions")
+ self.__tabs.add_tab(self.__sessions)
+ self.__tabs.add_tab(CuminDetails(app, "details"))
+
def show_sessions(self, session):
- return self.tabs.show_mode(session, self.sessions)
+ return self.__tabs.show_mode(session, self.__sessions)
def render_script(self, session, queue):
data = "model.xml?class=client;id=%i" % queue.id
return "wooly.setIntervalUpdate('%s', updateClient, 3000)" % data
- def render_icon_resource(self, session, queue):
- return "client-36.png"
-
class ClientStatistics(TabbedModeSet):
def __init__(self, app, name):
super(ClientStatistics, self).__init__(app, name)
16 years, 9 months
rhmessaging commits: r1866 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-08 14:39:06 -0400 (Tue, 08 Apr 2008)
New Revision: 1866
Modified:
mgmt/cumin/python/cumin/exchange.py
Log:
Modernize ExchangeView and add a details tab
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-04-08 18:09:15 UTC (rev 1865)
+++ mgmt/cumin/python/cumin/exchange.py 2008-04-08 18:39:06 UTC (rev 1866)
@@ -193,33 +193,26 @@
def __init__(self, app, name):
super(ExchangeView, self).__init__(app, name)
- self.status = ExchangeStatus(app, "status")
- self.add_child(self.status)
+ status = ExchangeStatus(app, "status")
+ self.add_child(status)
- self.tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.tabs)
+ self.__tabs = TabbedModeSet(app, "tabs")
+ self.add_child(self.__tabs)
- self.tabs.add_tab(ExchangeStatistics(app, "stats"))
+ self.__tabs.add_tab(ExchangeStatistics(app, "stats"))
- #self.producers = ExchangeProducerSet(app, "producers")
- #self.tabs.add_tab(self.producers)
+ self.__bindings = ExchangeBindingSet(app, "bindings")
+ self.__tabs.add_tab(self.__bindings)
- self.bindings = ExchangeBindingSet(app, "bindings")
- self.tabs.add_tab(self.bindings)
+ self.__tabs.add_tab(CuminDetails(app, "details"))
- def show_producers(self, session):
- return self.tabs.show_mode(session, self.producers);
-
def show_bindings(self, session):
- return self.tabs.show_mode(session, self.bindings);
+ return self.__tabs.show_mode(session, self.__bindings);
def render_script(self, session, queue):
data = "model.xml?class=exchange;id=%i" % queue.id
return "wooly.setIntervalUpdate('%s', updateExchange, 3000)" % data
- def render_icon_resource(self, session, queue):
- return "exchange-36.png"
-
class ExchangeBindingSet(BindingSet):
def get_args(self, session):
return self.frame.get_args(session)
16 years, 9 months
rhmessaging commits: r1865 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-08 14:09:15 -0400 (Tue, 08 Apr 2008)
New Revision: 1865
Modified:
mgmt/cumin/python/cumin/queue.py
Log:
Modernize QueueView and add a details tab
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-04-08 16:35:27 UTC (rev 1864)
+++ mgmt/cumin/python/cumin/queue.py 2008-04-08 18:09:15 UTC (rev 1865)
@@ -228,30 +228,23 @@
status = QueueStatus(app, "status")
self.add_child(status)
- self.tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.tabs)
+ self.__tabs = TabbedModeSet(app, "tabs")
+ self.add_child(self.__tabs)
- self.tabs.add_tab(QueueStatistics(app, "stats"))
+ self.__tabs.add_tab(QueueStatistics(app, "stats"))
- #self.consumers = QueueConsumerSet(app, "consumers")
- #self.tabs.add_tab(self.consumers)
+ self.__bindings = QueueBindingSet(app, "bindings")
+ self.__tabs.add_tab(self.__bindings)
- self.bindings = QueueBindingSet(app, "bindings")
- self.tabs.add_tab(self.bindings)
+ details = CuminDetails(app, "details")
+ self.__tabs.add_tab(details)
- def show_consumers(self, session):
- self.tabs.show_mode(session, self.consumers);
-
def show_bindings(self, session):
- self.tabs.show_mode(session, self.bindings);
+ self.__tabs.show_mode(session, self.__bindings);
def render_script(self, session, queue):
data = "model.xml?class=queue;id=%i" % queue.id
return "wooly.setIntervalUpdate('%s', updateQueue, 3000)" % data
-
- def render_icon_resource(self, session, queue):
- return "queue-36.png"
-
class QueueBindingSet(BindingSet):
def get_args(self, session):
return self.frame.get_args(session)
16 years, 9 months
rhmessaging commits: r1864 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-08 12:35:27 -0400 (Tue, 08 Apr 2008)
New Revision: 1864
Modified:
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/widgets.py
Log:
Reintroduce icons, this time using the ui metadata.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-04-08 16:25:12 UTC (rev 1863)
+++ mgmt/cumin/python/cumin/model.py 2008-04-08 16:35:27 UTC (rev 1864)
@@ -318,6 +318,9 @@
def get_title(self, session):
return "Object"
+ def get_icon_href(self, session):
+ return "resource?name=action-36.png"
+
def get_object_href(self, session, object):
branch = session.branch()
self.show_object(branch, object)
@@ -472,6 +475,9 @@
#action.title = "Send Ping"
#action.summary = True
+ def get_icon_href(self, session):
+ return "resource?name=system-36.png"
+
def show_object(self, session, system):
return self.cumin_model.show_main(session).show_system(session, system)
@@ -512,6 +518,9 @@
prop = CuminProperty(self, "dataDir")
prop.title = "Data Directory"
+ def get_icon_href(self, session):
+ return "resource?name=broker-36.png"
+
def show_object(self, session, broker):
reg = broker.registrations[0]
return self.cumin_model.show_main(session).show_broker(session, reg)
@@ -709,6 +718,9 @@
def get_title(self, session):
return "Queue"
+ def get_icon_href(self, session):
+ return "resource?name=queue-36.png"
+
def show_object(self, session, queue):
frame = self.cumin_model.show_main(session)
frame = frame.show_broker(session, queue.vhost.broker.registrations[0])
@@ -787,6 +799,9 @@
def get_title(self, session):
return "Exchange"
+ def get_icon_href(self, session):
+ return "resource?name=exchange-36.png"
+
class CuminBinding(RemoteClass):
def __init__(self, model):
super(CuminBinding, self).__init__(model, "binding",
@@ -849,6 +864,9 @@
def get_title(self, session):
return "Client"
+ def get_icon_href(self, session):
+ return "resource?name=client-36.png"
+
def get_object_name(self, client):
return client.address
@@ -981,6 +999,9 @@
def get_title(self, session):
return "Broker Registration"
+ def get_icon_href(self, session):
+ return "resource?name=broker-36.png"
+
def show_object(self, session, reg):
return self.cumin_model.show_main(session).show_broker(session, reg)
@@ -996,6 +1017,9 @@
def get_title(self, session):
return "Broker Group"
+ def get_icon_href(self, session):
+ return "resource?name=group-36.png"
+
class ModelPage(Page):
def __init__(self, app, name):
super(ModelPage, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-04-08 16:25:12 UTC (rev 1863)
+++ mgmt/cumin/python/cumin/widgets.py 2008-04-08 16:35:27 UTC (rev 1864)
@@ -285,7 +285,8 @@
return cls.get_object_title(session, object)
def render_icon_href(self, session, object):
- return "resource?name=action-36.png"
+ cls = self.app.model.get_class_by_object(object)
+ return cls.get_icon_href(session)
class SummaryProperties(CuminProperties):
def do_get_items(self, session, object):
16 years, 9 months
rhmessaging commits: r1863 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-08 12:25:12 -0400 (Tue, 08 Apr 2008)
New Revision: 1863
Modified:
mgmt/cumin/python/cumin/broker.py
Log:
Improve the way we generate broker links in BrokerSet
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-04-08 16:13:10 UTC (rev 1862)
+++ mgmt/cumin/python/cumin/broker.py 2008-04-08 16:25:12 UTC (rev 1863)
@@ -86,10 +86,10 @@
def render_content(self, session, data):
reg = BrokerRegistration.get(data["id"])
- branch = session.branch()
- frame = self.app.model.broker_registration.show_object(branch, reg)
- frame.show_view(branch)
- return fmt_olink(branch, reg, name=data["name"])
+ cls = self.app.model.get_class_by_object(reg)
+ href = cls.get_object_href(session, reg)
+ name = data["name"]
+ return fmt_link(href, name)
class GroupsColumn(SqlTableColumn):
def render_title(self, session, data):
16 years, 9 months
rhmessaging commits: r1862 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-08 12:13:10 -0400 (Tue, 08 Apr 2008)
New Revision: 1862
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Repair model xml.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-04-08 15:55:57 UTC (rev 1861)
+++ mgmt/cumin/python/cumin/model.py 2008-04-08 16:13:10 UTC (rev 1862)
@@ -343,12 +343,13 @@
def write_xml(self, writer, object):
writer.write("<%s id=\"%i\" name=\"%s\">" % \
- (self.name, object.id, self.get_object_name(object)))
+ (self.cumin_name, object.id,
+ self.get_object_name(object)))
self.write_event_xml(writer, object)
self.write_stat_xml(writer, object)
- writer.write("</%s>" % self.name)
+ writer.write("</%s>" % self.cumin_name)
class RemoteClass(CuminClass):
def __init__(self, model, name, mint_class, mint_stats_class):
16 years, 9 months
rhmessaging commits: r1861 - in mgmt: cumin/python/wooly and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-08 11:55:57 -0400 (Tue, 08 Apr 2008)
New Revision: 1861
Modified:
mgmt/cumin/python/cumin/widgets.strings
mgmt/cumin/python/wooly/widgets.strings
mgmt/notes/justin-todo.txt
Log:
Some style sprucing.
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2008-04-08 15:36:41 UTC (rev 1860)
+++ mgmt/cumin/python/cumin/widgets.strings 2008-04-08 15:55:57 UTC (rev 1861)
@@ -155,7 +155,7 @@
[CuminSummary.css]
div.CuminSummary {
width: 32em;
- margin: 0 0 1em 0;
+ margin: 0 0 2em 0;
min-height: 6em;
}
Modified: mgmt/cumin/python/wooly/widgets.strings
===================================================================
--- mgmt/cumin/python/wooly/widgets.strings 2008-04-08 15:36:41 UTC (rev 1860)
+++ mgmt/cumin/python/wooly/widgets.strings 2008-04-08 15:55:57 UTC (rev 1861)
@@ -148,9 +148,14 @@
[ActionSet.css]
ul.ActionSet li {
- margin: 0 0 0 1em;
}
+ul.ActionSet a:before {
+ content: "\00BB \0020";
+ font-weight: bold;
+ color: #dc9f2e;
+}
+
[ActionSet.html]
<ul class="ActionSet">{items}</ul>
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-04-08 15:36:41 UTC (rev 1860)
+++ mgmt/notes/justin-todo.txt 2008-04-08 15:55:57 UTC (rev 1861)
@@ -26,6 +26,8 @@
* Enforce one reg per broker, to avoid confusion
+ * Check for per-row querying in BrokerSet
+
Deferred
* Change the way CuminAction.invoke works
16 years, 9 months
rhmessaging commits: r1860 - in mgmt: mint/python/mint and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-04-08 11:36:41 -0400 (Tue, 08 Apr 2008)
New Revision: 1860
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/parameters.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/cumin/widgets.strings
mgmt/mint/python/mint/__init__.py
mgmt/notes/justin-todo.txt
Log:
Revamps object summaries, using more ui metadata. Fixes the double
registration problem. Some changes to broker -> registration
navigation.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/broker.py 2008-04-08 15:36:41 UTC (rev 1860)
@@ -85,10 +85,11 @@
return "Name"
def render_content(self, session, data):
- broker = Identifiable(data["id"])
+ reg = BrokerRegistration.get(data["id"])
branch = session.branch()
- self.app.model.broker.show(branch, broker).show_view(branch)
- return fmt_olink(branch, broker, name=data["name"])
+ frame = self.app.model.broker_registration.show_object(branch, reg)
+ frame.show_view(branch)
+ return fmt_olink(branch, reg, name=data["name"])
class GroupsColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -108,7 +109,8 @@
for group in broker.groups[:2]:
branch = session.branch()
- frame = self.app.model.broker_group.show(branch, group)
+ frame = self.app.model.broker_group.show_object \
+ (branch, group)
frame.show_view(branch)
links.append(fmt_olink(branch, group))
@@ -132,18 +134,17 @@
self.add_column(col)
def get_args(self, session):
- return self.frame.get_args(session)
+ reg = self.frame.get_object(session)
+ return (reg.getDefaultVhost(),)
- def render_title(self, session, broker):
- count = self.get_item_count(session, broker)
+ def render_title(self, session, vhost):
+ count = self.get_item_count(session, vhost)
return "Peers %s" % fmt_count(count)
- def render_sql_where(self, session, reg):
- vhost = reg.getDefaultVhost()
+ def render_sql_where(self, session, vhost):
return "where v.id = %(vhost_id)r"
- def get_sql_values(self, session, reg):
- vhost = reg.getDefaultVhost()
+ def get_sql_values(self, session, vhost):
return {"vhost_id": vhost.id}
class AddressColumn(SqlTableColumn):
@@ -168,7 +169,7 @@
def __init__(self, app, name):
super(BrokerFrame, self).__init__(app, name)
- self.object = BrokerParameter(app, "id")
+ self.object = BrokerRegistrationParameter(app, "id")
self.add_parameter(self.object)
view = BrokerView(app, "view")
@@ -246,8 +247,8 @@
self.__body.add_mode(self.__tabs)
self.__tabs.add_tab(self.BrokerQueueTab(app, "queues"))
- self.__tabs.add_tab(self.BrokerExchangeTab(app, "exchanges"))
- self.__tabs.add_tab(self.BrokerClientTab(app, "clients"))
+ self.__tabs.add_tab(ExchangeSet(app, "exchanges"))
+ self.__tabs.add_tab(ClientSet(app, "clients"))
self.__tabs.add_tab(PeerSet(app, "links"))
self.__missing = self.BrokerMissing(app, "missing")
@@ -267,9 +268,6 @@
super(BrokerView, self).do_process(session, reg)
- def render_title(self, session, reg):
- return "Broker '%s'" % reg.name
-
def render_script(self, session, reg):
if reg.broker:
data = "model.xml?class=broker;id=%i" % reg.broker.id
@@ -308,24 +306,6 @@
self.frame.show_queue(branch, None).show_add(branch)
return branch.marshal()
- class BrokerExchangeTab(ExchangeSet):
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def render_title(self, session, reg):
- vhost = reg.getDefaultVhost()
- return super(BrokerView.BrokerExchangeTab, self).render_title \
- (session, vhost)
-
- class BrokerClientTab(ClientSet):
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def render_title(self, session, reg):
- vhost = reg.getDefaultVhost()
- return super(BrokerView.BrokerClientTab, self).render_title \
- (session, vhost)
-
class BrokerStatsTab(Widget):
def get_args(self, session):
return self.frame.get_args(session)
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/broker.strings 2008-04-08 15:36:41 UTC (rev 1860)
@@ -75,8 +75,6 @@
{status}
-<h1><img src="resource?name={icon_resource}"/>{title}</h1>
-
{summary}
{body}
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/client.py 2008-04-08 15:36:41 UTC (rev 1860)
@@ -43,7 +43,8 @@
self.add_child(self.__close)
def get_args(self, session):
- return self.frame.get_args(session)
+ reg = self.frame.get_object(session)
+ return (reg.getDefaultVhost(),)
def get_unit_plural(self, session):
return self.unit.get(session) == "b" and "Bytes" or "Frames"
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/exchange.py 2008-04-08 15:36:41 UTC (rev 1860)
@@ -66,7 +66,8 @@
self.add_child(self.phase)
def get_args(self, session):
- return self.frame.get_args(session)
+ reg = self.frame.get_object(session)
+ return (reg.getDefaultVhost(),)
def render_title(self, session, vhost):
return "Exchanges %s" % fmt_count(vhost.exchanges.count())
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/model.py 2008-04-08 15:36:41 UTC (rev 1860)
@@ -512,7 +512,8 @@
prop.title = "Data Directory"
def show_object(self, session, broker):
- return self.cumin_model.show_main(session).show_broker(session, broker)
+ reg = broker.registrations[0]
+ return self.cumin_model.show_main(session).show_broker(session, reg)
class CuminQueue(RemoteClass):
def __init__(self, model):
@@ -709,7 +710,7 @@
def show_object(self, session, queue):
frame = self.cumin_model.show_main(session)
- frame = frame.show_broker(session, queue.vhost.broker)
+ frame = frame.show_broker(session, queue.vhost.broker.registrations[0])
return frame.show_queue(session, queue)
class Purge(CuminAction):
@@ -779,7 +780,7 @@
def show_object(self, session, exchange):
frame = self.cumin_model.show_main(session)
- frame = frame.show_broker(exchange.vhost.broker)
+ frame = frame.show_broker(exchange.vhost.broker.registrations[0])
return frame.show_queue(session, exchange)
def get_title(self, session):
@@ -840,7 +841,8 @@
def show_object(self, session, client):
frame = self.cumin_model.show_main(session)
- frame = frame.show_broker(session, client.vhost.broker)
+ frame = frame.show_broker(session,
+ client.vhost.broker.registrations[0])
return frame.show_client(session, client)
def get_title(self, session):
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/page.py 2008-04-08 15:36:41 UTC (rev 1860)
@@ -130,9 +130,10 @@
ccount = self.app.model.count_invocations("OK")
return len(self.app.model.invocations) - pcount - ccount
- def show_broker(self, session, broker):
+ def show_broker(self, session, reg):
+ assert isinstance(reg, BrokerRegistration)
frame = self.show_mode(session, self.__broker)
- frame.set_object(session, broker)
+ frame.set_object(session, reg)
return self.page.set_current_frame(session, frame)
def show_brokers_add(self, session):
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/page.strings 2008-04-08 15:36:41 UTC (rev 1860)
@@ -49,16 +49,6 @@
margin: 0;
}
-h1 {
- font-size: 1.1em;
- margin: 0 0 1em 0;
-}
-
-h1 img {
- vertical-align: -50%;
- margin: 0 0.5em 0 0;
-}
-
h2 {
font-size: 1em;
margin: 0 0 0.5em 0;
Modified: mgmt/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/cumin/python/cumin/parameters.py 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/parameters.py 2008-04-08 15:36:41 UTC (rev 1860)
@@ -30,7 +30,7 @@
def do_marshal(self, group):
return str(group.id)
-class BrokerParameter(Parameter):
+class BrokerRegistrationParameter(Parameter):
def do_unmarshal(self, string):
return BrokerRegistration.get(int(string))
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/queue.py 2008-04-08 15:36:41 UTC (rev 1860)
@@ -61,9 +61,10 @@
self.add_child(self.__purge)
def get_args(self, session):
- return self.frame.get_args(session)
+ reg = self.frame.get_object(session)
+ return (reg.getDefaultVhost(),)
- def render_title(self, session, *args):
+ def render_title(self, session, vhost):
return "Queues %s" % fmt_count(Queue.select().count())
def render_sql_where(self, session, vhost):
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/widgets.py 2008-04-08 15:36:41 UTC (rev 1860)
@@ -277,6 +277,16 @@
actions = self.SummaryActions(app, "actions")
self.add_child(actions)
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def render_title(self, session, object):
+ cls = self.app.model.get_class_by_object(object)
+ return cls.get_object_title(session, object)
+
+ def render_icon_href(self, session, object):
+ return "resource?name=action-36.png"
+
class SummaryProperties(CuminProperties):
def do_get_items(self, session, object):
cls = self.app.model.get_class_by_object(object)
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/cumin/python/cumin/widgets.strings 2008-04-08 15:36:41 UTC (rev 1860)
@@ -5,8 +5,6 @@
{status}
-<h1><img src="resource?name={icon_resource}"/>{title}</h1>
-
{summary}
{tabs}
@@ -155,71 +153,56 @@
</table>
[CuminSummary.css]
-table.CuminSummary {
- width: 36em;
- font-size: 0.9em;
+div.CuminSummary {
+ width: 32em;
margin: 0 0 1em 0;
- border-collapse: collapse;
+ min-height: 6em;
}
-table.CuminSummary td.properties {
- width: 50%;
- padding: 0.5em;
- border-top: 1px dotted #ccc;
- border-right: 1px dotted #ccc;
+div.CuminSummary h1 {
+ font-size: 1.1em;
}
-table.CuminSummary td.actions {
- width: 50%;
- padding: 0.5em;
- border-top: 1px dotted #ccc;
+div.CuminSummary h1 img {
+ vertical-align: -60%;
+ margin: 0 0.25em 0 0;
}
-table.CuminSummary table.PropertySet {
- margin: 0.5em 0;
+div.CuminSummary hr {
+ margin: 0.75em 0;
+ border: 0;
+ border-top: 1px dotted #ccc;
+ padding: 0;
}
-table.CuminSummary ul.ActionSet {
- margin: 0.5em 0;
+div.CuminSummary div.actions {
+ font-size: 0.9em;
+ width: 16em;
+ float: right;
}
-table.CuminSummary ul.ActionSet li {
- list-style-type: square;
+div.CuminSummary div.properties {
+ font-size: 0.9em;
}
[CuminSummary.html]
-<table class="CuminSummary">
- <tr>
- <td class="properties">
- {properties}
- </td>
- <td class="actions">
- <div>Act on this object:</div>
- {actions}
- </td>
- </tr>
-</table>
+<div class="CuminSummary">
+ <h1>
+ <img src="{icon_href}"/>
+ {title}
+ </h1>
-[SummaryProperties.css]
-dl.SummaryProperties {
- margin: 0 0 0.5em 0;
-}
+ <hr/>
-dl.SummaryProperties dt {
- font-size: 0.9em;
- font-weight: bold;
-}
+ <div class="actions">
+ {actions}
+ </div>
-dl.SummaryProperties dt {
- font-size: 0.9em;
-}
+ <div class="properties">
+ {properties}
+ </div>
+</div>
-[SummaryProperties.html]
-<dl class="SummaryProperties">{items}</dl>
-
-[SummaryProperties.property_html]
-<dt>{title}</dt><dd>{value}</dd>
-
[StateSwitch.html]
<ul class="radiotabs">
{items}
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/mint/python/mint/__init__.py 2008-04-08 15:36:41 UTC (rev 1860)
@@ -143,7 +143,9 @@
#print "\n\n=============== %s %d found AFTER QUERY\n\n" % (objType.__name__, idOriginal)
pass
- if obj and obj.__class__ is Broker and obj.managedBroker:
+ if isinstance(obj, Broker):
+ assert obj.managedBroker
+
host, port = obj.managedBroker.split(":")
port = int(port)
existing = list(obj.registrations)
@@ -154,6 +156,7 @@
log.info("Attaching broker to reg %s" % reg)
reg.broker = obj
+ reg.syncUpdate()
obj.syncUpdate()
return obj
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-04-08 14:20:25 UTC (rev 1859)
+++ mgmt/notes/justin-todo.txt 2008-04-08 15:36:41 UTC (rev 1860)
@@ -20,6 +20,12 @@
* client.py:159 calls add_error, which no longer exists
+ * Avoid constructing literal sql at broker.py:378
+
+ * An invalid id for a QueueParameter produces an ugly error
+
+ * Enforce one reg per broker, to avoid confusion
+
Deferred
* Change the way CuminAction.invoke works
16 years, 9 months
rhmessaging commits: r1859 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-04-08 10:20:25 -0400 (Tue, 08 Apr 2008)
New Revision: 1859
Modified:
store/trunk/cpp/lib/jrnl/pmgr.cpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
Log:
Corrected calls to clean() in pmgr and wmgr that previously caused valgrind to fail internally.
Modified: store/trunk/cpp/lib/jrnl/pmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.cpp 2008-04-08 12:08:21 UTC (rev 1858)
+++ store/trunk/cpp/lib/jrnl/pmgr.cpp 2008-04-08 14:20:25 UTC (rev 1859)
@@ -95,7 +95,7 @@
pmgr::~pmgr()
{
- clean();
+ pmgr::clean();
}
void
@@ -106,7 +106,7 @@
_pg_cntr = 0;
_pg_offset_dblks = 0;
_aio_evt_rem = 0;
- clean();
+ pmgr::clean();
// 1. Allocate page memory (as a single block)
size_t pagesize = _pages * _pagesize * _sblksize;
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-04-08 12:08:21 UTC (rev 1858)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-04-08 14:20:25 UTC (rev 1859)
@@ -53,7 +53,7 @@
rmgr::~rmgr()
{
- clean();
+ rmgr::clean();
}
void
@@ -88,8 +88,6 @@
void
rmgr::clean()
{
- // pmgr::clean();
-
::free(_fhdr_buffer);
_fhdr_buffer = 0;
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-04-08 12:08:21 UTC (rev 1858)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-04-08 14:20:25 UTC (rev 1859)
@@ -83,7 +83,7 @@
wmgr::~wmgr()
{
- clean();
+ wmgr::clean();
}
void
@@ -909,10 +909,11 @@
wmgr::initialize()
{
pmgr::initialize();
+ wmgr::clean();
_num_jfiles = _jc->num_jfiles();
if (::posix_memalign(&_fhdr_base_ptr, _sblksize, _sblksize * _num_jfiles))
{
- clean();
+ wmgr::clean();
std::ostringstream oss;
oss << "posix_memalign(): blksize=" << _sblksize << " size=" << _sblksize;
oss << " errno=" << errno;
@@ -1069,8 +1070,6 @@
void
wmgr::clean()
{
- // pmgr::clean();
- // clean up allocated memory here
::free(_fhdr_base_ptr);
_fhdr_base_ptr = 0;
16 years, 9 months