Statistics
| Branch: | Revision:

root / block / raw-win32.c @ 6c6ea921

History | View | Annotate | Download (11 kB)

1 223d4670 ths
/*
2 223d4670 ths
 * Block driver for RAW files (win32)
3 223d4670 ths
 *
4 223d4670 ths
 * Copyright (c) 2006 Fabrice Bellard
5 223d4670 ths
 *
6 223d4670 ths
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 223d4670 ths
 * of this software and associated documentation files (the "Software"), to deal
8 223d4670 ths
 * in the Software without restriction, including without limitation the rights
9 223d4670 ths
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 223d4670 ths
 * copies of the Software, and to permit persons to whom the Software is
11 223d4670 ths
 * furnished to do so, subject to the following conditions:
12 223d4670 ths
 *
13 223d4670 ths
 * The above copyright notice and this permission notice shall be included in
14 223d4670 ths
 * all copies or substantial portions of the Software.
15 223d4670 ths
 *
16 223d4670 ths
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 223d4670 ths
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 223d4670 ths
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 223d4670 ths
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 223d4670 ths
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 223d4670 ths
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 223d4670 ths
 * THE SOFTWARE.
23 223d4670 ths
 */
24 223d4670 ths
#include "qemu-common.h"
25 223d4670 ths
#include "qemu-timer.h"
26 223d4670 ths
#include "block_int.h"
27 5efa9d5a Anthony Liguori
#include "module.h"
28 49dc768d aliguori
#include <windows.h>
29 223d4670 ths
#include <winioctl.h>
30 223d4670 ths
31 223d4670 ths
#define FTYPE_FILE 0
32 223d4670 ths
#define FTYPE_CD     1
33 223d4670 ths
#define FTYPE_HARDDISK 2
34 223d4670 ths
35 223d4670 ths
typedef struct BDRVRawState {
36 223d4670 ths
    HANDLE hfile;
37 223d4670 ths
    int type;
38 223d4670 ths
    char drive_path[16]; /* format: "d:\" */
39 223d4670 ths
} BDRVRawState;
40 223d4670 ths
41 223d4670 ths
int qemu_ftruncate64(int fd, int64_t length)
42 223d4670 ths
{
43 223d4670 ths
    LARGE_INTEGER li;
44 223d4670 ths
    LONG high;
45 223d4670 ths
    HANDLE h;
46 223d4670 ths
    BOOL res;
47 223d4670 ths
48 223d4670 ths
    if ((GetVersion() & 0x80000000UL) && (length >> 32) != 0)
49 223d4670 ths
        return -1;
50 223d4670 ths
51 223d4670 ths
    h = (HANDLE)_get_osfhandle(fd);
52 223d4670 ths
53 223d4670 ths
    /* get current position, ftruncate do not change position */
54 223d4670 ths
    li.HighPart = 0;
55 223d4670 ths
    li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT);
56 223d4670 ths
    if (li.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
57 223d4670 ths
        return -1;
58 223d4670 ths
59 223d4670 ths
    high = length >> 32;
60 223d4670 ths
    if (!SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN))
61 223d4670 ths
        return -1;
62 223d4670 ths
    res = SetEndOfFile(h);
63 223d4670 ths
64 223d4670 ths
    /* back to old position */
65 223d4670 ths
    SetFilePointer(h, li.LowPart, &li.HighPart, FILE_BEGIN);
66 223d4670 ths
    return res ? 0 : -1;
