mirror of
https://github.com/open-simh/simh.git
synced 2026-05-04 23:25:46 +00:00
PDP11/VAX: Use semi-unique drive serial numbers when writing BAD144 bad block info to newly created disk images
The 32 bit drive serial number is determined by hashing the newly create filename.
This commit is contained in:
16
sim_disk.c
16
sim_disk.c
@@ -74,6 +74,7 @@ Internal routines:
|
||||
|
||||
#include "sim_defs.h"
|
||||
#include "sim_disk.h"
|
||||
#include "sim_ether.h"
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -1404,7 +1405,8 @@ t_addr da;
|
||||
int32 wds = ctx->sector_size/sizeof (uint16);
|
||||
uint16 *buf;
|
||||
DEVICE *dptr;
|
||||
uint32 packid = (uint32)time(NULL);
|
||||
char *namebuf, *c;
|
||||
uint32 packid;
|
||||
|
||||
if ((sec < 2) || (wds < 16))
|
||||
return SCPE_ARG;
|
||||
@@ -1420,6 +1422,18 @@ if (!get_yn ("Overwrite last track? [N]", FALSE))
|
||||
return SCPE_OK;
|
||||
if ((buf = (uint16 *) malloc (wds * sizeof (uint16))) == NULL)
|
||||
return SCPE_MEM;
|
||||
if ((namebuf = (char *) malloc (1 + strlen (uptr->filename))) == NULL) {
|
||||
free (buf);
|
||||
return SCPE_MEM;
|
||||
}
|
||||
strcpy (namebuf, uptr->filename);
|
||||
if ((c = strrchr (namebuf, '/')))
|
||||
strcpy (namebuf, c+1);
|
||||
if ((c = strrchr (namebuf, '\\')))
|
||||
strcpy (namebuf, c+1);
|
||||
if ((c = strrchr (namebuf, ']')))
|
||||
strcpy (namebuf, c+1);
|
||||
packid = eth_crc32(0, namebuf, strlen (namebuf));
|
||||
buf[0] = (uint16)packid;
|
||||
buf[1] = (uint16)(packid >> 16);
|
||||
buf[2] = buf[3] = 0;
|
||||
|
||||
Reference in New Issue
Block a user