Revision 577d0a38
b/blockdev.c | ||
---|---|---|
536 | 536 |
dinfo->trans = translation; |
537 | 537 |
dinfo->opts = opts; |
538 | 538 |
dinfo->refcount = 1; |
539 |
if (serial) { |
|
540 |
pstrcpy(dinfo->serial, sizeof(dinfo->serial), serial); |
|
541 |
} |
|
539 |
dinfo->serial = serial; |
|
542 | 540 |
QTAILQ_INSERT_TAIL(&drives, dinfo, next); |
543 | 541 |
|
544 | 542 |
bdrv_set_on_error(dinfo->bdrv, on_read_error, on_write_error); |
b/blockdev.h | ||
---|---|---|
17 | 17 |
void blockdev_mark_auto_del(BlockDriverState *bs); |
18 | 18 |
void blockdev_auto_del(BlockDriverState *bs); |
19 | 19 |
|
20 |
#define BLOCK_SERIAL_STRLEN 20 |
|
21 |
|
|
22 | 20 |
typedef enum { |
23 | 21 |
IF_DEFAULT = -1, /* for use with drive_add() only */ |
24 | 22 |
IF_NONE, |
... | ... | |
37 | 35 |
int media_cd; |
38 | 36 |
int cyls, heads, secs, trans; |
39 | 37 |
QemuOpts *opts; |
40 |
char serial[BLOCK_SERIAL_STRLEN + 1];
|
|
38 |
const char *serial;
|
|
41 | 39 |
QTAILQ_ENTRY(DriveInfo) next; |
42 | 40 |
int refcount; |
43 | 41 |
}; |
b/hw/block-common.c | ||
---|---|---|
17 | 17 |
if (!*serial) { |
18 | 18 |
/* try to fall back to value set with legacy -drive serial=... */ |
19 | 19 |
dinfo = drive_get_by_blockdev(conf->bs); |
20 |
if (*dinfo->serial) {
|
|
20 |
if (dinfo->serial) { |
|
21 | 21 |
*serial = g_strdup(dinfo->serial); |
22 | 22 |
} |
23 | 23 |
} |
b/hw/ide/core.c | ||
---|---|---|
2095 | 2095 |
trans = hd_bios_chs_auto_trans(cyls, heads, secs); |
2096 | 2096 |
} |
2097 | 2097 |
if (ide_init_drive(&bus->ifs[i], dinfo->bdrv, |
2098 |
dinfo->media_cd ? IDE_CD : IDE_HD, NULL,
|
|
2099 |
*dinfo->serial ? dinfo->serial : NULL,
|
|
2100 |
NULL, 0, cyls, heads, secs, trans) < 0) {
|
|
2098 |
dinfo->media_cd ? IDE_CD : IDE_HD, |
|
2099 |
NULL, dinfo->serial, NULL, 0,
|
|
2100 |
cyls, heads, secs, trans) < 0) { |
|
2101 | 2101 |
error_report("Can't set up IDE drive %s", dinfo->id); |
2102 | 2102 |
exit(1); |
2103 | 2103 |
} |
Also available in: Unified diff