67 223d4670 ths
}
68 223d4670 ths
69 223d4670 ths
static int set_sparse(int fd)
70 223d4670 ths
{
71 223d4670 ths
    DWORD returned;
72 223d4670 ths
    return (int) DeviceIoControl((HANDLE)_get_osfhandle(fd), FSCTL_SET_SPARSE,
73 223d4670 ths
                                 NULL, 0, NULL, 0, &returned, NULL);
74 223d4670 ths
}
75 223d4670 ths
76 223d4670 ths
static int raw_open(BlockDriverState *bs, const char *filename, int flags)
77 223d4670 ths
{
78 223d4670 ths
    BDRVRawState *s = bs->opaque;
79 9a2d77ad Christoph Hellwig
    int access_flags;
80 223d4670 ths
    DWORD overlapped;
81 223d4670 ths
82 223d4670 ths
    s->type = FTYPE_FILE;
83 223d4670 ths
84 f5edb014 Naphtali Sprei
    if (flags & BDRV_O_RDWR) {
85 223d4670 ths
        access_flags = GENERIC_READ | GENERIC_WRITE;
86 223d4670 ths
    } else {
87 223d4670 ths
        access_flags = GENERIC_READ;
88 223d4670 ths
    }
89 9a2d77ad Christoph Hellwig
90 03ff3ca3 aliguori
    overlapped = FILE_ATTRIBUTE_NORMAL;
91 9f7965c7 aliguori
    if ((flags & BDRV_O_NOCACHE))
92 33f00271 balrog
        overlapped |= FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH;
93 9f7965c7 aliguori
    else if (!(flags & BDRV_O_CACHE_WB))
94 9f7965c7 aliguori
        overlapped |= FILE_FLAG_WRITE_THROUGH;
95 223d4670 ths
    s->hfile = CreateFile(filename, access_flags,
96 223d4670 ths
                          FILE_SHARE_READ, NULL,
97 9a2d77ad Christoph Hellwig
                          OPEN_EXISTING, overlapped, NULL);
98 223d4670 ths
    if (s->hfile == INVALID_HANDLE_VALUE) {
99 223d4670 ths
        int err = GetLastError();
100 223d4670 ths
101 223d4670 ths
        if (err == ERROR_ACCESS_DENIED)
102 223d4670 ths
            return -EACCES;
103 223d4670 ths
        return -1;
104 223d4670 ths
    }
105 223d4670 ths
    return 0;
106 223d4670 ths
}
107 223d4670 ths
108 eda578e5 aliguori
static int raw_read(BlockDriverState *bs, int64_t sector_num,
109 eda578e5 aliguori
                    uint8_t *buf, int nb_sectors)
110 223d4670 ths
{
111 223d4670 ths
    BDRVRawState *s = bs->opaque;
112 223d4670 ths
    OVERLAPPED ov;
113 223d4670 ths
    DWORD ret_count;
114 223d4670 ths
    int ret;
115 eda578e5 aliguori
    int64_t offset = sector_num * 512;
116 eda578e5 aliguori
    int count = nb_sectors * 512;
117 223d4670 ths
118 223d4670 ths
    memset(&ov, 0, sizeof(ov));
119 223d4670 ths
    ov.Offset = offset;
120 223d4670 ths
    ov.OffsetHigh = offset >> 32;
121 223d4670 ths
    ret = ReadFile(s->hfile, buf, count, &ret_count, &ov);
122 9c39be47 aliguori
    if (!ret)
123 9c39be47 aliguori
        return ret_count;
124 537a1d4b aliguori
    if (ret_count == count)
125 537a1d4b aliguori
        ret_count = 0;
126 223d4670 ths
    return ret_count;
127 223d4670 ths
}
128 223d4670 ths
129 eda578e5 aliguori
static int raw_write(BlockDriverState *bs, int64_t sector_num,
130 eda578e5 aliguori
                     const uint8_t *buf, int nb_sectors)
