summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_dev.c
Commit message (Collapse)AuthorAgeFilesLines
* Provide compatibility symlink for logical partitions:marcel2009-02-201-0/+12
| | | | | | | | | | 1. Extend geom_dev by having it create the symlink (i.e. call make_dev_alias) based on the DIOCGPROVIDERALIAS ioctl. In this way the functionaility is generic and thus usable by any geom/provider. 2. Have g_part handle said ioctl through the devalias method, so that it's under control of the scheme itself. By design the alias will not be created for newly added partitions.
* Remove unused unrhdr from GEOM character device module.ed2009-01-241-17/+1
| | | | | | Now that make_dev() doesn't require unit numbers to be unique, there is no need to use an unrhdr here to generate the numbers. Remove the entire init-routine, because it is optional.
* Remove unit2minor() use from kernel code.ed2008-09-261-1/+1
| | | | | | | | | | | | | | | When I changed kern_conf.c three months ago I made device unit numbers equal to (unneeded) device minor numbers. We used to require bitshifting, because there were eight bits in the middle that were reserved for a device major number. Not very long after I turned dev2unit(), minor(), unit2minor() and minor2unit() into macro's. The unit2minor() and minor2unit() macro's were no-ops. We'd better not remove these four macro's from the kernel, because there is a lot of (external) code that may still depend on them. For now it's harmless to remove all invocations of unit2minor() and minor2unit(). Reviewed by: kib
* - Add a new ioctl for getting the provider name of a geom provider.lulf2008-09-071-0/+7
| | | | | | | | - Add a routine for looking up a device and checking if it is a valid geom provider given a partial or full path to its device node. Reviewed by: phk Approved by: pjd (mentor)
* Remove the distinction between device minor and unit numbers.ed2008-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though we got rid of device major numbers some time ago, device drivers still need to provide unique device minor numbers to make_dev(). These numbers are only used inside the kernel. They are not related to device major and minor numbers which are visible in devfs. These are actually based on the inode number of the device. It would eventually be nice to remove minor numbers entirely, but we don't want to be too agressive here. Because the 8-15 bits of the device number field (si_drv0) are still reserved for the major number, there is no 1:1 mapping of the device minor and unit numbers. Because this is now unused, remove the restrictions on these numbers. The MAXMAJOR definition was actually used for two purposes. It was used to convert both the userspace and kernelspace device numbers to their major/minor pair, which is why it is now named UMINORMASK. minor2unit() and unit2minor() have now become useless. Both minor() and dev2unit() now serve the same purpose. We should eventually remove some of them, at least turning them into macro's. If devfs would become completely minor number unaware, we could consider using si_drv0 directly, just like si_drv1 and si_drv2. Approved by: philip (mentor)
* Chop DIOCGDELETE from userland up in 1024 sector chunks to give geom_diskphk2007-12-161-2/+18
| | | | | | | or any other bio chopping geom a reasonable size of work. Check for delivered signals between chunks, because the request size and service time is unbounded.
* Don't limit BIO_DELETE requests to MAXPHYS, they perform no dataphk2007-12-161-2/+1
| | | | transfers, so they are not subject to the VM system limitation.
* Implement three new ioctls that can be used with GEOM provider:pjd2007-05-051-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DIOCGFLUSH - Flush write cache (sends BIO_FLUSH). DIOCGDELETE - Delete data (mark as unused) (sends BIO_DELETE). DIOCGIDENT - Get provider's uniqe and fixed identifier (asks for GEOM::ident attribute). First two are self-explanatory, but the last one might not be. Here are properties of provider's ident: - ident value is preserved between reboots, - provider can be detached/attached and ident is preserved, - provider's name can change - ident can't, - ident value should not be based on on-disk metadata; in other words copying whole data from one disk to another should not yield the same ident for the other disk, - there could be more than one provider with the same ident, but only if they point at exactly the same physical storage, this is the case for multipathing for example, - GEOM classes that consumes single providers and provide single providers, like geli, gbde, should just attach class name to the ident of the underlying provider, - ident is an ASCII string (is printable), - ident is optional and applications can't relay on its presence. The main purpose for this is that application and remember provider's ident and once it tries to open provider by its name again, it may compare idents to be sure this is the right provider. If it is not (idents don't match), then it can open provider by its ident. OK'ed by: phk
* make_dev(9) can be (and is) called without Giant, so there is no need tokris2007-03-261-8/+0
| | | | | | drop the topology lock and acquire Giant around this call. Reviewed by: phk
* Use pause() rather than tsleep() on stack variables and function pointers.jhb2007-02-271-3/+3
|
* Use tsleep() rather than msleep() with a NULL mtx parameter.jhb2007-02-231-1/+1
|
* In g_dev_strategy(), when failing an IO request with EINVAL due tosimon2006-06-181-0/+1
| | | | | | | | | | | | | | offset or request size which is not a multiple of the sector size, make sure that the bio is set to indicate that no data has actually been transferred. The result of this is that the file offset is no longer incremented for these requests. The fact that the file offset was incremented broke fdisk(8)'s probing of sector size for non-512 byte sector sizes. Reviewed by: phk, cperciva Submitted by: mdodd MFC after: 2 weeks
* Avoid null pointer dereference.phk2005-03-181-3/+2
|
* Add placeholder mutex argument to new_unrhdr().phk2005-03-071-2/+1
|
* Pass the file->flags down to geom ioctl handlers.phk2004-12-121-1/+1
| | | | | | | | Reject certain ioctls if write permission is not indicated. Bump geom API version. Reported by: Ruben de Groot <mail25@bzerk.org>
* Don't set si_bsize_phys, nobody cares.phk2004-10-291-2/+0
|
* Give dev_strategy() an explict cdev argument in preparation for removingphk2004-10-291-2/+2
| | | | | | | | | | | buf->b-dev. Put a bio between the buf passed to dev_strategy() and the device driver strategy routine in order to not clobber fields in the buf. Assert copyright on vfs_bio.c and update copyright message to canonical text. There is no legal difference between John Dysons two-clause abbreviated BSD license and the canonical text.
* Use unit number allocation functions for GEOM minor numbers.phk2004-10-251-3/+18
|
* Retire si_stripesize and si_stripeoffset they will not be needed in cdevphk2004-10-251-2/+0
| | | | in the future.
* Don't call g_waitidle(), it happens automagically now.phk2004-10-231-3/+0
|
* Deny invalid I/O requests which comes from userland here, because laterpjd2004-09-271-0/+6
| | | | | | | we'll get a panic. MT5 candidate. Reviewed by: phk
* Assert topology is held in g_dev_getprovider().phk2004-09-241-3/+5
| | | | | Don't call devsw(). It is not necessary, and we do not need to hold dev_lock to compare the devsw pointer to our own since we do not dereference it.
* Tag all geom classes in the tree with a version number.phk2004-08-081-0/+1
|
* Use default method initialization on geoms.phk2004-08-081-1/+1
|
* Duplicate the securelevel check from spec_vnops.c here.phk2004-06-191-0/+11
|
* Reduce the thaumaturgical level of root filesystem mounts: Instead of usingphk2004-06-171-43/+0
| | | | | | | an otherwise redundant clone routine in geom_disk.c, mount a temporary DEVFS and do a proper lookup. Submitted by: thomas
* Second half of the dev_t cleanup.phk2004-06-171-1/+1
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-10/+10
| | | | Bump __FreeBSD_version accordingly.
* Device megapatch 4/6:phk2004-02-211-1/+2
| | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
* Remove the absolute count g_access_abs() function since experience hasphk2004-02-121-3/+3
| | | | | | | | | | | | shown that it is not useful. Rename the relative count g_access_rel() function to g_access(), only the name has changed. Change all g_access_rel() calls in our CVS tree to call g_access() instead. Add an #ifndef BURN_BRIDGES #define of g_access_rel() for source code compatibility.
* Add missing newline in printf.phk2004-01-231-1/+1
| | | | Submitted by: Pawel Jakub Dawidek <nick@garage.freebsd.pl>
* Remove KASSERT check for negative bio_offsets, add "normal" EIOphk2003-10-191-3/+0
| | | | error return for same.
* Assume that bp->bio_offset is correctly initialized.phk2003-10-121-1/+0
| | | | This fixes non-power-of-2 blocksize GEOM I/O.
* Make sure to return ENOIOCTL if the ioctl is not handled.phk2003-09-041-2/+2
|
* Simplify the ioctl handling in GEOM.phk2003-09-011-40/+5
| | | | | | | | | | | | | | | This replaces the current ioctl processing with a direct call path from geom_dev() where the ioctl arrives (from SPECFS) to any directly connected GEOM class. The inverse of the above is no longer supported. This is the situation were you have one or more intervening GEOM classes, for instance a BSDlabel on top of a MBR or PC98. If you want to issue MBR or PC98 specific ioctls, you will need to issue them on a MBR or PC98 providers. This paves the way for inviting CD's, FD's and other special cases inside GEOM.
* Add the new g_dev_getprovider() function, the swap_pager needs it now.phk2003-08-301-0/+14
| | | | Spotted by: mr
* Replace a panic with a .1Hz retry loop.phk2003-08-131-1/+10
| | | | Not a perfect solution, but far cheaper than one.
* Kick Giant compatibility one layer up.phk2003-08-021-9/+1
|
* Use __FBSDID().obrien2003-06-111-2/+3
| | | | Approved by: phk
* Improve the root-dev prompt facility for printing devices which couldphk2003-06-071-8/+6
| | | | possibly be a root filesystem.
* Wait for everything to settle before we try to print the list ofphk2003-06-071-0/+1
| | | | geom devices.
* Remove unused variables.phk2003-05-311-6/+1
| | | | Found by: FlexeLint
* Remove the G_CLASS_INITIALIZER, we do not need it anymore.phk2003-05-311-1/+0
|
* When a GEOM (/dev-)device is closed and we find that I/O requests arephk2003-05-091-3/+15
| | | | | | | | | | | | still outstanding, give them a chance to complete. If after 10 seconds we still find outstanding I/O requests, complete the close with a console warning that the system is likely to panic later on. This is a workaround for umount -f not quite doing the right thing. Approved by: re/scottl
* Back out all the stuff that didn't belong in the last commit.phk2003-05-021-3/+3
|
* Use g_slice_spoiled() rather than g_std_spoiled().phk2003-05-021-3/+3
| | | | Remember to free the buffer we got from g_read_data().
* Deprecate machine/limits.h in favor of new sys/limits.h.kan2003-04-291-1/+1
| | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
* Properly handle races between open/close and orphan.phk2003-04-021-10/+34
| | | | | | | KASSERT the race between close and strategy, it is an error in the upper echelons if this happens, Add XXX: comment explaining why the ioctl/orphan race is not closed.
* Premptively change initializations of struct g_class to use C99phk2003-03-241-3/+2
| | | | | sparse struct initializations before we extend the struct with new OAM related member functions.
* Including <sys/stdint.h> is (almost?) universally only to be able to usephk2003-03-181-1/+0
| | | | | %j in printfs, so put a newsted include in <sys/systm.h> where the printf prototype lives and save everybody else the trouble.
OpenPOWER on IntegriCloud