Commit Graph

164 Commits

Author SHA1 Message Date
Hiroki Sato
b78ae23fdd - Add "-f file" support to listing mode (-l). When a -f option is
specified, only md(4) devices which have the specified file as backing
  store are displayed.
- Use MD_NAME instead of "md".
- Use _PATH_DEV instead of "/dev/".

MFC after:	1 week
2013-06-20 14:30:16 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Jaakko Heinonen
734e78dfcb Disallow attaching preloaded memory disks via ioctl.
- The feature is dangerous because the kernel code didn't check
  validity of the memory address provided from user space.
- It seems that mdconfig(8) never really supported attaching preloaded
  memory disks.
- Preloaded memory disks are automatically attached during md(4)
  initialization. Thus there shouldn't be much use for the feature.

PR:		kern/169683
Discussed on:	freebsd-hackers
2012-11-21 16:56:47 +00:00
Warren Block
2f78ba90f4 Add an example showing the use of gnop(8) to skip over header data.
PR:		kern/145999
Reviewed by:	mjg
MFC after:	1 week
2012-11-04 03:19:07 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Edward Tomasz Napierala
dc604f0cf6 Make it possible to resize md(4) devices.
Reviewed by:	kib
Sponsored by:	FreeBSD Foundation
2012-07-07 20:32:21 +00:00
Eitan Adler
eb5f456981 Remove ancient vnconfig symlink
Submitted by:	ak
Approved by:	cperciva
MFC after:	1 week
2012-07-07 17:20:27 +00:00
Gavin Atkinson
b45c4eb9ae The -S option, to specify the sector size, has been usable on all types of
memory disks since r135340.  Update the man page to reflect this.

Noticed by:	avg
MFC after:	3 days
2012-06-27 12:19:28 +00:00
Joel Dahl
4228c8a2b1 Remove end of line whitespace. 2012-05-12 19:59:37 +00:00
Joel Dahl
5da4420931 mdoc: use Po and Pc macros instead of parens. Also avoid starting a line
with Ns.
2012-05-12 17:14:55 +00:00
Benjamin Kaduk
ac5b109f31 Fix a couple of style issues. Tweak grammar and markup while here.
Approved by:	hrs (mentor)
2012-04-09 01:20:50 +00:00
Edward Tomasz Napierala
cff3dc0871 Add missing "static". 2012-03-14 10:10:15 +00:00
Edward Tomasz Napierala
77c437734c Rewrite option parsing in mdconfig(8). This makes it more user-friendly
by removing the ordering requirements and adding more descriptive error
messages; it also makes it more readable and maintainable.

Sponsored by:	The FreeBSD Foundation
2012-01-27 11:48:44 +00:00
Edward Tomasz Napierala
89ef44efa3 Replace the beerware license on mdconfig(8) with standard 2-clause BSD.
Approved by:	phk@
2012-01-21 11:48:48 +00:00
Dag-Erling Smørgrav
6c49c6cff2 Somewhere around the 473rd time I mistyped "mdconfig file" instead of
"mdconfig -f file", I decided that it would be easier to make mdconfig
DWIM than to teach my fingers to type the correct command line.

MFC after:	3 weeks
2011-04-29 22:40:11 +00:00
Dag-Erling Smørgrav
3b39802214 whitespace nit - sorry for the churn 2011-04-27 21:40:49 +00:00
Dag-Erling Smørgrav
e81d0f5a74 whitespace nit 2011-04-27 21:39:59 +00:00
Rebecca Cran
c3e257a9e7 Add a check to make sure the provider name is "mdN" before printing the
unit number.

Suggested by: 	jh
MFC after:	3 days
2011-02-14 09:58:47 +00:00
Rebecca Cran
6992d350af Only print the unit number when invoked with the -n flag.
PR:	bin/144300
Submitted by:	arundel
MFC after:	3 days
2011-02-13 18:30:17 +00:00
Joel Dahl
db28020476 Use "cylinder" instead of "cyl" for consistency.
Reviewed by:	phk
2010-11-13 15:28:44 +00:00
Jaakko Heinonen
a4ca6a4926 Make mdconfig(8) WARNS=6 clean:
- Constify geom_config_get() name argument.
- Add void keyword for usage().
- Initialize mdunit to NULL.
- Don't call md_prthumanval() at all if length is NULL.