131 223d4670 ths
{
132 223d4670 ths
    BDRVRawState *s = bs->opaque;
133 223d4670 ths
    OVERLAPPED ov;
134 223d4670 ths
    DWORD ret_count;
135 223d4670 ths
    int ret;
136 eda578e5 aliguori
    int64_t offset = sector_num * 512;
137 eda578e5 aliguori
    int count = nb_sectors * 512;
138 223d4670 ths
139 223d4670 ths
    memset(&ov, 0, sizeof(ov));
140 223d4670 ths
    ov.Offset = offset;
141 223d4670 ths
    ov.OffsetHigh = offset >> 32;
142 223d4670 ths
    ret = WriteFile(s->hfile, buf, count, &ret_count, &ov);
143 9c39be47 aliguori
    if (!ret)
144 9c39be47 aliguori
        return ret_count;
145 537a1d4b aliguori
    if (ret_count == count)
146 537a1d4b aliguori
        ret_count = 0;
147 223d4670 ths
    return ret_count;
148 223d4670 ths
}
149 223d4670 ths
150 223d4670 ths
static void raw_flush(BlockDriverState *bs)
151 223d4670 ths
{
152 223d4670 ths
    BDRVRawState *s = bs->opaque;
153 223d4670 ths
    FlushFileBuffers(s->hfile);
154 223d4670 ths
}
155 223d4670 ths
156 223d4670 ths
static void raw_close(BlockDriverState *bs)
157 223d4670 ths
{
158 223d4670 ths
    BDRVRawState *s = bs->opaque;
159 223d4670 ths
    CloseHandle(s->hfile);
160 223d4670 ths
}
161 223d4670 ths
162 223d4670 ths
static int raw_truncate(BlockDriverState *bs, int64_t offset)
163 223d4670 ths
{
164 223d4670 ths
    BDRVRawState *s = bs->opaque;
165 b9e82a59 blueswir1
    LONG low, high;
166 223d4670 ths
167 223d4670 ths
    low = offset;
168 223d4670 ths
    high = offset >> 32;
169 223d4670 ths
    if (!SetFilePointer(s->hfile, low, &high, FILE_BEGIN))
170 223d4670 ths
        return -EIO;
171 223d4670 ths
    if (!SetEndOfFile(s->hfile))
172 223d4670 ths
        return -EIO;
173 223d4670 ths
    return 0;
174 223d4670 ths
}
175 223d4670 ths
176 223d4670 ths
static int64_t raw_getlength(BlockDriverState *bs)
177 223d4670 ths
{
178 223d4670 ths
    BDRVRawState *s = bs->opaque;
179 223d4670 ths
    LARGE_INTEGER l;
180 223d4670 ths
    ULARGE_INTEGER available, total, total_free;
181 223d4670 ths
    DISK_GEOMETRY_EX dg;
182 223d4670 ths
    DWORD count;
183 223d4670 ths
    BOOL status;
184 223d4670 ths
185 223d4670 ths
    switch(s->type) {
186 223d4670 ths
    case FTYPE_FILE:
187 b9e82a59 blueswir1
        l.LowPart = GetFileSize(s->hfile, (PDWORD)&l.HighPart);
188 223d4670 ths
        if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
189 223d4670 ths
            return -EIO;
190 223d4670 ths
        break;
191 223d4670 ths
    case FTYPE_CD:
192 223d4670 ths
        if (!GetDiskFreeSpaceEx(s->drive_path, &available, &total, &total_free))
193 223d4670 ths
            return -EIO;
194 223d4670 ths
        l.QuadPart = total.QuadPart;
195 223d4670 ths
        break;
196 223d4670 ths
    case FTYPE_HARDDISK:
197 223d4670 ths
        status = DeviceIoControl(s->hfile, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
198 223d4670 ths
                                 NULL, 0, &dg, sizeof(dg), &count, NULL);
199 223d4670 ths
        if (status != 0) {
200 223d4670 ths
            l = dg.DiskSize;
201 223d4670 ths
        }
202 223d4670 ths
        break;
203 223d4670 ths
    default:
204 223d4670 ths
        return -EIO;
205 223d4670 ths
    }
206 223d4670 ths
    return l.QuadPart;
207 223d4670 ths
}
208 223d4670 ths
209 0e7e1989 Kevin Wolf
static int raw_create(const char *filename, QEMUOptionParameter *options)
210 223d4670 ths
{
211 223d4670 ths
    int fd;
212 0e7e1989 Kevin Wolf
    int64_t total_size = 0;
213 223d4670 ths
214 0e7e1989 Kevin Wolf
    /* Read out options */
215 0e7e1989 Kevin Wolf
    while (options && options->name) {
216 0e7e1989 Kevin Wolf
        if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
217 0e7e1989 Kevin Wolf
            total_size = options->value.n / 512;
218 0e7e1989 Kevin Wolf
        }
219 0e7e1989 Kevin Wolf
        options++;
220 0e7e1989 Kevin Wolf
    }
