Minor partition() efficiency improvements (don't do regular partitioning
i/o on cd drives)
This commit is contained in:
		
							parent
							
								
									9df1cb9e48
								
							
						
					
					
						commit
						f26239d1f8
					
				@ -337,7 +337,9 @@ message *m_ptr;
 | 
			
		||||
  if (!(wn->state & IDENTIFIED) || (wn->state & DEAF)) {
 | 
			
		||||
	/* Try to identify the device. */
 | 
			
		||||
	if (w_identify() != OK) {
 | 
			
		||||
#if VERBOSE
 | 
			
		||||
  		printf("%s: probe failed\n", w_name());
 | 
			
		||||
#endif
 | 
			
		||||
		if (wn->state & DEAF) w_reset();
 | 
			
		||||
		wn->state = IGNORING;
 | 
			
		||||
		return(ENXIO);
 | 
			
		||||
@ -378,7 +380,7 @@ message *m_ptr;
 | 
			
		||||
	if (!(wn->state & ATAPI) && (m_ptr->COUNT & RO_BIT)) return EACCES;
 | 
			
		||||
 | 
			
		||||
	/* Partition the disk. */
 | 
			
		||||
	partition(&w_dtab, w_drive * DEV_PER_DRIVE, P_PRIMARY);
 | 
			
		||||
	partition(&w_dtab, w_drive * DEV_PER_DRIVE, P_PRIMARY, wn->state & ATAPI);
 | 
			
		||||
	wn->open_ct++;
 | 
			
		||||
  }
 | 
			
		||||
  return(OK);
 | 
			
		||||
 | 
			
		||||
@ -317,7 +317,7 @@ message *m_ptr;
 | 
			
		||||
 | 
			
		||||
  if (w_wn->open_ct++ == 0) {
 | 
			
		||||
	/* Partition the disk. */
 | 
			
		||||
	partition(&w_dtab, w_drive * DEV_PER_DRIVE, P_PRIMARY);
 | 
			
		||||
	partition(&w_dtab, w_drive * DEV_PER_DRIVE, P_PRIMARY, 0);
 | 
			
		||||
  }
 | 
			
		||||
  return(OK);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1277,7 +1277,7 @@ int density;
 | 
			
		||||
 | 
			
		||||
  if (iovec1.iov_size != 0) return(EIO);
 | 
			
		||||
 | 
			
		||||
  partition(&f_dtab, f_drive, P_FLOPPY);
 | 
			
		||||
  partition(&f_dtab, f_drive, P_FLOPPY, 0);
 | 
			
		||||
  return(OK);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -24,10 +24,11 @@ FORWARD _PROTOTYPE( void sort, (struct part_entry *table) );
 | 
			
		||||
/*============================================================================*
 | 
			
		||||
 *				partition				      *
 | 
			
		||||
 *============================================================================*/
 | 
			
		||||
PUBLIC void partition(dp, device, style)
 | 
			
		||||
PUBLIC void partition(dp, device, style, atapi)
 | 
			
		||||
struct driver *dp;	/* device dependent entry points */
 | 
			
		||||
int device;		/* device to partition */
 | 
			
		||||
int style;		/* partitioning style: floppy, primary, sub. */
 | 
			
		||||
int atapi;		/* atapi device */
 | 
			
		||||
{
 | 
			
		||||
/* This routine is called on first open to initialize the partition tables
 | 
			
		||||
 * of a device.  It makes sure that each partition falls safely within the
 | 
			
		||||
@ -48,9 +49,12 @@ int style;		/* partitioning style: floppy, primary, sub. */
 | 
			
		||||
  limit = base + div64u(dv->dv_size, SECTOR_SIZE);
 | 
			
		||||
 | 
			
		||||
  /* Read the partition table for the device. */
 | 
			
		||||
  if (!get_part_table(dp, device, 0L, table, &io))
 | 
			
		||||
	  if(!io || !get_iso_fake_part_table(dp, device, 0L, table))
 | 
			
		||||
	  	return;
 | 
			
		||||
  if(atapi) {
 | 
			
		||||
  	if(!get_iso_fake_part_table(dp, device, 0L, table))
 | 
			
		||||
  		return;
 | 
			
		||||
  } else if(!get_part_table(dp, device, 0L, table, &io)) {
 | 
			
		||||
	  return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* Compute the device number of the first partition. */
 | 
			
		||||
  switch (style) {
 | 
			
		||||
@ -86,7 +90,7 @@ int style;		/* partitioning style: floppy, primary, sub. */
 | 
			
		||||
	if (style == P_PRIMARY) {
 | 
			
		||||
		/* Each Minix primary partition can be subpartitioned. */
 | 
			
		||||
		if (pe->sysind == MINIX_PART)
 | 
			
		||||
			partition(dp, device + par, P_SUB);
 | 
			
		||||
			partition(dp, device + par, P_SUB, atapi);
 | 
			
		||||
 | 
			
		||||
		/* An extended partition has logical partitions. */
 | 
			
		||||
		if (ext_part(pe->sysind))
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
#include <ibm/partition.h>
 | 
			
		||||
 | 
			
		||||
_PROTOTYPE( void partition, (struct driver *dr, int device, int style) );
 | 
			
		||||
_PROTOTYPE( void partition, (struct driver *dr, int device, int style, int atapi) );
 | 
			
		||||
 | 
			
		||||
/* BIOS parameter table layout. */
 | 
			
		||||
#define bp_cylinders(t)		(* (u16_t *) (&(t)[0]))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user