Approved by:	trasz (mentor)
2010-01-22 08:51:58 +00:00
Jaakko Heinonen
0e3ebc63e6 Print sizes up to INT64_MAX in md_prthumanval().
PR:		bin/125365
Approved by:	trasz (mentor)
MFC after:	2 weeks
2010-01-18 14:07:41 +00:00
Ruslan Ermilov
106d839190 Switch the default WARNS level for sbin/ to 6.
Submitted by:	Ulrich Spörlein
2009-10-19 16:00:24 +00:00
Edward Tomasz Napierala
a9ebb31183 Add the possibility to specify "-o force" with "mdconfig -du".
Reviewed by:	scottl
Approved by:	rwatson (mentor)
Sponsored by:	FreeBSD Foundation
2009-01-10 17:17:18 +00:00
Dmitry Morozovsky
c94b8307db Add -v (verbose) option to -l command, to show size and backing store
of all md devices at one time.

Approved by:	phk
MFC after:	2 weeks
2008-06-21 15:04:42 +00:00
Remko Lodder
3655c14d25 Every newline should start on it's own line. I didn't do that in the
previous commit, so make it happen now.

Prodded by:	brueffer
2007-11-28 12:29:59 +00:00
Remko Lodder
d18e01346c Sync with md(4)'s information regarding the swap backend.
PR:		docs/115721
Submitted by:	Stefan Lambrev <stefan.lambrev@moneybookers.com>
MFC After:	3 days
2007-11-28 12:11:36 +00:00
Florent Thoumie
69fcb5379c Fix exit code when using -l on a non-existent md(4) device.
PR:		conf/116177
Submitted by:	Remi Guyomarch <rguyom@pobox.com>
MFC after:	3 days
2007-11-16 17:40:24 +00:00
Giorgos Keramidas
d257bc4a71 * Expand the example descriptions, fix mdoc-bugs in
"(-a and -t vnode are implied)"
  and reuse it near the cd9660 example.
* Spell 'backing store' as two words.
2007-11-11 08:12:21 +00:00
Giorgos Keramidas
284096f773 Instead of hardcoding md10 as the device node in the cd9660 example,
use a trick submitted by Ruslan.

MFC after:	1 day
2007-11-09 18:02:51 +00:00
Giorgos Keramidas
5810c7ef77 Add an example which shows how mdconfig(8) can be used
to mount an ISO 9660 CD image file.

PR:		112691
Submitted by:	Warren Block, wblock at wonkity.com
MFC after:	3 days
2007-05-18 13:57:17 +00:00
Nick Hibma
7090e3d10c Kris suggested that swap is a better choice as a default than malloc.
MFC:	1 week
2007-02-20 22:04:23 +00:00
Nick Hibma
35ce0ff2f2 [Found the original diff I made, see previous commit for other part]
Assume '-a' and '-t malloc' flags for '-s <size>' (malloc ramdisk) if not
specified.

Reviewed by:	phk (some time ago)
MFC:		1 week
2007-02-20 21:29:30 +00:00
Nick Hibma
1253fe1ead Make attach the default for -f. That way
mdconfig -f image

works like a charm.

Reviewed by:	phk (some time ago)
MFC:		1 week
2007-02-20 21:04:12 +00:00
Poul-Henning Kamp
f07de1474c Make WITHOUT_DYNAMICROOT=foo work again: remember to reference
libbsdxml and libsbuf.
2006-04-01 16:34:45 +00:00
Jason Evans
c3345c667e Unbreak the build. 2006-03-27 05:33:35 +00:00
Wojciech A. Koszek
ea3d97ae67 For now, bring back some of the old bits as a fix for specifying md(4)
device number at creation time with -u option. Together with XMLizing
mdconfig(8), I broke this functionality.

This change is temporary. Complete fix will be commited soon.

Approved by:	cognet (mentor)
2006-03-27 00:46:22 +00:00
Wojciech A. Koszek
c27a895433 Teach md(4) and mdconfig(8) how to understand XML. Right now there won't be
a problem with listing large number of md(4) devices. Either 'list' or
'query' mode uses XML.

Additionally, new functionality was introduced. It's possible to pass
multiple devices to -u:

	# ./mdconfig -l -u md0,md1