221 223d4670 ths
222 223d4670 ths
    fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
223 223d4670 ths
              0644);
224 223d4670 ths
    if (fd < 0)
225 223d4670 ths
        return -EIO;
226 223d4670 ths
    set_sparse(fd);
227 223d4670 ths
    ftruncate(fd, total_size * 512);
228 223d4670 ths
    close(fd);
229 223d4670 ths
    return 0;
230 223d4670 ths
}
231 223d4670 ths
232 0e7e1989 Kevin Wolf
static QEMUOptionParameter raw_create_options[] = {
233 db08adf5 Kevin Wolf
    {
234 db08adf5 Kevin Wolf
        .name = BLOCK_OPT_SIZE,
235 db08adf5 Kevin Wolf
        .type = OPT_SIZE,
236 db08adf5 Kevin Wolf
        .help = "Virtual disk size"
237 db08adf5 Kevin Wolf
    },
238 0e7e1989 Kevin Wolf
    { NULL }
239 0e7e1989 Kevin Wolf
};
240 0e7e1989 Kevin Wolf
241 84a12e66 Christoph Hellwig
static BlockDriver bdrv_file = {
242 84a12e66 Christoph Hellwig
    .format_name        = "file",
243 84a12e66 Christoph Hellwig
    .protocol_name        = "file",
244 f1b2f712 aliguori
    .instance_size        = sizeof(BDRVRawState),
245 66f82cee Kevin Wolf
    .bdrv_file_open        = raw_open,
246 f1b2f712 aliguori
    .bdrv_close                = raw_close,
247 f1b2f712 aliguori
    .bdrv_create        = raw_create,
248 f1b2f712 aliguori
    .bdrv_flush                = raw_flush,
249 f1b2f712 aliguori
    .bdrv_read                = raw_read,
250 f1b2f712 aliguori
    .bdrv_write                = raw_write,
251 f1b2f712 aliguori
    .bdrv_truncate        = raw_truncate,
252 f1b2f712 aliguori
    .bdrv_getlength        = raw_getlength,
253 0e7e1989 Kevin Wolf
254 0e7e1989 Kevin Wolf
    .create_options = raw_create_options,
255 223d4670 ths
};
256 223d4670 ths
257 223d4670 ths
/***********************************************/
258 223d4670 ths
/* host device */
259 223d4670 ths
260 223d4670 ths
static int find_cdrom(char *cdrom_name, int cdrom_name_size)
261 223d4670 ths
{
262 223d4670 ths
    char drives[256], *pdrv = drives;
263 223d4670 ths
    UINT type;
264 223d4670 ths
265 223d4670 ths
    memset(drives, 0, sizeof(drives));
266 223d4670 ths
    GetLogicalDriveStrings(sizeof(drives), drives);
267 223d4670 ths
    while(pdrv[0] != '\0') {
268 223d4670 ths
        type = GetDriveType(pdrv);
269 223d4670 ths
        switch(type) {
270 223d4670 ths
        case DRIVE_CDROM:
271 223d4670 ths
            snprintf(cdrom_name, cdrom_name_size, "\\\\.\\%c:", pdrv[0]);
272 223d4670 ths
            return 0;
273 223d4670 ths
            break;
274 223d4670 ths
        }
275 223d4670 ths
        pdrv += lstrlen(pdrv) + 1;
276 223d4670 ths
    }
277 223d4670 ths
    return -1;
278 223d4670 ths
}
279 223d4670 ths
280 223d4670 ths
static int find_device_type(BlockDriverState *bs, const char *filename)
281 223d4670 ths
{
282 223d4670 ths
    BDRVRawState *s = bs->opaque;
283 223d4670 ths
    UINT type;
284 223d4670 ths
    const char *p;
285 223d4670 ths
286 223d4670 ths
    if (strstart(filename, "\\\\.\\", &p) ||
287 223d4670 ths
        strstart(filename, "//./", &p)) {
288 223d4670 ths
        if (stristart(p, "PhysicalDrive", NULL))
289 223d4670 ths
            return FTYPE_HARDDISK;
290 223d4670 ths
        snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", p[0]);
291 223d4670 ths
        type = GetDriveType(s->drive_path);
292 3060cd14 aliguori
        switch (type) {
293 3060cd14 aliguori
        case DRIVE_REMOVABLE:
294 3060cd14 aliguori
        case DRIVE_FIXED:
295 3060cd14 aliguori
            return FTYPE_HARDDISK;
296 3060cd14 aliguori
        case DRIVE_CDROM:
297 223d4670 ths
            return FTYPE_CD;
298 3060cd14 aliguori
        default:
299 223d4670 ths
            return FTYPE_FILE;
300 3060cd14 aliguori
        }
301 223d4670 ths
    } else {
302 223d4670 ths
        return FTYPE_FILE;
303 223d4670 ths
    }
304 223d4670 ths
}
305 223d4670 ths
306 508c7cb3 Christoph Hellwig
static int hdev_probe_device(const char *filename)
307 508c7cb3 Christoph Hellwig
{
308 508c7cb3 Christoph Hellwig
    if (strstart(filename, "/dev/cdrom", NULL))
309 508c7cb3 Christoph Hellwig
        return 100;
310 508c7cb3 Christoph Hellwig
    if (is_windows_drive(filename))
311 508c7cb3 Christoph Hellwig
        return 100;
312 508c7cb3 Christoph Hellwig
    return 0;
313 508c7cb3 Christoph Hellwig
}
314 508c7cb3 Christoph Hellwig
315 223d4670 ths
static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
316 223d4670 ths
{
317 223d4670 ths
    BDRVRawState *s = bs->opaque;
318 223d4670 ths
    int access_flags, create_flags;
319 223d4670 ths
    DWORD overlapped;
320 223d4670 ths
    char device_name[64];
321 223d4670 ths
322 223d4670 ths
    if (strstart(filename, "/dev/cdrom", NULL)) {
323 223d4670 ths
        if (find_cdrom(device_name, sizeof(device_name)) < 0)
324 223d4670 ths
            return -ENOENT;
325 223d4670 ths
        filename = device_name;
326 223d4670 ths
    } else {
327 223d4670 ths
        /* transform drive letters into device name */
328 223d4670 ths
        if (((filename[0] >= 'a' && filename[0] <= 'z') ||
329 223d4670 ths
             (filename[0] >= 'A' && filename[0] <= 'Z')) &&
330 223d4670 ths
            filename[1] == ':' && filename[2] == '\0') {
331 223d4670 ths
            snprintf(device_name, sizeof(device_name), "\\\\.\\%c:", filename[0]);
332 223d4670 ths
            filename = device_name;
333 223d4670 ths
        }
334 223d4670 ths
    }
335 223d4670 ths
    s->type = find_device_type(bs, filename);
336 223d4670 ths
337 f5edb014 Naphtali Sprei
    if (flags & BDRV_O_RDWR) {
338 223d4670 ths
        access_flags = GENERIC_READ | GENERIC_WRITE;
339 223d4670 ths
    } else {
340 223d4670 ths
        access_flags = GENERIC_READ;
341 223d4670 ths
    }
342 223d4670 ths
    create_flags = OPEN_EXISTING;
343 223d4670 ths
344 03ff3ca3 aliguori
    overlapped = FILE_ATTRIBUTE_NORMAL;
345 9f7965c7 aliguori
    if ((flags & BDRV_O_NOCACHE))
346 33f00271 balrog
        overlapped |= FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH;
347 9f7965c7 aliguori
    else if (!(flags & BDRV_O_CACHE_WB))
348 9f7965c7 aliguori
        overlapped |= FILE_FLAG_WRITE_THROUGH;
349 223d4670 ths
    s->hfile = CreateFile(filename, access_flags,
350 223d4670 ths
                          FILE_SHARE_READ, NULL,
351 223d4670 ths
                          create_flags, overlapped, NULL);
352 223d4670 ths
    if (s->hfile == INVALID_HANDLE_VALUE) {
353 223d4670 ths
        int err = GetLastError();
354 223d4670 ths
355 223d4670 ths
        if (err == ERROR_ACCESS_DENIED)
356 223d4670 ths
            return -EACCES;
357 223d4670 ths
        return -1;
358 223d4670 ths
    }
359 223d4670 ths
    return 0;
360 223d4670 ths
}
361 223d4670 ths
362 223d4670 ths
#if 0
363 223d4670 ths
/***********************************************/
364 223d4670 ths
/* removable device additional commands */
365 223d4670 ths

