summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_diskslice.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed a memory leak for slices with an (unsupported) bad sector table.bde2000-01-281-1/+2
| | | | Broken in: rev.1.80.
* Cleanup some more remaining bdev fluff.phk2000-01-161-70/+18
|
* Remove BAD144 support, it has already been disabled for some time.phk1999-12-081-77/+4
|
* Add missing 't' in printf message.phk1999-09-251-1/+1
|
* Add a DSO_BAD144 flag which indicates that the driver actually understandphk1999-09-201-1/+9
| | | | | | | | BAD144 handling. Reject DIOCSBAD and labels with BAD144 tables if the driver cannot grok it. Reviewed by: bde
* Const poisoning from d_name.bde1999-09-131-6/+5
| | | | Fixed some style bugs in recent changes.
* Changes to centralise the default blocksize behaviour.julian1999-09-091-2/+0
| | | | | | More likely to follow. Submitted by: phk@freebsd.org
* Fix a warning for the !DEVFS case.peter1999-09-031-2/+4
|
* Revert a bunch of contraversial changes by PHK. Afterjulian1999-09-031-0/+1
| | | | | | | | | | a quick think and discussion among various people some form of some of these changes will probably be recommitted. The reversion requested was requested by dg while discussions proceed. PHK has indicated that he can live with this, and it has been agreed that some form of some of these changes may return shortly after further discussion.
* Use "multiple 4 char outdent until no wrap" rather than ANSI stringphk1999-09-011-7/+7
| | | | | | | concatenation to preserve K&R compatibility. Requested by: bde Terminology by: grog
* Include "dscheck" and device name in all messages from dscheck().phk1999-08-311-7/+13
|
* Make bdev userland access work like cdev userland access unlessphk1999-08-301-1/+0
| | | | | | | | | | the highly non-recommended option ALLOW_BDEV_ACCESS is used. (bdev access is evil because you don't get write errors reported.) Kill si_bsize_best before it kills Matt :-) Use the specfs routines rather having cloned copies in devfs.
* initialize si_bsize_phys from what the drive told us.phk1999-08-291-1/+1
|
* We don't need to pass the diskname argument all over the diskslice/labelphk1999-08-281-35/+27
| | | | code, we can find the name from any convenient dev_t
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Convert DEVFS hooks in (most) drivers to make_dev().phk1999-08-231-1/+5
| | | | | | | | | | | | | | | | Diskslice/label code not yet handled. Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers) Add the correct hook for devfs to kern_conf.c The net result of this excercise is that a lot less files depends on DEVFS, and devtoname() gets more sensible output in many cases. A few drivers had minor additional cleanups performed relating to cdevsw registration. A few drivers don't register a cdevsw{} anymore, but only use make_dev().
* Spring cleaning around strategy and disklabels/slices:phk1999-08-141-48/+18
| | | | | | | | | | | | | | Introduce BUF_STRATEGY(struct buf *, int flag) macro, and use it throughout. please see comment in sys/conf.h about the flag argument. Remove strategy argument from all the diskslice/label/bad144 implementations, it should be found from the dev_t. Remove bogus and unused strategy1 routines. Remove open/close arguments from dssize(). Pick them up from dev_t. Remove unused and unfinished setgeom support from diskslice/label/bad144 code.
* dsopen: Print a message if the unit has an invalid sector size.grog1999-06-211-4/+6
| | | | Reviewed-by: ken, bde
* Divorce "dev_t" from the "major|minor" bitmap, which is now calledphk1999-05-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | udev_t in the kernel but still called dev_t in userland. Provide functions to manipulate both types: major() umajor() minor() uminor() makedev() umakedev() dev2udev() udev2dev() For now they're functions, they will become in-line functions after one of the next two steps in this process. Return major/minor/makedev to macro-hood for userland. Register a name in cdevsw[] for the "filedescriptor" driver. In the kernel the udev_t appears in places where we have the major/minor number combination, (ie: a potential device: we may not have the driver nor the device), like in inodes, vattr, cdevsw registration and so on, whereas the dev_t appears where we carry around a reference to a actual device. In the future the cdevsw and the aliased-from vnode will be hung directly from the dev_t, along with up to two softc pointers for the device driver and a few houskeeping bits. This will essentially replace the current "alias" check code (same buck, bigger bang). A little stunt has been provided to try to catch places where the wrong type is being used (dev_t vs udev_t), if you see something not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if it makes a difference. If it does, please try to track it down (many hands make light work) or at least try to reproduce it as simply as possible, and describe how to do that. Without DEVT_FASCIST I belive this patch is a no-op. Stylistic/posixoid comments about the userland view of the <sys/*.h> files welcome now, from userland they now contain the end result. Next planned step: make all dev_t's refer to the same devsw[] which means convert BLK's to CHR's at the perimeter of the vnodes and other places where they enter the game (bootdev, mknod, sysctl).
* Hack the diskslice stuff so that it allows the alpha sysinstall todfr1999-05-091-2/+8
| | | | | manipulate the disklabel. This is almost certainly not the right way to do it but I'm desperate.
* Fix a goof in the #ifdef DEVFS case which was found by inspection,phk1999-05-071-2/+2
| | | | | it may have made things very difficult for people if they tried to used DEVFS.
* Rename one of the two devfs_link's to devfs_makelink.eivind1998-12-101-3/+3
|
* Examine all occurrences of sprintf(), strcat(), and str[n]cpy()archie1998-12-041-3/+4
| | | | | | | | | | | | | | for possible buffer overflow problems. Replaced most sprintf()'s with snprintf(); for others cases, added terminating NUL bytes where appropriate, replaced constants like "16" with sizeof(), etc. These changes include several bug fixes, but most changes are for maintainability's sake. Any instance where it wasn't "immediately obvious" that a buffer overflow could not occur was made safer. Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Mike Spengler <mks@networkcs.com>
* Overload the correct errno for attempts to set an in-core label withbde1998-10-171-2/+2
| | | | | | | | | | | | | | | a raw partition at a nonzero offset (EINVAL should have been EXDEV; DIOCSDINFO was broken, and DIOCWDINFO was broken because it depended on DIOCSDINFO). A zero offset for the raw partition should probably be enforced in setdisklabel(), and DIOCWDINFO should probably always be handled by first calling setdisklabel() so that writedisklabel() doesn't need to enforce it, but this has never been done; dsioctl() has a special check. Changes in this commit are limited to dsioctl() to preserve bug for bug compatibility in drivers that don't use the slice code (notably the ccd driver, which allows setting a bogus label in DIOCWDINFO and doesn't undo the setting when writedisklabel() fails).
* remove bdevsw arg from dsopen();phk1998-08-231-9/+4
| | | | | Forgotten by: julian Reviewed by: bde
* Protect all modifications to v_numoutput with splbio().dfr1998-08-131-3/+7
|
* Added a flags arg to dsopen() and updated drivers. The DSO_ONESLICEbde1998-07-301-14/+24
| | | | | | | | | | | and DSO_NOLABELS flags prevent searching for slices and labels respectively. Current drivers don't set these flags. When DSO_NOLABELS is set, the in-core label for the whole disk is cloned to create an in-core label for each slice. This gives the correct result (a good in-core label for the compatibility slice) if DSO_ONESLICE is set or only one slice is found, but usually gives broken labels otherwise, so DSO_ONESLICE should be set if DSO_NOLABELS is set.
* Centralized and optimized handling of large sectors. Centralizedbde1998-07-291-31/+74
| | | | | | | checking of transfer sizes and alignments. Old version tested with 2K-sectors on od disks by: Shunsuke Akiyama <akiyama@kme.mei.co.jp>.
* Use the slice-relative blkno in all parts of the label writebde1998-07-291-3/+3
| | | | | | protection checks. Using the partition-relative blkno in some parts broke the write protection for partitions at unusual offsets (only for partitions at offset 1 on i386's).
* Set bp->b_resid for failed transfers in dscheck(). This is thebde1998-07-281-1/+2
| | | | | | | | best place to set it, and the wd and wfd strategy routines don't set it (for failed transfers) because they expect dscheck() to initialize everything necessary. dscheck() has always set B_ERROR, but this is not quite sufficient, because b_resid is used by physio() to decide how much of a B_ERROR'ed i/o was done.
* Initialize more defaults for the in-core label for the whole disk.bde1998-07-201-24/+46
| | | | | | | Callers only need to initialize d_secperunit now, but should initialize d_type (to reduce the IDE/SCSI confusion), d_typename (put the disk model in it) and geometry info (if it isn't completely ficticious). Callers will soon need to initialize d_secsize.
* Cleaned up rev.1.39 - the shadowing variable should have just gone away.bde1998-07-201-6/+4
|
* Moved allocation of the slices struct to the right place. Initializebde1998-07-201-1/+36
| | | | | everything in it (the devsw pointers were not initialized early or at all for the !DEVFS case, but this was harmless on i386's).
* Backed out rev.1.43 (removed nonsense SLICE ifdef). SLICE isbde1998-07-201-4/+1
| | | | | | | | | | normally only defined in opt_devfs.h, so testing it before including anything is normally a no-op. Undef'ing DEVFS before including opt_devfs.h is similarly useless. OTOH, DEVFS support for sliced but not SLICEd (despite defined(SLICE)) devices is either harmless (if there are no such devices, then nothing in this file is used) or necessary (otherwise). It even seems to work for sliced cd devices.
* Fixed printf format errors.bde1998-07-111-4/+5
|
* There is no such thing any more as "struct bdevsw".julian1998-07-041-2/+2
| | | | | | | | | | | | | | | | | | There is only cdevsw (which should be renamed in a later edit to deventry or something). cdevsw contains the union of what were in both bdevsw an cdevsw entries. The bdevsw[] table stiff exists and is a second pointer to the cdevsw entry of the device. it's major is in d_bmaj rather than d_maj. some cleanup still to happen (e.g. dsopen now gets two pointers to the same cdevsw struct instead of one to a bdevsw and one to a cdevsw). rawread()/rawwrite() went away as part of this though it's not strictly the same patch, just that it involves all the same lines in the drivers. cdroms no longer have write() entries (they did have rawwrite (?)). tapes no longer have support for bdev operations. Reviewed by: Eivind Eklund and Mike Smith Changes suggested by eivind.
* Don't attempt to copy the whole slices "struct" for DIOCGSLICEINFO.bde1998-06-061-2/+3
| | | | | | | | | The slices "struct" isn't really a struct; we allocate only part of it in the fully dangerously dedicated case. Since the "struct" is malloced, the page beyond it may not be mapped, so attempts to copy it would crash. This problem became larger when the full struct was bloated from < 1K to > 3K by the addition of (mostly unused) DEVFS tokens some time before 2.2.0 was released.
* Discussed with: bdeobrien1998-04-241-1/+1
|
* Create virgin disklabels with 8 (MAXPARTITIONS) partitions rather thanobrien1998-04-241-4/+2
| | | | | three (RAW_PART + 1); This makes ``disklabel -Brw sdN auto'' do the Right Thing.
* Add changes and code to implement a functional DEVFS.julian1998-04-191-1/+4
| | | | | | | | | | | | | | | | | | | | | This code will be turned on with the TWO options DEVFS and SLICE. (see LINT) Two labels PRE_DEVFS_SLICE and POST_DEVFS_SLICE will deliniate these changes. /dev will be automatically mounted by init (thanks phk) on bootup. See /sys/dev/slice/slice.4 for more info. All code should act the same without these options enabled. Mike Smith, Poul Henning Kamp, Soeren, and a few dozen others This code does not support the following: bad144 handling. Persistance. (My head is still hurting from the last time we discussed this) ATAPI flopies are not handled by the SLICE code yet. When this code is running, all major numbers are arbitrary and COULD be dynamically assigned. (this is not done, for POLA only) Minor numbers for disk slices ARE arbitray and dynamically assigned.
* Fixed an aliasing bug. It was too easy to defeat the check for movingbde1998-02-151-3/+13
| | | | | | or shrinking an open partition (by changing the label for a compatibility slice while partitions on the corresponding real slice are open, or vice versa).
* Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.eivind1998-01-241-1/+3
| | | | | | | | This introduce an xxxFS_BOOT for each of the rootable filesystems. (Presently not required, but encouraged to allow a smooth move of option *FS to opt_dontuse.h later.) LFS is temporarily disabled, and will be re-enabled tomorrow.
* Use ENOIOCTL instead of -1 (= ERESTART) for diskslice ioctls that arebde1997-12-061-2/+2
| | | | not handled at a particular level.
* Rename some local variables to avoid shadowing other local variables.phk1997-11-071-5/+5
| | | | Found by: -Wshadow
* Reject attempts to set an in-core label which says that the "disk"bde1997-09-161-4/+10
| | | | | | | | | | | | | | | | | | | or a partition is larger than the slice. Now `disklabel -Brw sdX auto' should fail properly on sliced disks without partition of type 165, e.g., on zip disks with the factory default formatting. Previously it set a bogus in-core label for the compatibility slice and used this to corrupt the MBR (the slice has offset 0 and size 0, but setting the label in effect corrupted its size to nonzero). `disklabel -Brw sdX auto' already failed properly on normally (not dangerously dedicated) sliced disks _with_ partition of type 165, because the compatibility slice has a nonzero offset so the MBR remained inaccessible when the size was corrupted. This bug only affected in-core labels. On-disk labels are checked carefully when they read and written.
* Removed unused #includes.bde1997-09-021-2/+1
|
* Don't include <sys/ioctl.h> in the kernel. Stage 1: don't includebde1997-03-241-2/+1
| | | | | it when it is not used. In most cases, the reasons for including it went away when the special ioctl headers became self-sufficient.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* This is the kernel Lite/2 commit. There are some requisite userlanddyson1997-02-101-0/+1
| | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
OpenPOWER on IntegriCloud