[PC-BSD Commits] r17308 - pcbsd/current/build-files/src-patches
svn at pcbsd.org
svn at pcbsd.org
Tue Jun 19 07:42:44 PDT 2012
Author: kris
Date: 2012-06-19 14:42:43 +0000 (Tue, 19 Jun 2012)
New Revision: 17308
Modified:
pcbsd/current/build-files/src-patches/patch-mediachange
Log:
Update mediachange patch from mav
Modified: pcbsd/current/build-files/src-patches/patch-mediachange
===================================================================
--- pcbsd/current/build-files/src-patches/patch-mediachange 2012-06-19 12:54:56 UTC (rev 17307)
+++ pcbsd/current/build-files/src-patches/patch-mediachange 2012-06-19 14:42:43 UTC (rev 17308)
@@ -1,47 +1,8 @@
-diff -ruN sys/cam/ata/ata_all.h sys/cam/ata/ata_all.h
---- sys/cam/ata/ata_all.h 2011-09-26 12:38:08.103290847 -0700
-+++ sys/cam/ata/ata_all.h 2012-06-09 06:16:30.000000000 -0700
-@@ -35,6 +35,7 @@
- struct cam_periph;
- union ccb;
-
-+#define SID_AEN 0x04 /* Abuse inq_flags bit to track enabled AEN. */
- #define SID_DMA 0x10 /* Abuse inq_flags bit to track enabled DMA. */
-
- struct ata_cmd {
-diff -ruN sys/cam/ata/ata_xpt.c sys/cam/ata/ata_xpt.c
---- sys/cam/ata/ata_xpt.c 2012-02-10 07:24:13.567066565 -0800
-+++ sys/cam/ata/ata_xpt.c 2012-06-09 06:16:30.000000000 -0700
-@@ -457,6 +457,12 @@
- 0, 0x02);
- break;
- case PROBE_SETAN:
-+ /* Remember what transport thinks about AEN. */
-+ if (softc->caps & CTS_SATA_CAPS_H_AN)
-+ path->device->inq_flags |= SID_AEN;
-+ else
-+ path->device->inq_flags &= ~SID_AEN;
-+ xpt_async(AC_GETDEV_CHANGED, path, NULL);
- cam_fill_ataio(ataio,
- 1,
- probedone,
-@@ -1187,6 +1193,12 @@
- cts.xport_specific.sata.valid = CTS_SATA_VALID_CAPS;
- xpt_action((union ccb *)&cts);
- softc->caps = caps;
-+ /* Remember what transport thinks about AEN. */
-+ if (softc->caps & CTS_SATA_CAPS_H_AN)
-+ path->device->inq_flags |= SID_AEN;
-+ else
-+ path->device->inq_flags &= ~SID_AEN;
-+ xpt_async(AC_GETDEV_CHANGED, path, NULL);
- if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) {
- path->device->flags &= ~CAM_DEV_UNCONFIGURED;
- xpt_acquire_device(path->device);
-diff -ruN cam/scsi/scsi_cd.c cam/scsi/scsi_cd.c
---- sys/cam/scsi/scsi_cd.c 2012-02-10 07:24:13.405476713 -0800
-+++ sys/cam/scsi/scsi_cd.c 2012-06-09 06:23:13.000000000 -0700
-@@ -112,6 +112,7 @@
+Index: sys/cam/scsi/scsi_cd.c
+===================================================================
+--- sys/cam/scsi/scsi_cd.c (revision 236842)
++++ sys/cam/scsi/scsi_cd.c (working copy)
+@@ -112,6 +112,7 @@ typedef enum {
CD_CCB_PROBE = 0x01,
CD_CCB_BUFFER_IO = 0x02,
CD_CCB_WAITING = 0x03,
@@ -49,7 +10,7 @@
CD_CCB_TYPE_MASK = 0x0F,
CD_CCB_RETRY_UA = 0x10
} cd_ccb_state;
-@@ -156,12 +157,14 @@
+@@ -156,12 +157,14 @@ struct cd_softc {
struct cam_periph *periph;
int minimum_command_size;
int outstanding_cmds;
@@ -64,7 +25,7 @@
};
struct cd_page_sizes {
-@@ -283,6 +286,7 @@
+@@ -283,6 +286,7 @@ static int cdsendkey(struct cam_periph *periph,
struct dvd_authinfo *authinfo);
static int cdreaddvdstructure(struct cam_periph *periph,
struct dvd_struct *dvdstruct);
@@ -72,7 +33,7 @@
static struct periph_driver cddriver =
{
-@@ -292,6 +296,9 @@
+@@ -292,6 +296,9 @@ static struct periph_driver cddriver =
PERIPHDRIVER_DECLARE(cd, cddriver);
@@ -82,7 +43,7 @@
#ifndef CD_DEFAULT_RETRY
#define CD_DEFAULT_RETRY 4
#endif
-@@ -302,11 +309,15 @@
+@@ -302,15 +309,21 @@ PERIPHDRIVER_DECLARE(cd, cddriver);
#define CHANGER_MAX_BUSY_SECONDS 15
#endif
@@ -92,13 +53,20 @@
static int changer_max_busy_seconds = CHANGER_MAX_BUSY_SECONDS;
SYSCTL_NODE(_kern_cam, OID_AUTO, cd, CTLFLAG_RD, 0, "CAM CDROM driver");
+-SYSCTL_NODE(_kern_cam_cd, OID_AUTO, changer, CTLFLAG_RD, 0, "CD Changer");
+SYSCTL_INT(_kern_cam_cd, OID_AUTO, poll_period, CTLFLAG_RW,
-+ &cd_poll_period, 0, "Media polling period in seconds");
++ &cd_poll_period, 0, "Media polling period in seconds");
+TUNABLE_INT("kern.cam.cd.poll_period", &cd_poll_period);
- SYSCTL_NODE(_kern_cam_cd, OID_AUTO, changer, CTLFLAG_RD, 0, "CD Changer");
SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RW,
&cd_retry_count, 0, "Normal I/O retry count");
-@@ -475,6 +486,7 @@
+ TUNABLE_INT("kern.cam.cd.retry_count", &cd_retry_count);
++
++static SYSCTL_NODE(_kern_cam_cd, OID_AUTO, changer, CTLFLAG_RD, 0,
++ "CD Changer");
+ SYSCTL_INT(_kern_cam_cd_changer, OID_AUTO, min_busy_seconds, CTLFLAG_RW,
+ &changer_min_busy_seconds, 0, "Minimum changer scheduling quantum");
+ TUNABLE_INT("kern.cam.cd.changer.min_busy_seconds", &changer_min_busy_seconds);
+@@ -475,6 +488,7 @@ cdcleanup(struct cam_periph *periph)
}
disk_destroy(softc->disk);
@@ -106,7 +74,7 @@
free(softc, M_DEVBUF);
cam_periph_lock(periph);
}
-@@ -521,6 +533,19 @@
+@@ -521,6 +535,19 @@ cdasync(void *callback_arg, u_int32_t code,
break;
}
@@ -126,16 +94,16 @@
case AC_SENT_BDR:
case AC_BUS_RESET:
{
-@@ -756,8 +781,18 @@
+@@ -756,10 +783,20 @@ cdregister(struct cam_periph *periph, void *arg)
* Add an async callback so that we get
* notified if this device goes away.
*/
- xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE,
- cdasync, periph, periph->path);
-+ xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE /*|
-+ AC_SCSI_AEN*/, cdasync, periph, periph->path);
-+
-+ /*
++ xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE |
++ AC_SCSI_AEN, cdasync, periph, periph->path);
+
+ /*
+ * Schedule a periodic media polling events.
+ */
+ callout_init_mtx(&softc->mediapoll_c, periph->sim->mtx, 0);
@@ -144,10 +112,12 @@
+ cd_poll_period != 0)
+ callout_reset(&softc->mediapoll_c, cd_poll_period * hz,
+ cdmediapoll, softc);
-
- /*
++
++ /*
* If the target lun is greater than 0, we most likely have a CD
-@@ -1464,8 +1499,25 @@
+ * changer device. Check the quirk entries as well, though, just
+ * in case someone has a CD tower with one lun per drive or
+@@ -1464,8 +1501,25 @@ cdstart(struct cam_periph *periph, union ccb *star
periph->immediate_priority = CAM_PRIORITY_NONE;
wakeup(&periph->ccb_list);
} else if (bp == NULL) {
@@ -156,7 +126,7 @@
+ softc->tur = 0;
+ csio = &start_ccb->csio;
+ scsi_test_unit_ready(csio,
-+ /*retries*/ cd_retry_count,
++ /*retries*/ 0,
+ cddone,
+ MSG_SIMPLE_Q_TAG,
+ SSD_FULL_SIZE,
@@ -174,7 +144,7 @@
bioq_remove(&softc->bio_queue, bp);
scsi_read_write(&start_ccb->csio,
-@@ -1508,7 +1560,7 @@
+@@ -1508,7 +1562,7 @@ cdstart(struct cam_periph *periph, union ccb *star
xpt_action(start_ccb);
}
@@ -183,7 +153,7 @@
/* Have more work to do, so ensure we stay scheduled */
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
}
-@@ -1812,6 +1864,24 @@
+@@ -1812,6 +1866,24 @@ cddone(struct cam_periph *periph, union ccb *done_
wakeup(&done_ccb->ccb_h.cbfcnp);
return;
}
@@ -191,8 +161,8 @@
+ {
+ if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+
-+ if (cderror(done_ccb,
-+ CAM_RETRY_SELTO, SF_RETRY_UA) == ERESTART)
++ if (cderror(done_ccb, CAM_RETRY_SELTO,
++ SF_RETRY_UA | SF_NO_PRINT) == ERESTART)
+ return;
+ if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
+ cam_release_devq(done_ccb->ccb_h.path,
@@ -208,7 +178,7 @@
default:
break;
}
-@@ -3152,11 +3222,15 @@
+@@ -3152,11 +3224,15 @@ cderror(union ccb *ccb, u_int32_t cam_flags, u_int
&& ((ccb->ccb_h.flags & CAM_SENSE_PTR) == 0)) {
int sense_key, error_code, asc, ascq;
@@ -226,7 +196,7 @@
}
if (error == ERESTART)
-@@ -3172,6 +3246,23 @@
+@@ -3172,6 +3248,23 @@ cderror(union ccb *ccb, u_int32_t cam_flags, u_int
&softc->saved_ccb));
}
@@ -250,32 +220,53 @@
/*
* Read table of contents
*/
-diff -ruN sys/geom/geom.h sys/geom/geom.h
---- sys/geom/geom.h 2011-09-26 12:46:10.226551209 -0700
-+++ sys/geom/geom.h 2012-06-09 06:16:30.000000000 -0700
-@@ -168,7 +168,9 @@
- struct g_provider *provider;
- LIST_ENTRY(g_consumer) consumers; /* XXX: better name */
- int acr, acw, ace;
-- int spoiled;
-+ int flags;
-+#define G_CF_SPOILED 0x1
-+#define G_CF_ORPHAN 0x4
- struct devstat *stat;
- u_int nstart, nend;
+Index: sys/cam/ata/ata_xpt.c
+===================================================================
+--- sys/cam/ata/ata_xpt.c (revision 236842)
++++ sys/cam/ata/ata_xpt.c (working copy)
+@@ -464,6 +464,12 @@ negotiate:
+ 0, 0x02);
+ break;
+ case PROBE_SETAN:
++ /* Remember what transport thinks about AEN. */
++ if (softc->caps & CTS_SATA_CAPS_H_AN)
++ path->device->inq_flags |= SID_AEN;
++ else
++ path->device->inq_flags &= ~SID_AEN;
++ xpt_async(AC_GETDEV_CHANGED, path, NULL);
+ cam_fill_ataio(ataio,
+ 1,
+ probedone,
+@@ -1153,6 +1159,12 @@ notsata:
+ cts.xport_specific.sata.valid = CTS_SATA_VALID_CAPS;
+ xpt_action((union ccb *)&cts);
+ softc->caps = caps;
++ /* Remember what transport thinks about AEN. */
++ if (softc->caps & CTS_SATA_CAPS_H_AN)
++ path->device->inq_flags |= SID_AEN;
++ else
++ path->device->inq_flags &= ~SID_AEN;
++ xpt_async(AC_GETDEV_CHANGED, path, NULL);
+ if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) {
+ path->device->flags &= ~CAM_DEV_UNCONFIGURED;
+ xpt_acquire_device(path->device);
+Index: sys/cam/ata/ata_all.h
+===================================================================
+--- sys/cam/ata/ata_all.h (revision 236842)
++++ sys/cam/ata/ata_all.h (working copy)
+@@ -35,6 +35,7 @@ struct ccb_ataio;
+ struct cam_periph;
+ union ccb;
-@@ -241,6 +243,7 @@
- int g_waitfor_event(g_event_t *func, void *arg, int flag, ...);
- void g_cancel_event(void *ref);
- int g_attr_changed(struct g_provider *pp, const char *attr, int flag);
-+int g_media_changed(struct g_provider *pp, int flag);
- void g_orphan_provider(struct g_provider *pp, int error);
- void g_waitidlelock(void);
++#define SID_AEN 0x04 /* Abuse inq_flags bit to track enabled AEN. */
+ #define SID_DMA 0x10 /* Abuse inq_flags bit to track enabled DMA. */
-diff -ruN sys/geom/geom_dev.c sys/geom/geom_dev.c
---- sys/geom/geom_dev.c 2011-09-26 12:46:09.522841497 -0700
-+++ sys/geom/geom_dev.c 2012-06-09 06:16:30.000000000 -0700
-@@ -43,6 +43,7 @@
+ struct ata_cmd {
+Index: sys/geom/geom_dev.c
+===================================================================
+--- sys/geom/geom_dev.c (revision 236842)
++++ sys/geom/geom_dev.c (working copy)
+@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/ctype.h>
#include <sys/bio.h>
@@ -283,13 +274,13 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
-@@ -105,6 +106,21 @@
+@@ -105,7 +106,22 @@ g_dev_print(void)
static void
g_dev_attrchanged(struct g_consumer *cp, const char *attr)
{
+ struct cdev *dev;
+ char buf[SPECNAMELEN + 6];
-+
+
+ if (strcmp(attr, "GEOM::media") == 0) {
+ dev = cp->geom->softc;
+ snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
@@ -302,10 +293,11 @@
+ }
+ return;
+ }
-
++
if (strcmp(attr, "GEOM::physpath") != 0)
return;
-@@ -119,7 +135,6 @@
+
+@@ -119,7 +135,6 @@ g_dev_attrchanged(struct g_consumer *cp, const cha
g_io_getattr("GEOM::physpath", cp, &physpath_len, physpath);
g_access(cp, -1, 0, 0);
if (error == 0 && strlen(physpath) != 0) {
@@ -313,7 +305,7 @@
struct cdev *old_alias_dev;
struct cdev **alias_devp;
-@@ -162,7 +177,8 @@
+@@ -162,7 +177,8 @@ g_dev_taste(struct g_class *mp, struct g_provider
g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name);
g_topology_assert();
LIST_FOREACH(cp, &pp->consumers, consumers)
@@ -323,56 +315,12 @@
return (NULL);
gp = g_new_geomf(mp, pp->name);
cp = g_new_consumer(gp);
-diff -ruN sys/geom/geom_disk.c sys/geom/geom_disk.c
---- sys/geom/geom_disk.c 2011-09-26 12:46:09.584655488 -0700
-+++ sys/geom/geom_disk.c 2012-06-09 06:16:30.000000000 -0700
-@@ -604,6 +604,19 @@
- (void)g_attr_changed(pp, attr, flag);
- }
-
-+void
-+disk_media_changed(struct disk *dp, int flag)
-+{
-+ struct g_geom *gp;
-+ struct g_provider *pp;
-+
-+ gp = dp->d_geom;
-+ if (gp != NULL) {
-+ LIST_FOREACH(pp, &gp->provider, provider)
-+ g_media_changed(pp, flag);
-+ }
-+}
-+
- static void
- g_kern_disks(void *p, int flag __unused)
+Index: sys/geom/geom_subr.c
+===================================================================
+--- sys/geom/geom_subr.c (revision 236842)
++++ sys/geom/geom_subr.c (working copy)
+@@ -530,7 +530,7 @@ g_new_provider_event(void *arg, int flag)
{
-diff -ruN sys/geom/geom_disk.h sys/geom/geom_disk.h
---- sys/geom/geom_disk.h 2011-09-26 12:46:09.725216905 -0700
-+++ sys/geom/geom_disk.h 2012-06-09 06:16:30.000000000 -0700
-@@ -107,6 +107,7 @@
- void disk_destroy(struct disk *disk);
- void disk_gone(struct disk *disk);
- void disk_attr_changed(struct disk *dp, const char *attr, int flag);
-+void disk_media_changed(struct disk *dp, int flag);
-
- #define DISK_VERSION_00 0x58561059
- #define DISK_VERSION_01 0x5856105a
-diff -ruN sys/geom/geom_slice.c sys/geom/geom_slice.c
---- sys/geom/geom_slice.c 2011-09-26 12:46:09.802522527 -0700
-+++ sys/geom/geom_slice.c 2012-06-09 06:16:30.000000000 -0700
-@@ -465,6 +465,7 @@
- g_topology_assert();
- gp = cp->geom;
- g_trace(G_T_TOPOLOGY, "g_slice_spoiled(%p/%s)", cp, gp->name);
-+ cp->flags |= G_CF_ORPHAN;
- gsp = gp->softc;
- gp->softc = NULL;
- g_slice_free(gsp);
-diff -ruN sys/geom/geom_subr.c sys/geom/geom_subr.c
---- sys/geom/geom_subr.c 2011-09-26 12:46:10.071077844 -0700
-+++ sys/geom/geom_subr.c 2012-06-09 06:16:30.000000000 -0700
-@@ -530,7 +530,7 @@
- {
struct g_class *mp;
struct g_provider *pp;
- struct g_consumer *cp;
@@ -380,7 +328,7 @@
g_topology_assert();
if (flag == EV_CANCEL)
-@@ -541,11 +541,17 @@
+@@ -541,11 +541,17 @@ g_new_provider_event(void *arg, int flag)
G_VALID_PROVIDER(pp);
KASSERT(!(pp->flags & G_PF_WITHER),
("g_new_provider_event but withered"));
@@ -399,7 +347,7 @@
break;
if (cp != NULL)
continue;
-@@ -787,7 +793,7 @@
+@@ -787,7 +793,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw,
* are probably just ahead of the event telling us that. Fail
* now rather than having to unravel this later.
*/
@@ -408,7 +356,7 @@
(dcr > 0 || dcw > 0 || dce > 0))
return (ENXIO);
-@@ -937,6 +943,7 @@
+@@ -937,6 +943,7 @@ g_std_spoiled(struct g_consumer *cp)
g_topology_assert();
G_VALID_CONSUMER(cp);
g_trace(G_T_TOPOLOGY, "g_std_spoiled(%p)", cp);
@@ -416,7 +364,7 @@
g_detach(cp);
gp = cp->geom;
LIST_FOREACH(pp, &gp->provider, provider)
-@@ -972,9 +979,9 @@
+@@ -972,9 +979,9 @@ g_spoil_event(void *arg, int flag)
G_VALID_PROVIDER(pp);
for (cp = LIST_FIRST(&pp->consumers); cp != NULL; cp = cp2) {
cp2 = LIST_NEXT(cp, consumers);
@@ -428,7 +376,7 @@
if (cp->geom->spoiled == NULL)
continue;
cp->geom->spoiled(cp);
-@@ -999,12 +1006,27 @@
+@@ -999,12 +1006,27 @@ g_spoil(struct g_provider *pp, struct g_consumer *
KASSERT(cp2->acw == 0, ("spoiling cp->acw = %d", cp2->acw));
*/
KASSERT(cp2->ace == 0, ("spoiling cp->ace = %d", cp2->ace));
@@ -457,7 +405,7 @@
g_getattr__(const char *attr, struct g_consumer *cp, void *var, int len)
{
int error, i;
-@@ -1159,15 +1181,15 @@
+@@ -1159,15 +1181,15 @@ db_show_geom_consumer(int indent, struct g_consume
cp->provider);
}
gprintln(" access: r%dw%de%d", cp->acr, cp->acw, cp->ace);
@@ -476,3 +424,74 @@
db_printf("\n");
}
}
+Index: sys/geom/geom.h
+===================================================================
+--- sys/geom/geom.h (revision 236842)
++++ sys/geom/geom.h (working copy)
+@@ -168,7 +168,9 @@ struct g_consumer {
+ struct g_provider *provider;
+ LIST_ENTRY(g_consumer) consumers; /* XXX: better name */
+ int acr, acw, ace;
+- int spoiled;
++ int flags;
++#define G_CF_SPOILED 0x1
++#define G_CF_ORPHAN 0x4
+ struct devstat *stat;
+ u_int nstart, nend;
+
+@@ -241,6 +243,7 @@ int g_post_event(g_event_t *func, void *arg, int f
+ int g_waitfor_event(g_event_t *func, void *arg, int flag, ...);
+ void g_cancel_event(void *ref);
+ int g_attr_changed(struct g_provider *pp, const char *attr, int flag);
++int g_media_changed(struct g_provider *pp, int flag);
+ void g_orphan_provider(struct g_provider *pp, int error);
+ void g_waitidlelock(void);
+
+Index: sys/geom/geom_disk.c
+===================================================================
+--- sys/geom/geom_disk.c (revision 236842)
++++ sys/geom/geom_disk.c (working copy)
+@@ -604,6 +604,19 @@ disk_attr_changed(struct disk *dp, const char *att
+ (void)g_attr_changed(pp, attr, flag);
+ }
+
++void
++disk_media_changed(struct disk *dp, int flag)
++{
++ struct g_geom *gp;
++ struct g_provider *pp;
++
++ gp = dp->d_geom;
++ if (gp != NULL) {
++ LIST_FOREACH(pp, &gp->provider, provider)
++ g_media_changed(pp, flag);
++ }
++}
++
+ static void
+ g_kern_disks(void *p, int flag __unused)
+ {
+Index: sys/geom/geom_slice.c
+===================================================================
+--- sys/geom/geom_slice.c (revision 236842)
++++ sys/geom/geom_slice.c (working copy)
+@@ -465,6 +465,7 @@ g_slice_spoiled(struct g_consumer *cp)
+ g_topology_assert();
+ gp = cp->geom;
+ g_trace(G_T_TOPOLOGY, "g_slice_spoiled(%p/%s)", cp, gp->name);
++ cp->flags |= G_CF_ORPHAN;
+ gsp = gp->softc;
+ gp->softc = NULL;
+ g_slice_free(gsp);
+Index: sys/geom/geom_disk.h
+===================================================================
+--- sys/geom/geom_disk.h (revision 236842)
++++ sys/geom/geom_disk.h (working copy)
+@@ -107,6 +107,7 @@ void disk_create(struct disk *disk, int version);
+ void disk_destroy(struct disk *disk);
+ void disk_gone(struct disk *disk);
+ void disk_attr_changed(struct disk *dp, const char *attr, int flag);
++void disk_media_changed(struct disk *dp, int flag);
+
+ #define DISK_VERSION_00 0x58561059
+ #define DISK_VERSION_01 0x5856105a
More information about the Commits
mailing list