]> Git Repo - qemu.git/blob - block/raw-win32.c
Merge remote-tracking branch 'remotes/bonzini/scsi-next' into staging
[qemu.git] / block / raw-win32.c
1 /*
2  * Block driver for RAW files (win32)
3  *
4  * Copyright (c) 2006 Fabrice Bellard
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 #include "qemu-common.h"
25 #include "qemu/timer.h"
26 #include "block/block_int.h"
27 #include "qemu/module.h"
28 #include "raw-aio.h"
29 #include "trace.h"
30 #include "block/thread-pool.h"
31 #include "qemu/iov.h"
32 #include <windows.h>
33 #include <winioctl.h>
34
35 #define FTYPE_FILE 0
36 #define FTYPE_CD     1
37 #define FTYPE_HARDDISK 2
38
39 static QEMUWin32AIOState *aio;
40
41 typedef struct RawWin32AIOData {
42     BlockDriverState *bs;
43     HANDLE hfile;
44     struct iovec *aio_iov;
45     int aio_niov;
46     size_t aio_nbytes;
47     off64_t aio_offset;
48     int aio_type;
49 } RawWin32AIOData;
50
51 typedef struct BDRVRawState {
52     HANDLE hfile;
53     int type;
54     char drive_path[16]; /* format: "d:\" */
55     QEMUWin32AIOState *aio;
56 } BDRVRawState;
57
58 /*
59  * Read/writes the data to/from a given linear buffer.
60  *
61  * Returns the number of bytes handles or -errno in case of an error. Short
62  * reads are only returned if the end of the file is reached.
63  */
64 static size_t handle_aiocb_rw(RawWin32AIOData *aiocb)
65 {
66     size_t offset = 0;
67     int i;
68
69     for (i = 0; i < aiocb->aio_niov; i++) {
70         OVERLAPPED ov;
71         DWORD ret, ret_count, len;
72
73         memset(&ov, 0, sizeof(ov));
74         ov.Offset = (aiocb->aio_offset + offset);
75         ov.OffsetHigh = (aiocb->aio_offset + offset) >> 32;
76         len = aiocb->aio_iov[i].iov_len;
77         if (aiocb->aio_type & QEMU_AIO_WRITE) {
78             ret = WriteFile(aiocb->hfile, aiocb->aio_iov[i].iov_base,
79                             len, &ret_count, &ov);
80         } else {
81             ret = ReadFile(aiocb->hfile, aiocb->aio_iov[i].iov_base,
82                            len, &ret_count, &ov);
83         }
84         if (!ret) {
85             ret_count = 0;
86         }
87         if (ret_count != len) {
88             offset += ret_count;
89             break;
90         }
91         offset += len;
92     }
93
94     return offset;
95 }
96
97 static int aio_worker(void *arg)
98 {
99     RawWin32AIOData *aiocb = arg;
100     ssize_t ret = 0;
101     size_t count;
102
103     switch (aiocb->aio_type & QEMU_AIO_TYPE_MASK) {
104     case QEMU_AIO_READ:
105         count = handle_aiocb_rw(aiocb);
106         if (count < aiocb->aio_nbytes && aiocb->bs->growable) {
107             /* A short read means that we have reached EOF. Pad the buffer
108              * with zeros for bytes after EOF. */
109             iov_memset(aiocb->aio_iov, aiocb->aio_niov, count,
110                       0, aiocb->aio_nbytes - count);
111
112             count = aiocb->aio_nbytes;
113         }
114         if (count == aiocb->aio_nbytes) {
115             ret = 0;
116         } else {
117             ret = -EINVAL;
118         }
119         break;
120     case QEMU_AIO_WRITE:
121         count = handle_aiocb_rw(aiocb);
122         if (count == aiocb->aio_nbytes) {
123             count = 0;
124         } else {
125             count = -EINVAL;
126         }
127         break;
128     case QEMU_AIO_FLUSH:
129         if (!FlushFileBuffers(aiocb->hfile)) {
130             return -EIO;
131         }
132         break;
133     default:
134         fprintf(stderr, "invalid aio request (0x%x)\n", aiocb->aio_type);
135         ret = -EINVAL;
136         break;
137     }
138
139     g_slice_free(RawWin32AIOData, aiocb);
140     return ret;
141 }
142
143 static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, HANDLE hfile,
144         int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
145         BlockDriverCompletionFunc *cb, void *opaque, int type)
146 {
147     RawWin32AIOData *acb = g_slice_new(RawWin32AIOData);
148     ThreadPool *pool;
149
150     acb->bs = bs;
151     acb->hfile = hfile;
152     acb->aio_type = type;
153
154     if (qiov) {
155         acb->aio_iov = qiov->iov;
156         acb->aio_niov = qiov->niov;
157     }
158     acb->aio_nbytes = nb_sectors * 512;
159     acb->aio_offset = sector_num * 512;
160
161     trace_paio_submit(acb, opaque, sector_num, nb_sectors, type);
162     pool = aio_get_thread_pool(bdrv_get_aio_context(bs));
163     return thread_pool_submit_aio(pool, aio_worker, acb, cb, opaque);
164 }
165
166 int qemu_ftruncate64(int fd, int64_t length)
167 {
168     LARGE_INTEGER li;
169     DWORD dw;
170     LONG high;
171     HANDLE h;
172     BOOL res;
173
174     if ((GetVersion() & 0x80000000UL) && (length >> 32) != 0)
175         return -1;
176
177     h = (HANDLE)_get_osfhandle(fd);
178
179     /* get current position, ftruncate do not change position */
180     li.HighPart = 0;
181     li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT);
182     if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
183         return -1;
184     }
185
186     high = length >> 32;
187     dw = SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN);
188     if (dw == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
189         return -1;
190     }
191     res = SetEndOfFile(h);
192
193     /* back to old position */
194     SetFilePointer(h, li.LowPart, &li.HighPart, FILE_BEGIN);
195     return res ? 0 : -1;
196 }
197
198 static int set_sparse(int fd)
199 {
200     DWORD returned;
201     return (int) DeviceIoControl((HANDLE)_get_osfhandle(fd), FSCTL_SET_SPARSE,
202                                  NULL, 0, NULL, 0, &returned, NULL);
203 }
204
205 static void raw_probe_alignment(BlockDriverState *bs)
206 {
207     BDRVRawState *s = bs->opaque;
208     DWORD sectorsPerCluster, freeClusters, totalClusters, count;
209     DISK_GEOMETRY_EX dg;
210     BOOL status;
211
212     if (s->type == FTYPE_CD) {
213         bs->request_alignment = 2048;
214         return;
215     }
216     if (s->type == FTYPE_HARDDISK) {
217         status = DeviceIoControl(s->hfile, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
218                                  NULL, 0, &dg, sizeof(dg), &count, NULL);
219         if (status != 0) {
220             bs->request_alignment = dg.Geometry.BytesPerSector;
221             return;
222         }
223         /* try GetDiskFreeSpace too */
224     }
225
226     if (s->drive_path[0]) {
227         GetDiskFreeSpace(s->drive_path, &sectorsPerCluster,
228                          &dg.Geometry.BytesPerSector,
229                          &freeClusters, &totalClusters);
230         bs->request_alignment = dg.Geometry.BytesPerSector;
231     }
232 }
233
234 static void raw_parse_flags(int flags, int *access_flags, DWORD *overlapped)
235 {
236     assert(access_flags != NULL);
237     assert(overlapped != NULL);
238
239     if (flags & BDRV_O_RDWR) {
240         *access_flags = GENERIC_READ | GENERIC_WRITE;
241     } else {
242         *access_flags = GENERIC_READ;
243     }
244
245     *overlapped = FILE_ATTRIBUTE_NORMAL;
246     if (flags & BDRV_O_NATIVE_AIO) {
247         *overlapped |= FILE_FLAG_OVERLAPPED;
248     }
249     if (flags & BDRV_O_NOCACHE) {
250         *overlapped |= FILE_FLAG_NO_BUFFERING;
251     }
252 }
253
254 static void raw_parse_filename(const char *filename, QDict *options,
255                                Error **errp)
256 {
257     /* The filename does not have to be prefixed by the protocol name, since
258      * "file" is the default protocol; therefore, the return value of this
259      * function call can be ignored. */
260     strstart(filename, "file:", &filename);
261
262     qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
263 }
264
265 static QemuOptsList raw_runtime_opts = {
266     .name = "raw",
267     .head = QTAILQ_HEAD_INITIALIZER(raw_runtime_opts.head),
268     .desc = {
269         {
270             .name = "filename",
271             .type = QEMU_OPT_STRING,
272             .help = "File name of the image",
273         },
274         { /* end of list */ }
275     },
276 };
277
278 static int raw_open(BlockDriverState *bs, QDict *options, int flags,
279                     Error **errp)
280 {
281     BDRVRawState *s = bs->opaque;
282     int access_flags;
283     DWORD overlapped;
284     QemuOpts *opts;
285     Error *local_err = NULL;
286     const char *filename;
287     int ret;
288
289     s->type = FTYPE_FILE;
290
291     opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
292     qemu_opts_absorb_qdict(opts, options, &local_err);
293     if (local_err) {
294         error_propagate(errp, local_err);
295         ret = -EINVAL;
296         goto fail;
297     }
298
299     filename = qemu_opt_get(opts, "filename");
300
301     raw_parse_flags(flags, &access_flags, &overlapped);
302
303     if ((flags & BDRV_O_NATIVE_AIO) && aio == NULL) {
304         aio = win32_aio_init();
305         if (aio == NULL) {
306             error_setg(errp, "Could not initialize AIO");
307             ret = -EINVAL;
308             goto fail;
309         }
310     }
311
312     if (filename[0] && filename[1] == ':') {
313         snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", filename[0]);
314     } else if (filename[0] == '\\' && filename[1] == '\\') {
315         s->drive_path[0] = 0;
316     } else {
317         /* Relative path.  */
318         char buf[MAX_PATH];
319         GetCurrentDirectory(MAX_PATH, buf);
320         snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", buf[0]);
321     }
322
323     s->hfile = CreateFile(filename, access_flags,
324                           FILE_SHARE_READ, NULL,
325                           OPEN_EXISTING, overlapped, NULL);
326     if (s->hfile == INVALID_HANDLE_VALUE) {
327         int err = GetLastError();
328
329         if (err == ERROR_ACCESS_DENIED) {
330             ret = -EACCES;
331         } else {
332             ret = -EINVAL;
333         }
334         goto fail;
335     }
336
337     if (flags & BDRV_O_NATIVE_AIO) {
338         ret = win32_aio_attach(aio, s->hfile);
339         if (ret < 0) {
340             CloseHandle(s->hfile);
341             error_setg_errno(errp, -ret, "Could not enable AIO");
342             goto fail;
343         }
344         s->aio = aio;
345     }
346
347     raw_probe_alignment(bs);
348     ret = 0;
349 fail:
350     qemu_opts_del(opts);
351     return ret;
352 }
353
354 static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs,
355                          int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
356                          BlockDriverCompletionFunc *cb, void *opaque)
357 {
358     BDRVRawState *s = bs->opaque;
359     if (s->aio) {
360         return win32_aio_submit(bs, s->aio, s->hfile, sector_num, qiov,
361                                 nb_sectors, cb, opaque, QEMU_AIO_READ); 
362     } else {
363         return paio_submit(bs, s->hfile, sector_num, qiov, nb_sectors,
364                            cb, opaque, QEMU_AIO_READ);
365     }
366 }
367
368 static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs,
369                           int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
370                           BlockDriverCompletionFunc *cb, void *opaque)
371 {
372     BDRVRawState *s = bs->opaque;
373     if (s->aio) {
374         return win32_aio_submit(bs, s->aio, s->hfile, sector_num, qiov,
375                                 nb_sectors, cb, opaque, QEMU_AIO_WRITE); 
376     } else {
377         return paio_submit(bs, s->hfile, sector_num, qiov, nb_sectors,
378                            cb, opaque, QEMU_AIO_WRITE);
379     }
380 }
381
382 static BlockDriverAIOCB *raw_aio_flush(BlockDriverState *bs,
383                          BlockDriverCompletionFunc *cb, void *opaque)
384 {
385     BDRVRawState *s = bs->opaque;
386     return paio_submit(bs, s->hfile, 0, NULL, 0, cb, opaque, QEMU_AIO_FLUSH);
387 }
388
389 static void raw_close(BlockDriverState *bs)
390 {
391     BDRVRawState *s = bs->opaque;
392     CloseHandle(s->hfile);
393     if (bs->open_flags & BDRV_O_TEMPORARY) {
394         unlink(bs->filename);
395     }
396 }
397
398 static int raw_truncate(BlockDriverState *bs, int64_t offset)
399 {
400     BDRVRawState *s = bs->opaque;
401     LONG low, high;
402     DWORD dwPtrLow;
403
404     low = offset;
405     high = offset >> 32;
406
407     /*
408      * An error has occurred if the return value is INVALID_SET_FILE_POINTER
409      * and GetLastError doesn't return NO_ERROR.
410      */
411     dwPtrLow = SetFilePointer(s->hfile, low, &high, FILE_BEGIN);
412     if (dwPtrLow == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
413         fprintf(stderr, "SetFilePointer error: %lu\n", GetLastError());
414         return -EIO;
415     }
416     if (SetEndOfFile(s->hfile) == 0) {
417         fprintf(stderr, "SetEndOfFile error: %lu\n", GetLastError());
418         return -EIO;
419     }
420     return 0;
421 }
422
423 static int64_t raw_getlength(BlockDriverState *bs)
424 {
425     BDRVRawState *s = bs->opaque;
426     LARGE_INTEGER l;
427     ULARGE_INTEGER available, total, total_free;
428     DISK_GEOMETRY_EX dg;
429     DWORD count;
430     BOOL status;
431
432     switch(s->type) {
433     case FTYPE_FILE:
434         l.LowPart = GetFileSize(s->hfile, (PDWORD)&l.HighPart);
435         if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
436             return -EIO;
437         break;
438     case FTYPE_CD:
439         if (!GetDiskFreeSpaceEx(s->drive_path, &available, &total, &total_free))
440             return -EIO;
441         l.QuadPart = total.QuadPart;
442         break;
443     case FTYPE_HARDDISK:
444         status = DeviceIoControl(s->hfile, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
445                                  NULL, 0, &dg, sizeof(dg), &count, NULL);
446         if (status != 0) {
447             l = dg.DiskSize;
448         }
449         break;
450     default:
451         return -EIO;
452     }
453     return l.QuadPart;
454 }
455
456 static int64_t raw_get_allocated_file_size(BlockDriverState *bs)
457 {
458     typedef DWORD (WINAPI * get_compressed_t)(const char *filename,
459                                               DWORD * high);
460     get_compressed_t get_compressed;
461     struct _stati64 st;
462     const char *filename = bs->filename;
463     /* WinNT support GetCompressedFileSize to determine allocate size */
464     get_compressed =
465         (get_compressed_t) GetProcAddress(GetModuleHandle("kernel32"),
466                                             "GetCompressedFileSizeA");
467     if (get_compressed) {
468         DWORD high, low;
469         low = get_compressed(filename, &high);
470         if (low != 0xFFFFFFFFlu || GetLastError() == NO_ERROR) {
471             return (((int64_t) high) << 32) + low;
472         }
473     }
474
475     if (_stati64(filename, &st) < 0) {
476         return -1;
477     }
478     return st.st_size;
479 }
480
481 static int raw_create(const char *filename, QEMUOptionParameter *options,
482                       Error **errp)
483 {
484     int fd;
485     int64_t total_size = 0;
486
487     strstart(filename, "file:", &filename);
488
489     /* Read out options */
490     while (options && options->name) {
491         if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
492             total_size = options->value.n / 512;
493         }
494         options++;
495     }
496
497     fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
498                    0644);
499     if (fd < 0) {
500         error_setg_errno(errp, errno, "Could not create file");
501         return -EIO;
502     }
503     set_sparse(fd);
504     ftruncate(fd, total_size * 512);
505     qemu_close(fd);
506     return 0;
507 }
508
509 static QEMUOptionParameter raw_create_options[] = {
510     {
511         .name = BLOCK_OPT_SIZE,
512         .type = OPT_SIZE,
513         .help = "Virtual disk size"
514     },
515     { NULL }
516 };
517
518 static BlockDriver bdrv_file = {
519     .format_name        = "file",
520     .protocol_name      = "file",
521     .instance_size      = sizeof(BDRVRawState),
522     .bdrv_needs_filename = true,
523     .bdrv_parse_filename = raw_parse_filename,
524     .bdrv_file_open     = raw_open,
525     .bdrv_close         = raw_close,
526     .bdrv_create        = raw_create,
527     .bdrv_has_zero_init = bdrv_has_zero_init_1,
528
529     .bdrv_aio_readv     = raw_aio_readv,
530     .bdrv_aio_writev    = raw_aio_writev,
531     .bdrv_aio_flush     = raw_aio_flush,
532
533     .bdrv_truncate      = raw_truncate,
534     .bdrv_getlength     = raw_getlength,
535     .bdrv_get_allocated_file_size
536                         = raw_get_allocated_file_size,
537
538     .create_options = raw_create_options,
539 };
540
541 /***********************************************/
542 /* host device */
543
544 static int find_cdrom(char *cdrom_name, int cdrom_name_size)
545 {
546     char drives[256], *pdrv = drives;
547     UINT type;
548
549     memset(drives, 0, sizeof(drives));
550     GetLogicalDriveStrings(sizeof(drives), drives);
551     while(pdrv[0] != '\0') {
552         type = GetDriveType(pdrv);
553         switch(type) {
554         case DRIVE_CDROM:
555             snprintf(cdrom_name, cdrom_name_size, "\\\\.\\%c:", pdrv[0]);
556             return 0;
557             break;
558         }
559         pdrv += lstrlen(pdrv) + 1;
560     }
561     return -1;
562 }
563
564 static int find_device_type(BlockDriverState *bs, const char *filename)
565 {
566     BDRVRawState *s = bs->opaque;
567     UINT type;
568     const char *p;
569
570     if (strstart(filename, "\\\\.\\", &p) ||
571         strstart(filename, "//./", &p)) {
572         if (stristart(p, "PhysicalDrive", NULL))
573             return FTYPE_HARDDISK;
574         snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", p[0]);
575         type = GetDriveType(s->drive_path);
576         switch (type) {
577         case DRIVE_REMOVABLE:
578         case DRIVE_FIXED:
579             return FTYPE_HARDDISK;
580         case DRIVE_CDROM:
581             return FTYPE_CD;
582         default:
583             return FTYPE_FILE;
584         }
585     } else {
586         return FTYPE_FILE;
587     }
588 }
589
590 static int hdev_probe_device(const char *filename)
591 {
592     if (strstart(filename, "/dev/cdrom", NULL))
593         return 100;
594     if (is_windows_drive(filename))
595         return 100;
596     return 0;
597 }
598
599 static void hdev_parse_filename(const char *filename, QDict *options,
600                                 Error **errp)
601 {
602     /* The prefix is optional, just as for "file". */
603     strstart(filename, "host_device:", &filename);
604
605     qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
606 }
607
608 static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
609                      Error **errp)
610 {
611     BDRVRawState *s = bs->opaque;
612     int access_flags, create_flags;
613     int ret = 0;
614     DWORD overlapped;
615     char device_name[64];
616
617     Error *local_err = NULL;
618     const char *filename;
619
620     QemuOpts *opts = qemu_opts_create(&raw_runtime_opts, NULL, 0,
621                                       &error_abort);
622     qemu_opts_absorb_qdict(opts, options, &local_err);
623     if (local_err) {
624         error_propagate(errp, local_err);
625         ret = -EINVAL;
626         goto done;
627     }
628
629     filename = qemu_opt_get(opts, "filename");
630
631     if (strstart(filename, "/dev/cdrom", NULL)) {
632         if (find_cdrom(device_name, sizeof(device_name)) < 0) {
633             error_setg(errp, "Could not open CD-ROM drive");
634             ret = -ENOENT;
635             goto done;
636         }
637         filename = device_name;
638     } else {
639         /* transform drive letters into device name */
640         if (((filename[0] >= 'a' && filename[0] <= 'z') ||
641              (filename[0] >= 'A' && filename[0] <= 'Z')) &&
642             filename[1] == ':' && filename[2] == '\0') {
643             snprintf(device_name, sizeof(device_name), "\\\\.\\%c:", filename[0]);
644             filename = device_name;
645         }
646     }
647     s->type = find_device_type(bs, filename);
648
649     raw_parse_flags(flags, &access_flags, &overlapped);
650
651     create_flags = OPEN_EXISTING;
652
653     s->hfile = CreateFile(filename, access_flags,
654                           FILE_SHARE_READ, NULL,
655                           create_flags, overlapped, NULL);
656     if (s->hfile == INVALID_HANDLE_VALUE) {
657         int err = GetLastError();
658
659         if (err == ERROR_ACCESS_DENIED) {
660             ret = -EACCES;
661         } else {
662             ret = -EINVAL;
663         }
664         error_setg_errno(errp, -ret, "Could not open device");
665         goto done;
666     }
667
668 done:
669     qemu_opts_del(opts);
670     return ret;
671 }
672
673 static BlockDriver bdrv_host_device = {
674     .format_name        = "host_device",
675     .protocol_name      = "host_device",
676     .instance_size      = sizeof(BDRVRawState),
677     .bdrv_needs_filename = true,
678     .bdrv_parse_filename = hdev_parse_filename,
679     .bdrv_probe_device  = hdev_probe_device,
680     .bdrv_file_open     = hdev_open,
681     .bdrv_close         = raw_close,
682
683     .bdrv_aio_readv     = raw_aio_readv,
684     .bdrv_aio_writev    = raw_aio_writev,
685     .bdrv_aio_flush     = raw_aio_flush,
686
687     .bdrv_getlength      = raw_getlength,
688     .has_variable_length = true,
689
690     .bdrv_get_allocated_file_size
691                         = raw_get_allocated_file_size,
692 };
693
694 static void bdrv_file_init(void)
695 {
696     bdrv_register(&bdrv_file);
697     bdrv_register(&bdrv_host_device);
698 }
699
700 block_init(bdrv_file_init);
This page took 0.059427 seconds and 4 git commands to generate.