Approved by:	cognet (mentor)
2006-03-26 23:21:11 +00:00
Wojciech A. Koszek
4bfd989f3e Keep proper order of includes. Additionally, sort them. Make functions used
in that file static.

Approved by:	cognet (mentor)
2006-03-26 22:52:36 +00:00
Pawel Jakub Dawidek
a921cb3130 Use kld(3) for loading geom_md.ko. 2006-02-18 11:40:24 +00:00
Dima Dorfman
7e06d7bcbc Sort the list results by the unit number. The list returned by the
kernel is in the order the devices were made, which is not useful to
the user. Also, remove the "%d more" test since the kernel does not
return the complete count in md_pad[0] (maybe it should?).

Submitted by:	Wojciech A. Koszek
2005-12-22 10:32:11 +00:00
Pawel Jakub Dawidek
d941425873 Rename GEOM class kernel module g_md.ko to geom_md.ko for consistency
with the rest.

mdconfig.c:	Simplify mdmaybeload() function.
mdioctl.h:	Removed (now unused) #define.
loader.conf:	Sort GEOM classes properly.

OK'ed by:	phk
2005-11-11 11:31:23 +00:00
Christian S.J. Peron
c313f09bfb When using files as backing stores for devices, and the user has requested the
device be created read+write, check to see if the backing store is read only
through the use of the access(2) system call. If this check fails returning
EACCES, EPERM or EROFS then gracefully downgrade the access to read only. Also
print a warning message to stderr, informing the user that the access mode
they requested is not available.

This behavior used to be handled by md(4) but was changed in revision 1.154

Discussed with:	pjd, phk, Dario Freni <saturnero at freesbie dot org>
Reviewed by:	phk
2005-08-30 16:45:32 +00:00
Pawel Jakub Dawidek
5d19b2f993 We can specify device size in bytes. Document this in usage. 2005-03-01 14:56:49 +00:00
Michael Reifenberger
d111a5c972 Document the terabyte "-s" parameter in the usage string.
Split the usage line to not exceed 80 chars.
2005-02-21 09:09:07 +00:00
Ruslan Ermilov
8d646af581 Sync program's usage() with manpage's SYNOPSIS. 2005-02-10 09:19:34 +00:00
Pawel Jakub Dawidek
0d79319a76 Allow to specify device size in bytes.
MFC after:	1 week
2005-01-22 20:02:01 +00:00
Pawel Jakub Dawidek
88b5b78d59 Rewrite piece of code which I committed some time ago that allows to
show file name for 'mdconfig -l -u <x>' command.
This allows to preserve API/ABI compatibility with version 0 (that's why
I changed version number back to 0) and will allow to merge this change
to RELENG_5.

MFC after:	5 days
2004-12-27 17:20:06 +00:00
Ruslan Ermilov
78bb116290 Sync usage() with manpage SYNOPSIS and code. 2004-11-13 17:08:52 +00:00
Dima Dorfman
df5f8fa751 Bump .Dd, replace missing letter, and prefer to use a verb that
matches the option letter.

Submitted by:	ru
Should know better by now:	dd
2004-11-06 14:03:37 +00:00
Pawel Jakub Dawidek
61a6eb62ec For file backed md(4) devices output their source file via
'mdconfig -l -u <unit>'.
Bump version number, as this change breaks ABI/API.
2004-11-06 13:07:02 +00:00
Dima Dorfman
e08f2053fc Update the description of -l to reflect reality. After mdconfig.c
1.25, -l without -u only lists the names, so specifying -u does more
than just limit the output to one device.
2004-11-06 10:21:12 +00:00
Dima Dorfman
9a777b93be If there aren't any devices to list, output nothing instead of an
empty line. This is consistent with other utilities.

While I'm here, remove artifacts of the previous list implementation.
2004-11-06 09:56:27 +00:00
Pawel Jakub Dawidek
b830359bc5 - Make md(4) 64-bit clean.
After this change it should be possible to use very big md(4) devices.
- Clean up and simplify the code a bit.
- Use humanize_number(3) to print size of md(4) devices.
- Add 't' suffix which stands for terabyte.
- Make '-S' to really work with all types of devices.
- Other minor changes.
2004-09-16 21:32:13 +00:00
John-Mark Gurney
d31ba6257b add support for documented readonly option...
also print out the option that is unknow so that the user knows what (s)he
did wrong..

