root / hw / device-hotplug.c @ 3e21ffc9
History | View | Annotate | Download (1.6 kB)
1 | 6f338c34 | aliguori | /*
|
---|---|---|---|
2 | 6f338c34 | aliguori | * QEMU device hotplug helpers
|
3 | 6f338c34 | aliguori | *
|
4 | 6f338c34 | aliguori | * Copyright (c) 2004 Fabrice Bellard
|
5 | 6f338c34 | aliguori | *
|
6 | 6f338c34 | aliguori | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | 6f338c34 | aliguori | * of this software and associated documentation files (the "Software"), to deal
|
8 | 6f338c34 | aliguori | * in the Software without restriction, including without limitation the rights
|
9 | 6f338c34 | aliguori | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | 6f338c34 | aliguori | * copies of the Software, and to permit persons to whom the Software is
|
11 | 6f338c34 | aliguori | * furnished to do so, subject to the following conditions:
|
12 | 6f338c34 | aliguori | *
|
13 | 6f338c34 | aliguori | * The above copyright notice and this permission notice shall be included in
|
14 | 6f338c34 | aliguori | * all copies or substantial portions of the Software.
|
15 | 6f338c34 | aliguori | *
|
16 | 6f338c34 | aliguori | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | 6f338c34 | aliguori | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | 6f338c34 | aliguori | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | 6f338c34 | aliguori | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | 6f338c34 | aliguori | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 6f338c34 | aliguori | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 6f338c34 | aliguori | * THE SOFTWARE.
|
23 | 6f338c34 | aliguori | */
|
24 | 6f338c34 | aliguori | |
25 | 6f338c34 | aliguori | #include "hw.h" |
26 | 6f338c34 | aliguori | #include "boards.h" |
27 | 6f338c34 | aliguori | #include "net.h" |
28 | 6f338c34 | aliguori | #include "block_int.h" |
29 | 6f338c34 | aliguori | #include "sysemu.h" |
30 | 6f338c34 | aliguori | |
31 | 9dfd7c7a | Gerd Hoffmann | DriveInfo *add_init_drive(const char *optstr) |
32 | 6f338c34 | aliguori | { |
33 | 751c6a17 | Gerd Hoffmann | int fatal_error;
|
34 | 751c6a17 | Gerd Hoffmann | DriveInfo *dinfo; |
35 | 9dfd7c7a | Gerd Hoffmann | QemuOpts *opts; |
36 | 6f338c34 | aliguori | |
37 | 9dfd7c7a | Gerd Hoffmann | opts = drive_add(NULL, "%s", optstr); |
38 | 9dfd7c7a | Gerd Hoffmann | if (!opts)
|
39 | 751c6a17 | Gerd Hoffmann | return NULL; |
40 | 6f338c34 | aliguori | |
41 | 9dfd7c7a | Gerd Hoffmann | dinfo = drive_init(opts, current_machine, &fatal_error); |
42 | 751c6a17 | Gerd Hoffmann | if (!dinfo) {
|
43 | 9dfd7c7a | Gerd Hoffmann | qemu_opts_del(opts); |
44 | 751c6a17 | Gerd Hoffmann | return NULL; |
45 | 6f338c34 | aliguori | } |
46 | 6f338c34 | aliguori | |
47 | 751c6a17 | Gerd Hoffmann | return dinfo;
|
48 | 6f338c34 | aliguori | } |