/*
 * 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);
	}
    }
}
Exemple #2
0
/*
 * Attempt to open the disk described by (dev) for use by (f).
 *
 * Note that the philosophy here is "give them exactly what
 * they ask for".  This is necessary because being too "smart"
 * about what the user might want leads to complications.
 * (eg. given no slice or partition value, with a disk that is
 *  sliced - are they after the first BSD slice, or the DOS
 *  slice before it?)
 */
static int 
bd_open(struct open_file *f, ...)
{
    va_list			ap;
    struct i386_devdesc		*dev;
    struct open_disk		*od;
    int				error;

    va_start(ap, f);
    dev = va_arg(ap, struct i386_devdesc *);
    va_end(ap);
    if ((error = bd_opendisk(&od, dev)))
	return(error);
    
    BD(dev).bd_open++;
    if (BD(dev).bd_bcache == NULL)
	BD(dev).bd_bcache = bcache_allocate();

    /*
     * Save our context
     */
    ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od;
    DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff);
    return(0);
}
Exemple #3
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);
}
Exemple #4
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);
	}
    }