366 223d4670 ths
static int raw_is_inserted(BlockDriverState *bs)
367 223d4670 ths
{
368 223d4670 ths
    return 1;
369 223d4670 ths
}
370 223d4670 ths

371 223d4670 ths
static int raw_media_changed(BlockDriverState *bs)
372 223d4670 ths
{
373 223d4670 ths
    return -ENOTSUP;
374 223d4670 ths
}
375 223d4670 ths

376 223d4670 ths
static int raw_eject(BlockDriverState *bs, int eject_flag)
377 223d4670 ths
{
378 223d4670 ths
    DWORD ret_count;
379 223d4670 ths

380 223d4670 ths
    if (s->type == FTYPE_FILE)
381 223d4670 ths
        return -ENOTSUP;
382 223d4670 ths
    if (eject_flag) {
383 223d4670 ths
        DeviceIoControl(s->hfile, IOCTL_STORAGE_EJECT_MEDIA,
384 223d4670 ths
                        NULL, 0, NULL, 0, &lpBytesReturned, NULL);
385 223d4670 ths
    } else {
386 223d4670 ths
        DeviceIoControl(s->hfile, IOCTL_STORAGE_LOAD_MEDIA,
387 223d4670 ths
                        NULL, 0, NULL, 0, &lpBytesReturned, NULL);
388 223d4670 ths
    }
389 223d4670 ths
}
390 223d4670 ths

