svn commit: r189143 - in head: lib/libc/sys sys/sys
Author: ed Date: Sat Feb 28 10:10:30 2009 New Revision: 189143 URL: http://svn.freebsd.org/changeset/base/189143 Log: Add missing POSIX 1003.1-2008 open(2) flag; O_TTY_INIT. On FreeBSD, this is the default behaviour. According to the spec, we may give this flag a value of zero, but I'd rather not do this. If we define it to a non-zero value, we can always change default behaviour without changing the ABI. This is very unlikely to happen, though. Modified: head/lib/libc/sys/open.2 head/sys/sys/fcntl.h Modified: head/lib/libc/sys/open.2 == --- head/lib/libc/sys/open.2Sat Feb 28 06:39:39 2009(r189142) +++ head/lib/libc/sys/open.2Sat Feb 28 10:10:30 2009(r189143) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd April 10, 2008 +.Dd February 28, 2009 .Dt OPEN 2 .Os .Sh NAME @@ -116,6 +116,7 @@ O_FSYNC synchronous writes O_SYNC synchronous writes O_NOFOLLOW do not follow symlinks O_NOCTTY don't assign controlling terminal +O_TTY_INIT restore default terminal attributes .Ed .Pp Opening a file with @@ -208,6 +209,19 @@ The system call will not assign controlling terminals on .Fx . .Pp +.Dv O_TTY_INIT +may be used to ensure the OS restores the terminal attributes when +initially opening a TTY. +This is the default on +.Fx , +but is present for +.Tn POSIX +compatibility. +The initial call to +.Fn open +on a TTY will always restore default terminal attributes on +.Fx . +.Pp If successful, .Fn open returns a non-negative integer, termed a file descriptor. Modified: head/sys/sys/fcntl.h == --- head/sys/sys/fcntl.hSat Feb 28 06:39:39 2009(r189142) +++ head/sys/sys/fcntl.hSat Feb 28 10:10:30 2009(r189143) @@ -140,6 +140,11 @@ typedef__pid_t pid_t; #defineFEXEC O_EXEC #endif +/* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */ +#if __POSIX_VISIBLE >= 200809 +#defineO_TTY_INIT 0x0008 /* Restore default termios attributes */ +#endif + /* * XXX missing O_DSYNC, O_RSYNC. */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189144 - in stable/7/sys: . cam contrib/pf dev/cxgb
Author: trasz Date: Sat Feb 28 10:24:57 2009 New Revision: 189144 URL: http://svn.freebsd.org/changeset/base/189144 Log: MFC r186184: Get rid of dead_sim. There is no way to make it work - any attempt to actually use it would panic on mtx operation, as dead_sim doesn't have a proper mutex. Even if it had a properly initialized mutex, it wouldn't have properly locked and owned one. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:10:30 2009(r189143) +++ stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:24:57 2009(r189144) @@ -698,19 +698,6 @@ static struct cdevsw xpt_cdevsw = { }; -static void dead_sim_action(struct cam_sim *sim, union ccb *ccb); -static void dead_sim_poll(struct cam_sim *sim); - -/* Dummy SIM that is used when the real one has gone. */ -static struct cam_sim cam_dead_sim = { - .sim_action = dead_sim_action, - .sim_poll = dead_sim_poll, - .sim_name = "dead_sim", -}; - -#define SIM_DEAD(sim) ((sim) == &cam_dead_sim) - - /* Storage for debugging datastructures */ #ifdef CAMDEBUG struct cam_path *cam_dpath; @@ -3023,19 +3010,10 @@ xpt_action(union ccb *start_ccb) case XPT_ENG_EXEC: { struct cam_path *path; - struct cam_sim *sim; int runq; path = start_ccb->ccb_h.path; - sim = path->bus->sim; - if (SIM_DEAD(sim)) { - /* The SIM has gone; just execute the CCB directly. */ - cam_ccbq_send_ccb(&path->device->ccbq, start_ccb); - (*(sim->sim_action))(sim, start_ccb); - break; - } - cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); if (path->device->qfrozen_cnt == 0) runq = xpt_schedule_dev_sendq(path->bus, path->device); @@ -3623,7 +3601,6 @@ void xpt_schedule(struct cam_periph *perph, u_int32_t new_priority) { struct cam_ed *device; - union ccb *work_ccb; int runq; mtx_assert(perph->sim->mtx, MA_OWNED); @@ -3640,15 +3617,6 @@ xpt_schedule(struct cam_periph *perph, u new_priority); } runq = 0; - } else if (SIM_DEAD(perph->path->bus->sim)) { - /* The SIM is gone so just call periph_start directly. */ - work_ccb = xpt_get_ccb(perph->path->device); - if (work_ccb == NULL) - return; /* XXX */ - xpt_setup_ccb(&work_ccb->ccb_h, perph->path, new_priority); - perph->pinfo.priority = new_priority; - perph->periph_start(perph, work_ccb); - return; } else { /* New entry on the queue */ CAM_DEBUG(perph->path, CAM_DEBUG_SUBTRACE, @@ -4372,15 +4340,8 @@ int32_t xpt_bus_deregister(path_id_t pathid) { struct cam_path bus_path; - struct cam_ed *device; - struct cam_ed_qinfo *qinfo; - struct cam_devq *devq; - struct cam_periph *periph; - struct cam_sim *ccbsim; - union ccb *work_ccb; cam_status status; - status = xpt_compile_path(&bus_path, NULL, pathid, CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); if (status != CAM_REQ_CMP) @@ -4389,42 +4350,6 @@ xpt_bus_deregister(path_id_t pathid) xpt_async(AC_LOST_DEVICE, &bus_path, NULL); xpt_async(AC_PATH_DEREGISTERED, &bus_path, NULL); - /* The SIM may be gone, so use a dummy SIM for any stray operations. */ - devq = bus_path.bus->sim->devq; - ccbsim = bus_path.bus->sim; - bus_path.bus->sim = &cam_dead_sim; - - /* Execute any pending operations now. */ - while ((qinfo = (struct cam_ed_qinfo *)camq_remove(&devq->send_queue, - CAMQ_HEAD)) != NULL || - (qinfo = (struct cam_ed_qinfo *)camq_remove(&devq->alloc_queue, - CAMQ_HEAD)) != NULL) { - do { - device = qinfo->device; - work_ccb = cam_ccbq_peek_ccb(&device->ccbq, CAMQ_HEAD); - if (work_ccb != NULL) { - devq->active_dev = device; - cam_ccbq_remove_ccb(&device->ccbq, work_ccb); - cam_ccbq_send_ccb(&device->ccbq, work_ccb); - (*(ccbsim->sim_action))(ccbsim, work_ccb); - } - - periph = (struct cam_periph *)camq_remove(&device->drvq, -
svn commit: r189145 - in stable/7/sys: . cam contrib/pf dev/cxgb
Author: trasz Date: Sat Feb 28 10:27:46 2009 New Revision: 189145 URL: http://svn.freebsd.org/changeset/base/189145 Log: MFC r186185: Add SIM refcounting. This is slightly different from what DragonFly does - in DragonFly, it's cam_sim_release() what actually frees the SIM; cam_sim_free does nothing more than calling cam_sim_release(). Here, we drain in cam_sim_free, waiting for refcount to drop to zero. We cannot do the same think DragonFly does, because after cam_sim_free returns, client would destroy the sim->mtx, and CAM would trip over an initialized mutex. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_sim.c stable/7/sys/cam/cam_sim.h stable/7/sys/cam/cam_xpt.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_sim.c == --- stable/7/sys/cam/cam_sim.c Sat Feb 28 10:24:57 2009(r189144) +++ stable/7/sys/cam/cam_sim.c Sat Feb 28 10:27:46 2009(r189145) @@ -84,6 +84,7 @@ cam_sim_alloc(sim_action_func sim_action sim->max_tagged_dev_openings = max_tagged_dev_transactions; sim->max_dev_openings = max_dev_transactions; sim->flags = 0; + sim->refcount = 1; sim->devq = queue; sim->mtx = mtx; if (mtx == &Giant) { @@ -103,12 +104,40 @@ cam_sim_alloc(sim_action_func sim_action void cam_sim_free(struct cam_sim *sim, int free_devq) { + int error; + + sim->refcount--; + if (sim->refcount > 0) { + error = msleep(sim, sim->mtx, PRIBIO, "simfree", 0); + KASSERT(error == 0, ("invalid error value for msleep(9)")); + } + + KASSERT(sim->refcount == 0, ("sim->refcount == 0")); + if (free_devq) cam_simq_free(sim->devq); free(sim, M_CAMSIM); } void +cam_sim_release(struct cam_sim *sim) +{ + KASSERT(sim->refcount >= 1, ("sim->refcount >= 1")); + + sim->refcount--; + if (sim->refcount <= 1) + wakeup(sim); +} + +void +cam_sim_hold(struct cam_sim *sim) +{ + KASSERT(sim->refcount >= 1, ("sim->refcount >= 1")); + + sim->refcount++; +} + +void cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id) { sim->path_id = path_id; Modified: stable/7/sys/cam/cam_sim.h == --- stable/7/sys/cam/cam_sim.h Sat Feb 28 10:24:57 2009(r189144) +++ stable/7/sys/cam/cam_sim.h Sat Feb 28 10:27:46 2009(r189145) @@ -61,6 +61,8 @@ struct cam_sim * cam_sim_alloc(sim_acti int max_tagged_dev_transactions, struct cam_devq *queue); void cam_sim_free(struct cam_sim *sim, int free_devq); +void cam_sim_hold(struct cam_sim *sim); +void cam_sim_release(struct cam_sim *sim); /* Optional sim attributes may be set with these. */ void cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id); @@ -105,6 +107,7 @@ struct cam_sim { #define CAM_SIM_ON_DONEQ 0x04 struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ + int refcount; /* References to the SIM. */ /* "Pool" of inactive ccbs managed by xpt_alloc_ccb and xpt_free_ccb */ SLIST_HEAD(,ccb_hdr)ccb_freeq; Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:24:57 2009(r189144) +++ stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:27:46 2009(r189145) @@ -4304,6 +4304,7 @@ xpt_bus_register(struct cam_sim *sim, de TAILQ_INIT(&new_bus->et_entries); new_bus->path_id = sim->path_id; + cam_sim_hold(sim); new_bus->sim = sim; timevalclear(&new_bus->last_reset); new_bus->flags = 0; @@ -4846,6 +4847,7 @@ xpt_release_bus(struct cam_eb *bus) TAILQ_REMOVE(&xsoftc.xpt_busses, bus, links); xsoftc.bus_generation++; mtx_unlock(&xsoftc.xpt_topo_lock); + cam_sim_release(bus->sim); free(bus, M_CAMXPT); } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189146 - in stable/7/sys: . cam contrib/pf dev/cxgb
Author: trasz Date: Sat Feb 28 10:29:55 2009 New Revision: 189146 URL: http://svn.freebsd.org/changeset/base/189146 Log: MFC r186318: Move mtx_assert lower, when we can be sure that the pointer to the mutex is valid. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_periph.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_periph.c == --- stable/7/sys/cam/cam_periph.c Sat Feb 28 10:27:46 2009 (r189145) +++ stable/7/sys/cam/cam_periph.c Sat Feb 28 10:29:55 2009 (r189146) @@ -311,8 +311,6 @@ cam_periph_hold(struct cam_periph *perip struct mtx *mtx; int error; - mtx_assert(periph->sim->mtx, MA_OWNED); - /* * Increment the reference count on the peripheral * while we wait for our lock attempt to succeed @@ -324,6 +322,7 @@ cam_periph_hold(struct cam_periph *perip return (ENXIO); mtx = periph->sim->mtx; + mtx_assert(mtx, MA_OWNED); if (mtx == &Giant) mtx = NULL; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189147 - in stable/7/sys: . cam cam/scsi contrib/pf dev/cxgb
Author: trasz Date: Sat Feb 28 10:33:00 2009 New Revision: 189147 URL: http://svn.freebsd.org/changeset/base/189147 Log: MFC r186319: Periph driver fixes, second try. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_periph.c stable/7/sys/cam/cam_periph.h stable/7/sys/cam/cam_xpt.c stable/7/sys/cam/scsi/scsi_da.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_periph.c == --- stable/7/sys/cam/cam_periph.c Sat Feb 28 10:29:55 2009 (r189146) +++ stable/7/sys/cam/cam_periph.c Sat Feb 28 10:33:00 2009 (r189147) @@ -290,7 +290,7 @@ cam_periph_acquire(struct cam_periph *pe } void -cam_periph_release(struct cam_periph *periph) +cam_periph_release_locked(struct cam_periph *periph) { if (periph == NULL) @@ -302,7 +302,21 @@ cam_periph_release(struct cam_periph *pe camperiphfree(periph); } xpt_unlock_buses(); +} + +void +cam_periph_release(struct cam_periph *periph) +{ + struct cam_sim *sim; + if (periph == NULL) + return; + + sim = periph->sim; + mtx_assert(sim->mtx, MA_NOTOWNED); + mtx_lock(sim->mtx); + cam_periph_release_locked(periph); + mtx_unlock(sim->mtx); } int @@ -329,7 +343,7 @@ cam_periph_hold(struct cam_periph *perip while ((periph->flags & CAM_PERIPH_LOCKED) != 0) { periph->flags |= CAM_PERIPH_LOCK_WANTED; if ((error = msleep(periph, mtx, priority, "caplck", 0)) != 0) { - cam_periph_release(periph); + cam_periph_release_locked(periph); return (error); } } @@ -350,7 +364,7 @@ cam_periph_unhold(struct cam_periph *per wakeup(periph); } - cam_periph_release(periph); + cam_periph_release_locked(periph); } /* Modified: stable/7/sys/cam/cam_periph.h == --- stable/7/sys/cam/cam_periph.h Sat Feb 28 10:29:55 2009 (r189146) +++ stable/7/sys/cam/cam_periph.h Sat Feb 28 10:33:00 2009 (r189147) @@ -141,6 +141,7 @@ cam_status cam_periph_alloc(periph_ctor_ struct cam_periph *cam_periph_find(struct cam_path *path, char *name); cam_status cam_periph_acquire(struct cam_periph *periph); void cam_periph_release(struct cam_periph *periph); +void cam_periph_release_locked(struct cam_periph *periph); intcam_periph_hold(struct cam_periph *periph, int priority); void cam_periph_unhold(struct cam_periph *periph); void cam_periph_invalidate(struct cam_periph *periph); Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:29:55 2009(r189146) +++ stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:33:00 2009(r189147) @@ -6314,7 +6314,7 @@ probedone(struct cam_periph *periph, uni xpt_done(done_ccb); if (TAILQ_FIRST(&softc->request_ccbs) == NULL) { cam_periph_invalidate(periph); - cam_periph_release(periph); + cam_periph_release_locked(periph); } else { probeschedule(periph); } Modified: stable/7/sys/cam/scsi/scsi_da.c == --- stable/7/sys/cam/scsi/scsi_da.c Sat Feb 28 10:29:55 2009 (r189146) +++ stable/7/sys/cam/scsi/scsi_da.c Sat Feb 28 10:33:00 2009 (r189147) @@ -771,8 +771,8 @@ daclose(struct disk *dp) softc->flags &= ~DA_FLAG_OPEN; cam_periph_unhold(periph); - cam_periph_release(periph); cam_periph_unlock(periph); + cam_periph_release(periph); return (0); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189148 - in stable/7/sys: . cam contrib/pf dev/cxgb
Author: trasz Date: Sat Feb 28 10:35:30 2009 New Revision: 189148 URL: http://svn.freebsd.org/changeset/base/189148 Log: MFC r186320: Fix cam_sim_free() wakeup condition and add mtx_asserts. Submitted by: Christoph Mallon Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_sim.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_sim.c == --- stable/7/sys/cam/cam_sim.c Sat Feb 28 10:33:00 2009(r189147) +++ stable/7/sys/cam/cam_sim.c Sat Feb 28 10:35:30 2009(r189148) @@ -123,9 +123,10 @@ void cam_sim_release(struct cam_sim *sim) { KASSERT(sim->refcount >= 1, ("sim->refcount >= 1")); + mtx_assert(sim->mtx, MA_OWNED); sim->refcount--; - if (sim->refcount <= 1) + if (sim->refcount == 0) wakeup(sim); } @@ -133,6 +134,7 @@ void cam_sim_hold(struct cam_sim *sim) { KASSERT(sim->refcount >= 1, ("sim->refcount >= 1")); + mtx_assert(sim->mtx, MA_OWNED); sim->refcount++; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189149 - in stable/7/sys: . cam contrib/pf dev/ata dev/cxgb
Author: trasz Date: Sat Feb 28 10:38:32 2009 New Revision: 189149 URL: http://svn.freebsd.org/changeset/base/189149 Log: MFC r186905: Make "kldunload atapicam" return EBUSY instead of deadlocking when a device created by atapicam is being kept opened or mounted. This is probably just a temporary solution until we invent something better. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Reported by: Jaakko Heinonen Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c stable/7/sys/cam/cam_xpt_sim.h stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ata/atapi-cam.c stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:35:30 2009(r189148) +++ stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:38:32 2009(r189149) @@ -2642,6 +2642,39 @@ xptbustraverse(struct cam_eb *start_bus, return(retval); } +int +xpt_sim_opened(struct cam_sim *sim) +{ + struct cam_eb *bus; + struct cam_et *target; + struct cam_ed *device; + struct cam_periph *periph; + + KASSERT(sim->refcount >= 1, ("sim->refcount >= 1")); + mtx_assert(sim->mtx, MA_OWNED); + + mtx_lock(&xsoftc.xpt_topo_lock); + TAILQ_FOREACH(bus, &xsoftc.xpt_busses, links) { + if (bus->sim != sim) + continue; + + TAILQ_FOREACH(target, &bus->et_entries, links) { + TAILQ_FOREACH(device, &target->ed_entries, links) { + SLIST_FOREACH(periph, &device->periphs, + periph_links) { + if (periph->refcount > 0) { + mtx_unlock(&xsoftc.xpt_topo_lock); + return (1); + } + } + } + } + } + + mtx_unlock(&xsoftc.xpt_topo_lock); + return (0); +} + static int xpttargettraverse(struct cam_eb *bus, struct cam_et *start_target, xpt_targetfunc_t *tr_func, void *arg) @@ -4277,7 +4310,7 @@ xpt_release_ccb(union ccb *free_ccb) * for this new bus and places it in the array of busses and assigns * it a path_id. The path_id may be influenced by "hard wiring" * information specified by the user. Once interrupt services are - * availible, the bus will be probed. + * available, the bus will be probed. */ int32_t xpt_bus_register(struct cam_sim *sim, device_t parent, u_int32_t bus) Modified: stable/7/sys/cam/cam_xpt_sim.h == --- stable/7/sys/cam/cam_xpt_sim.h Sat Feb 28 10:35:30 2009 (r189148) +++ stable/7/sys/cam/cam_xpt_sim.h Sat Feb 28 10:38:32 2009 (r189149) @@ -45,6 +45,7 @@ void xpt_release_simq(struct cam_sim *s u_int32_t xpt_freeze_devq(struct cam_path *path, u_int count); void xpt_release_devq(struct cam_path *path, u_int count, int run_queue); +intxpt_sim_opened(struct cam_sim *sim); void xpt_done(union ccb *done_ccb); #endif Modified: stable/7/sys/dev/ata/atapi-cam.c == --- stable/7/sys/dev/ata/atapi-cam.cSat Feb 28 10:35:30 2009 (r189148) +++ stable/7/sys/dev/ata/atapi-cam.cSat Feb 28 10:38:32 2009 (r189149) @@ -254,6 +254,10 @@ atapi_cam_detach(device_t dev) struct atapi_xpt_softc *scp = device_get_softc(dev); mtx_lock(&scp->state_lock); +if (xpt_sim_opened(scp->sim)) { + mtx_unlock(&scp->state_lock); + return (EBUSY); +} xpt_freeze_simq(scp->sim, 1 /*count*/); scp->flags |= DETACHING; mtx_unlock(&scp->state_lock); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189150 - head/usr.bin/fstat
Author: ed Date: Sat Feb 28 10:40:37 2009 New Revision: 189150 URL: http://svn.freebsd.org/changeset/base/189150 Log: Fix compilation of fstat. The udev should now be obtained from the dosmount instead of the denode. Modified: head/usr.bin/fstat/msdosfs.c Modified: head/usr.bin/fstat/msdosfs.c == --- head/usr.bin/fstat/msdosfs.cSat Feb 28 10:38:32 2009 (r189149) +++ head/usr.bin/fstat/msdosfs.cSat Feb 28 10:40:37 2009 (r189150) @@ -110,7 +110,7 @@ msdosfs_filestat(struct vnode *vp, struc mnt->kptr = denode.de_pmp; } - fsp->fsid = dev2udev(denode.de_dev); + fsp->fsid = dev2udev(mnt->data.pm_dev); fsp->mode = 0555; fsp->mode |= denode.de_Attributes & ATTR_READONLY ? 0 : 0222; fsp->mode &= mnt->data.pm_mask; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189151 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 10:40:52 2009 New Revision: 189151 URL: http://svn.freebsd.org/changeset/base/189151 Log: MFC r187028: Don't call destroy_dev(9) with a mutex held. While here, shuffle things around so the periph destructors look alike. Based on a patch by Jaakko Heinonen. Submitted by: Jaakko Heinonen Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_ch.c stable/7/sys/cam/scsi/scsi_pass.c stable/7/sys/cam/scsi/scsi_pt.c stable/7/sys/cam/scsi/scsi_sa.c stable/7/sys/cam/scsi/scsi_ses.c stable/7/sys/cam/scsi/scsi_sg.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_ch.c == --- stable/7/sys/cam/scsi/scsi_ch.c Sat Feb 28 10:40:37 2009 (r189150) +++ stable/7/sys/cam/scsi/scsi_ch.c Sat Feb 28 10:40:52 2009 (r189151) @@ -262,9 +262,11 @@ chcleanup(struct cam_periph *periph) softc = (struct ch_softc *)periph->softc; + xpt_print(periph->path, "removing device entry\n"); devstat_remove_entry(softc->device_stats); + cam_periph_unlock(periph); destroy_dev(softc->dev); - xpt_print(periph->path, "removing device entry\n"); + cam_periph_lock(periph); free(softc, M_DEVBUF); } Modified: stable/7/sys/cam/scsi/scsi_pass.c == --- stable/7/sys/cam/scsi/scsi_pass.c Sat Feb 28 10:40:37 2009 (r189150) +++ stable/7/sys/cam/scsi/scsi_pass.c Sat Feb 28 10:40:52 2009 (r189151) @@ -165,13 +165,12 @@ passcleanup(struct cam_periph *periph) softc = (struct pass_softc *)periph->softc; + if (bootverbose) + xpt_print(periph->path, "removing device entry\n"); devstat_remove_entry(softc->device_stats); - + cam_periph_unlock(periph); destroy_dev(softc->dev); - - if (bootverbose) { - xpt_print(periph->path, "removing device entry\n"); - } + cam_periph_lock(periph); free(softc, M_DEVBUF); } Modified: stable/7/sys/cam/scsi/scsi_pt.c == --- stable/7/sys/cam/scsi/scsi_pt.c Sat Feb 28 10:40:37 2009 (r189150) +++ stable/7/sys/cam/scsi/scsi_pt.c Sat Feb 28 10:40:52 2009 (r189151) @@ -342,11 +342,11 @@ ptdtor(struct cam_periph *periph) softc = (struct pt_softc *)periph->softc; + xpt_print(periph->path, "removing device entry\n"); devstat_remove_entry(softc->device_stats); - + cam_periph_unlock(periph); destroy_dev(softc->dev); - - xpt_print(periph->path, "removing device entry\n"); + cam_periph_lock(periph); free(softc, M_DEVBUF); } Modified: stable/7/sys/cam/scsi/scsi_sa.c == --- stable/7/sys/cam/scsi/scsi_sa.c Sat Feb 28 10:40:37 2009 (r189150) +++ stable/7/sys/cam/scsi/scsi_sa.c Sat Feb 28 10:40:52 2009 (r189151) @@ -1377,17 +1377,16 @@ sacleanup(struct cam_periph *periph) softc = (struct sa_softc *)periph->softc; + xpt_print(periph->path, "removing device entry\n"); devstat_remove_entry(softc->device_stats); - + cam_periph_unlock(periph); destroy_dev(softc->devs.ctl_dev); - for (i = 0; i < SA_NUM_MODES; i++) { destroy_dev(softc->devs.mode_devs[i].r_dev); destroy_dev(softc->devs.mode_devs[i].nr_dev); destroy_dev(softc->devs.mode_devs[i].er_dev); } - - xpt_print(periph->path, "removing device entry\n"); + cam_periph_lock(periph); free(softc, M_SCSISA); } Modified: stable/7/sys/cam/scsi/scsi_ses.c == --- stable/7/sys/cam/scsi/scsi_ses.cSat Feb 28 10:40:37 2009 (r189150) +++ stable/7/sys/cam/scsi/scsi_ses.cSat Feb 28 10:40:52 2009 (r189151) @@ -227,9 +227,10 @@ sescleanup(struct cam_periph *periph) softc = (struct ses_softc *)periph->softc; - destroy_dev(softc->ses_dev); - xpt_print(periph->path, "removing device entry\n"); + cam_periph_unlock(periph); + destroy_dev(softc->ses_dev); + cam_periph_lock(periph); free(softc, M_SCSISES); } Modified: stable/7/sys/cam/scsi/scsi_sg.c == --- stable/7/sys/cam/scsi/scsi_sg.c Sat Feb 28 10:40:37 2009 (r189150) +++ stable/7/sys/cam/scsi/scsi_sg.c Sat Feb 28 10:40:52 2009 (r189151) @@ -200,11 +200,12 @@ sgcleanup(struct cam_periph *periph) s
Re: svn commit: r189120 - head/sys/fs/msdosfs
* M. Warner Losh wrote: > This commit broke tinderbox. This should now be fixed. -- Ed Schouten WWW: http://80386.nl/ pgp0MTqg9Edhz.pgp Description: PGP signature
svn commit: r189152 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 10:43:10 2009 New Revision: 189152 URL: http://svn.freebsd.org/changeset/base/189152 Log: MFC r187243: Add missing 'break' statement. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Found with: Coverity Prevent(tm) CID: 3927 Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_all.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_all.c == --- stable/7/sys/cam/scsi/scsi_all.cSat Feb 28 10:40:52 2009 (r189151) +++ stable/7/sys/cam/scsi/scsi_all.cSat Feb 28 10:43:10 2009 (r189152) @@ -2263,6 +2263,7 @@ scsi_print_inquiry(struct scsi_inquiry_d break; case T_NODEVICE: dtype = "Uninstalled"; + break; default: dtype = "unknown"; break; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189153 - head/sys/sys
Author: rwatson Date: Sat Feb 28 10:44:39 2009 New Revision: 189153 URL: http://svn.freebsd.org/changeset/base/189153 Log: Remove PRIV_ROOT -- all system privileges must now be explicitly named in support of forthcoming work on a fine-grained privilege mechanism. Facilitated by: bz, thompsa, rink Modified: head/sys/sys/priv.h Modified: head/sys/sys/priv.h == --- head/sys/sys/priv.h Sat Feb 28 10:43:10 2009(r189152) +++ head/sys/sys/priv.h Sat Feb 28 10:44:39 2009(r189153) @@ -52,13 +52,7 @@ /* * Track beginning of privilege list. */ -#define_PRIV_LOWEST0 - -/* - * PRIV_ROOT is a catch-all for as yet unnamed privileges. No new - * references to this privilege should be added. - */ -#definePRIV_ROOT 1 /* Catch-all during development. */ +#define_PRIV_LOWEST1 /* * The remaining privileges typically correspond to one or a small @@ -67,6 +61,7 @@ * privileges, such as the ability to reboot, and then loosely by * subsystem, indicated by a subsystem name. */ +#define_PRIV_ROOT 1 /* Removed. */ #definePRIV_ACCT 2 /* Manage process accounting. */ #definePRIV_MAXFILES 3 /* Exceed system open files limit. */ #definePRIV_MAXPROC4 /* Exceed system processes limit. */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189154 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 10:45:31 2009 New Revision: 189154 URL: http://svn.freebsd.org/changeset/base/189154 Log: MFC r187244: Remove unused variable. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Found with: Coverity Prevent(tm) CID: 3665 Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_da.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_da.c == --- stable/7/sys/cam/scsi/scsi_da.c Sat Feb 28 10:44:39 2009 (r189153) +++ stable/7/sys/cam/scsi/scsi_da.c Sat Feb 28 10:45:31 2009 (r189154) @@ -1012,7 +1012,6 @@ daasync(void *callback_arg, u_int32_t co case AC_FOUND_DEVICE: { struct ccb_getdev *cgd; - struct cam_sim *sim; cam_status status; cgd = (struct ccb_getdev *)arg; @@ -1029,7 +1028,6 @@ daasync(void *callback_arg, u_int32_t co * this device and start the probe * process. */ - sim = xpt_path_sim(cgd->ccb_h.path); status = cam_periph_alloc(daregister, daoninvalidate, dacleanup, dastart, "da", CAM_PERIPH_BIO, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189155 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 10:48:11 2009 New Revision: 189155 URL: http://svn.freebsd.org/changeset/base/189155 Log: MFC r187245: Fix use after free. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Found with: Coverity Prevent(tm) CID: 3712 Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:45:31 2009(r189154) +++ stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:48:11 2009(r189155) @@ -6137,7 +6137,7 @@ probedone(struct cam_periph *periph, uni } xpt_release_ccb(done_ccb); softc->action = PROBE_TUR_FOR_NEGOTIATION; - xpt_schedule(periph, done_ccb->ccb_h.pinfo.priority); + xpt_schedule(periph, priority); return; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189156 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 10:50:59 2009 New Revision: 189156 URL: http://svn.freebsd.org/changeset/base/189156 Log: MFC r187247. Add missing 'break' statement. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Found with: Coverity Prevent(tm) CID: 3667 Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_sg.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_sg.c == --- stable/7/sys/cam/scsi/scsi_sg.c Sat Feb 28 10:48:11 2009 (r189155) +++ stable/7/sys/cam/scsi/scsi_sg.c Sat Feb 28 10:50:59 2009 (r189156) @@ -941,6 +941,7 @@ sg_scsiio_status(struct ccb_scsiio *csio case CAM_DEV_NOT_THERE: *hoststat = DID_BAD_TARGET; *drvstat = 0; + break; case CAM_SEL_TIMEOUT: *hoststat = DID_NO_CONNECT; *drvstat = 0; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189157 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 10:53:20 2009 New Revision: 189157 URL: http://svn.freebsd.org/changeset/base/189157 Log: MFC r187649: Guard against NULL pointer dereference. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Found with: Coverity Prevent(tm) CID: 130 Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_periph.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_periph.c == --- stable/7/sys/cam/cam_periph.c Sat Feb 28 10:50:59 2009 (r189156) +++ stable/7/sys/cam/cam_periph.c Sat Feb 28 10:53:20 2009 (r189157) @@ -171,6 +171,10 @@ cam_periph_alloc(periph_ctor_t *periph_c break; } xpt_unlock_buses(); + if (p_drv == NULL) { + printf("cam_periph_alloc: invalid periph name '%s'\n", name); + return (CAM_REQ_INVALID); + } sim = xpt_path_sim(path); path_id = xpt_path_path_id(path); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189158 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 10:59:48 2009 New Revision: 189158 URL: http://svn.freebsd.org/changeset/base/189158 Log: MFC r187650: Guard against NULL pointer dereference. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Found with: Coverity Prevent(tm) CID: 1847 Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:53:20 2009(r189157) +++ stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:59:48 2009(r189158) @@ -4177,7 +4177,10 @@ xpt_path_string(struct cam_path *path, c { struct sbuf sb; - mtx_assert(path->bus->sim->mtx, MA_OWNED); +#ifdef INVARIANTS + if (path != NULL && path->bus != NULL && path->bus->sim != NULL) + mtx_assert(path->bus->sim->mtx, MA_OWNED); +#endif sbuf_new(&sb, str, str_len, 0); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189159 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 11:03:24 2009 New Revision: 189159 URL: http://svn.freebsd.org/changeset/base/189159 Log: MFC r187651: Don't leak memory when alloc fails. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Found with: Coverity Prevent(tm) CID: 2908 Modified: stable/7/sys/ (props changed) stable/7/sys/cam/scsi/scsi_low.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/scsi/scsi_low.c == --- stable/7/sys/cam/scsi/scsi_low.cSat Feb 28 10:59:48 2009 (r189158) +++ stable/7/sys/cam/scsi/scsi_low.cSat Feb 28 11:03:24 2009 (r189159) @@ -966,16 +966,16 @@ scsi_low_rescan_bus_cam(slp) struct scsi_low_softc *slp; { struct cam_path *path; - union ccb *ccb = xpt_alloc_ccb(); + union ccb *ccb; cam_status status; - bzero(ccb, sizeof(union ccb)); - status = xpt_create_path(&path, xpt_periph, cam_sim_path(slp->sl_si.sim), -1, 0); if (status != CAM_REQ_CMP) return; + ccb = xpt_alloc_ccb(); + bzero(ccb, sizeof(union ccb)); xpt_setup_ccb(&ccb->ccb_h, path, 5); ccb->ccb_h.func_code = XPT_SCAN_BUS; ccb->ccb_h.cbfcnp = scsi_low_cam_rescan_callback; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189160 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 11:09:27 2009 New Revision: 189160 URL: http://svn.freebsd.org/changeset/base/189160 Log: MFC r187652: Protect against NULL pointer dereference. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sat Feb 28 11:03:24 2009(r189159) +++ stable/7/sys/cam/cam_xpt.c Sat Feb 28 11:09:27 2009(r189160) @@ -5194,6 +5194,11 @@ xpt_scan_bus(struct cam_periph *periph, /* Save some state for use while we probe for devices */ scan_info = (xpt_scan_bus_info *) malloc(sizeof(xpt_scan_bus_info), M_CAMXPT, M_NOWAIT); + if (scan_info == NULL) { + request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + xpt_done(request_ccb); + return; + } scan_info->request_ccb = request_ccb; scan_info->cpi = &work_ccb->cpi; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189161 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: trasz Date: Sat Feb 28 11:11:38 2009 New Revision: 189161 URL: http://svn.freebsd.org/changeset/base/189161 Log: MFC r188345: Remove an overzealous check. Submitted by: das Reviewed by: scottl Approved by: rwatson (mentor, implicit) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sat Feb 28 11:09:27 2009(r189160) +++ stable/7/sys/cam/cam_xpt.c Sat Feb 28 11:11:38 2009(r189161) @@ -4178,7 +4178,7 @@ xpt_path_string(struct cam_path *path, c struct sbuf sb; #ifdef INVARIANTS - if (path != NULL && path->bus != NULL && path->bus->sim != NULL) + if (path != NULL && path->bus != NULL) mtx_assert(path->bus->sim->mtx, MA_OWNED); #endif ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189162 - in stable/7/sys: . contrib/pf dev/cxgb geom
Author: trasz Date: Sat Feb 28 11:16:57 2009 New Revision: 189162 URL: http://svn.freebsd.org/changeset/base/189162 Log: MFC r186188: Implement g_vfs_orphan(). Without it, the filesystem never closes the device, which means refcount on periph drivers never drops, which means cam_sim_free() never returns, which results in umass sleeping there ad infinitum. Submitted by: pjd Reviewed by: scottl, pjd Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/geom/geom_vfs.c Modified: stable/7/sys/geom/geom_vfs.c == --- stable/7/sys/geom/geom_vfs.cSat Feb 28 11:11:38 2009 (r189161) +++ stable/7/sys/geom/geom_vfs.cSat Feb 28 11:16:57 2009 (r189162) @@ -93,10 +93,23 @@ g_vfs_strategy(struct bufobj *bo, struct { struct g_consumer *cp; struct bio *bip; + int vfslocked; cp = bo->bo_private; G_VALID_CONSUMER(cp); + /* +* If the the provider has orphaned us, just return EXIO. +*/ + if (cp->provider == NULL) { + bp->b_error = ENXIO; + bp->b_ioflags |= BIO_ERROR; + vfslocked = VFS_LOCK_GIANT(((struct mount *)NULL)); + bufdone(bp); + VFS_UNLOCK_GIANT(vfslocked); + return; + } + bip = g_alloc_bio(); bip->bio_cmd = bp->b_iocmd; bip->bio_offset = bp->b_iooffset; @@ -110,18 +123,20 @@ g_vfs_strategy(struct bufobj *bo, struct static void g_vfs_orphan(struct g_consumer *cp) { + struct g_geom *gp; + struct bufobj *bo; + + g_topology_assert(); + + gp = cp->geom; + bo = gp->softc; + g_trace(G_T_TOPOLOGY, "g_vfs_orphan(%p(%s))", cp, gp->name); + if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) + g_access(cp, -cp->acr, -cp->acw, -cp->ace); + g_detach(cp); /* -* Don't do anything here yet. -* -* Ideally we should detach the consumer already now, but that -* leads to a locking requirement in the I/O path to see if we have -* a consumer or not. Considering how ugly things are going to get -* anyway as none of our filesystems are graceful about i/o errors, -* this is not important right now. -* -* Down the road, this is the place where we could give the user -* a "Abort, Retry or Ignore" option to replace the media again. +* Do not destroy the geom. Filesystem will do this during unmount. */ } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189163 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb geom
Author: trasz Date: Sat Feb 28 11:19:02 2009 New Revision: 189163 URL: http://svn.freebsd.org/changeset/base/189163 Log: MFC r187053: Prevent a panic that happens on SMP machines when removing a disk with many writes queued up. Reviewed by: phk, scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/geom/geom_vfs.c Modified: stable/7/sys/geom/geom_vfs.c == --- stable/7/sys/geom/geom_vfs.cSat Feb 28 11:16:57 2009 (r189162) +++ stable/7/sys/geom/geom_vfs.cSat Feb 28 11:19:02 2009 (r189163) @@ -71,6 +71,16 @@ g_vfs_done(struct bio *bip) struct buf *bp; int vfslocked; + /* +* Provider ('bio_to') could have withered away sometime +* between incrementing the 'nend' in g_io_deliver() and now, +* making 'bio_to' a dangling pointer. We cannot do that +* in g_wither_geom(), as it would require going over +* the 'g_bio_run_up' list, resetting the pointer. +*/ + if (bip->bio_from->provider == NULL) + bip->bio_to = NULL; + if (bip->bio_error) { printf("g_vfs_done():"); g_print_bio(bip); @@ -136,7 +146,7 @@ g_vfs_orphan(struct g_consumer *cp) g_detach(cp); /* -* Do not destroy the geom. Filesystem will do this during unmount. +* Do not destroy the geom. Filesystem will do that during unmount. */ } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189164 - stable/7/share/man/man4
Author: trasz Date: Sat Feb 28 11:20:37 2009 New Revision: 189164 URL: http://svn.freebsd.org/changeset/base/189164 Log: MFC r188916: Fix a typo and add manpage links to geom(4). Approved by: rwatson (mentor) Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/geom.4 stable/7/share/man/man4/igb.4 (props changed) Modified: stable/7/share/man/man4/geom.4 == --- stable/7/share/man/man4/geom.4 Sat Feb 28 11:19:02 2009 (r189163) +++ stable/7/share/man/man4/geom.4 Sat Feb 28 11:20:37 2009 (r189164) @@ -249,7 +249,7 @@ It will explicitly close (i.e.: zero the which will propagate all the way down through the mesh. It will then detach and destroy its geom. .It -The geom whose provider is now attached will destroy the provider, +The geom whose provider is now detached will destroy the provider, detach and destroy its consumer and destroy its geom. .It This process percolates all the way down through the mesh, until @@ -431,6 +431,18 @@ This is unused at this time. .It 0x80 Pq Dv G_F_CTLDUMP Dump contents of gctl requests. .El +.Sh SEE ALSO +.Xr disk 9 , +.Xr DECLARE_GEOM_CLASS 9 , +.Xr g_access 9 , +.Xr g_attach 9 , +.Xr g_bio 9 , +.Xr g_consumer 9 , +.Xr g_data 9 , +.Xr g_event 9 , +.Xr g_geom 9 , +.Xr g_provider 9 , +.Xr g_provider_by_name 9 .Sh HISTORY This software was developed for the .Fx ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189165 - stable/7/share/man/man9
Author: trasz Date: Sat Feb 28 11:22:09 2009 New Revision: 189165 URL: http://svn.freebsd.org/changeset/base/189165 Log: MFC r188917: Mention disk_gone() in disk(9). Approved by: rwatson (mentor) Modified: stable/7/share/man/man9/ (props changed) stable/7/share/man/man9/Makefile stable/7/share/man/man9/disk.9 Modified: stable/7/share/man/man9/Makefile == --- stable/7/share/man/man9/MakefileSat Feb 28 11:20:37 2009 (r189164) +++ stable/7/share/man/man9/MakefileSat Feb 28 11:22:09 2009 (r189165) @@ -559,7 +559,9 @@ MLINKS+=devstat.9 devicestat.9 \ devstat.9 devstat_end_transaction.9 \ devstat.9 devstat_remove_entry.9 \ devstat.9 devstat_start_transaction.9 -MLINKS+=disk.9 disk_create.9 \ +MLINKS+=disk.9 disk_alloc.9 \ + disk.9 disk_create.9 \ + disk.9 disk_gone.9 \ disk.9 disk_destroy.9 MLINKS+=domain.9 DOMAIN_SET.9 \ domain.9 net_add_domain.9 \ Modified: stable/7/share/man/man9/disk.9 == --- stable/7/share/man/man9/disk.9 Sat Feb 28 11:20:37 2009 (r189164) +++ stable/7/share/man/man9/disk.9 Sat Feb 28 11:22:09 2009 (r189165) @@ -40,6 +40,8 @@ .Ft void .Fn disk_create "struct disk *disk" "int version" .Ft void +.Fn disk_gone "struct disk *disk" +.Ft void .Fn disk_destroy "struct disk *disk" .Sh DESCRIPTION The disk storage API permits kernel device drivers providing access to @@ -65,6 +67,11 @@ function, fill in the fields and call .Fn disk_create when the device is ready to service requests. +.Fn disk_gone +orphans all of the providers associated with the drive, setting an error +condition of ENXIO in each one. +In addition, it prevents a re-taste on last close for writing if an error +condition has been set in the provider. After calling .Fn disk_destroy , the device driver is not allowed to access the contents of ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189166 - head/sys/dev/ata
Author: mav Date: Sat Feb 28 11:25:05 2009 New Revision: 189166 URL: http://svn.freebsd.org/changeset/base/189166 Log: Rework device probing by moving ata_getparam() call from ata_identify() to drivers' probe routines. It allows not to sleep and so not drop Giant inside ata_identify() critical section and so avoid crash if it reentered on request timeout. Reentering of probe call checked inside of it. Give device own knowledge about it's type (ata/atapi/atapicam). It is not a good idea to ask channel status for device type inside ata_getparam(). Add softc memory deallocation on device destruction. Modified: head/sys/dev/ata/ata-all.c head/sys/dev/ata/ata-all.h head/sys/dev/ata/ata-disk.c head/sys/dev/ata/atapi-cam.c head/sys/dev/ata/atapi-cd.c head/sys/dev/ata/atapi-fd.c head/sys/dev/ata/atapi-tape.c Modified: head/sys/dev/ata/ata-all.c == --- head/sys/dev/ata/ata-all.c Sat Feb 28 11:22:09 2009(r189165) +++ head/sys/dev/ata/ata-all.c Sat Feb 28 11:25:05 2009(r189166) @@ -61,7 +61,6 @@ static struct cdevsw ata_cdevsw = { /* prototypes */ static void ata_boot_attach(void); -static device_t ata_add_child(device_t, struct ata_device *, int); static void ata_conn_event(void *, int); static void bswap(int8_t *, int); static void btrim(int8_t *, int); @@ -180,7 +179,7 @@ ata_detach(device_t dev) if (!device_get_children(dev, &children, &nchildren)) { for (i = 0; i < nchildren; i++) if (children[i]) - device_delete_child(dev, children[i]); + ata_delete_child(dev, children[i]); free(children, M_TEMP); } taskqueue_drain(taskqueue_thread, &ch->conntask); @@ -265,7 +264,7 @@ ata_reinit(device_t dev) ata_finish(request); request = NULL; } - device_delete_child(dev, children[i]); + ata_delete_child(dev, children[i]); } } free(children, M_TEMP); @@ -590,19 +589,44 @@ ata_boot_attach(void) /* * misc support functions */ -static device_t -ata_add_child(device_t parent, struct ata_device *atadev, int unit) +device_t +ata_add_child(device_t parent, int unit, int atapi) { +struct ata_device *atadev; device_t child; +int dev_unit = -1; -if ((child = device_add_child(parent, NULL, unit))) { +#ifdef ATA_STATIC_ID +if (!atapi) + dev_unit = (device_get_unit(parent) << 1) + unit; +#endif +if ((child = device_add_child(parent, NULL, dev_unit))) { + if (!(atadev = malloc(sizeof(struct ata_device), + M_ATA, M_NOWAIT | M_ZERO))) { + device_printf(parent, "out of memory\n"); + device_delete_child(parent, child); + return (NULL); + } device_set_softc(child, atadev); device_quiet(child); atadev->dev = child; + atadev->unit = unit; + atadev->type = atapi ? ATA_T_ATAPI : ATA_T_ATA; atadev->max_iosize = DEV_BSIZE; atadev->mode = ATA_PIO_MAX; } -return child; +return (child); +} + +int +ata_delete_child(device_t parent, device_t child) +{ +struct ata_device *atadev = device_get_softc(child); +int res; + +res = device_delete_child(parent, child); +free(atadev, M_ATA); +return (res); } int @@ -613,11 +637,11 @@ ata_getparam(struct ata_device *atadev, u_int8_t command = 0; int error = ENOMEM, retries = 2; -if (ch->devices & (ATA_ATA_MASTER << atadev->unit)) +if (atadev->type == ATA_T_ATA) command = ATA_ATA_IDENTIFY; -if (ch->devices & (ATA_ATAPI_MASTER << atadev->unit)) +else if (atadev->type == ATA_T_ATAPI) command = ATA_ATAPI_IDENTIFY; -if (!command) +else return ENXIO; while (retries-- > 0 && error) { @@ -663,17 +687,18 @@ ata_getparam(struct ata_device *atadev, btrim(atacap->serial, sizeof(atacap->serial)); bpack(atacap->serial, atacap->serial, sizeof(atacap->serial)); - if (bootverbose) - printf("ata%d-%s: pio=%s wdma=%s udma=%s cable=%s wire\n", + if (init) { + char buffer[64]; + + if (bootverbose) { + printf("ata%d-%s: pio=%s wdma=%s udma=%s cable=%s wire\n", device_get_unit(ch->dev), ata_unit2str(atadev), ata_mode2str(ata_pmode(atacap)), ata_mode2str(ata_wmode(atacap)), ata_mode2str(ata_umode(atacap)), (atacap->hwres & ATA_CABLE_ID) ? "80":"40"); - - if (init) { - char buffer[64]; + } sprintf(buffer, "%.40s/%.8s", atacap->model, atacap->revision); device_set_desc_copy(atadev->dev, buffer); @@ -706,7 +731,6 @@ ata_identify(device_t dev) struct ata_channel *ch = device_get_softc(dev); struct ata_device *atadev;
svn commit: r189167 - head/sys/kern
Author: ed Date: Sat Feb 28 14:20:26 2009 New Revision: 189167 URL: http://svn.freebsd.org/changeset/base/189167 Log: Replace bcopy() calls inside the TTY layer with memcpy()/strlcpy(). In all these cases the buffers never overlap. Program names are also likely to be shorter, so use a regular strlcpy() to copy p_comm. Modified: head/sys/kern/tty.c head/sys/kern/tty_info.c head/sys/kern/tty_pts.c Modified: head/sys/kern/tty.c == --- head/sys/kern/tty.c Sat Feb 28 11:25:05 2009(r189166) +++ head/sys/kern/tty.c Sat Feb 28 14:20:26 2009(r189167) @@ -724,14 +724,14 @@ ttyil_ioctl(struct cdev *dev, u_long cmd switch (cmd) { case TIOCGETA: /* Obtain terminal flags through tcgetattr(). */ - bcopy(dev->si_drv2, data, sizeof(struct termios)); + memcpy(data, dev->si_drv2, sizeof(struct termios)); break; case TIOCSETA: /* Set terminal flags through tcsetattr(). */ error = priv_check(td, PRIV_TTY_SETA); if (error) break; - bcopy(data, dev->si_drv2, sizeof(struct termios)); + memcpy(dev->si_drv2, data, sizeof(struct termios)); break; case TIOCGETD: *(int *)data = TTYDISC; @@ -769,7 +769,7 @@ tty_init_termios(struct tty *tp) t->c_oflag = TTYDEF_OFLAG; t->c_ispeed = TTYDEF_SPEED; t->c_ospeed = TTYDEF_SPEED; - bcopy(ttydefchars, &t->c_cc, sizeof ttydefchars); + memcpy(&t->c_cc, ttydefchars, sizeof ttydefchars); tp->t_termios_init_out = *t; } @@ -1344,7 +1344,7 @@ tty_generic_ioctl(struct tty *tp, u_long return (0); case TIOCGETA: /* Obtain terminal flags through tcgetattr(). */ - bcopy(&tp->t_termios, data, sizeof(struct termios)); + memcpy(data, &tp->t_termios, sizeof(struct termios)); return (0); case TIOCSETA: case TIOCSETAW: @@ -1399,7 +1399,7 @@ tty_generic_ioctl(struct tty *tp, u_long tp->t_termios.c_iflag = t->c_iflag; tp->t_termios.c_oflag = t->c_oflag; tp->t_termios.c_lflag = t->c_lflag; - bcopy(t->c_cc, &tp->t_termios.c_cc, sizeof(t->c_cc)); + memcpy(&tp->t_termios.c_cc, t->c_cc, sizeof t->c_cc); ttydisc_optimize(tp); @@ -1568,13 +1568,13 @@ tty_generic_ioctl(struct tty *tp, u_long return (0); case TIOCGWINSZ: /* Obtain window size. */ - bcopy(&tp->t_winsize, data, sizeof(struct winsize)); + memcpy(data, &tp->t_winsize, sizeof(struct winsize)); return (0); case TIOCSWINSZ: /* Set window size. */ if (bcmp(&tp->t_winsize, data, sizeof(struct winsize)) == 0) return (0); - bcopy(data, &tp->t_winsize, sizeof(struct winsize)); + memcpy(&tp->t_winsize, data, sizeof(struct winsize)); tty_signal_pgrp(tp, SIGWINCH); return (0); case TIOCEXCL: Modified: head/sys/kern/tty_info.c == --- head/sys/kern/tty_info.cSat Feb 28 11:25:05 2009(r189166) +++ head/sys/kern/tty_info.cSat Feb 28 14:20:26 2009(r189167) @@ -299,7 +299,7 @@ tty_info(struct tty *tp) PGRP_UNLOCK(tp->t_pgrp); rufetchcalc(pick, &ru, &utime, &stime); pid = pick->p_pid; - bcopy(pick->p_comm, comm, sizeof(comm)); + strlcpy(comm, pick->p_comm, sizeof comm); PROC_UNLOCK(pick); /* Print command, pid, state, utime, stime, %cpu, and rss. */ Modified: head/sys/kern/tty_pts.c == --- head/sys/kern/tty_pts.c Sat Feb 28 11:25:05 2009(r189166) +++ head/sys/kern/tty_pts.c Sat Feb 28 14:20:26 2009(r189167) @@ -310,7 +310,7 @@ ptsdev_ioctl(struct file *fp, u_long cmd case TIOCGETA: /* Obtain terminal flags through tcgetattr(). */ tty_lock(tp); - bcopy(&tp->t_termios, data, sizeof(struct termios)); + memcpy(data, &tp->t_termios, sizeof(struct termios)); tty_unlock(tp); return (0); #endif /* PTS_LINUX */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189168 - head/usr.bin/nl
Author: das Date: Sat Feb 28 15:53:36 2009 New Revision: 189168 URL: http://svn.freebsd.org/changeset/base/189168 Log: Use getline() instead of fgets(). This enables nl(1) to handle arbitrarily long lines and embedded NULs. The new functionality is nugatory, but adding it is a simple way to improve the exposure of getline() in -CURRENT. Modified: head/usr.bin/nl/nl.c Modified: head/usr.bin/nl/nl.c == --- head/usr.bin/nl/nl.cSat Feb 28 14:20:26 2009(r189167) +++ head/usr.bin/nl/nl.cSat Feb 28 15:53:36 2009(r189168) @@ -42,6 +42,7 @@ __COPYRIGHT( __RCSID("$FreeBSD$"); #endif +#define_WITH_GETLINE #include #include @@ -98,12 +99,6 @@ static void parse_numbering(const char * static voidusage(void); /* - * Pointer to dynamically allocated input line buffer, and its size. - */ -static char *buffer; -static size_t buffersize; - -/* * Dynamically allocated buffer suitable for string representation of ints. */ static char *intbuffer; @@ -269,14 +264,6 @@ main(argc, argv) memcpy(delim + delim1len, delim2, delim2len); delimlen = delim1len + delim2len; - /* Determine the maximum input line length to operate on. */ - if ((val = sysconf(_SC_LINE_MAX)) == -1) /* ignore errno */ - val = LINE_MAX; - /* Allocate sufficient buffer space (including the terminating NUL). */ - buffersize = (size_t)val + 1; - if ((buffer = malloc(buffersize)) == NULL) - err(EXIT_FAILURE, "cannot allocate input line buffer"); - /* Allocate a buffer suitable for preformatting line number. */ intbuffersize = max(INT_STRLEN_MAXIMUM, width) + 1; /* NUL */ if ((intbuffer = malloc(intbuffersize)) == NULL) @@ -292,6 +279,9 @@ main(argc, argv) static void filter() { + char *buffer; + size_t buffersize; + ssize_t linelen; int line; /* logical line number */ int section;/* logical page section */ unsigned int adjblank; /* adjacent blank lines */ @@ -302,21 +292,23 @@ filter() line = startnum; section = BODY; - while (fgets(buffer, (int)buffersize, stdin) != NULL) { + buffer = NULL; + buffersize = 0; + while ((linelen = getline(&buffer, &buffersize, stdin)) > 0) { for (idx = FOOTER; idx <= NP_LAST; idx++) { /* Does it look like a delimiter? */ + if (delimlen * (idx + 1) > linelen) + break; if (memcmp(buffer + delimlen * idx, delim, - delimlen) == 0) { - /* Was this the whole line? */ - if (buffer[delimlen * (idx + 1)] == '\n') { - section = idx; - adjblank = 0; - if (restart) - line = startnum; - goto nextline; - } - } else { + delimlen) != 0) break; + /* Was this the whole line? */ + if (buffer[delimlen * (idx + 1)] == '\n') { + section = idx; + adjblank = 0; + if (restart) + line = startnum; + goto nextline; } } @@ -354,7 +346,8 @@ filter() } else { (void)printf("%*s", width, ""); } - (void)printf("%s%s", sep, buffer); + (void)fputs(sep, stdout); + (void)fwrite(buffer, linelen, 1, stdout); if (ferror(stdout)) err(EXIT_FAILURE, "output error"); @@ -364,6 +357,8 @@ nextline: if (ferror(stdin)) err(EXIT_FAILURE, "input error"); + + free(buffer); } /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189169 - head/usr.bin/newkey
Author: ed Date: Sat Feb 28 16:16:37 2009 New Revision: 189169 URL: http://svn.freebsd.org/changeset/base/189169 Log: Fix compilation of newkey(8) with WITHOUT_NIS=yes. Increasing WARNS seems to have broken compilation of this utility. Instead of lowering WARNS, just fix to code to compile properly. Submitted by: Tested by:bms Modified: head/usr.bin/newkey/newkey.c head/usr.bin/newkey/update.c Modified: head/usr.bin/newkey/newkey.c == --- head/usr.bin/newkey/newkey.cSat Feb 28 15:53:36 2009 (r189168) +++ head/usr.bin/newkey/newkey.cSat Feb 28 16:16:37 2009 (r189169) @@ -87,7 +87,7 @@ static char YPDBPATH[]="/var/yp"; static char PKMAP[] = "publickey.byname"; #else static char PKFILE[] = "/etc/publickey"; -static char *err_string(); +static const char *err_string(int); #endif /* YP */ static void usage(void); @@ -199,10 +199,10 @@ setpublicmap(char *name, char *public, c * to an input error code. An input value of zero will return * a success message. */ -static char * +static const char * err_string(int code) { - char *pmesg; + const char *pmesg; switch (code) { case 0: Modified: head/usr.bin/newkey/update.c == --- head/usr.bin/newkey/update.cSat Feb 28 15:53:36 2009 (r189168) +++ head/usr.bin/newkey/update.cSat Feb 28 16:16:37 2009 (r189169) @@ -70,11 +70,7 @@ __FBSDID("$FreeBSD$"); static char SHELL[] = "/bin/sh"; static char YPDBPATH[]="/var/yp"; /* This is defined but not used! */ static char UPDATEFILE[] = "updaters"; -#else -static char PKFILE[] = "/etc/publickey"; -#endif /* YP */ -#ifdef YP static int _openchild(char *, FILE **, FILE **); static char *basename(char *path); @@ -238,8 +234,8 @@ static int match(char *, char *); * the local file and then shuts up. */ int -localupdate(char *name, char *filename, u_int op, u_int keylen, -char *key, u_int datalen, char *data) +localupdate(char *name, char *filename, u_int op, u_int keylen __unused, +char *key, u_int datalen __unused, char *data) { char line[256]; FILE *rf; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189170 - in head/sys: cddl/compat/opensolaris/sys conf gnu/fs/xfs/FreeBSD libkern net80211 netgraph netgraph/atm/uni powerpc/booke sys xdr
Author: ed Date: Sat Feb 28 16:21:25 2009 New Revision: 189170 URL: http://svn.freebsd.org/changeset/base/189170 Log: Add memmove() to the kernel, making the kernel compile with Clang. When copying big structures, LLVM generates calls to memmove(), because it may not be able to figure out whether structures overlap. This caused linker errors to occur. memmove() is now implemented using bcopy(). Ideally it would be the other way around, but that can be solved in the future. On ARM we don't do add anything, because it already has memmove(). Discussed on: arch@ Reviewed by: rdivacky Added: head/sys/libkern/memmove.c (contents, props changed) Modified: head/sys/cddl/compat/opensolaris/sys/sysmacros.h head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.ia64 head/sys/conf/files.mips head/sys/conf/files.pc98 head/sys/conf/files.powerpc head/sys/conf/files.sparc64 head/sys/conf/files.sun4v head/sys/gnu/fs/xfs/FreeBSD/xfs_compat.h head/sys/net80211/ieee80211_freebsd.h head/sys/netgraph/atm/uni/ng_uni_cust.h head/sys/netgraph/ng_l2tp.c head/sys/powerpc/booke/pmap.c head/sys/sys/systm.h head/sys/xdr/xdr_mem.c Modified: head/sys/cddl/compat/opensolaris/sys/sysmacros.h == --- head/sys/cddl/compat/opensolaris/sys/sysmacros.hSat Feb 28 16:16:37 2009(r189169) +++ head/sys/cddl/compat/opensolaris/sys/sysmacros.hSat Feb 28 16:21:25 2009(r189170) @@ -97,10 +97,6 @@ extern "C" { #defineP2SAMEHIGHBIT_TYPED(x, y, type) \ (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) -#ifdef _KERNEL -#definememmove(dst, src, size) bcopy((src), (dst), (size)) -#endif - /* * Find highest one bit set. * Returns bit number + 1 of highest bit that is set, otherwise returns 0. Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Sat Feb 28 16:16:37 2009(r189169) +++ head/sys/conf/files.amd64 Sat Feb 28 16:21:25 2009(r189170) @@ -271,4 +271,5 @@ i386/cpufreq/powernow.c optionalcpufre i386/cpufreq/est.c optionalcpufreq i386/cpufreq/p4tcc.c optionalcpufreq # +libkern/memmove.c standard libkern/memset.c standard Modified: head/sys/conf/files.i386 == --- head/sys/conf/files.i386Sat Feb 28 16:16:37 2009(r189169) +++ head/sys/conf/files.i386Sat Feb 28 16:21:25 2009(r189170) @@ -366,6 +366,7 @@ kern/imgact_gzip.c optional gzip libkern/divdi3.c standard libkern/ffsl.c standard libkern/flsl.c standard +libkern/memmove.c standard libkern/memset.c standard libkern/moddi3.c standard libkern/qdivrem.c standard Modified: head/sys/conf/files.ia64 == --- head/sys/conf/files.ia64Sat Feb 28 16:16:37 2009(r189169) +++ head/sys/conf/files.ia64Sat Feb 28 16:21:25 2009(r189170) @@ -130,4 +130,5 @@ libkern/ia64/__umoddi3.Sstandard libkern/ia64/__umodsi3.S standard libkern/ia64/bswap16.S standard libkern/ia64/bswap32.S standard +libkern/memmove.c standard libkern/memset.c standard Modified: head/sys/conf/files.mips == --- head/sys/conf/files.mipsSat Feb 28 16:16:37 2009(r189169) +++ head/sys/conf/files.mipsSat Feb 28 16:21:25 2009(r189170) @@ -82,6 +82,7 @@ libkern/ffsl.cstandard libkern/fls.c standard libkern/flsl.c standard libkern/lshrdi3.c standard +libkern/memmove.c standard libkern/moddi3.c standard libkern/qdivrem.c standard libkern/udivdi3.c standard Modified: head/sys/conf/files.pc98 == --- head/sys/conf/files.pc98Sat Feb 28 16:16:37 2009(r189169) +++ head/sys/conf/files.pc98Sat Feb 28 16:21:25 2009(r189170) @@ -224,6 +224,7 @@ kern/imgact_gzip.c optional gzip libkern/divdi3.c standard libkern/ffsl.c standard libkern/flsl.c standard +libkern/memmove.c standard libkern/memset.c standard libkern/moddi3.c standard libkern/qdivrem.c standard Modified: head/sys/conf/files.powerpc == --- head/sys/conf/files.powerpc Sat Feb 28 16:16:37 2009(r189169) +++ head/sys/co
svn commit: r189171 - svnadmin/conf
Author: ed Date: Sat Feb 28 17:01:55 2009 New Revision: 189171 URL: http://svn.freebsd.org/changeset/base/189171 Log: As discussed with kib, make myself rdivacky's co-mentor. Roman is one of the LLVM guys, so I guess it would speed up the procedurs if I could just approve his work, to save some roundtrips. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Sat Feb 28 16:21:25 2009(r189170) +++ svnadmin/conf/mentors Sat Feb 28 17:01:55 2009(r189171) @@ -15,7 +15,7 @@ cbzimmer sam erimlaier Co-mentor: thompsa jamie bz Co-mentor: brooks phokib -rdivacky kib +rdivacky kib Co-mentor: ed remko imp sbruno scottl sson jb ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189172 - head/sys/dev/usb
Author: thompsa Date: Sat Feb 28 17:14:03 2009 New Revision: 189172 URL: http://svn.freebsd.org/changeset/base/189172 Log: - Remove the usb interface number from the device nodes as it is not needed. - Do not recreate the device nodes in set_alt_interface as the endpoints do not change. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_dev.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h Modified: head/sys/dev/usb/usb_dev.c == --- head/sys/dev/usb/usb_dev.c Sat Feb 28 17:01:55 2009(r189171) +++ head/sys/dev/usb/usb_dev.c Sat Feb 28 17:14:03 2009(r189172) @@ -82,7 +82,7 @@ static intusb2_fifo_uiomove(struct usb2 static voidusb2_fifo_check_methods(struct usb2_fifo_methods *); static struct usb2_fifo *usb2_fifo_alloc(void); static struct usb2_pipe *usb2_dev_get_pipe(struct usb2_device *, uint8_t, - uint8_t, uint8_t); + uint8_t); static voidusb2_loc_fill(struct usb2_fs_privdata *, struct usb2_cdev_privdata *); static voidusb2_close(void *); @@ -140,7 +140,6 @@ usb2_loc_fill(struct usb2_fs_privdata* p { cpd->bus_index = pd->bus_index; cpd->dev_index = pd->dev_index; - cpd->iface_index = pd->iface_index; cpd->ep_addr = pd->ep_addr; cpd->fifo_index = pd->fifo_index; } @@ -238,19 +237,6 @@ usb2_ref_device(struct usb2_cdev_privdat } } - /* check if we require an interface */ - cpd->iface = usb2_get_iface(cpd->udev, cpd->iface_index); - if (dev_ep_index != 0) { - /* non control endpoint - we need an interface */ - if (cpd->iface == NULL) { - DPRINTFN(2, "no iface\n"); - goto error; - } - if (cpd->iface->idesc == NULL) { - DPRINTFN(2, "no idesc\n"); - goto error; - } - } /* when everything is OK we increment the refcounts */ if (cpd->is_write) { DPRINTFN(2, "ref write\n"); @@ -394,7 +380,6 @@ usb2_fifo_create(struct usb2_cdev_privda struct usb2_device *udev = cpd->udev; struct usb2_fifo *f; struct usb2_pipe *pipe; - uint8_t iface_index = cpd->iface_index; uint8_t n; uint8_t is_tx; uint8_t is_rx; @@ -449,11 +434,6 @@ usb2_fifo_create(struct usb2_cdev_privda /* wrong endpoint index */ continue; } - if (ep != 0 && - f->iface_index != iface_index) { - /* wrong interface index */ - continue; - } if (f->opened) { /* FIFO is opened */ is_busy = 1; @@ -471,11 +451,6 @@ usb2_fifo_create(struct usb2_cdev_privda /* wrong endpoint index */ continue; } - if (ep != 0 && - f->iface_index != iface_index) { - /* wrong interface index */ - continue; - } if (f->opened) { /* FIFO is opened */ is_busy = 1; @@ -499,8 +474,8 @@ usb2_fifo_create(struct usb2_cdev_privda if (is_tx && (udev->fifo[n + USB_FIFO_TX] == NULL)) { pipe = usb2_dev_get_pipe(udev, - iface_index, ep, USB_FIFO_TX); - DPRINTFN(5, "dev_get_pipe(%d, 0x%x, 0x%x)\n", iface_index, ep, USB_FIFO_TX); + ep, USB_FIFO_TX); + DPRINTFN(5, "dev_get_pipe(%d, 0x%x)\n", ep, USB_FIFO_TX); if (pipe == NULL) { DPRINTFN(5, "dev_get_pipe returned NULL\n"); return (EINVAL); @@ -516,7 +491,7 @@ usb2_fifo_create(struct usb2_cdev_privda f->priv_mtx = udev->default_mtx; f->priv_sc0 = pipe; f->methods = &usb2_ugen_methods; - f->iface_index = iface_index; + f->iface_index = pipe->iface_index; f->udev = udev; mtx_lock(&usb2_ref_lock); udev->fifo[n + USB_FIFO_TX] = f; @@ -527,8 +502,8 @@ usb2_fifo_create(struct usb2_cdev_privda (udev->fifo[n + USB_FIFO_RX] == NULL)) { pipe = usb2_dev_get_pipe(udev, - iface_index, ep, USB_F
svn commit: r189173 - head/sys/dev/usb
Author: thompsa Date: Sat Feb 28 17:20:00 2009 New Revision: 189173 URL: http://svn.freebsd.org/changeset/base/189173 Log: A couple of style nits in the last commit - unwrap short lines - move variable initialisation out of the declaration. Modified: head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_dev.c == --- head/sys/dev/usb/usb_dev.c Sat Feb 28 17:14:03 2009(r189172) +++ head/sys/dev/usb/usb_dev.c Sat Feb 28 17:20:00 2009(r189173) @@ -473,8 +473,7 @@ usb2_fifo_create(struct usb2_cdev_privda /* Check TX FIFO */ if (is_tx && (udev->fifo[n + USB_FIFO_TX] == NULL)) { - pipe = usb2_dev_get_pipe(udev, - ep, USB_FIFO_TX); + pipe = usb2_dev_get_pipe(udev, ep, USB_FIFO_TX); DPRINTFN(5, "dev_get_pipe(%d, 0x%x)\n", ep, USB_FIFO_TX); if (pipe == NULL) { DPRINTFN(5, "dev_get_pipe returned NULL\n"); @@ -501,8 +500,7 @@ usb2_fifo_create(struct usb2_cdev_privda if (is_rx && (udev->fifo[n + USB_FIFO_RX] == NULL)) { - pipe = usb2_dev_get_pipe(udev, - ep, USB_FIFO_RX); + pipe = usb2_dev_get_pipe(udev, ep, USB_FIFO_RX); DPRINTFN(5, "dev_get_pipe(%d, 0x%x)\n", ep, USB_FIFO_RX); if (pipe == NULL) { DPRINTFN(5, "dev_get_pipe returned NULL\n"); @@ -598,8 +596,7 @@ usb2_fifo_free(struct usb2_fifo *f) } static struct usb2_pipe * -usb2_dev_get_pipe(struct usb2_device *udev, -uint8_t ep_index, uint8_t dir) +usb2_dev_get_pipe(struct usb2_device *udev, uint8_t ep_index, uint8_t dir) { struct usb2_pipe *pipe; uint8_t ep_dir; Modified: head/sys/dev/usb/usb_device.c == --- head/sys/dev/usb/usb_device.c Sat Feb 28 17:14:03 2009 (r189172) +++ head/sys/dev/usb/usb_device.c Sat Feb 28 17:20:00 2009 (r189173) @@ -1722,8 +1722,7 @@ usb2_make_dev(struct usb2_device *udev, /* Now, create the device itself */ snprintf(devname, sizeof(devname), "%u.%u.%u", - pd->bus_index, pd->dev_index, - pd->ep_addr); + pd->bus_index, pd->dev_index, pd->ep_addr); pd->cdev = make_dev(&usb2_devsw, 0, UID_ROOT, GID_OPERATOR, 0600, USB_DEVICE_DIR "/%s", devname); pd->cdev->si_drv1 = pd; @@ -1734,7 +1733,7 @@ usb2_make_dev(struct usb2_device *udev, static void usb2_cdev_create(struct usb2_device *udev) { - struct usb2_config_descriptor *cd = usb2_get_config_descriptor(udev); + struct usb2_config_descriptor *cd; struct usb2_endpoint_descriptor *ed; struct usb2_descriptor *desc; struct usb2_fs_privdata* pd; @@ -1762,6 +1761,7 @@ usb2_cdev_create(struct usb2_device *ude * Collect all used endpoint numbers instead of just * generating 16 static endpoints. */ + cd = usb2_get_config_descriptor(udev); while ((desc = usb2_desc_foreach(cd, desc))) { /* filter out all endpoint descriptors */ if ((desc->bDescriptorType == UDESC_ENDPOINT) && ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189193 - svnadmin/conf
Author: kib Date: Sat Feb 28 19:09:36 2009 New Revision: 189193 URL: http://svn.freebsd.org/changeset/base/189193 Log: Welcome Dmitry Chagin. He plan to mostly work on linuxolator at the start. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access == --- svnadmin/conf/accessSat Feb 28 18:03:28 2009(r189192) +++ svnadmin/conf/accessSat Feb 28 19:09:36 2009(r189193) @@ -53,6 +53,7 @@ das davidc davidch davidxu +dchagin dd dds deischen Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Sat Feb 28 18:03:28 2009(r189192) +++ svnadmin/conf/mentors Sat Feb 28 19:09:36 2009(r189193) @@ -12,6 +12,7 @@ # Mentee Mentor Optional comment avgrpaulo Co-mentor: jhb cbzimmer sam +dchaginkib erimlaier Co-mentor: thompsa jamie bz Co-mentor: brooks phokib ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189194 - head/sys/kern
Author: thompsa Date: Sat Feb 28 19:10:43 2009 New Revision: 189194 URL: http://svn.freebsd.org/changeset/base/189194 Log: Move the NORELEASE check to after the recurse count decrement and bailout, this is not counted as actually releasing the lock. Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c == --- head/sys/kern/subr_witness.cSat Feb 28 19:09:36 2009 (r189193) +++ head/sys/kern/subr_witness.cSat Feb 28 19:10:43 2009 (r189194) @@ -1511,12 +1511,6 @@ found: instance->li_line); panic("share->uexcl"); } - if ((instance->li_flags & LI_NORELEASE) != 0 && witness_watch > 0) { - printf("forbidden unlock of (%s) %s @ %s:%d\n", class->lc_name, - lock->lo_name, file, line); - panic("lock marked norelease"); - } - /* If we are recursed, unrecurse. */ if ((instance->li_flags & LI_RECURSEMASK) > 0) { CTR4(KTR_WITNESS, "%s: pid %d unrecursed on %s r=%d", __func__, @@ -1525,6 +1519,12 @@ found: instance->li_flags--; return; } + /* The lock is now being dropped, check for NORELEASE flag */ + if ((instance->li_flags & LI_NORELEASE) != 0 && witness_watch > 0) { + printf("forbidden unlock of (%s) %s @ %s:%d\n", class->lc_name, + lock->lo_name, file, line); + panic("lock marked norelease"); + } /* Otherwise, remove this item from the list. */ s = intr_disable(); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r189193 - svnadmin/conf
On Sat, Feb 28, 2009 at 07:09:37PM +, Konstantin Belousov wrote: > Author: kib > Date: Sat Feb 28 19:09:36 2009 > New Revision: 189193 > URL: http://svn.freebsd.org/changeset/base/189193 > > Log: > Welcome Dmitry Chagin. He plan to mostly work on linuxolator at the start. > > Approved by:core awesome!!! thank you kostik for sponsoring him! ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189195 - head/sys/dev/ata
Author: mav Date: Sat Feb 28 22:07:15 2009 New Revision: 189195 URL: http://svn.freebsd.org/changeset/base/189195 Log: Revert my ata_identify()/ata_reinit() related changes: r189166, r189091 and partially r188903. Revert breaks new drives detection on reinit to the state as it was before me, but fixes series of new bugs reported by some people. Unconditional queueing of ata_completed() calls can lead to deadlock if due to timeout ata_reinit() was called at the same thread by previous ata_completed(). Calling of ata_identify() on ata_reinit() in current implementation opens numerous races and deadlocks. Problems I was touching here are still exist and should be addresed, but probably in different way. Modified: head/sys/dev/ata/ata-all.c head/sys/dev/ata/ata-all.h head/sys/dev/ata/ata-disk.c head/sys/dev/ata/ata-queue.c head/sys/dev/ata/ata-raid.c head/sys/dev/ata/atapi-cam.c head/sys/dev/ata/atapi-cd.c head/sys/dev/ata/atapi-fd.c head/sys/dev/ata/atapi-tape.c Modified: head/sys/dev/ata/ata-all.c == --- head/sys/dev/ata/ata-all.c Sat Feb 28 19:10:43 2009(r189194) +++ head/sys/dev/ata/ata-all.c Sat Feb 28 22:07:15 2009(r189195) @@ -61,6 +61,7 @@ static struct cdevsw ata_cdevsw = { /* prototypes */ static void ata_boot_attach(void); +static device_t ata_add_child(device_t, struct ata_device *, int); static void ata_conn_event(void *, int); static void bswap(int8_t *, int); static void btrim(int8_t *, int); @@ -179,7 +180,7 @@ ata_detach(device_t dev) if (!device_get_children(dev, &children, &nchildren)) { for (i = 0; i < nchildren; i++) if (children[i]) - ata_delete_child(dev, children[i]); + device_delete_child(dev, children[i]); free(children, M_TEMP); } taskqueue_drain(taskqueue_thread, &ch->conntask); @@ -264,7 +265,7 @@ ata_reinit(device_t dev) ata_finish(request); request = NULL; } - ata_delete_child(dev, children[i]); + device_delete_child(dev, children[i]); } } free(children, M_TEMP); @@ -290,7 +291,7 @@ ata_reinit(device_t dev) ATA_LOCKING(dev, ATA_LF_UNLOCK); /* Add new children. */ -ata_identify(dev); +/*ata_identify(dev); */ if (bootverbose) device_printf(dev, "reinit done ..\n"); @@ -589,44 +590,19 @@ ata_boot_attach(void) /* * misc support functions */ -device_t -ata_add_child(device_t parent, int unit, int atapi) +static device_t +ata_add_child(device_t parent, struct ata_device *atadev, int unit) { -struct ata_device *atadev; device_t child; -int dev_unit = -1; -#ifdef ATA_STATIC_ID -if (!atapi) - dev_unit = (device_get_unit(parent) << 1) + unit; -#endif -if ((child = device_add_child(parent, NULL, dev_unit))) { - if (!(atadev = malloc(sizeof(struct ata_device), - M_ATA, M_NOWAIT | M_ZERO))) { - device_printf(parent, "out of memory\n"); - device_delete_child(parent, child); - return (NULL); - } +if ((child = device_add_child(parent, NULL, unit))) { device_set_softc(child, atadev); device_quiet(child); atadev->dev = child; - atadev->unit = unit; - atadev->type = atapi ? ATA_T_ATAPI : ATA_T_ATA; atadev->max_iosize = DEV_BSIZE; atadev->mode = ATA_PIO_MAX; } -return (child); -} - -int -ata_delete_child(device_t parent, device_t child) -{ -struct ata_device *atadev = device_get_softc(child); -int res; - -res = device_delete_child(parent, child); -free(atadev, M_ATA); -return (res); +return child; } int @@ -637,11 +613,11 @@ ata_getparam(struct ata_device *atadev, u_int8_t command = 0; int error = ENOMEM, retries = 2; -if (atadev->type == ATA_T_ATA) +if (ch->devices & (ATA_ATA_MASTER << atadev->unit)) command = ATA_ATA_IDENTIFY; -else if (atadev->type == ATA_T_ATAPI) +if (ch->devices & (ATA_ATAPI_MASTER << atadev->unit)) command = ATA_ATAPI_IDENTIFY; -else +if (!command) return ENXIO; while (retries-- > 0 && error) { @@ -651,7 +627,7 @@ ata_getparam(struct ata_device *atadev, request->timeout = 1; request->retries = 0; request->u.ata.command = command; - request->flags = (ATA_R_READ|ATA_R_AT_HEAD|ATA_R_THREAD); + request->flags = (ATA_R_READ|ATA_R_AT_HEAD|ATA_R_DIRECT); if (!bootverbose) request->flags |= ATA_R_QUIET; request->data = (void *)&atadev->param; @@ -687,18 +663,17 @@ ata_getparam(struct ata_device *atadev, btrim(atacap->serial, sizeof(atacap->serial)); bpack(atacap->serial, atacap->serial, sizeof(atacap->serial)); - if (init) { - char buffer[64]; - - if (
svn commit: r189196 - head/sys/netinet
Author: rwatson Date: Sat Feb 28 22:58:52 2009 New Revision: 189196 URL: http://svn.freebsd.org/changeset/base/189196 Log: Remove unreachable code for generating RST segments from tcp_twcheck(); this code became stale when T/TCP support was removed. Discussed with: bz, sam MFC after:1 month Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c == --- head/sys/netinet/tcp_timewait.c Sat Feb 28 22:07:15 2009 (r189195) +++ head/sys/netinet/tcp_timewait.c Sat Feb 28 22:58:52 2009 (r189196) @@ -333,11 +333,6 @@ tcp_twcheck(struct inpcb *inp, struct tc struct tcptw *tw; int thflags; tcp_seq seq; -#ifdef INET6 - int isipv6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0; -#else - const int isipv6 = 0; -#endif /* tcbinfo lock required for tcp_twclose(), tcp_tw_2msl_reset(). */ INP_INFO_WLOCK_ASSERT(&V_tcbinfo); @@ -417,46 +412,6 @@ tcp_twcheck(struct inpcb *inp, struct tc if (thflags != TH_ACK || tlen != 0 || th->th_seq != tw->rcv_nxt || th->th_ack != tw->snd_nxt) tcp_twrespond(tw, TH_ACK); - goto drop; - - /* -* Generate a RST, dropping incoming segment. -* Make ACK acceptable to originator of segment. -* Don't bother to respond if destination was broadcast/multicast. -*/ - if (m->m_flags & (M_BCAST|M_MCAST)) - goto drop; - if (isipv6) { -#ifdef INET6 - struct ip6_hdr *ip6; - - /* IPv6 anycast check is done at tcp6_input() */ - ip6 = mtod(m, struct ip6_hdr *); - if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || - IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) - goto drop; -#endif - } else { - struct ip *ip; - - ip = mtod(m, struct ip *); - if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || - IN_MULTICAST(ntohl(ip->ip_src.s_addr)) || - ip->ip_src.s_addr == htonl(INADDR_BROADCAST) || - in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) - goto drop; - } - if (thflags & TH_ACK) { - tcp_respond(NULL, - mtod(m, void *), th, m, 0, th->th_ack, TH_RST); - } else { - seq = th->th_seq + (thflags & TH_SYN ? 1 : 0); - tcp_respond(NULL, - mtod(m, void *), th, m, seq, 0, TH_RST|TH_ACK); - } - INP_WUNLOCK(inp); - return (0); - drop: INP_WUNLOCK(inp); m_freem(m); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189204 - head/sys/sys
Author: bms Date: Sun Mar 1 04:57:23 2009 New Revision: 189204 URL: http://svn.freebsd.org/changeset/base/189204 Log: In sys/tree.h: * Add RB_FOREACH_FROM() which continues traversal *at* the y-node provided. There is no pre-increment. * Nuke RB_FOREACH_SAFE as it was buggy; it would omit the final node. * Replace RB_FOREACH_SAFE() with a working implementation derived from RB_FOREACH_FROM(). The key observation is that we now only check the loop-control variable, but still cache the next member pointer. * Add RB_FOREACH_REVERSE_FROM() which continues backwards traversal *at* the y-node provided. There is no pre-increment. Typically this is used to back out of allocations made whilst walking an RB-tree. * Add RB_FOREACH_REVERSE_SAFE() which performs insertion and deletion safe backwards traversal. Modified: head/sys/sys/tree.h Modified: head/sys/sys/tree.h == --- head/sys/sys/tree.h Sun Mar 1 04:49:42 2009(r189203) +++ head/sys/sys/tree.h Sun Mar 1 04:57:23 2009(r189204) @@ -737,9 +737,14 @@ name##_RB_MINMAX(struct name *head, int (x) != NULL; \ (x) = name##_RB_NEXT(x)) +#define RB_FOREACH_FROM(x, name, y)\ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);\ +(x) = (y)) + #define RB_FOREACH_SAFE(x, name, head, y) \ for ((x) = RB_MIN(name, head); \ -(x) != NULL && ((y) = name##_RB_NEXT(x)); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);\ (x) = (y)) #define RB_FOREACH_REVERSE(x, name, head) \ @@ -747,4 +752,14 @@ name##_RB_MINMAX(struct name *head, int (x) != NULL; \ (x) = name##_RB_PREV(x)) +#define RB_FOREACH_REVERSE_FROM(x, name, y)\ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);\ +(x) = (y)) + +#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ + for ((x) = RB_MAX(name, head); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);\ +(x) = (y)) + #endif /* _SYS_TREE_H_ */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189207 - head/lib/libc/stdlib
Author: delphij Date: Sun Mar 1 05:44:28 2009 New Revision: 189207 URL: http://svn.freebsd.org/changeset/base/189207 Log: "-isoC-99" should be spelled without 'c'. Modified: head/lib/libc/stdlib/atol.3 Modified: head/lib/libc/stdlib/atol.3 == --- head/lib/libc/stdlib/atol.3 Sun Mar 1 05:09:34 2009(r189206) +++ head/lib/libc/stdlib/atol.3 Sun Mar 1 05:44:28 2009(r189207) @@ -103,7 +103,7 @@ and is not required by .St -isoC or -.St -isoC-c99 , +.St -isoC-99 , but it is allowed by all of .St -isoC , St -isoC-99 and ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189208 - head/lib/libc/net
Author: delphij Date: Sun Mar 1 05:47:14 2009 New Revision: 189208 URL: http://svn.freebsd.org/changeset/base/189208 Log: Add a missing .El. Modified: head/lib/libc/net/rcmd.3 Modified: head/lib/libc/net/rcmd.3 == --- head/lib/libc/net/rcmd.3Sun Mar 1 05:44:28 2009(r189207) +++ head/lib/libc/net/rcmd.3Sun Mar 1 05:47:14 2009(r189208) @@ -245,6 +245,7 @@ When using the .Fn rcmd function, this variable is used as the program to run instead of .Xr rsh 1 . +.El .Sh DIAGNOSTICS The .Fn rcmd ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189209 - head/sys/sys
Author: das Date: Sun Mar 1 06:27:03 2009 New Revision: 189209 URL: http://svn.freebsd.org/changeset/base/189209 Log: Fix a typo in the previous commit. Submitted by: Mel Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h == --- head/sys/sys/cdefs.hSun Mar 1 05:47:14 2009(r189208) +++ head/sys/sys/cdefs.hSun Mar 1 06:27:03 2009(r189209) @@ -521,7 +521,7 @@ #if _POSIX_C_SOURCE >= 200809 #define__POSIX_VISIBLE 200809 #define__ISO_C_VISIBLE 1999 -#elif _POSIX_C_SOURCE >= 200121 +#elif _POSIX_C_SOURCE >= 200112 #define__POSIX_VISIBLE 200112 #define__ISO_C_VISIBLE 1999 #elif _POSIX_C_SOURCE >= 199506 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189210 - stable/7/sys/cam
Author: scottl Date: Sun Mar 1 06:46:39 2009 New Revision: 189210 URL: http://svn.freebsd.org/changeset/base/189210 Log: Merge r186891: Retry TEST UNIT READY if needed. Modified: stable/7/sys/cam/cam_xpt.c (contents, props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:27:03 2009(r189209) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:46:39 2009(r189210) @@ -5652,7 +5652,7 @@ probestart(struct cam_periph *periph, un case PROBE_DV_EXIT: { scsi_test_unit_ready(csio, -/*retries*/4, +/*retries*/10, probedone, MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, @@ -6259,6 +6259,13 @@ probedone(struct cam_periph *periph, uni break; } case PROBE_TUR_FOR_NEGOTIATION: + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + DELAY(50); + if (cam_periph_error(done_ccb, 0, SF_RETRY_UA, + NULL) == ERESTART) + return; + } + /* FALLTHROUGH */ case PROBE_DV_EXIT: if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { /* Don't wedge the queue */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189211 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: scottl Date: Sun Mar 1 06:57:25 2009 New Revision: 189211 URL: http://svn.freebsd.org/changeset/base/189211 Log: Merge 188570: Fix tag negotiation for pseudo-scsi devices and subsystems. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (contents, props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:46:39 2009(r189210) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:57:25 2009(r189211) @@ -6143,10 +6143,9 @@ probedone(struct cam_periph *periph, uni xpt_schedule(periph, priority); return; } - xpt_release_ccb(done_ccb); - softc->action = PROBE_TUR_FOR_NEGOTIATION; - xpt_schedule(periph, priority); - return; + + csio->data_ptr = NULL; + /* FALLTHROUGH */ } case PROBE_SERIAL_NUM_1: ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189212 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: scottl Date: Sun Mar 1 07:00:52 2009 New Revision: 189212 URL: http://svn.freebsd.org/changeset/base/189212 Log: Merge 188670: Instrument the probe state machine Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (contents, props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 06:57:25 2009(r189211) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:00:52 2009(r189212) @@ -5419,9 +5419,33 @@ typedef enum { PROBE_TUR_FOR_NEGOTIATION, PROBE_INQUIRY_BASIC_DV1, PROBE_INQUIRY_BASIC_DV2, - PROBE_DV_EXIT + PROBE_DV_EXIT, + PROBE_INVALID } probe_action; +static char *probe_action_text[] = { + "PROBE_TUR", + "PROBE_INQUIRY", + "PROBE_FULL_INQUIRY", + "PROBE_MODE_SENSE", + "PROBE_SERIAL_NUM_0", + "PROBE_SERIAL_NUM_1", + "PROBE_TUR_FOR_NEGOTIATION", + "PROBE_INQUIRY_BASIC_DV1", + "PROBE_INQUIRY_BASIC_DV2", + "PROBE_DV_EXIT", + "PROBE_INVALID" +}; + +#define PROBE_SET_ACTION(softc, newaction) \ +do { \ + char **text = probe_action_text;\ + CAM_DEBUG((softc)->periph->path, CAM_DEBUG_INFO,\ + ("Probe %s to %s\n", text[(softc)->action], \ + text[(newaction)]));\ + (softc)->action = (newaction); \ +} while(0) + typedef enum { PROBE_INQUIRY_CKSUM = 0x01, PROBE_SERIAL_CKSUM = 0x02, @@ -5435,6 +5459,7 @@ typedef struct { probe_flags flags; MD5_CTX context; u_int8_tdigest[16]; + struct cam_periph *periph; } probe_softc; static void @@ -5566,6 +5591,8 @@ proberegister(struct cam_periph *periph, periph_links.tqe); softc->flags = 0; periph->softc = softc; + softc->periph = periph; + softc->action = PROBE_INVALID; status = cam_periph_acquire(periph); if (status != CAM_REQ_CMP) { return (status); @@ -5617,13 +5644,13 @@ probeschedule(struct cam_periph *periph) */ if (((ccb->ccb_h.path->device->flags & CAM_DEV_UNCONFIGURED) == 0) && (ccb->ccb_h.target_lun == 0)) { - softc->action = PROBE_TUR; + PROBE_SET_ACTION(softc, PROBE_TUR); } else if ((cpi.hba_inquiry & (PI_WIDE_32|PI_WIDE_16|PI_SDTR_ABLE)) != 0 && (cpi.hba_misc & PIM_NOBUSRESET) != 0) { proberequestdefaultnegotiation(periph); - softc->action = PROBE_INQUIRY; + PROBE_SET_ACTION(softc, PROBE_INQUIRY); } else { - softc->action = PROBE_INQUIRY; + PROBE_SET_ACTION(softc, PROBE_INQUIRY); } if (ccb->crcn.flags & CAM_EXPECT_INQ_CHANGE) @@ -5712,7 +5739,7 @@ probestart(struct cam_periph *periph, un if (inq_buf == NULL) { xpt_print(periph->path, "malloc failure- skipping Basic" "Domain Validation\n"); - softc->action = PROBE_DV_EXIT; + PROBE_SET_ACTION(softc, PROBE_DV_EXIT); scsi_test_unit_ready(csio, /*retries*/4, probedone, @@ -5758,7 +5785,7 @@ probestart(struct cam_periph *periph, un } xpt_print(periph->path, "Unable to mode sense control page - " "malloc failure\n"); - softc->action = PROBE_SERIAL_NUM_0; + PROBE_SET_ACTION(softc, PROBE_SERIAL_NUM_0); } /* FALLTHROUGH */ case PROBE_SERIAL_NUM_0: @@ -5827,6 +5854,11 @@ probestart(struct cam_periph *periph, un probedone(periph, start_ccb); return; } + case PROBE_INVALID: + CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_INFO, + ("probestart: invalid action state\n")); + default: + break; } xpt_action(start_ccb); } @@ -5980,7 +6012,7 @@ probedone(struct cam_periph *periph, uni /*count*/1, /*run_queue*/TRUE); } - softc->action = PROBE_INQUIRY; + PROBE_SET_ACTION(softc, PROBE_INQUIRY); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; @@ -6017,7 +6049,7 @@ probedone(struct cam_periph *periph, uni
svn commit: r189213 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: scottl Date: Sun Mar 1 07:02:16 2009 New Revision: 189213 URL: http://svn.freebsd.org/changeset/base/189213 Log: Merge 188688: GCC bogon. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (contents, props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:00:52 2009(r189212) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:02:16 2009(r189213) @@ -5439,7 +5439,8 @@ static char *probe_action_text[] = { #define PROBE_SET_ACTION(softc, newaction) \ do { \ - char **text = probe_action_text;\ + char **text;\ + text = probe_action_text; \ CAM_DEBUG((softc)->periph->path, CAM_DEBUG_INFO,\ ("Probe %s to %s\n", text[(softc)->action], \ text[(newaction)]));\ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189214 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: scottl Date: Sun Mar 1 07:03:35 2009 New Revision: 189214 URL: http://svn.freebsd.org/changeset/base/189214 Log: Merge 188671: Fix negotiation for imperfect SCSI and pseudo-SCSI devices. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (contents, props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_xpt.c == --- stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:02:16 2009(r189213) +++ stable/7/sys/cam/cam_xpt.c Sun Mar 1 07:03:35 2009(r189214) @@ -6680,9 +6680,7 @@ xpt_set_transfer_settings(struct ccb_tra if (((device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0 && (inq_data->flags & SID_Sync) == 0 && cts->type == CTS_TYPE_CURRENT_SETTINGS) -|| ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) -|| (spi->sync_offset == 0) -|| (spi->sync_period == 0)) { +|| ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0)) { /* Force async */ spi->sync_period = 0; spi->sync_offset = 0; @@ -6730,7 +6728,8 @@ xpt_set_transfer_settings(struct ccb_tra if (spi->bus_width == 0) spi->ppr_options = 0; - if ((spi->flags & CTS_SPI_FLAGS_DISC_ENB) == 0) { + if ((spi->valid & CTS_SPI_VALID_DISC) +&& ((spi->flags & CTS_SPI_FLAGS_DISC_ENB) == 0)) { /* * Can't tag queue without disconnection. */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189215 - in stable/7/sys: . cam contrib/pf dev/cxgb
Author: scottl Date: Sun Mar 1 07:06:44 2009 New Revision: 189215 URL: http://svn.freebsd.org/changeset/base/189215 Log: Merge 186396: Fix comment Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_sim.h stable/7/sys/cam/cam_xpt.c (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_sim.h == --- stable/7/sys/cam/cam_sim.h Sun Mar 1 07:03:35 2009(r189214) +++ stable/7/sys/cam/cam_sim.h Sun Mar 1 07:06:44 2009(r189215) @@ -109,7 +109,7 @@ struct cam_sim { struct cam_devq *devq; /* Device Queue to use for this SIM */ int refcount; /* References to the SIM. */ - /* "Pool" of inactive ccbs managed by xpt_alloc_ccb and xpt_free_ccb */ + /* "Pool" of inactive ccbs managed by xpt_get_ccb and xpt_release_ccb */ SLIST_HEAD(,ccb_hdr)ccb_freeq; /* * Maximum size of ccb pool. Modified as devices are added/removed ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189216 - head/share/termcap
Author: rafan Date: Sun Mar 1 07:08:46 2009 New Revision: 189216 URL: http://svn.freebsd.org/changeset/base/189216 Log: - Remove kH (kp_kll) from screen. It has the identical key sequence as @7 (kp_end). As ncurses has the limitation that it returns the first matched key symbol, you can not use END in ncurses based program under screen (like ports/misc/mc). We did similar changes to xterm entry last year for exactly the same reason. PR: 132199 Submitted by: Timur I. Bakeyev MFC after:2 month Modified: head/share/termcap/termcap.src Modified: head/share/termcap/termcap.src == --- head/share/termcap/termcap.src Sun Mar 1 07:06:44 2009 (r189215) +++ head/share/termcap/termcap.src Sun Mar 1 07:08:46 2009 (r189216) @@ -2771,7 +2771,7 @@ SC|screen|VT 100/ANSI X3.64 virtual term :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\ :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\ - :kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:@7=\E[4~:kP=\E[5~:\ + :kh=\E[1~:kI=\E[2~:kD=\E[3~:@7=\E[4~:kP=\E[5~:\ :kN=\E[6~:eA=\E(B\E)0:as=^N:ae=^O:ti=\E[?1049h:te=\E[?1049l:\ :vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\ :Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189217 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: scottl Date: Sun Mar 1 07:16:50 2009 New Revision: 189217 URL: http://svn.freebsd.org/changeset/base/189217 Log: Fix mergeinfo for cam_xpt.c Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_xpt.c (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189218 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: scottl Date: Sun Mar 1 07:22:46 2009 New Revision: 189218 URL: http://svn.freebsd.org/changeset/base/189218 Log: Merge 176204: Fix typo Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_periph.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_periph.c == --- stable/7/sys/cam/cam_periph.c Sun Mar 1 07:16:50 2009 (r189217) +++ stable/7/sys/cam/cam_periph.c Sun Mar 1 07:22:46 2009 (r189218) @@ -1632,7 +1632,7 @@ cam_periph_error(union ccb *ccb, cam_fla ccb->ccb_h.retry_count--; error = ERESTART; } else { - action_string = "Retries Exausted"; + action_string = "Retries Exhausted"; error = EIO; } break; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r189219 - in stable/7/sys: . cam contrib/pf dev/ath/ath_hal dev/cxgb
Author: scottl Date: Sun Mar 1 07:24:26 2009 New Revision: 189219 URL: http://svn.freebsd.org/changeset/base/189219 Log: Merge 188395: Fix "invalid periph name" error condition. Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_periph.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_periph.c == --- stable/7/sys/cam/cam_periph.c Sun Mar 1 07:22:46 2009 (r189218) +++ stable/7/sys/cam/cam_periph.c Sun Mar 1 07:24:26 2009 (r189219) @@ -171,7 +171,7 @@ cam_periph_alloc(periph_ctor_t *periph_c break; } xpt_unlock_buses(); - if (p_drv == NULL) { + if (*p_drv == NULL) { printf("cam_periph_alloc: invalid periph name '%s'\n", name); return (CAM_REQ_INVALID); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"