MFC after:	3 days
2004-09-08 20:28:29 +00:00
John-Mark Gurney
a246f097d6 change the name of the md module, to g_md, introduce a define with the
name MD_MODNAME, and make mdconfig use this new define...
2004-08-09 06:45:20 +00:00
Poul-Henning Kamp
e869d3777e Give better diagnostic for problems with backing files. 2004-07-25 08:17:23 +00:00
Ruslan Ermilov
9806e23132 Mechanically kill hard sentence breaks. 2004-07-02 21:45:06 +00:00
Ruslan Ermilov
d04b5dfe6c Assorted markup, grammar, and spelling fixes. 2004-05-17 08:35:43 +00:00
Poul-Henning Kamp
7a6b2b6429 Fix a long-standing deadlock issue with vnode backed md(4) devices:
On vnode backed md(4) devices over a certain, currently undetermined
size relative to the buffer cache our "lemming-syncer" can provoke
a buffer starvation which puts the md thread to sleep on wdrain.

This generally tends to grind the entire system to a stop because the
event that is supposed to wake up the thread will not happen until a fair
bit of the piled up I/O requests in the system finish, and since a lot
of those are on a md(4) vnode backed device which is currently waiting
on wdrain until a fair amount of the piled up ... you get the picture.

The cure is to issue all VOP_WRITES on the vnode backing the device
with IO_SYNC.

In addition to more closely emulating a real disk device with a
non-lying write-cache, this makes the writes exempt from rate-limited
(there to avoid starving the buffer cache) and consequently prevents
the deadlock.

Unfortunately performance takes a hit.

Add "async" option to give people who know what they are doing the
old behaviour.
2004-03-10 20:41:09 +00:00
Poul-Henning Kamp
91f9647d49 s/bytes/byte/ 2004-02-19 19:53:07 +00:00
Poul-Henning Kamp
79ae25f61f Note that geometry can also be specified on vnode backed deviecs. 2004-01-12 10:54:09 +00:00
Poul-Henning Kamp
b4bca2d5ec Warn that big malloc disks are a panic(8) implementation.
Submitted by:	Colin Percival <cperciva@builder.daemonology.net>
(Who should really get his own bit one of these days!)

PR:	59988
2004-01-02 14:28:06 +00:00
Marc Fonvieille
84783ceaeb Add a full example of a file-backed disk creation, I used the Handbook's
example.

PR:		docs/51897
Submitted by:	Kevin Oberman <oberman@es.net>
2003-10-11 09:59:25 +00:00
Marc Fonvieille
8b23842d38 s/disklabel/bsdlabel where needed. 2003-10-11 08:24:07 +00:00
Poul-Henning Kamp
076cb6a8c9 Document the -x and -y options. 2003-09-21 19:05:35 +00:00
Alexander Kabaev
8a50130bbb Do not compare unsigned int values with ULONG_MAX. The comparison is
always false on 64bit platforms and GCC 3.3.1 issues warning there.
2003-07-11 05:47:05 +00:00
Robert Watson
f79c46d3f4 Add "-n" argument, which causes mdconfig to simply print the unit
number X, rather than mdX, making it easier to script tests that
use md devices but don't want to make assumptions about any existing
md use (such as in diskless environments).
2003-06-11 06:38:24 +00:00
Doug Barton
1b6c6f4aae Add .Xr's to mdmfs(8).
Submitted by:	Scot W. Hetzel <hetzels@westbend.net>
2003-04-27 01:46:56 +00:00
Poul-Henning Kamp
4e8bfe1482 Add a couple of undocumented test options to MD(4) to aid in regression
testting of GEOM.
2003-04-09 11:59:29 +00:00
Yaroslav Tykhiy
252bcf459d Give clearer diagnostics on some cases of invalid
combinations of mdconfig(8) command-line arguments.

Make mdconfig(8) accept "-a -f file -o options"
equally with "-a -f file" (assuming "-t vnode".)
2003-04-01 15:23:55 +00:00
Poul-Henning Kamp
ebe789d61c Add a "-S sectorsize" option to enable Kirk to find a bug :-) 2003-03-03 13:05:00 +00:00
Poul-Henning Kamp
e39eff98a0 Don't use the kern.disks sysctl to find a list of md devices, use the
MDIOCLIST ioctl instead.

