--- trunk/src/diskimage.c 2007/10/08 16:18:38 12 +++ trunk/src/diskimage.c 2007/10/08 16:18:51 14 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: diskimage.c,v 1.95 2005/08/10 22:25:50 debug Exp $ + * $Id: diskimage.c,v 1.98 2005/09/27 23:55:43 debug Exp $ * * Disk image support. * @@ -478,6 +478,7 @@ int diskimage_scsicommand(struct cpu *cpu, int id, int type, struct scsi_transfer *xferp) { + char namebuf[16]; int retlen, i; uint64_t size; int64_t ofs; @@ -588,10 +589,22 @@ xferp->data_in[6] = 0x04; /* ACKREQQ */ xferp->data_in[7] = 0x60; /* WBus32, WBus16 */ - /* These must be padded with spaces: */ - memcpy(xferp->data_in+8, "FAKE ", 8); - memcpy(xferp->data_in+16, "DISK ", 16); - memcpy(xferp->data_in+32, "V0.0", 4); + /* These are padded with spaces: */ + + memcpy(xferp->data_in+8, "EMULATED", 8); + if (diskimage_getname(cpu->machine, id, + type, namebuf, sizeof(namebuf))) { + int i; + for (i=0; idata_in+16, namebuf, 16); + } else + memcpy(xferp->data_in+16, "DISK ", 16); + memcpy(xferp->data_in+32, "0000", 4); /* * Some Ultrix kernels want specific responses from @@ -1477,6 +1490,8 @@ machine->machine_type == MACHINE_COBALT || machine->machine_type == MACHINE_EVBMIPS || machine->machine_type == MACHINE_HPCMIPS || + machine->machine_type == MACHINE_CATS || + machine->machine_type == MACHINE_NETWINDER || machine->machine_type == MACHINE_PS2) d->type = DISKIMAGE_IDE; @@ -1505,14 +1520,15 @@ * Is this a tape, CD-ROM or a normal disk? * * An intelligent guess, if no prefixes are used, would be that - * filenames ending with .iso are CD-ROM images. + * filenames ending with .iso or .cdr are CD-ROM images. */ if (prefix_t) { d->is_a_tape = 1; } else { if (prefix_c || ((strlen(d->fname) > 4 && - strcasecmp(d->fname + strlen(d->fname) - 4, ".iso") == 0) + (strcasecmp(d->fname + strlen(d->fname) - 4, ".cdr") == 0 || + strcasecmp(d->fname + strlen(d->fname) - 4, ".iso") == 0)) && !prefix_d) ) { d->is_a_cdrom = 1; @@ -1669,6 +1685,35 @@ } +/* + * diskimage_getname(): + * + * Returns 1 if a valid disk image name was returned, 0 otherwise. + */ +int diskimage_getname(struct machine *machine, int id, int type, + char *buf, size_t bufsize) +{ + struct diskimage *d = machine->first_diskimage; + + if (buf == NULL) + return 0; + + while (d != NULL) { + if (d->type == type && d->id == id) { + char *p = strrchr(d->fname, '/'); + if (p == NULL) + p = d->fname; + else + p ++; + snprintf(buf, bufsize, "%s", p); + return 1; + } + d = d->next; + } + return 0; +} + + /* * diskimage_is_a_cdrom(): *