Index: stable/12/sbin/devd/devd.conf.5 =================================================================== --- stable/12/sbin/devd/devd.conf.5 (revision 366606) +++ stable/12/sbin/devd/devd.conf.5 (revision 366607) @@ -1,718 +1,718 @@ .\" .\" Copyright (c) 2002 M. Warner Losh .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .\" The section on comments was taken from named.conf.5, which has the .\" following copyright: .\" Copyright (c) 1999-2000 by Internet Software Consortium .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS .\" ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE .\" CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL .\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR .\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" .Dd August 18, 2020 .Dt DEVD.CONF 5 .Os .Sh NAME .Nm devd.conf .Nd configuration file for .Xr devd 8 .Sh DESCRIPTION .Ss General Syntax A .Xr devd 8 configuration consists of two general features, statements and comments. All statements end with a semicolon. Many statements can contain substatements, which are also terminated with a semicolon. .Pp The following statements are supported: .Bl -tag -width ".Ic options" .It Ic attach Specifies various matching criteria and actions to perform when a newly attached device matches said criteria. .It Ic detach Specifies various matching criteria and actions to perform when a newly detached device matches said criteria. .It Ic nomatch Specifies various matching criteria and actions to perform when no device driver currently loaded in the kernel claims a (new) device. .It Ic notify Specifies various matching criteria and actions to perform when the kernel sends an event notification to userland. .It Ic options Specifies various options and parameters for the operation of .Xr devd 8 . .El .Pp Statements may occur in any order in the configuration file, and may be repeated as often as required. Further details on the syntax and meaning of each statement and their substatements are explained below. .Pp Each statement, except .Ic options has a priority (an arbitrary number) associated with it, where .Ql 0 is defined as the lowest priority. If two statements match the same event, only the action of the statement with highest priority will be executed. In this way generic statements can be overridden for devices or notifications that require special attention. .Pp The general syntax of a statement is: .Bd -literal -offset indent statement priority { substatement "value"; ... substatement "value"; }; .Ed .Ss Sub-statements The following sub-statements are supported within the .Ic options statement. .Bl -tag -width ".Ic directory" .It Ic directory Qq Ar /some/path ; Adds the given directory to the list of directories from which .Xr devd 8 will read all files named "*.conf" as further configuration files. Any number of .Ic directory statements can be used. .It Ic pid-file Qq Pa /var/run/devd.pid ; Specifies PID file. .It Ic set Ar regexp-name Qq Ar (some|regexp) ; Creates a regular expression and assigns it to the variable .Ar regexp-name . The variable is available throughout the rest of the configuration file. If the string begins with .Ql \&! , it matches if the regular expression formed by the rest of the string does not match. All regular expressions have an implicit .Ql ^$ around them. .El .Pp The following sub-statements are supported within the .Ic attach and .Ic detach statements. .Bl -tag -width ".Ic directory" .It Ic action Qq Ar command ; Command to execute upon a successful match. Example .Dq Li "/etc/pccard_ether $device-name start" . .It Ic class Qq Ar string ; This is shorthand for .Dq Ic match Qo Li class Qc Qq Ar string . .It Ic device-name Qq string ; This is shorthand for .Dq Ic match Qo Li device-name Qc Qq Ar string . This matches a device named .Ar string , which is allowed to be a regular expression or a variable previously created containing a regular expression. The .Dq Li device-name variable is available for later use with the .Ic action statement. .It Ic match Qo Ar variable Qc Qq Ar value ; Matches the content of .Ar value against .Ar variable ; the content of .Ar value may be a regular expression. Not required during .Ic attach nor .Ic detach events since the .Ic device-name statement takes care of all device matching. For a partial list of variables, see below. .It Ic media-type Qq Ar string ; For network devices, .Ic media-type will match devices that have the given media type. Valid media types are: .Dq Li Ethernet , .Dq Li Tokenring , .Dq Li FDDI , .Dq Li 802.11 , and .Dq Li ATM . .It Ic subdevice Qq Ar string ; This is shorthand for .Dq Ic match Qo Li subdevice Qc Qq Ar string . .El .Pp The following sub-statements are supported within the .Ic nomatch statement. .Bl -tag -width ".Ic directory" .It Ic action Qq Ar command ; Same as above. .It Ic match Qo Ar variable Qc Qq Ar value ; Matches the content of .Ar value against .Ar variable ; the content of .Ar value may be a regular expression. For a partial list of variables, see below. .El .Pp The following sub-statements are supported within the .Ic notify statement. The .Dq Li notify variable is available inside this statement and contains, a value, depending on which system and subsystem that delivered the event. .Bl -tag -width ".Ic directory" .It Ic action Qq Ar command ; Command to execute upon a successful match. Example .Dq Li "/etc/rc.d/power_profile $notify" . .It Ic match Qo Ar system | subsystem | type | notify Qc Qq Ar value ; Any number of .Ic match statements can exist within a .Ic notify statement; .Ar value can be either a fixed string or a regular expression. Below is a list of available systems, subsystems, and types. .It Ic media-type Qq Ar string ; See above. .El .Ss Variables that can be used with the match statement A partial list of variables and their possible values that can be used together with the .Ic match statement. The variables are published by the bus based on characteristics of the device that generated the event (for device events). Variables for other classes of events are dependent on those events. .Pp .Bl -tag -width ".Li manufacturer" -compact .It Ic Variable .Ic Description .It Li * The entire message from the current event. .It Li _ The entire message from the current event, after the initial type character. .It Li timestamp The time this event was processed, in seconds since 1970 dot fraction. .It Li bus Device name of parent bus. .It Li cdev Device node path if one is created by the .Xr devfs 5 filesystem. .It Li class Device class. .It Li comm Executable name (kernel). .It Li core Path to core file (kernel). .It Li device Device ID. .It Li devclass Device Class (USB). .It Li devsubclass Device Sub-class (USB). .It Li device-name Name of attached/detached device. .It Li endpoints Endpoint count (USB). .It Li function Card functions. .It Li interface Interface ID (USB). .It Li intclass Interface Class (USB). .It Li intprotocol Interface Protocol (USB). .It Li intsubclass Interface Sub-class (USB). .It Li jail Jail name for the process triggering the rule (RCTL). .It Li mode Peripheral mode (USB). .It Li notify Match the value of the .Dq Li notify variable. .It Li parent Parent device. .It Li pid PID of the process triggering the rule (RCTL). .It Li port Hub port number (USB). .It Li product Product ID (USB). .It Li release Hardware revision (USB). .It Li ruid Real UID of the process triggering the rule (RCTL). .It Li rule Rule (RCTL). .It Li sernum Serial Number (USB). .It Li slot Card slot. .It Li subvendor Sub-vendor ID (PCI). .It Li subdevice Sub-device ID (PCI). .It Li subsystem Matches a subsystem of a system, see below. .It Li system Matches a system type, see below. .It Li type Type of notification, see below. .It Li vendor Vendor ID. .El .Ss Notify matching A partial list of systems, subsystems, and types used within the .Ic notify mechanism. .\" .\" Please keep these tables sorted. Also, please use the same parameters .\" for each of the tables so that things line up in columns nicely. .\" Please do not omit the type column for notifiers that omit it. .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li ACPI Ta Ta Ta Events related to the ACPI Subsystem. .It Li ACPI Ta Li ACAD Ta Ta AC line state ($notify=0x00 is offline, 0x01 is online). .It Li ACPI Ta Li Button Ta Ta Button state ($notify=0x00 is power, 0x01 is sleep). .It Li ACPI Ta Li CMBAT Ta Ta Battery events. .It Li ACPI Ta Li Dock Ta Ta Dock state ($notify=0x00 is undocked, 0x01 is docked). .It Li ACPI Ta Li Lid Ta Ta Lid state ($notify=0x00 is closed, 0x01 is open). .It Li ACPI Ta Li PROCESSOR Ta Ta Processor state/configuration ($notify=0x81 is a change in available Cx states). .It Li ACPI Ta Li Resume Ta Ta Resume notification. .It Li ACPI Ta Li Suspend Ta Ta Suspend notification. .It Li ACPI Ta Li Thermal Ta Ta Thermal zone events. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li AEON Ta Li power Ta Li press Ta The power button on an Amiga has been pressed. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li CAM Ta Ta Ta Events related to the .Xr cam 4 system. .It Li CAM Ta Li periph Ta Ta Events related to peripheral devices. .It Li CAM Ta Li periph Ta Li error Ta Generic errors. .It Li CAM Ta Li periph Ta Li timeout Ta Command timeouts. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li CARP Ta Ta Ta Events related to the .Xr carp 4 protocol. .It CARP Ta Ar vhid@inet Ta Ta The .Dq subsystem contains the actual CARP vhid and the name of the network interface on which the event took place. .It CARP Ta Ar vhid@inet Ta MASTER Ta Node become the master for a virtual host. .It CARP Ta Ar vhid@inet Ta BACKUP Ta Node become the backup for a virtual host. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li coretemp Ta Ta Ta Events related to the .Xr coretemp 4 device. .It Li coretemp Ta Li Thermal Ta Ta Notification that the CPU core has reached critical temperature. .It Li coretemp Ta Li Thermal Ta Li temperature Ta String containing the temperature of the core that has become too hot. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li IFNET .It Li IFNET Ta Ar inet Ta Ta The .Dq subsystem is the actual name of the network interface on which the event took place. .It Li IFNET Ta Ar inet Ta Li LINK_UP Ta Carrier status changed to UP. .It Li IFNET Ta Ar inet Ta Li LINK_DOWN Ta Carrier status changed to DOWN. .It Li IFNET Ta Ar inet Ta Li ATTACH Ta The network interface is attached to the system. .It Li IFNET Ta Ar inet Ta Li DETACH Ta The network interface is detached from the system. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li DEVFS .It Li DEVFS Ta Li CDEV Ta Li CREATE Ta The .Xr devfs 5 node is created. .It Li DEVFS Ta Li CDEV Ta Li DESTROY Ta The .Xr devfs 5 node is destroyed. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li ETHERNET Ta Ar inet Ta IFATTACH Ta Notification when the default VNET instance of the .Ar inet interface is attached. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li GEOM Ta Ta Ta Events related to the .Xr geom 4 framework. The difference compared to .Li DEVFS is that .Li GEOM only includes disk-like devices. .It Li GEOM Ta Li DEV Ta Li CREATE Ta A .Xr geom 4 device node is created. .It Li GEOM Ta Li DEV Ta Li DESTROY Ta A .Xr geom 4 device node is destroyed. .It Li GEOM Ta Li DEV Ta Li GEOM::physpath Ta The physical path of a device has changed. .It Li GEOM Ta Li DEV Ta Li GEOM::rotation_rate Ta The rotation rate of the disk has changed. .It Li GEOM Ta Li DEV Ta Li MEDIACHANGE Ta Physical media has changed. .It Li GEOM Ta Li DEV Ta Li SIZECHANGE Ta A .Xr geom 4 provider size has changed. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li kern Ta Li power Ta Li resume Ta Notification that the system has woken from the suspended state. Note: this notification is deprecated and will be removed in .Fx 14.0 . .El .Pp .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li kernel Ta Li signal Ta Li coredump Ta Notification that a process has crashed and dumped core. .It Li kernel Ta Li power Ta Li resume Ta Notification that the system has woken from the suspended state. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li PMU Ta Ta Ta Notification of events from various types of Power Management Units. .It Li PMU Ta Li "AC" Ta Ta Notifications of AC power related events. .It Li PMU Ta Li "AC" Ta Li overvoltage Ta An over-voltage condition was detected on the AC power line. .It Li PMU Ta Li "AC" Ta Li plugged Ta Power has been applied to the AC power line. .It Li PMU Ta Li "AC" Ta Li unplugged Ta Power has been removed from the AC power line. .It Li PMU Ta Li Battery Ta Ta .It Li PMU Ta Li Battery Ta absent Ta Battery is no longer absent. .It Li PMU Ta Li Battery Ta charged Ta The battery has become charged. .It Li PMU Ta Li Battery Ta charging Ta The battery has started charging. .It Li PMU Ta Li Battery Ta disconnected Ta The battery has been disconnected. .It Li PMU Ta Li Battery Ta high-temp Ta The battery reported a temperature over the limit. .It Li PMU Ta Li Battery Ta low-temp Ta The battery reported a temperature under the limit. .It Li PMU Ta Li Battery Ta plugged Ta The battery has become plugged (eg connected). .It Li PMU Ta Li Battery Ta shutdown-threshold Ta The power in the battery has fallen below the shutdown threshold. .It Li PMU Ta Li Battery Ta warning-threshold Ta The power in the battery has fallen below the warn the user threshold. .It Li PMU Ta Li Button Ta pressed Ta A button on a .Xr adb 4 or .Xr pmu 4 has been pressed. .It Li PMU Ta Li keys Ta Ta One of the keys on the .Xr adb 4 keyboard has been pressed. .It Li PMU Ta Li keys Ta brightness Ta A brightness level change has been requested. Direction is in the $notify variable. .It Li PMU Ta Li keys Ta mute Ta -The mute key +The mute key .It Li PMU Ta Li keys Ta volume Ta A volume level change has been requested. Direction is in the $notify variable. .It Li PMU Ta Li keys Ta eject Ta An ejection has been requested. .It Li PMU Ta Li lid Ta close Ta The .Xr pmc 4 device has detected the lid closing. .It Li PMU Ta Li lid Ta open Ta The .Xr pmc 4 device has detected the lid openinging. .It Li PMU Ta Li POWER Ta ACLINE Ta The .Xr pmc 4 device has deteted an AC line state ($notify=0x00 is offline, 0x01 is online). .It Li PMU Ta Li USB Ta overvoltage Ta An over-voltage condition on the power lines for the USB power pins. .It Li PMU Ta Li USB Ta plugged Ta A device has been plugged into a USB device. .It Li PMU Ta Li USB Ta undervoltage Ta An under-voltage condition on the power lines for the USB power pins. .It Li PMU Ta Li USB Ta unplugged Ta A device has been unplugged into a USB device. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li RCTL Ta Ta Ta Events related to the .Xr rctl 8 framework. .It Li RCTL Ta Li rule Ta Li matched Ta A rule with action specified as "devctl" was triggered. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" .It Li USB Ta Ta Ta Events related to the USB subsystem. .It Li USB Ta Li DEVICE Ta Li ATTACH Ta USB device is attached to the system. .It Li USB Ta Li DEVICE Ta Li DETACH Ta USB device is detached to the system. .It Li USB Ta Li INTERFACE Ta Li ATTACH Ta USB interface is attached to a device. .It Li USB Ta Li INTERFACE Ta Li DETACH Ta USB interface is detached from a device. .El .Pp .\" .\" End of tables .\" A link state change to UP on the interface .Dq Li fxp0 would result in the following notify event: .Bd -literal -offset indent system=IFNET subsystem=fxp0 type=LINK_UP .Ed .Pp An AC line state change to .Dq offline would result in the following event: .Bd -literal -offset indent system=ACPI subsystem=ACAD notify=0x00 .Ed .Ss Comments Comments may appear anywhere that whitespace may appear in a configuration file. To appeal to programmers of all kinds, they can be written in C, C++, or shell/Perl constructs. .Pp C-style comments start with the two characters .Ql /* (slash, star) and end with .Ql */ (star, slash). Because they are completely delimited with these characters, they can be used to comment only a portion of a line or to span multiple lines. .Pp C-style comments cannot be nested. For example, the following is not valid because the entire comment ends with the first .Ql */ : .Bd -literal -offset indent /* This is the start of a comment. This is still part of the comment. /* This is an incorrect attempt at nesting a comment. */ This is no longer in any comment. */ .Ed .Pp C++-style comments start with the two characters .Ql // (slash, slash) and continue to the end of the physical line. They cannot be continued across multiple physical lines; to have one logical comment span multiple lines, each line must use the .Ql // pair. For example: .Bd -literal -offset indent // This is the start of a comment. The next line // is a new comment, even though it is logically // part of the previous comment. .Ed .Sh FILES .Bl -tag -width ".Pa /etc/devd.conf" -compact .It Pa /etc/devd.conf The .Xr devd 8 configuration file. .El .Sh EXAMPLES .Bd -literal # # This will catch link down events on the interfaces fxp0 and ath0 # notify 0 { match "system" "IFNET"; match "subsystem" "(fxp0|ath0)"; match "type" "LINK_DOWN"; action "logger $subsystem is DOWN"; }; # # Match lid open/close events # These can be combined to a single event, by passing the # value of $notify to the external script. # notify 0 { match "system" "ACPI"; match "subsystem" "Lid"; match "notify" "0x00"; action "logger Lid closed, we can sleep now!"; }; notify 0 { match "system" "ACPI"; match "subsystem" "Lid"; match "notify" "0x01"; action "logger Lid opened, the sleeper must awaken!"; }; # # Match a USB device type # notify 0 { match "system" "USB"; match "subsystem" "INTERFACE"; match "type" "ATTACH"; match "intclass" "0x0e"; action "logger USB video device attached"; }; # # Try to configure ath and iwn devices with pccard_ether # as they are attached. # attach 0 { device-name "(ath|iwn)[0-9]+"; action "/etc/pccard_ether $device-name start"; }; # # Stop ath and iwn devices as they are detached from # the system. # detach 0 { device-name "(ath|iwn)[0-9]+"; action "/etc/pccard_ether $device-name stop"; }; .Ed .Pp The installed .Pa /etc/devd.conf has many additional examples. .Sh SEE ALSO .Xr cam 4 , .Xr coretemp 4 , .Xr devfs 5 , .Xr re_format 7 , .Xr devd 8 Index: stable/12/sbin/fsdb/fsdb.8 =================================================================== --- stable/12/sbin/fsdb/fsdb.8 (revision 366606) +++ stable/12/sbin/fsdb/fsdb.8 (revision 366607) @@ -1,270 +1,270 @@ .\" $NetBSD: fsdb.8,v 1.2 1995/10/08 23:18:08 thorpej Exp $ .\" .\" Copyright (c) 1995 John T. Kohl .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE .\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd October 3, 2016 .Dt FSDB 8 .Os .Sh NAME .Nm fsdb .Nd FFS debugging/editing tool .Sh SYNOPSIS .Nm .Op Fl d .Op Fl f .Op Fl r .Ar fsname .Sh DESCRIPTION The .Nm utility opens .Ar fsname (usually a raw disk partition) and runs a command loop allowing manipulation of the file system's inode data. You are prompted to enter a command with .Ic "fsdb (inum X)>" where .Va X is the currently selected i-number. The initial selected inode is the root of the file system (i-number 2). The command processor uses the .Xr editline 3 library, so you can use command line editing to reduce typing if desired. When you exit the command loop, the file system superblock is marked dirty and any buffered blocks are written to the file system. .Pp The following options are available: .Bl -tag -width indent .It Fl d Enable additional debugging output (which comes primarily from .Xr fsck 8 Ns -derived code). .It Fl f Left for historical reasons and has no meaning. .It Fl r Open the file system read/only, and disables all commands that would write to it. .El .Sh COMMANDS Besides the built-in .Xr editline 3 commands, .Nm supports these commands: .Pp .Bl -tag -width indent -compact .It Cm help Print out the list of accepted commands. .Pp .It Cm inode Ar i-number Select inode .Ar i-number as the new current inode. .Pp .It Cm back Revert to the previously current inode. .Pp .It Cm clri Ar i-number Clear .Ar i-number . .Pp .It Cm lookup Ar name .It Cm cd Ar name Find .Ar name in the current directory and make its inode the current inode. .Ar Name may be a multi-component name or may begin with slash to indicate that the root inode should be used to start the lookup. If some component along the pathname is not found, the last valid directory encountered is left as the active inode. This command is valid only if the starting inode is a directory. .Pp .It Cm active .It Cm print Print out the active inode. .Pp .It Cm blocks Print out the block list of the active inode. Note that the printout can become long for large files, since all indirect block pointers will also be printed. .Pp .It Cm findblk Ar disk_block_number ... Find the inode(s) owning the specified disk block(s) number(s). Note that these are not absolute disk blocks numbers, but offsets from the start of the partition. .Pp .It Cm uplink Increment the active inode's link count. .Pp .It Cm downlink Decrement the active inode's link count. .Pp .It Cm linkcount Ar number Set the active inode's link count to .Ar number . .Pp .It Cm ls List the current inode's directory entries. This command is valid only if the current inode is a directory. .Pp .It Cm rm Ar name .It Cm del Ar name Remove the entry .Ar name from the current directory inode. This command is valid only if the current inode is a directory. .Pp .It Cm ln Ar ino Ar name Create a link to inode .Ar ino under the name .Ar name in the current directory inode. This command is valid only if the current inode is a directory. .Pp .It Cm chinum Ar dirslot Ar inum Change the i-number in directory entry .Ar dirslot to .Ar inum . .Pp .It Cm chname Ar dirslot Ar name Change the name in directory entry .Ar dirslot to .Ar name . This command cannot expand a directory entry. You can only rename an entry if the name will fit into the existing directory slot. .Pp .It Cm chtype Ar type Change the type of the current inode to .Ar type . .Ar Type may be one of: .Em file , .Em dir , .Em socket , or .Em fifo . .Pp .It Cm chmod Ar mode Change the mode bits of the current inode to .Ar mode . You cannot change the file type with this subcommand; use .Ic chtype to do that. .Pp .It Cm chflags Ar flags Change the file flags of the current inode to .Ar flags . .Pp .It Cm chown Ar uid Change the owner of the current inode to .Ar uid . .Pp .It Cm chgrp Ar gid Change the group of the current inode to .Ar gid . .Pp .It Cm chgen Ar gen Change the generation number of the current inode to .Ar gen . .Pp .It Cm btime Ar time .It Cm mtime Ar time .It Cm ctime Ar time .It Cm atime Ar time Change the creation (birth), modification, change, or access time (respectively) on the current inode to .Ar time . .Ar Time should be in the format .Em YYYYMMDDHHMMSS[.nsec] where .Em nsec is an optional nanosecond specification. If no nanoseconds are specified, the .Va birthnsec , .Va mtimensec , .Va ctimensec , or .Va atimensec field will be set to zero. Note that .Cm btime is available on UFS2 file systems only. .Pp .It Cm quit , q , exit , Em Exit the program. .El .Sh SEE ALSO .Xr editline 3 , .Xr fs 5 , .Xr clri 8 , .Xr fsck 8 .Sh HISTORY The .Nm utility appeared in .Bx 4.3 Tahoe . It used the source code for .Xr fsck 8 to implement most of the file system manipulation code. The remainder of .Nm appeared in .Nx 1.1 written by .An John T. Kohl . It first appeared in -.Fx 2.1.5 +.Fx 2.1.5 ported by Peter Wemm. .Sh BUGS Manipulation of ``short'' symlinks has no effect. In particular, one should not try changing a symlink's type. .Pp You must specify modes as numbers rather than symbolic names. .Pp There are a bunch of other things that you might want to do which .Nm does not implement. .Sh WARNING Use this tool with extreme caution--you can damage an FFS file system beyond what .Xr fsck 8 can repair. Index: stable/12/sbin/mdmfs/mdmfs.8 =================================================================== --- stable/12/sbin/mdmfs/mdmfs.8 (revision 366606) +++ stable/12/sbin/mdmfs/mdmfs.8 (revision 366607) @@ -1,451 +1,451 @@ .\" .\" Copyright (c) 2001 Dima Dorfman. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd October 31, 2019 .Dt MDMFS 8 .Os .Sh NAME .Nm mdmfs , .Nm mount_mfs .Nd configure and mount an in-memory file system using the .Xr md 4 driver or the .Xr tmpfs 5 filesystem .Sh SYNOPSIS .Nm .Op Fl DLlMNnPStTUX .Op Fl a Ar maxcontig .Op Fl b Ar block-size .Op Fl c Ar blocks-per-cylinder-group .Op Fl d Ar max-extent-size .Op Fl E Ar path-mdconfig .Op Fl e Ar maxbpg .Op Fl F Ar file .Op Fl f Ar frag-size .Op Fl i Ar bytes .Op Fl k Ar skel .Op Fl m Ar percent-free .Op Fl O Ar optimization .Op Fl o Ar mount-options .Op Fl p Ar permissions .Op Fl s Ar size .Op Fl T Ar fstype .Op Fl v Ar version .Op Fl w Ar user : Ns Ar group .Ar md-device .Ar mount-point .Sh DESCRIPTION The .Nm utility is designed to be a work-alike and look-alike of the deprecated .Xr mount_mfs 8 . The end result is essentially the same, but is accomplished in a completely different way. Based on .Ar md-device , the .Nm -utility either creates a +utility either creates a .Xr tmpfs 5 filesystem, or it configures an .Xr md 4 disk using .Xr mdconfig 8 , puts a UFS file system on it (unless .Fl P was specified) using .Xr newfs 8 , and mounts it using .Xr mount 8 . It can handle .Xr geom_uzip 4 compressed disk images, as long as the kernel supports this GEOM class. All the command line options are passed to the appropriate program at the appropriate stage in order to achieve the desired effect. .Pp When .Ar md-device is `auto', .Nm uses .Xr tmpfs 5 if it is present in the kernel or can be loaded as a module, otherwise it falls back to using .Xr md 4 auto-unit as if `md' had been specified. .Pp When .Ar md-device is `tmpfs', .Nm mounts a .Xr tmpfs 5 filesystem, translating the .Fl s size option, if present, into a `-o size=' mount option. Any .Fl o options on the command line are passed through to the .Xr tmpfs 5 mount. Options specific to .Xr mdconfig 8 or .Xr newfs 8 are ignored. .Pp When .Ar md-device does not result in .Xr tmpfs 5 being used, then an .Xr md 4 device is configured instead. By default, .Nm creates a swap-based .Pq Dv MD_SWAP disk with soft-updates enabled and mounts it on .Ar mount-point . It uses the .Xr md 4 device specified by .Ar md-device . If .Ar md-device is .Ql md (no unit number), it will use .Xr md 4 Ns 's auto-unit feature to automatically select an unused device. Unless otherwise specified with one of the options below, it uses the default arguments to all the helper programs. .Pp The following options are available. Where possible, the option letter matches the one used by .Xr mount_mfs 8 for the same thing. .Bl -tag -width indent .It Fl a Ar maxcontig Specify the maximum number of contiguous blocks that will be laid out before forcing a rotational delay (see the .Fl d option). .It Fl b Ar block-size The block size of the file system, in bytes. .It Fl c Ar blocks-per-cylinder-group The number of blocks per cylinder group in the file system. .It Fl D If not using auto-unit, do not run .Xr mdconfig 8 to try to detach the unit before attaching it. .It Fl d Ar max-extent-size The file system may choose to store large files using extents. This parameter specifies the largest extent size that may be used. It is presently limited to its default value which is 16 times the file system blocksize. .It Fl E Ar path-mdconfig Use .Ar path-mdconfig as a location of the .Xr mdconfig 8 utility. .It Fl e Ar maxbpg Indicate the maximum number of blocks any single file can allocate out of a cylinder group before it is forced to begin allocating blocks from another cylinder group. .It Fl F Ar file Create a vnode-backed .Pq Dv MD_VNODE memory disk backed by .Ar file . .It Fl f Ar frag-size The fragment size of the file system in bytes. .It Fl i Ar bytes Number of bytes per inode. .It Fl k Ar skel Copy the content of directory .Ar skel into .Ar mount-point . .It Fl l Enable multilabel MAC on the new file system. .It Fl L Show the output of the helper programs. By default, it is sent to .Pa /dev/null . .It Fl M Create a .Xr malloc 9 backed disk .Pq Dv MD_MALLOC instead of a swap-backed disk. .It Fl m Ar percent-free The percentage of space reserved for the superuser. .It Fl N Do not actually run the helper programs. This is most useful in conjunction with .Fl X . .It Fl n Do not create a .Pa .snap directory on the new file system. .It Fl O Ar optimization Select the optimization preference; valid choices are .Cm space and .Cm time , which will optimize for minimum space fragmentation and minimum time spent allocating blocks, respectively. .It Fl o Ar mount-options Specify the mount options with which to mount the file system. See .Xr mount 8 for more information. .It Fl P Preserve the existing file system; do not run .Xr newfs 8 . This only makes sense if .Fl F is specified to create a vnode-backed disk. .It Fl p Ar permissions Set the file (directory) permissions of the mount point .Ar mount-point to .Ar permissions . The .Ar permissions argument can be in any of the mode formats recognized by .Xr chmod 1 . If symbolic permissions are specified, the operation characters .Dq + and .Dq - are interpreted relative to the initial permissions of .Dq a=rwx . .It Fl S Do not enable soft-updates on the file system. .It Fl s Ar size Specify the size of the disk to create. This only makes sense if .Fl F is .Em not specified. That is, this will work when the backing storage is some form of memory, as opposed to a fixed-size file. The size may include the usual SI suffixes (k, m, g, t, p). A number without a suffix is interpreted as a count of 512-byte sectors. .It Fl t Turn on the TRIM enable flag for .Xr newfs 8 . When used with a file system that issue BIO_DELETE bio requests, .Xr md 4 returns deleted blocks to the system memory pool. .It Fl T Ar fstype Specify a file system type for a vnode-backed memory disk. Any file system supported by .Xr mount 8 command can be specified. This option only makes sense when .Fl F and .Fl P are used. .It Fl U Enable soft-updates on the file system. This is the default, and is accepted only for compatibility. It is only really useful to negate the .Fl S flag, should such a need occur. .It Fl v Ar version Specify the UFS version number for use on the file system; it may be either .Dv 1 or .Dv 2 . The default is derived from the default of the .Xr newfs 8 command. .It Fl w Ar user : Ns Ar group Set the owner and group to .Ar user and .Ar group , respectively. The arguments have the same semantics as with .Xr chown 8 , but specifying just a .Ar user or just a .Ar group is not supported. .It Fl X Print what command will be run before running it, and other assorted debugging information. .El .Pp The .Fl F and .Fl s options are passed to .Xr mdconfig 8 as .Fl f and .Fl s , respectively. The .Fl a , b , c , d , e , f , i , m and .Fl n options are passed to .Xr newfs 8 with the same letter. The .Fl O option is passed to .Xr newfs 8 as .Fl o . The .Fl o option is passed to .Xr mount 8 with the same letter. The .Fl T option is passed to .Xr mount 8 as .Fl t . For information on semantics, refer to the documentation of the programs that the options are passed to. .Sh EXAMPLES Create and mount a 32 megabyte swap-backed file system on .Pa /tmp : .Pp .Dl "mdmfs -s 32m md /tmp" .Pp The same file system created as an entry in .Pa /etc/fstab : .Pp .Dl "md /tmp mfs rw,-s32m 2 0" .Pp Create and mount a 16 megabyte malloc-backed file system on .Pa /tmp using the .Pa /dev/md1 device; furthermore, do not use soft-updates on it and mount it .Cm async : .Pp .Dl "mdmfs -M -S -o async -s 16m md1 /tmp" .Pp Create and mount a .Xr geom_uzip 4 based compressed disk image: .Pp .Dl "mdmfs -P -F foo.uzip -oro md.uzip /tmp/" .Pp Mount the same image, specifying the .Pa /dev/md1 device: .Pp .Dl "mdmfs -P -F foo.uzip -oro md1.uzip /tmp/" .Pp Configure a vnode-backed file system and mount its first partition, using automatic device numbering: .Pp .Dl "mdmfs -P -F foo.img mds1a /tmp/" .Pp Mount a vnode-backed cd9660 file system using automatic device numbering: .Pp .Dl "mdmfs -T cd9660 -P -F foo.iso md /tmp" .Sh COMPATIBILITY The .Nm utility, while designed to be compatible with .Xr mount_mfs 8 , can be useful by itself. Since .Xr mount_mfs 8 had some silly defaults, a .Dq compatibility mode is provided for the case where bug-to-bug compatibility is desired. .Pp Compatibility is enabled by starting .Nm with the name .Li mount_mfs or .Li mfs (as returned by .Xr getprogname 3 ) . In this mode, the following behavior, as done by .Xr mount_mfs 8 , is duplicated: .Bl -bullet -offset indent .It The file mode of .Ar mount-point is set by default to .Li 01777 as if .Fl p Ar 1777 was given on the command line. .El .Sh SEE ALSO .Xr md 4 , .Xr fstab 5 , .Xr tmpfs 5 , .Xr mdconfig 8 , .Xr mount 8 , .Xr newfs 8 .Sh HISTORY The .Nm utility appeared in .Fx 5.0 . .Sh AUTHORS .An Dima Dorfman Index: stable/12 =================================================================== --- stable/12 (revision 366606) +++ stable/12 (revision 366607) Property changes on: stable/12 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r366405,366408,366410