Up to [DragonFly] / src / sys / sys
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
Synchronize all changes made in HEAD to date with the 1.10 release branch. * usbdevs update * header file fixes * vinum root * vinum device I/O fixes * MD fixes * New PCI ids for netif rum and ural * New USB uplcom ids * linux exec memory leak * devclass ordering fixes (sound devices) * rate-limited kprintf support (filesystem full console spams) * msdosfs fixes * Manual page work
Add infrastructure to locate a disk device by name by scanning the disk list. Note: This doesn't work with the 'vn' device yet but it does work with ccd. Add a VFS with a dummy mount which is capable of synthesizing vnodes for devices. Add infrastructure that allows easy opening and closing of a device-backed vnode.
Disklabel separation work - Generally shift all disklabel-specific procedures for the kernel proper to a new source file, subr_disklabel32.c. Move the DTYPE_ and FS_ defines out of sys/disklabel.h and into a new header files sys/dtype.h Make adjustments to the uuids file, renaming "DragonFly Label" to "DragonFly Label32" and creating a "DragonFly Label64" uuid.
Implement raw extensions for WHOLE_DISK_SLICE device accesses for acd0. Disallow special accesses on devices that do not support the extensions. Implement direct track reading via /dev/acd0 or /dev/acd0t* (use MAKEDEV acd0t to create per-track devices). Fix a few bugs with the minor device numbers generated by MAKEDEV for /dev/acd*. /dev/acd0a and /dev/acd0c were improperly specifying the WHOLE_DISK_SLICE instead of the compatibility slice. Change all mountroot operations that were trying to access disks via RAW_PART to instead access them via WHOLE_SLICE_PART (removing more dependancies on the old disklabel structure). Replace the unconditional sector sanity check in dsopen() with better sanity checks in dscheck(). The checks are not made for special WHOLE_DISK_SLICE accesses, allowing weird sector sizes to feed through to the device.
Continue untangling the disklabel. * Move dk*() inline functions and other related stuff not directly related to the BSD disklabel out of sys/disklabel.h and into sys/diskslice.h. Add additional functions to sys/diskslice.h * Extend the slice and partition fields in the device minor number. We now support up to 128 slices and up to 256 partitions. * Implement new minor device numbers for 'raw slices', such as ad0s1. Previously raw slices used the same minor number as partition c within the slice. e.g. ad0s1 and ad0s1c had the same device number. This made it impossible to distinguish between the two. The 'whole disk' device's minor number has also changed. Our new whole-slice and whole-disk devices specify a partition number of (DKMAXPARTITIONS - 1) (aka 255). * Completely disable disklabel related operations on the raw disk, e.g. da0, and on partitions, e.g. da0s1a. Only allow disklabel operations on whole slices, e.g. da0s1. NOTE!! For compatibility while booting drivers which set DSO_COMPATLABEL, the compat disklabel may be read, but not written, via the whole-disk device. e.g. acd0. NOTE!! For compatibility we have no choice but to continue to snoop read/write operations on raw slices (e.g. da0s1) because the disklabel program and the kernel still depend on the snooping to modify the in-core version of the disklabel to the on-disk version. No snooping will occur on the whole-disk device (e.g. da0). No snooping will occur on raw slices (e.g. da0s1) if the disk is unlabeled and no in-core label was set. Note that disklabel -r -w DOES set an in-core label before writing to a raw-slice, so it is still ok. * dsopen() no longer attempts to scan the MBR or slice table when the whole-disk device (e.g. da0) is opened, and no longer attempts to read the disklabel when the whole-slice device is opened (e.g. da0s1). The disklabel is only read when a partition is explicitly opened or the label is explicitly read via an ioctl. * The virgin disklabel is stored in the struct diskslice for WHOLE_DISK_SLICE (slice 1).
Remove the roll-your-own disklabel from CCD. Use the kernel disk manager for disklabel support instead. Make CCD a real disk device rather then a fake one. NOTE: All /dev/ccd* devices have changed and must be remade Introduce DSO_COMPATMBR. This forces an MBR sector to be reserved in front of a disklabel even when the target disk does not have slices. It is used by the CCD and VN devices to keep the disklabel aligned the same way it has been historically. Implement 64 bit block addressing for CCD. Implement a new filesystem type "ccd", and require that the devices backing the CCD use that filesystem type for safety. Fix a bug in DIOCGPART where the partinfo->media_blocks was not being set properly for partitions.
* The diskslice abstraction now stores offsets/sizes as 64 bit quantities. (NOTE: DOS partition tables and standard disklabels can't handle 64 bit sector numbers yet). For future pluggable disklabel/partitioning schemes. * The kernel panic / kernel core API is now 64 bits. * The VN device now uses 64 bit sector numbers and can handle block devices up to what is supported by the filesystem (typically 8TB). This change was made primarily so we can test future disklabel / partition table support. * Pass 64 bit LBAs to various block devices and to the SCSI layer. * Check for and assert 32 bit overflow conditions in various places, instead of wrapping.
Continue untangling the disklabel. Use the generic disk_info structure to hold template information instead of the disklabel structure. This removes all references to the disklabel structure from the MBR code and leaves mostly opaque references in the slice code.
Continue untangling the disklabel. Have most disk device drivers fill out and install a generic disk_info structure instead of filling out random fields in the disklabel. The generic disk_info structure uses a 64 bit integer to represent the media size in bytes or total sector count.
Change the kernel dev_t, representing a pointer to a specinfo structure, to cdev_t. Change struct specinfo to struct cdev. The name 'cdev' was taken from FreeBSD. Remove the dev_t shim for the kernel. This commit generally removes the overloading of 'dev_t' between userland and the kernel. Also fix a bug in libkvm where a kernel dev_t (now cdev_t) was not being properly converted to a userland dev_t.
Fix an incorrect #ifndef label. Also remove a now unnecessary #include <sys/msgport.h>. Reported-by: Joe Talbott <email@example.com>
MASSIVE reorganization of the device operations vector. Change cdevsw to dev_ops. dev_ops is a syslink-compatible operations vector structure similar to the vop_ops structure used by vnodes. Remove a huge number of instances where a thread pointer is still being passed as an argument to various device ops and other related routines. The device OPEN and IOCTL calls now take a ucred instead of a thread pointer, and the CLOSE call no longer takes a thread pointer.
Improve seperation between kernel code and userland code by requiring that source files that #include kernel headers also #define _KERNEL or _KERNEL_STRUCTURES as appropriate. With-suggestions-from: joerg Still-todo: systimer.h, and clean up scsi_da.c Tested-by: cd /usr/src/nrelease && make installer_release Approved-by: dillon If-anything-breaks-yell-at: cpressey
Update all my personal copyrights to the Dragonfly Standard Copyright.
Device layer rollup commit. * cdevsw_add() is now required. cdevsw_add() and cdevsw_remove() may specify a mask/match indicating the range of supported minor numbers. Multiple cdevsw_add()'s using the same major number, but distinctly different ranges, may be issued. All devices that failed to call cdevsw_add() before now do. * cdevsw_remove() now automatically marks all devices within its supported range as being destroyed. * vnode->v_rdev is no longer resolved when the vnode is created. Instead, only v_udev (a newly added field) is resolved. v_rdev is resolved when the vnode is opened and cleared on the last close. * A great deal of code was making rather dubious assumptions with regards to the validity of devices associated with vnodes, primarily due to the persistence of a device structure due to being indexed by (major, minor) instead of by (cdevsw, major, minor). In particular, if you run a program which connects to a USB device and then you pull the USB device and plug it back in, the vnode subsystem will continue to believe that the device is open when, in fact, it isn't (because it was destroyed and recreated). In particular, note that all the VFS mount procedures now check devices via v_udev instead of v_rdev prior to calling VOP_OPEN(), since v_rdev is NULL prior to the first open. * The disk layer's device interaction has been rewritten. The disk layer (i.e. the slice and disklabel management layer) no longer overloads its data onto the device structure representing the underlying physical disk. Instead, the disk layer uses the new cdevsw_add() functionality to register its own cdevsw using the underlying device's major number, and simply does NOT register the underlying device's cdevsw. No confusion is created because the device hash is now based on (cdevsw,major,minor) rather then (major,minor). NOTE: This also means that underlying raw disk devices may use the entire device minor number instead of having to reserve the bits used by the disk layer, and also means that can we (theoretically) stack a fully disklabel-supported 'disk' on top of any block device. * The new reference counting scheme prevents this by associating a device with a cdevsw and disconnecting the device from its cdevsw when the cdevsw is removed. Additionally, all udev2dev() lookups run through the cdevsw mask/match and only successfully find devices still associated with an active cdevsw. * Major work on MFS: MFS no longer shortcuts vnode and device creation. It now creates a real vnode and a real device and implements real open and close VOPs. Additionally, due to the disk layer changes, MFS is no longer limited to 255 mounts. The new limit is 16 million. Since MFS creates a real device node, mount_mfs will now create a real /dev/mfs<PID> device that can be read from userland (e.g. so you can dump an MFS filesystem). * BUF AND DEVICE STRATEGY changes. The struct buf contains a b_dev field. In order to properly handle stacked devices we now require that the b_dev field be initialized before the device strategy routine is called. This required some additional work in various VFS implementations. To enforce this requirement, biodone() now sets b_dev to NODEV. The new disk layer will adjust b_dev before forwarding a request to the actual physical device. * A bug in the ISO CD boot sequence which resulted in a panic has been fixed. Testing by: lots of people, but David Rhodus found the most aggregious bugs.
__P() != wanted, begin removal, in order to preserve white space this needs to be done by hand, as I accidently killed a source tree that I had gotten this far on. I'm committing this now, LINT and GENERIC both build with these changes, there are many more to come.
DEV messaging stage 2/4: In this stage all DEV commands are now being funneled through the message port for action by the port's beginmsg function. CONSOLE and DISK device shims replace the port with their own and then forward to the original. FB (Frame Buffer) shims supposedly do the same thing but I haven't been able to test it. I don't expect instability in mainline code but there might be easy-to-fix, and some drivers still need to be converted. See primarily: kern/kern_device.c (new dev_*() functions and inherits cdevsw code from kern/kern_conf.c), sys/device.h, and kern/subr_disk.c for the high points. In this stage all DEV messages are still acted upon synchronously in the context of the caller. We cannot create a separate handler thread until the copyin's (primarily in ioctl functions) are made thread-aware. Note that the messaging shims are going to look rather messy in these early days but as more subsystems are converted over we will begin to use pre-initialized messages and message forwarding to avoid having to constantly rebuild messages prior to use. Note that DEV itself is a mess oweing to its 4.x roots and will be cleaned up in subsequent passes. e.g. the way sub-devices inherit the main device's cdevsw was always a bad hack and it still is, and several functions (mmap, kqfilter, psize, poll) return results rather then error codes, which will be fixed since now we have a message to store the result in :-)
Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most ids have been removed from !lint sections and moved into comment sections.
import from FreeBSD RELENG_4 188.8.131.52