Spotted by:	keramida
2003-01-27 08:01:08 +00:00
Giorgos Keramidas
f9e425b336 Make sure strsep() gets a nul-terminated string.
Reviewed by:	phk
2002-10-10 10:07:19 +00:00
Poul-Henning Kamp
ea396d5bfa Don't show disklabel in the examples, it is not necessary. 2002-09-26 21:29:10 +00:00
Tom Rhodes
ce66ddb763 s/filesystem/file system/g as discussed on -developers 2002-08-21 18:11:48 +00:00
Warner Losh
9d010543f4 Don't use NULL where you really mean 0 to sysctlbyname. 2002-08-21 15:15:15 +00:00
Ralf S. Engelschall
32f28b1541 Replace extra call to "tunefs" with the equivalent of "newfs -U".
Reviewed by:	phk
2002-07-15 11:30:21 +00:00
Philippe Charnier
e1205e80e5 The .Nm utility 2002-07-06 19:34:18 +00:00
Dag-Erling Smørgrav
d397408818 Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
Mike Barcroft
40dcc8608d Revert 1.20:
Memory disks may be used for other purposes besides newfs(8), so it
isn't helpful to require the minimum size meet newfs(8)'s criteria.
2002-03-21 12:03:09 +00:00
Mike Barcroft
6a1bd01754 Provide a proper error message in mdconfig(8) when a filesystem is too
small, instead of a less meaningful error in newfs(8).
2002-03-21 07:46:09 +00:00
Dima Dorfman
53d745bc7c Actually make use of the md_version field of 'struct mdio'. In order
not to needlessly break compatibility, decrement MDIOVERSION to 0.

Approved by:	phk
2001-12-20 06:38:21 +00:00
David E. O'Brien
2d68bf45bf Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by:	mike
2001-12-04 02:19:58 +00:00
Ruslan Ermilov
b87581119e mdoc(7) police: removed (now gratuitous) .Xo/.Xc brackets. 2001-08-10 10:41:30 +00:00
Dima Dorfman
3fa96e6678 Move all the prototypes to one place. 2001-08-07 19:27:46 +00:00
Dima Dorfman
26a0ee75c6 Introduce a force option, MD_FORCE, that instructs the driver to
bypass some extra anti-foot-shooting measures.  Currently, its only
effect is to allow detaching a device while it's still open (e.g.,
mounted).  This is useful for testing how the system reacts to a disk
suddenly going away, which can happen with some removeable media.

At this point, the force option is only checked on detach, so it
would've been possible to allow the option to be passed with the
MDIOCDETACH operation.  This was not done to allow the possibility of
having the force flag influence other tests in the future, which may
not necessarily deal with detaching the device.

Reviewed by:	sobomax
Approved by:	phk
2001-08-07 19:23:16 +00:00
Dima Dorfman
10b0e058bb Use MD_NAME and MDCTL_NAME constants where appropriate. 2001-07-18 13:32:38 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Ruslan Ermilov
9fe48c6e8d mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 11:04:34 +00:00
Dima Dorfman
c894b25a2f Constify mdmaybeload(), add a prototype for usage(), and get rid of a
sizeof(int) == sizeof(long) assumption; clamp down with WARNS=2.
2001-06-21 02:10:26 +00:00
Dima Dorfman
78baea25b2 Don't assume the length of MD_NAME is 2. 2001-06-21 01:39:01 +00:00
Dima Dorfman
2885b42173 Fail if -s isn't specified for an MD_MALLOC or MD_SWAP disk; the
driver itself obviously won't configure such a disk, but the error
returned (EDOM) is more cryptic to the average user than it should be.

Also assert that the argument to -u is in fact a valid unit; don't
just accept any string to mean 0.

Approved by:	phk
2001-06-21 01:36:09 +00:00
Ruslan Ermilov
0a5779d45b - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:33:27 +00:00
Ruslan Ermilov
fe655281c5 Set the default manual section for sbin/ to 8. 2001-03-20 18:13:31 +00:00
Ruslan Ermilov
3832aecacb mdoc(7) police: add a missing An call. 2001-03-12 09:18:12 +00:00
Maxim Sobolev
ed23a390c2 In the absence of explicit `-t type'' option assume that `-f file''
implies ``-t vnode''.

Approved by:	phk
2001-03-09 21:15:08 +00:00