Revision a3161038

b/arch_init.c
382 382
    trace_migration_bitmap_sync_start();
383 383
    memory_global_sync_dirty_bitmap(get_system_memory());
384 384

  
385
    QLIST_FOREACH(block, &ram_list.blocks, next) {
385
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
386 386
        for (addr = 0; addr < block->length; addr += TARGET_PAGE_SIZE) {
387 387
            if (memory_region_get_dirty(block->mr, addr, TARGET_PAGE_SIZE,
388 388
                                        DIRTY_MEMORY_MIGRATION)) {
......
424 424
    ram_addr_t current_addr;
425 425

  
426 426
    if (!block)
427
        block = QLIST_FIRST(&ram_list.blocks);
427
        block = QTAILQ_FIRST(&ram_list.blocks);
428 428

  
429 429
    do {
430 430
        mr = block->mr;
......
465 465
        offset += TARGET_PAGE_SIZE;
466 466
        if (offset >= block->length) {
467 467
            offset = 0;
468
            block = QLIST_NEXT(block, next);
468
            block = QTAILQ_NEXT(block, next);
469 469
            if (!block)
470
                block = QLIST_FIRST(&ram_list.blocks);
470
                block = QTAILQ_FIRST(&ram_list.blocks);
471 471
        }
472 472
    } while (block != last_block || offset != last_offset);
473 473

  
......
499 499
    RAMBlock *block;
500 500
    uint64_t total = 0;
501 501

  
502
    QLIST_FOREACH(block, &ram_list.blocks, next)
502
    QTAILQ_FOREACH(block, &ram_list.blocks, next)
503 503
        total += block->length;
504 504

  
505 505
    return total;
......
518 518
    RAMBlock *block, *nblock, **blocks;
519 519
    int n;
520 520
    n = 0;
521
    QLIST_FOREACH(block, &ram_list.blocks, next) {
521
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
522 522
        ++n;
523 523
    }
524 524
    blocks = g_malloc(n * sizeof *blocks);
525 525
    n = 0;
526
    QLIST_FOREACH_SAFE(block, &ram_list.blocks, next, nblock) {
526
    QTAILQ_FOREACH_SAFE(block, &ram_list.blocks, next, nblock) {
527 527
        blocks[n++] = block;
528
        QLIST_REMOVE(block, next);
528
        QTAILQ_REMOVE(&ram_list.blocks, block, next);
529 529
    }
530 530
    qsort(blocks, n, sizeof *blocks, block_compar);
531 531
    while (--n >= 0) {
532
        QLIST_INSERT_HEAD(&ram_list.blocks, blocks[n], next);
532
        QTAILQ_INSERT_HEAD(&ram_list.blocks, blocks[n], next);
533 533
    }
534 534
    g_free(blocks);
535 535
}
......
597 597

  
598 598
    qemu_put_be64(f, ram_bytes_total() | RAM_SAVE_FLAG_MEM_SIZE);
599 599

  
600
    QLIST_FOREACH(block, &ram_list.blocks, next) {
600
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
601 601
        qemu_put_byte(f, strlen(block->idstr));
602 602
        qemu_put_buffer(f, (uint8_t *)block->idstr, strlen(block->idstr));
603 603
        qemu_put_be64(f, block->length);
......
763 763
    qemu_get_buffer(f, (uint8_t *)id, len);
764 764
    id[len] = 0;
765 765

  
766
    QLIST_FOREACH(block, &ram_list.blocks, next) {
766
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
767 767
        if (!strncmp(id, block->idstr, sizeof(id)))
768 768
            return memory_region_get_ram_ptr(block->mr) + offset;
769 769
    }
......
807 807
                    id[len] = 0;
808 808
                    length = qemu_get_be64(f);
809 809

  
810
                    QLIST_FOREACH(block, &ram_list.blocks, next) {
810
                    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
811 811
                        if (!strncmp(id, block->idstr, sizeof(id))) {
812 812
                            if (block->length != length) {
813 813
                                ret =  -EINVAL;
b/dump.c
427 427
        }
428 428
    }
429 429

  
430
    QLIST_FOREACH(block, &ram_list.blocks, next) {
430
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
431 431
        if (s->has_filter) {
432 432
            if (block->offset >= s->begin + s->length ||
433 433
                block->offset + block->length <= s->begin) {
......
594 594
static int get_next_block(DumpState *s, RAMBlock *block)
595 595
{
596 596
    while (1) {
597
        block = QLIST_NEXT(block, next);
597
        block = QTAILQ_NEXT(block, next);
598 598
        if (!block) {
599 599
            /* no more block */
600 600
            return 1;
......
670 670
    RAMBlock *block;
671 671

  
672 672
    if (!s->has_filter) {
673
        s->block = QLIST_FIRST(&ram_list.blocks);
673
        s->block = QTAILQ_FIRST(&ram_list.blocks);
674 674
        return 0;
675 675
    }
676 676

  
677
    QLIST_FOREACH(block, &ram_list.blocks, next) {
677
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
678 678
        if (block->offset >= s->begin + s->length ||
679 679
            block->offset + block->length <= s->begin) {
680 680
            /* This block is out of the range */
b/exec.c
57 57
int phys_ram_fd;
58 58
static int in_migration;
59 59

  
60
RAMList ram_list = { .blocks = QLIST_HEAD_INITIALIZER(ram_list.blocks) };
60
RAMList ram_list = { .blocks = QTAILQ_HEAD_INITIALIZER(ram_list.blocks) };
61 61

  
62 62
static MemoryRegion *system_memory;
63 63
static MemoryRegion *system_io;
......
902 902
    RAMBlock *block, *next_block;
903 903
    ram_addr_t offset = RAM_ADDR_MAX, mingap = RAM_ADDR_MAX;
904 904

  
905
    if (QLIST_EMPTY(&ram_list.blocks))
905
    if (QTAILQ_EMPTY(&ram_list.blocks))
906 906
        return 0;
907 907

  
908
    QLIST_FOREACH(block, &ram_list.blocks, next) {
908
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
909 909
        ram_addr_t end, next = RAM_ADDR_MAX;
910 910

  
911 911
        end = block->offset + block->length;
912 912

  
913
        QLIST_FOREACH(next_block, &ram_list.blocks, next) {
913
        QTAILQ_FOREACH(next_block, &ram_list.blocks, next) {
914 914
            if (next_block->offset >= end) {
915 915
                next = MIN(next, next_block->offset);
916 916
            }
......
935 935
    RAMBlock *block;
936 936
    ram_addr_t last = 0;
937 937

  
938
    QLIST_FOREACH(block, &ram_list.blocks, next)
938
    QTAILQ_FOREACH(block, &ram_list.blocks, next)
939 939
        last = MAX(last, block->offset + block->length);
940 940

  
941 941
    return last;
......
964 964
    RAMBlock *new_block, *block;
965 965

  
966 966
    new_block = NULL;
967
    QLIST_FOREACH(block, &ram_list.blocks, next) {
967
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
968 968
        if (block->offset == addr) {
969 969
            new_block = block;
970 970
            break;
......
982 982
    }
983 983
    pstrcat(new_block->idstr, sizeof(new_block->idstr), name);
984 984

  
985
    QLIST_FOREACH(block, &ram_list.blocks, next) {
985
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
986 986
        if (block != new_block && !strcmp(block->idstr, new_block->idstr)) {
987 987
            fprintf(stderr, "RAMBlock \"%s\" already registered, abort!\n",
988 988
                    new_block->idstr);
......
1043 1043
    }
1044 1044
    new_block->length = size;
1045 1045

  
1046
    QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next);
1046
    QTAILQ_INSERT_HEAD(&ram_list.blocks, new_block, next);
1047 1047
    ram_list.mru_block = NULL;
1048 1048

  
1049 1049
    ram_list.phys_dirty = g_realloc(ram_list.phys_dirty,
......
1070 1070
{
1071 1071
    RAMBlock *block;
1072 1072

  
1073
    QLIST_FOREACH(block, &ram_list.blocks, next) {
1073
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
1074 1074
        if (addr == block->offset) {
1075
            QLIST_REMOVE(block, next);
1075
            QTAILQ_REMOVE(&ram_list.blocks, block, next);
1076 1076
            ram_list.mru_block = NULL;
1077 1077
            g_free(block);
1078 1078
            return;
......
1084 1084
{
1085 1085
    RAMBlock *block;
1086 1086

  
1087
    QLIST_FOREACH(block, &ram_list.blocks, next) {
1087
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
1088 1088
        if (addr == block->offset) {
1089
            QLIST_REMOVE(block, next);
1089
            QTAILQ_REMOVE(&ram_list.blocks, block, next);
1090 1090
            ram_list.mru_block = NULL;
1091 1091
            if (block->flags & RAM_PREALLOC_MASK) {
1092 1092
                ;
......
1127 1127
    int flags;
1128 1128
    void *area, *vaddr;
1129 1129

  
1130
    QLIST_FOREACH(block, &ram_list.blocks, next) {
1130
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
1131 1131
        offset = addr - block->offset;
1132 1132
        if (offset < block->length) {
1133 1133
            vaddr = block->host + offset;
......
1197 1197
    if (block && addr - block->offset < block->length) {
1198 1198
        goto found;
1199 1199
    }
1200
    QLIST_FOREACH(block, &ram_list.blocks, next) {
1200
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
1201 1201
        if (addr - block->offset < block->length) {
1202 1202
            goto found;
1203 1203
        }
......
1232 1232
{
1233 1233
    RAMBlock *block;
1234 1234

  
1235
    QLIST_FOREACH(block, &ram_list.blocks, next) {
1235
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
1236 1236
        if (addr - block->offset < block->length) {
1237 1237
            if (xen_enabled()) {
1238 1238
                /* We need to check if the requested address is in the RAM
......
1268 1268
    } else {
1269 1269
        RAMBlock *block;
1270 1270

  
1271
        QLIST_FOREACH(block, &ram_list.blocks, next) {
1271
        QTAILQ_FOREACH(block, &ram_list.blocks, next) {
1272 1272
            if (addr - block->offset < block->length) {
1273 1273
                if (addr - block->offset + *size > block->length)
1274 1274
                    *size = block->length - addr + block->offset;
......
1296 1296
        return 0;
1297 1297
    }
1298 1298

  
1299
    QLIST_FOREACH(block, &ram_list.blocks, next) {
1299
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
1300 1300
        /* This case append when the block is not mapped. */
1301 1301
        if (block->host == NULL) {
1302 1302
            continue;
b/include/exec/cpu-all.h
487 487
    ram_addr_t length;
488 488
    uint32_t flags;
489 489
    char idstr[256];
490
    QLIST_ENTRY(RAMBlock) next;
490
    QTAILQ_ENTRY(RAMBlock) next;
491 491
#if defined(__linux__) && !defined(TARGET_S390X)
492 492
    int fd;
493 493
#endif
......
496 496
typedef struct RAMList {
497 497
    uint8_t *phys_dirty;
498 498
    RAMBlock *mru_block;
499
    QLIST_HEAD(, RAMBlock) blocks;
499
    QTAILQ_HEAD(, RAMBlock) blocks;
500 500
} RAMList;
501 501
extern RAMList ram_list;
502 502

  
b/memory_mapping.c
200 200
     * If the guest doesn't use paging, the virtual address is equal to physical
201 201
     * address.
202 202
     */
203
    QLIST_FOREACH(block, &ram_list.blocks, next) {
203
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
204 204
        offset = block->offset;
205 205
        length = block->length;
206 206
        create_new_memory_mapping(list, offset, offset, length);
......
213 213
{
214 214
    RAMBlock *block;
215 215

  
216
    QLIST_FOREACH(block, &ram_list.blocks, next) {
216
    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
217 217
        create_new_memory_mapping(list, block->offset, 0, block->length);
218 218
    }
219 219
}
b/target-i386/arch_dump.c
403 403
    } else {
404 404
        info->d_class = ELFCLASS32;
405 405

  
406
        QLIST_FOREACH(block, &ram_list.blocks, next) {
406
        QTAILQ_FOREACH(block, &ram_list.blocks, next) {
407 407
            if (block->offset + block->length > UINT_MAX) {
408 408
                /* The memory size is greater than 4G */
409 409
                info->d_class = ELFCLASS64;

Also available in: Unified diff