Annotation of qemu/block/raw.c, revision 1.1.1.4

1.1       root        1: 
                      2: #include "qemu-common.h"
                      3: #include "block_int.h"
                      4: #include "module.h"
                      5: 
                      6: static int raw_open(BlockDriverState *bs, int flags)
                      7: {
                      8:     bs->sg = bs->file->sg;
                      9:     return 0;
                     10: }
                     11: 
1.1.1.3   root       12: static int coroutine_fn raw_co_readv(BlockDriverState *bs, int64_t sector_num,
                     13:                                      int nb_sectors, QEMUIOVector *qiov)
1.1       root       14: {
1.1.1.3   root       15:     return bdrv_co_readv(bs->file, sector_num, nb_sectors, qiov);
1.1       root       16: }
                     17: 
1.1.1.3   root       18: static int coroutine_fn raw_co_writev(BlockDriverState *bs, int64_t sector_num,
                     19:                                       int nb_sectors, QEMUIOVector *qiov)
1.1       root       20: {
1.1.1.3   root       21:     return bdrv_co_writev(bs->file, sector_num, nb_sectors, qiov);
1.1       root       22: }
                     23: 
                     24: static void raw_close(BlockDriverState *bs)
                     25: {
                     26: }
                     27: 
                     28: static int64_t raw_getlength(BlockDriverState *bs)
                     29: {
                     30:     return bdrv_getlength(bs->file);
                     31: }
                     32: 
                     33: static int raw_truncate(BlockDriverState *bs, int64_t offset)
                     34: {
                     35:     return bdrv_truncate(bs->file, offset);
                     36: }
                     37: 
                     38: static int raw_probe(const uint8_t *buf, int buf_size, const char *filename)
                     39: {
                     40:    return 1; /* everything can be opened as raw image */
                     41: }
                     42: 
1.1.1.3   root       43: static int coroutine_fn raw_co_discard(BlockDriverState *bs,
                     44:                                        int64_t sector_num, int nb_sectors)
1.1.1.2   root       45: {
1.1.1.3   root       46:     return bdrv_co_discard(bs->file, sector_num, nb_sectors);
1.1.1.2   root       47: }
                     48: 
1.1       root       49: static int raw_is_inserted(BlockDriverState *bs)
                     50: {
                     51:     return bdrv_is_inserted(bs->file);
                     52: }
                     53: 
1.1.1.3   root       54: static int raw_media_changed(BlockDriverState *bs)
                     55: {
                     56:     return bdrv_media_changed(bs->file);
                     57: }
                     58: 
1.1.1.4 ! root       59: static void raw_eject(BlockDriverState *bs, bool eject_flag)
1.1       root       60: {
1.1.1.3   root       61:     bdrv_eject(bs->file, eject_flag);
1.1       root       62: }
                     63: 
1.1.1.3   root       64: static void raw_lock_medium(BlockDriverState *bs, bool locked)
1.1       root       65: {
1.1.1.3   root       66:     bdrv_lock_medium(bs->file, locked);
1.1       root       67: }
                     68: 
                     69: static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
                     70: {
                     71:    return bdrv_ioctl(bs->file, req, buf);
                     72: }
                     73: 
                     74: static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs,
                     75:         unsigned long int req, void *buf,
                     76:         BlockDriverCompletionFunc *cb, void *opaque)
                     77: {
                     78:    return bdrv_aio_ioctl(bs->file, req, buf, cb, opaque);
                     79: }
                     80: 
                     81: static int raw_create(const char *filename, QEMUOptionParameter *options)
                     82: {
                     83:     return bdrv_create_file(filename, options);
                     84: }
                     85: 
                     86: static QEMUOptionParameter raw_create_options[] = {
                     87:     {
                     88:         .name = BLOCK_OPT_SIZE,
                     89:         .type = OPT_SIZE,
                     90:         .help = "Virtual disk size"
                     91:     },
                     92:     { NULL }
                     93: };
                     94: 
                     95: static int raw_has_zero_init(BlockDriverState *bs)
                     96: {
                     97:     return bdrv_has_zero_init(bs->file);
                     98: }
                     99: 
                    100: static BlockDriver bdrv_raw = {
                    101:     .format_name        = "raw",
                    102: 
1.1.1.3   root      103:     /* It's really 0, but we need to make g_malloc() happy */
1.1       root      104:     .instance_size      = 1,
                    105: 
                    106:     .bdrv_open          = raw_open,
                    107:     .bdrv_close         = raw_close,
1.1.1.3   root      108: 
                    109:     .bdrv_co_readv          = raw_co_readv,
                    110:     .bdrv_co_writev         = raw_co_writev,
                    111:     .bdrv_co_discard        = raw_co_discard,
                    112: 
1.1       root      113:     .bdrv_probe         = raw_probe,
                    114:     .bdrv_getlength     = raw_getlength,
                    115:     .bdrv_truncate      = raw_truncate,
                    116: 
                    117:     .bdrv_is_inserted   = raw_is_inserted,
1.1.1.3   root      118:     .bdrv_media_changed = raw_media_changed,
1.1       root      119:     .bdrv_eject         = raw_eject,
1.1.1.3   root      120:     .bdrv_lock_medium   = raw_lock_medium,
                    121: 
1.1       root      122:     .bdrv_ioctl         = raw_ioctl,
                    123:     .bdrv_aio_ioctl     = raw_aio_ioctl,
                    124: 
                    125:     .bdrv_create        = raw_create,
                    126:     .create_options     = raw_create_options,
                    127:     .bdrv_has_zero_init = raw_has_zero_init,
                    128: };
                    129: 
                    130: static void bdrv_raw_init(void)
                    131: {
                    132:     bdrv_register(&bdrv_raw);
                    133: }
                    134: 
                    135: block_init(bdrv_raw_init);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.