aboutsummaryrefslogtreecommitdiff
path: root/sbin/mdconfig/mdconfig.c
Commit message (Collapse)AuthorAgeFilesLines
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* Add ability to label md(4) devices.Maxim Sobolev2017-08-281-8/+18
| | | | | | | | | | | | | | | This feature comes from the fact that we rely memory-backed md(4) in our build process heavily. However, if the build goes haywire the allocated resources (i.e. swap and memory-backed md(4)'s) need to be purged. It is extremely useful to have ability to attach arbitrary labels to each of the virtual disks so that they can be identified and GC'ed if neecessary. MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D10457 Notes: svn path=/head/; revision=322969
* Add MD_VERIFY option to enable O_VERIFY in open for vnode type.Stephen J. Kiernan2017-05-311-0/+4
| | | | | | | | | | | | | | | | Add -o [no]verify option to mdconfig (and document in man page.) Implement GEOM attribute MNT::verified to ask md if the backing vnode is verified. Check for MNT::verified in cd9660 mount to flag the mount as MNT_VERIFIED if the underlying device has been verified. Reviewed by: rwatson Approved by: sjg (mentor) Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D2902 Notes: svn path=/head/; revision=319358
* Make mdconfig(8) not segfault when the kernel returns garbage data.Edward Tomasz Napierala2017-02-191-2/+2
| | | | | | | | MFC after: 2 weeks Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=313943
* For MD_PRELOAD type md(4) devices, if there is a file name in the preloadedStephen J. Kiernan2017-02-131-1/+2
| | | | | | | | | | | | | | | | | | | meta-data, copy it into the softc structure. When returning md(4) device details to the caller, include the file name in any MD_PRELOAD type devices if it is set (first character is not NUL.) In mdconfig, for "preload" type md(4) devices, if there is file config available, print it in the file column of the output. Reviewed by: brooks Approved by: sjg (mentor) MFC after: 1 month Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D9529 Notes: svn path=/head/; revision=313701
* Add 'p' postfix to mdconfig(8).Edward Tomasz Napierala2015-10-101-2/+5
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=289113
* Add "null" backend to mdconfig(8). This does exactly what the nameEdward Tomasz Napierala2013-12-041-3/+7
| | | | | | | | | | | suggests, and is somewhat useful for benchmarking. MFC after: 1 month No objections from: kib Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=258909
* Return 0 if:Hiroki Sato2013-10-241-6/+12
| | | | | | | | | | | | | | | 1. "-u N" specified, no -f, and mdN found, 2. no -u, "-f /pathname" specified, and mdN associated with /pathname found, 3. "-u N" specified, "-f /pathname" specified, and both of them found, 4. "-l" specified and no -f, 5. "-l" specified, "-f /pathname" specified, and /pathname found. otherwise return -1. Spotted by: Julian H. Stacey Notes: svn path=/head/; revision=257036
* Resolve fflag with realpath().Xin LI2013-07-311-1/+3
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=253833
* When listing with -f, skip all memory disks that are not vnode-backed.Xin LI2013-07-021-1/+2
| | | | | | | | Noticed by: kevlo MFC after: 3 days Notes: svn path=/head/; revision=252523
* - Use length of _PATH_DEV instead of a hardcoded value[*].Hiroki Sato2013-06-211-6/+6
| | | | | | | | | | - Use MD_NAME for "md". Pointed out by: trasz [*] MFC after: 1 week Notes: svn path=/head/; revision=252051
* eturn -1 when the specified backing store file is not found in the mdHiroki Sato2013-06-201-5/+9
| | | | | | | | | device list. MFC after: 1 week Notes: svn path=/head/; revision=252036
* - Add "-f file" support to listing mode (-l). When a -f option isHiroki Sato2013-06-201-24/+30
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=252033
* Disallow attaching preloaded memory disks via ioctl.Jaakko Heinonen2012-11-211-3/+1
| | | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=243372
* Make it possible to resize md(4) devices.Edward Tomasz Napierala2012-07-071-16/+39
| | | | | | | | Reviewed by: kib Sponsored by: FreeBSD Foundation Notes: svn path=/head/; revision=238215
* Add missing "static".Edward Tomasz Napierala2012-03-141-1/+1
| | | | Notes: svn path=/head/; revision=232964
* Rewrite option parsing in mdconfig(8). This makes it more user-friendlyEdward Tomasz Napierala2012-01-271-118/+131
| | | | | | | | | | by removing the ordering requirements and adding more descriptive error messages; it also makes it more readable and maintainable. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=230612
* Replace the beerware license on mdconfig(8) with standard 2-clause BSD.Edward Tomasz Napierala2012-01-211-8/+25
| | | | | | | Approved by: phk@ Notes: svn path=/head/; revision=230423
* Somewhere around the 473rd time I mistyped "mdconfig file" instead ofDag-Erling Smørgrav2011-04-291-20/+38
| | | | | | | | | | "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 Notes: svn path=/head/; revision=221232
* whitespace nit - sorry for the churnDag-Erling Smørgrav2011-04-271-2/+2
| | | | Notes: svn path=/head/; revision=221144
* whitespace nitDag-Erling Smørgrav2011-04-271-1/+1
| | | | Notes: svn path=/head/; revision=221143
* Add a check to make sure the provider name is "mdN" before printing theRebecca Cran2011-02-141-1/+5
| | | | | | | | | | unit number. Suggested by: jh MFC after: 3 days Notes: svn path=/head/; revision=218677
* Only print the unit number when invoked with the -n flag.Rebecca Cran2011-02-131-1/+1
| | | | | | | | | PR: bin/144300 Submitted by: arundel MFC after: 3 days Notes: svn path=/head/; revision=218652
* Use "cylinder" instead of "cyl" for consistency.Joel Dahl2010-11-131-1/+1
| | | | | | | Reviewed by: phk Notes: svn path=/head/; revision=215247
* Make mdconfig(8) WARNS=6 clean:Jaakko Heinonen2010-01-221-7/+6
| | | | | | | | | | | | - 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) Notes: svn path=/head/; revision=202784
* Print sizes up to INT64_MAX in md_prthumanval().Jaakko Heinonen2010-01-181-5/+6
| | | | | | | | | PR: bin/125365 Approved by: trasz (mentor) MFC after: 2 weeks Notes: svn path=/head/; revision=202573
* Add the possibility to specify "-o force" with "mdconfig -du".Edward Tomasz Napierala2009-01-101-1/+11
| | | | | | | | | Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Notes: svn path=/head/; revision=187027
* Add -v (verbose) option to -l command, to show size and backing storeDmitry Morozovsky2008-06-211-6/+12
| | | | | | | | | | of all md devices at one time. Approved by: phk MFC after: 2 weeks Notes: svn path=/head/; revision=179910
* Fix exit code when using -l on a non-existent md(4) device.Florent Thoumie2007-11-161-3/+9
| | | | | | | | | PR: conf/116177 Submitted by: Remi Guyomarch <rguyom@pobox.com> MFC after: 3 days Notes: svn path=/head/; revision=173676
* Kris suggested that swap is a better choice as a default than malloc.Nick Hibma2007-02-201-3/+3
| | | | | | | MFC: 1 week Notes: svn path=/head/; revision=166854
* [Found the original diff I made, see previous commit for other part]Nick Hibma2007-02-201-2/+13
| | | | | | | | | | | Assume '-a' and '-t malloc' flags for '-s <size>' (malloc ramdisk) if not specified. Reviewed by: phk (some time ago) MFC: 1 week Notes: svn path=/head/; revision=166853
* Make attach the default for -f. That wayNick Hibma2007-02-201-1/+5
| | | | | | | | | | | | mdconfig -f image works like a charm. Reviewed by: phk (some time ago) MFC: 1 week Notes: svn path=/head/; revision=166852
* Unbreak the build.Jason Evans2006-03-271-6/+1
| | | | Notes: svn path=/head/; revision=157173
* For now, bring back some of the old bits as a fix for specifying md(4)Wojciech A. Koszek2006-03-271-0/+7
| | | | | | | | | | | | 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) Notes: svn path=/head/; revision=157166
* Teach md(4) and mdconfig(8) how to understand XML. Right now there won't beWojciech A. Koszek2006-03-261-63/+156
| | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=157160
* Keep proper order of includes. Additionally, sort them. Make functions usedWojciech A. Koszek2006-03-261-23/+20
| | | | | | | | | in that file static. Approved by: cognet (mentor) Notes: svn path=/head/; revision=157159
* Use kld(3) for loading geom_md.ko.Pawel Jakub Dawidek2006-02-181-20/+3
| | | | Notes: svn path=/head/; revision=155807
* Sort the list results by the unit number. The list returned by theDima Dorfman2005-12-221-3/+13
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=153636
* Rename GEOM class kernel module g_md.ko to geom_md.ko for consistencyPawel Jakub Dawidek2005-11-111-27/+12
| | | | | | | | | | | | | with the rest. mdconfig.c: Simplify mdmaybeload() function. mdioctl.h: Removed (now unused) #define. loader.conf: Sort GEOM classes properly. OK'ed by: phk Notes: svn path=/head/; revision=152309
* When using files as backing stores for devices, and the user has requested theChristian S.J. Peron2005-08-301-0/+11
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=149638
* We can specify device size in bytes. Document this in usage.Pawel Jakub Dawidek2005-03-011-2/+3
| | | | Notes: svn path=/head/; revision=142926
* Document the terabyte "-s" parameter in the usage string.Michael Reifenberger2005-02-211-1/+2
| | | | | | | Split the usage line to not exceed 80 chars. Notes: svn path=/head/; revision=142167
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-02-101-1/+1
| | | | Notes: svn path=/head/; revision=141611
* Allow to specify device size in bytes.Pawel Jakub Dawidek2005-01-221-0/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=140627
* Rewrite piece of code which I committed some time ago that allows toPawel Jakub Dawidek2004-12-271-1/+5
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=139359
* Sync usage() with manpage SYNOPSIS and code.Ruslan Ermilov2004-11-131-4/+6
| | | | Notes: svn path=/head/; revision=137669
* For file backed md(4) devices output their source file viaPawel Jakub Dawidek2004-11-061-2/+7
| | | | | | | | 'mdconfig -l -u <unit>'. Bump version number, as this change breaks ABI/API. Notes: svn path=/head/; revision=137310
* If there aren't any devices to list, output nothing instead of anDima Dorfman2004-11-061-10/+2
| | | | | | | | | empty line. This is consistent with other utilities. While I'm here, remove artifacts of the previous list implementation. Notes: svn path=/head/; revision=137300
* - Make md(4) 64-bit clean.Pawel Jakub Dawidek2004-09-161-16/+41
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=135340
* add support for documented readonly option...John-Mark Gurney2004-09-081-1/+5
| | | | | | | | | | also print out the option that is unknow so that the user knows what (s)he did wrong.. MFC after: 3 days Notes: svn path=/head/; revision=134965