391 223d4670 ths
static int raw_set_locked(BlockDriverState *bs, int locked)
392 223d4670 ths
{
393 223d4670 ths
    return -ENOTSUP;
394 223d4670 ths
}
395 223d4670 ths
#endif
396 223d4670 ths
397 5efa9d5a Anthony Liguori
static BlockDriver bdrv_host_device = {
398 e60f469c aurel32
    .format_name        = "host_device",
399 84a12e66 Christoph Hellwig
    .protocol_name        = "host_device",
400 e60f469c aurel32
    .instance_size        = sizeof(BDRVRawState),
401 508c7cb3 Christoph Hellwig
    .bdrv_probe_device        = hdev_probe_device,
402 66f82cee Kevin Wolf
    .bdrv_file_open        = hdev_open,
403 e60f469c aurel32
    .bdrv_close                = raw_close,
404 e60f469c aurel32
    .bdrv_flush                = raw_flush,
405 223d4670 ths
406 eda578e5 aliguori
    .bdrv_read                = raw_read,
407 eda578e5 aliguori
    .bdrv_write                = raw_write,
408 e60f469c aurel32
    .bdrv_getlength        = raw_getlength,
409 223d4670 ths
};
410 5efa9d5a Anthony Liguori
411 84a12e66 Christoph Hellwig
static void bdrv_file_init(void)
412 5efa9d5a Anthony Liguori
{
413 84a12e66 Christoph Hellwig
    bdrv_register(&bdrv_file);
414 5efa9d5a Anthony Liguori
    bdrv_register(&bdrv_host_device);
415 5efa9d5a Anthony Liguori
}
416 5efa9d5a Anthony Liguori
417 84a12e66 Christoph Hellwig
block_init(bdrv_file_init);