From: Ben Gras Date: Mon, 8 Aug 2005 12:16:59 +0000 (+0000) Subject: Minor partition() efficiency improvements (don't do regular partitioning X-Git-Tag: v3.1.0~406 X-Git-Url: http://zhaoyanbai.com/repos/doc/html/static/gitweb.css?a=commitdiff_plain;h=f26239d1f825b2b4bae669eebc3780d8501ec28d;p=minix.git Minor partition() efficiency improvements (don't do regular partitioning i/o on cd drives) --- diff --git a/drivers/at_wini/at_wini.c b/drivers/at_wini/at_wini.c index 797c6e74d..0de6f7c39 100644 --- a/drivers/at_wini/at_wini.c +++ b/drivers/at_wini/at_wini.c @@ -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); diff --git a/drivers/bios_wini/bios_wini.c b/drivers/bios_wini/bios_wini.c index 87bd69192..eb3da2e31 100644 --- a/drivers/bios_wini/bios_wini.c +++ b/drivers/bios_wini/bios_wini.c @@ -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); } diff --git a/drivers/floppy/floppy.c b/drivers/floppy/floppy.c index 6745258f7..d57fdd08f 100644 --- a/drivers/floppy/floppy.c +++ b/drivers/floppy/floppy.c @@ -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); } diff --git a/drivers/libdriver/drvlib.c b/drivers/libdriver/drvlib.c index f87396c8e..4b98e136f 100644 --- a/drivers/libdriver/drvlib.c +++ b/drivers/libdriver/drvlib.c @@ -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)) diff --git a/drivers/libdriver/drvlib.h b/drivers/libdriver/drvlib.h index cd234a975..1986cab05 100644 --- a/drivers/libdriver/drvlib.h +++ b/drivers/libdriver/drvlib.h @@ -4,7 +4,7 @@ #include -_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]))