namespace
{
- int array[MAX_TEST_CONTEXTS];
+ int test_array[MAX_TEST_CONTEXTS];
int array_idx;
TestContext* test_contexts[MAX_TEST_CONTEXTS];
{
array_lock.Lock();
cout << "TestContext " << num << std::endl;
- array[array_idx++] = num;
+ test_array[array_idx++] = num;
array_lock.Unlock();
}
{
array_lock.Lock();
cout << "StrictOrderTestContext " << num << std::endl;
- array[num] = num;
+ test_array[num] = num;
array_lock.Unlock();
}
static int basic_timer_test(T &timer, Mutex *lock)
{
int ret = 0;
- memset(&array, 0, sizeof(array));
+ memset(&test_array, 0, sizeof(test_array));
array_idx = 0;
memset(&test_contexts, 0, sizeof(test_contexts));
} while (!done);
for (int i = 0; i < MAX_TEST_CONTEXTS; ++i) {
- if (array[i] != i) {
+ if (test_array[i] != i) {
ret = 1;
- cout << "error: expected array[" << i << "] = " << i
- << "; got " << array[i] << " instead." << std::endl;
+ cout << "error: expected test_array[" << i << "] = " << i
+ << "; got " << test_array[i] << " instead." << std::endl;
}
}
static int test_out_of_order_insertion(SafeTimer &timer, Mutex *lock)
{
int ret = 0;
- memset(&array, 0, sizeof(array));
+ memset(&test_array, 0, sizeof(test_array));
array_idx = 0;
memset(&test_contexts, 0, sizeof(test_contexts));
for (; secs < 100 ; ++secs) {
sleep(1);
array_lock.Lock();
- int a = array[1];
+ int a = test_array[1];
array_lock.Unlock();
if (a == 1)
break;
if (secs == 100) {
ret = 1;
- cout << "error: expected array[" << 1 << "] = " << 1
- << "; got " << array[1] << " instead." << std::endl;
+ cout << "error: expected test_array[" << 1 << "] = " << 1
+ << "; got " << test_array[1] << " instead." << std::endl;
}
return ret;
cout << __PRETTY_FUNCTION__ << std::endl;
int ret = 0;
- memset(&array, 0, sizeof(array));
+ memset(&test_array, 0, sizeof(test_array));
array_idx = 0;
memset(&test_contexts, 0, sizeof(test_contexts));
safe_timer_lock.Unlock();
for (int i = 0; i < array_idx; ++i) {
- if (array[i] != i) {
+ if (test_array[i] != i) {
ret = 1;
- cout << "error: expected array[" << i << "] = " << i
- << "; got " << array[i] << " instead." << std::endl;
+ cout << "error: expected test_array[" << i << "] = " << i
+ << "; got " << test_array[i] << " instead." << std::endl;
}
}
cout << __PRETTY_FUNCTION__ << std::endl;
int ret = 0;
- memset(&array, 0, sizeof(array));
+ memset(&test_array, 0, sizeof(test_array));
array_idx = 0;
memset(&test_contexts, 0, sizeof(test_contexts));
safe_timer_lock.Unlock();
for (int i = 1; i < array_idx; i += 2) {
- if (array[i] != i) {
+ if (test_array[i] != i) {
ret = 1;
- cout << "error: expected array[" << i << "] = " << i
- << "; got " << array[i] << " instead." << std::endl;
+ cout << "error: expected test_array[" << i << "] = " << i
+ << "; got " << test_array[i] << " instead." << std::endl;
}
}
}
if (alignment)
assert(segment_length % alignment == 0);
- out.insert(make_pair(pos, segment_length));
+ out.insert(pair<uint64_t, uint64_t>(pos, segment_length));
pos += segment_length;
}
}
segment_length = limit - pos;
}
if (include) {
- out.insert(make_pair(pos, segment_length));
+ out.insert(pair<uint64_t, uint64_t>(pos, segment_length));
include = false;
} else {
include = true;
interval_set<uint64_t> ranges;
cur_cont->first->get_ranges(cur_cont->second, ranges);
while (!ranges.contains(pos)) {
- stack.push_front(make_pair(cur_cont, limit));
+ stack.push_front(pair<list<pair<ceph::shared_ptr<ContentsGenerator>,
+ ContDesc> >::iterator,
+ uint64_t>(cur_cont, limit));
uint64_t length = cur_cont->first->get_length(cur_cont->second);
uint64_t next;
if (pos >= length) {
}
void ObjectDesc::update(ContentsGenerator *gen, const ContDesc &next) {
- layers.push_front(make_pair(gen, next));
+ layers.push_front(pair<ceph::shared_ptr<ContentsGenerator>, ContDesc>(ceph::shared_ptr<ContentsGenerator>(gen), next));
return;
}
AttrGenerator(uint64_t max_len) : max_len(max_len) {}
void get_ranges_map(
const ContDesc &cont, map<uint64_t, uint64_t> &out) {
- out.insert(make_pair(0, get_length(cont)));
+ out.insert(pair<uint64_t, uint64_t>(0, get_length(cont)));
}
uint64_t get_length(const ContDesc &in) {
RandWrap rand(in.seqnum);
ObjectDesc(const ContDesc &init, ContentsGenerator *cont_gen)
: exists(false), dirty(false),
version(0) {
- layers.push_front(make_pair(cont_gen, init));
+ layers.push_front(pair<ceph::shared_ptr<ContentsGenerator>, ContDesc>(ceph::shared_ptr<ContentsGenerator>(cont_gen), init));
}
class iterator {