diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2010-02-21 23:20:10 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2010-02-21 23:20:10 -0500 |
commit | 575ffc8fd1127e3cb8fbb7f587cadfa85eb9b73d (patch) | |
tree | 718b84dbf1550276c1d3eb50e487dd160a64d6d9 /src/floppy.c | |
parent | 0360e8e69bb3a773ceb9d2b091b62c027bca862b (diff) | |
download | seabios-575ffc8fd1127e3cb8fbb7f587cadfa85eb9b73d.tar.gz |
Cleanup - build drive description in temp memory during init.
Remove describe_drive() mechanism for calling printf with a drive
description. Instead, have each drive build a description in
temporary ram during drive initialization.
Also, remove fields now unneeded from 'struct disk_s' - model and
cntl_info.
Diffstat (limited to 'src/floppy.c')
-rw-r--r-- | src/floppy.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/floppy.c b/src/floppy.c index d2e689c1..a8942cf0 100644 --- a/src/floppy.c +++ b/src/floppy.c @@ -96,9 +96,12 @@ addFloppy(int floppyid, int ftype, int driver) return NULL; } + char *desc = malloc_tmp(MAXDESCSIZE); struct drive_s *drive_g = malloc_fseg(sizeof(*drive_g)); - if (!drive_g) { + if (!drive_g || !desc) { warn_noalloc(); + free(desc); + free(drive_g); return NULL; } memset(drive_g, 0, sizeof(*drive_g)); @@ -107,6 +110,8 @@ addFloppy(int floppyid, int ftype, int driver) drive_g->blksize = DISK_SECTOR_SIZE; drive_g->floppy_type = ftype; drive_g->sectors = (u64)-1; + drive_g->desc = desc; + snprintf(desc, MAXDESCSIZE, "drive %c", 'A' + floppyid); memcpy(&drive_g->lchs, &FloppyInfo[ftype].chs , sizeof(FloppyInfo[ftype].chs)); @@ -116,12 +121,6 @@ addFloppy(int floppyid, int ftype, int driver) } void -describe_floppy(struct drive_s *drive_g) -{ - printf("drive %c", 'A' + drive_g->cntl_id); -} - -void floppy_setup(void) { if (! CONFIG_FLOPPY) |