/*
 * Print information about disks
 */
static void
bd_print(int verbose)
{
    int				i, j;
    char			line[80];
    struct i386_devdesc		dev;
    struct open_disk		*od;
    struct pc98_partition	*dptr;
    
    for (i = 0; i < nbdinfo; i++) {
	sprintf(line, "    disk%d:   BIOS drive %c:\n", i, 'A' + i);
	pager_output(line);

	/* try to open the whole disk */
	dev.d_unit = i;
	dev.d_kind.biosdisk.slice = -1;
	dev.d_kind.biosdisk.partition = -1;
	
	if (!bd_opendisk(&od, &dev)) {

	    /* Do we have a partition table? */
	    if (od->od_flags & BD_PARTTABOK) {
		dptr = &od->od_slicetab[0];

		/* Check for a "dedicated" disk */
		for (j = 0; j < od->od_nslices; j++) {
		    sprintf(line, "      disk%ds%d", i, j + 1);
		    bd_printslice(od, &dptr[j], line, verbose);
		}
	    }
	    bd_closedisk(od);
	}
    }
}
static int 
bd_close(struct open_file *f)
{
    struct open_disk	*od = (struct open_disk *)(((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data);

    bd_closedisk(od);
    return(0);
}
Beispiel #3
0
static int 
bd_close(struct open_file *f)
{
    struct i386_devdesc		*dev = f->f_devdata;
    struct open_disk	*od = (struct open_disk *)(dev->d_kind.biosdisk.data);

    BD(dev).bd_open--;
    if (BD(dev).bd_open == 0) {
	bcache_free(BD(dev).bd_bcache);
	BD(dev).bd_bcache = NULL;
    }

    bd_closedisk(od);
    return(0);
}
Beispiel #4
0
/*
 * Print information about disks
 */
static int
bd_print(int verbose)
{
    int				i, j, ret = 0;
    char			line[80];
    struct i386_devdesc		dev;
    struct open_disk		*od;
    struct pc98_partition	*dptr;
    
    if (nbdinfo == 0)
	return (0);

    printf("%s devices:", biosdisk.dv_name);
    if ((ret = pager_output("\n")) != 0)
	return (ret);

    for (i = 0; i < nbdinfo; i++) {
	snprintf(line, sizeof(line), "    disk%d:   BIOS drive %c:\n",
	    i, 'A' + i);
	if ((ret = pager_output(line)) != 0)
	    break;

	/* try to open the whole disk */
	dev.d_unit = i;
	dev.d_kind.biosdisk.slice = -1;
	dev.d_kind.biosdisk.partition = -1;
	
	if (!bd_opendisk(&od, &dev)) {

	    /* Do we have a partition table? */
	    if (od->od_flags & BD_PARTTABOK) {
		dptr = &od->od_slicetab[0];

		/* Check for a "dedicated" disk */
		for (j = 0; j < od->od_nslices; j++) {
		    snprintf(line, sizeof(line), "      disk%ds%d", i, j + 1);
		    if ((ret = bd_printslice(od, &dptr[j], line, verbose)) != 0)
			break;
		}
	    }
	    bd_closedisk(od);
	    if (ret != 0)
		break;
	}
    }
    return (ret);
}
Beispiel #5
0
/*
 * Print information about disks
 */
static void
bd_print(int verbose)
{
    int				i, j;
    char			line[80];
    struct i386_devdesc		dev;
    struct open_disk		*od;
    struct dos_partition	*dptr;
    
    for (i = 0; i < nbdinfo; i++) {
	sprintf(line, "    disk%d:   BIOS drive %c:\n", i, 
		(bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit) : ('C' + bdinfo[i].bd_unit - 0x80));
	pager_output(line);

	/* try to open the whole disk */
	dev.d_kind.biosdisk.unit = i;
	dev.d_kind.biosdisk.slice = -1;
	dev.d_kind.biosdisk.partition = -1;
	
	if (!bd_opendisk(&od, &dev)) {

	    /* Do we have a partition table? */
	    if (od->od_flags & BD_PARTTABOK) {
		dptr = &od->od_parttab[0];

		/* Check for a "truly dedicated" disk */
		if ((dptr[3].dp_typ == DOSPTYP_386BSD) &&
		    (dptr[3].dp_start == 0) &&
		    (dptr[3].dp_size == 50000)) {
		    sprintf(line, "      disk%d", i);
		    bd_printslice(od, 0, line);
		} else {
		    for (j = 0; j < NDOSPART; j++) {
			switch(dptr[j].dp_typ) {
			case DOSPTYP_386BSD:
			    sprintf(line, "      disk%ds%d", i, j + 1);
			    bd_printslice(od, dptr[j].dp_start, line);
			    break;
			default:
			}
		    }
		    
		}
	    }
	    bd_closedisk(od);
	}
    }