summaryrefslogtreecommitdiffstats
path: root/sys/scsi/cd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* No leading space(s) before labels.krw2019-01-201-4/+4
| | | | Prodded by guenther@
* When retiring a SCSI request, sometimes the buf's b_error value iskrw2019-01-201-4/+6
| | | | | | | | forcibly set to a value. Make sure that in all those cases the B_ERROR flag is cleared (if b_error is being set to 0) or set (if b_error is being set to non-zero) appropriately. ok dlg@ jmatthew@
* Don't pull in <sys/file.h> just to get fcntl.hguenther2017-12-301-2/+2
| | | | ok deraadt@ krw@
* If you use sys/param.h, you don't need sys/types.hderaadt2017-09-081-2/+1
|
* To prevent anyone else from stumbling on this (now) archaic bit ofkrw2017-05-291-11/+1
| | | | | | | | history, nuke all mentions of XS_NO_CCB and the #define. 2006 - 2017. R.I.P. ok kettenis@ inferred ok dlg@
* Also pass the blk offset to disk_unbusy(), so that it can pass it toderaadt2017-05-041-3/+3
| | | | | | the random subsystem as entropy. This value is pretty much unknown, and anyways our entropy input ring does not saturate from knowns. ok mikeb djm
* Standardize on calling local scsi_link variables 'link' instead ofkrw2016-03-121-41/+41
| | | | | | | | | | | 'sc_link'. 'sc_link' is a field in the various device *_softc structures, where the sc_ prefix was for 'softc'. Reduces potential mental confusion. Newer code from down under was already using 'link'. No functional change. Prompted by bluhm@'s adventures in scsi. ok dlg@ jmatthew@
* More damned eye searing whitespace.krw2015-06-071-7/+7
|
* convert bcopy to memcpy. ok dlg krwtedu2014-12-151-9/+9
|
* remove uneeded proc.h includesjsg2014-09-141-2/+1
| | | | ok mpi@ kspillner@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-2/+2
| | | | after discussions with beck deraadt kettenis.
* Sprinkle (long long) casts where %lld is being used to print daddr_tkrw2013-11-011-2/+2
| | | | | | variables. Some random whitespace/knf repairs encountered on the way. ok miod@ on inspection, feedback & more suggestions from millert@
* Print daddr_t variables with %lld, u_int64_t variables with %llu.krw2013-10-031-2/+2
|
* scsi_size() is now used only by cd(4). So move it from scsi_base.ckrw2013-09-271-4/+112
| | | | | | | to cd.c and call it cd_size(), like sd_size() lives in sd.c. Tweak some daddr_t variables to u_int64_t on the way, when they are for disk sector numbers, not 512-byte block numbers.
* cddump() takes a daddr_t parameter. Call that parameter 'blkno' and notkrw2013-09-151-2/+2
| | | | | 'secno'. This is what sddump() already does and consistant is good. No function change.
* Use DL_SECTOBLK() and DL_BLKTOSEC() to clarify code and removekrw2013-09-151-4/+3
| | | | | | | | repeated handrolling of same code. Use daddr_t variable to calculate daddr_t return values, and u_int64_t variables to calculate disk sector values. No functional change.
* final removal of daddr64_t. daddr_t has been 64 bit for a long enoughderaadt2013-06-111-4/+4
| | | | | test period; i think 3 years ago the last bugs fell out. ok otto beck others
* Eliminate redundant buf validation checks in xxstrategy() methods nowmatthew2011-07-061-23/+5
| | | | | | | | | | | | that they're implemented consistently in bounds_check_with_label(). Also, per krw's request, change bounds_check_with_label() to return 0 if the checks succeed, and change the drivers to test == -1 instead of <= 0. (Man page update to follow; intentionally omitting arch/vax/mba/hp.c from this commit because it doesn't even build currently and miod@ promises to kill it soon.) ok krw@
* Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingmatthew2011-07-031-3/+1
| | | | | | | | that's ever used it, and it's long since been changed to use DVACT_{QUIESCE,SUSPEND,RESUME} instead. ok deraadt@, dlg@; miod@ also agreed with this idea when I brought it up a few weeks ago
* Refactor some common open/close/detach disk driver code intomatthew2011-06-301-35/+5
| | | | | | subr_disk.c. For now just the MI disk drivers. ok deraadt@, krw@; jsing@ liked the approach too
* Use disk_lock_nointr() in the xxclose() routines so that they cannotderaadt2011-06-191-6/+2
| | | | | be interrupted. ok matthew
* Use disk_lock/disk_unlock directly and in the same way in these drivers,deraadt2011-06-191-11/+9
| | | | | | rather than using various wrappings. Convert vnd to using the sc_dk rwlock instead of using one of its own. ok matthew
* Delete the long dead LOCKED and WANTED flags from cd(4), sd(4), andmatthew2011-06-061-3/+1
| | | | | | | wd(4). They haven't been used for 10+ years, since the drivers were switched to use disk_lock() and disk_unlock() instead. No binary change.
* Drop kernel support for the useless DIOCWLABEL ioctl and prune a lotmatthew2011-06-051-11/+1
| | | | | | | | | of silly flag twiddling code in various disk drivers. ok deraadt@, miod@ N.B., users will need a -current disklabel(8) to be able to write new disklabels to disk now.
* Get rid of the wlabel argument to bounds_check_with_label(). It'smatthew2011-06-031-3/+2
| | | | | | | | | never done anything in OpenBSD and just clutters disk drivers with silly flag handling. More cleanup to follow. ok deraadt@, millert@; no objections krw@
* Change a few of the more common disk drivers (sd, cd, wd, rd, and vnd)matthew2011-05-311-2/+2
| | | | | | | | | | | | | | | | | | | to return EBUSY if the user tries to modify an open partition's offset or size. Only sadness can result if a user tries this, and rejecting it prevents a race between sdstart() and sdstrategy(). Curiously, there was already code in the kernel and in disklabel(8) to detect/handle this, but it was effectively disabled because the disk drivers always used something like "/* sc->sc_dk.dk_openmask */ 0", and this commented out code has existed since even r1.1 in NetBSD. I had no problems building a release and messing around with disklabel(8) for a bit with this diff. Canarying the more common MI disk drivers until we gain confidence that there aren't any regressions, then we can switch the remaining drivers. "I am surprised you got me convinced that this stuff is safe" deraadt@ ok krw@
* use dma_alloc/dma_free instead of malloc to allocate buffers which needderaadt2011-03-171-90/+128
| | | | | to be in the right address space. help from matthew and krw
* SCSI devices are assumed to be T_FIXED unless they say otherwise.krw2010-11-221-1/+5
| | | | | | | | | | | cd(4) did not believe any T_FIXED device was its responsibility. Thus when a USB CD forgot to mention that it is T_REMOV, it appeared as uk(4). Make cd(4) accept even T_FIXED devices that claim to be T_CDROM or T_WORM. Noticed and fix tested by Rene Maroufi. Closes PR #6513.
* Introduce a DKF_NOLABELREAD flag, which is used by a device to preventjsing2010-09-231-1/+2
| | | | | | automatic reading of disklabel on attach. ok deraadt@ miod@ krw@
* All users of physio(9) now pass NULL as the buf pointer argument, somatthew2010-09-221-3/+3
| | | | | | | no point in keeping it around. "i like this" thib@ (a while back); ok krw@ and oga@; reminder to update the man page and tweaks jmc@
* Add a real DIOCGPDINFO, allowing access to the physical informationkrw2010-09-211-2/+6
| | | | | | about the device rather than the contents of whichever disklabel was read. Tweak whitespace in sd.c to make the code appearance consistant.
* bufq_drain() does not need to be done in deactivate; we only needderaadt2010-09-201-2/+1
| | | | | to deactivate transactions we are currently doing. ok dlg
* scsi_xsh_del the xs handler on DEACTIVATE.dlg2010-09-141-1/+2
| | | | | same change as sd.c r1.212. matthew@ pointed out that cd(4) and st(4) would need the same change.
* Make cd the same as sd by calling the cd_parms member of the softc 'params'krw2010-09-121-14/+14
| | | | rather than 'sc_params'. No change to .o file.
* Be more ruthlessly consistent in variable names for blk/block ==krw2010-09-111-22/+22
| | | | | | | 512 == DEV_BSIZE units and variable-sized physical device 'sectors'. I hope this reduces confusion a bit more. No change to .o files. ok for intent miod@, with tweak.
* Introduce a disk_lookup() function which calls device_lookup(), beforejsing2010-09-081-2/+2
| | | | | | | | | | | | | verifying that the resulting device is present on the disklist. This avoids a race whereby the disk driver can be accessed as soon as the softc has been allocated, but before the disk has completed initialisation and has called disk_attach() (up until this point dk_label is still a null pointer). Cut cd(4), sd(4) and wd(4) across to disk_lookup(). All callers of disk_attach() need to be tested and cut over in due course. ok deraadt@ krw@
* Store a struct device pointer within struct disk and populate this whenjsing2010-09-081-2/+2
| | | | | | | disk_attach() is called by the device driver. We will be building on this shortly. ok deraadt@ krw@
* remove the powerhook code. All architectures now use the ca_activate treederaadt2010-09-071-31/+4
| | | | | traversal code to suspend/resume ok oga kettenis blambert
* rely on SCSI_AUTOCONF for cd_resume instead of wrapping it in a workqderaadt2010-09-071-11/+6
| | | | | (which creates a potential race against cd detach) discussed with krw and dlg seperately
* make struct bufq a member of the softc for devices that use it,dlg2010-09-011-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | rather than it being a pointer to something that needs to be allocated at attach. since all these devices need a bufq to operate, it makes sense to have it allocated as part of the softc and get bufq_init to just initialise all its fields. it also gets rid of the possibility that you wont be able to allocate the bufq struct during attach, which is something you dont want to happen. secondly, it consistently implements a split between wrapper functions and the per discipline implementation of the bufq handlers. it consistently does the locking in the wrappers rather than doing half in the wrappers and the other half in the implementations. it also consistently handles the outstanding bufq bq pointer in the wrappers. this hides most of the implementation inside kern_bufq.c. the only stuff left in buf.h is for the bits each implementation needs to put inside struct buf. tested by thib@ krw@ and me ok thib@ matthew@ no objection from krw@
* Change the powerhook into an activation routine. It has to use a workq.deraadt2010-08-311-17/+31
| | | | | There is a bit of concern that this workq can race against a detach happening... any solutions from the peanut gallery?
* Avoid possible aliasing-related compiler issues by always writing tomatthew2010-08-301-50/+55
| | | | | | | cmd->opcode through the type casted command pointer rather than through xs->cmd->opcode. Requested by deraadt@; ok krw@.
* Garbage collect struct dkdriver.matthew2010-08-281-4/+1
| | | | ok miod@; "please go ahead" jsing@
* DVD_INVALIDATE_AGID is a 'no payload' operation, so don't setkrw2010-07-281-2/+2
| | | | | | | | | | | | | xs->datalen and reset xs->data to NULL. This prevents a spurious attempt to setup (dma map, etc) and possibly attempt data tranfser. In line with what Linux and FreeBSD do as far as I can tell. Reduces the delay before my DVD starts playing its movie. Idea to also set xs->data to NULL from matthew@. "No objection" matthew@
* Missing SCSI_DATA_IN flag in dvd_read_copyright() causedkrw2010-07-251-2/+2
| | | | confusion. Fixes at least my usb DVD reader and The Blue Tick.
* Let DVD's play again. Logic reversal prevented copyright reading.krw2010-07-251-2/+2
| | | | Symptoms noted by oga@. actual bug spotted by dlg@
* Fix a few more scsi_scsi_cmd() removal regressions, caught bymatthew2010-07-221-16/+18
| | | | | | -Wuninitialized. Silly typo in my first diff noticed by oga@ and krw@; ok krw@
* Appropriately set SCSI_DATA_IN or SCSI_DATA_OUT depending on type ofmatthew2010-07-221-2/+11
| | | | | | dvd_auth command. Fixes regression from scsi_scsi_cmd() removal. ok dlg@
* Eliminate scsi_scsi_cmd() now that ss(4) is gone and with it thekrw2010-07-221-236/+392
| | | | | | | | | last bastardized sync and buf call through scsi_scsi_cmd(). Flatten code to call scsi_xs_sync() directly for all commands. Airplane typos shaken out by various. ok dlg@ matthew@ deraadt@
* Die struct scsi_device! Die! Instead, save a pointer to the routinekrw2010-07-011-12/+8
| | | | | | | | | | | | to interpret sense errors. This is initialized to the basic interpretation routine, and specific scsi drivers (sd/st/cd) can replace this with their own. While here kill EJUSTRETURN dance and make more specialized interpretation routines directly call the basic routine if desired. Fixes by matthew@ to my first diff. Most original work by dlg@. ok matthew@ marco@ dlg@