Commit Graph

186 Commits

Author SHA1 Message Date
mlelstv 19722ca2cf Use opendisk when looking for filesystem type, otherwise the detection
only works if the correct device path is given as an argument.
2023-01-24 08:09:37 +00:00
hannken 7b77b9376c Change getdiskinfo() to no longer infer the partition from the device name.
Since 2016-06-16 we create disk devices "<type><<unit>" as an alias
for "<type><<unit><part>" where "<part>" is the raw partition.
These devices are treated as invalid partitions and a zero geometry
is returned.

Take the partition from "st_rdev" instead.

Fix for PR kern/57134: st_size of stat on vnd raw partition sometimes
is 0, causing newfs to fail
2023-01-02 16:08:13 +00:00
sevan ad16dbb6f1 grammar 2020-04-18 22:02:11 +00:00
joerg a74e29fe24 Avoid common symbols for fsck_lfs. 2020-04-03 19:36:32 +00:00
bad 7a2e426f67 initialize disc_dict to NULL.
otherwise, if DIOCGDISKINFO returns an error != ENXIO getdiskinfo() later
tries to prop_object_release() stack garbage.

found by rumpctrl tests using clang-7.
2019-09-28 18:03:18 +00:00
martin 21c20a3068 Properly release the disk properties dictionary we received via
ioctl.
Detected by leak sanitizer when building with MKSANITIZER=yes.
2019-08-18 11:08:56 +00:00
wiz 7ca7a31b02 file system police. 2016-09-11 09:09:54 +00:00
sevan 2817e8b69c Document the version fsck first appeared.
Bump date.
2016-09-11 03:48:11 +00:00
dholland 49f4cf4b46 Add used-by comments on source files that are .PATH'd in from elsewhere. 2015-06-21 04:01:40 +00:00
dholland c30abfbbfa global variables should be declared extern. 2015-06-21 03:58:36 +00:00
dholland 68072c6ae8 add missing rcsid 2015-06-21 03:33:22 +00:00
martin 80e8cba3b7 Make querying the disk geometry fail silently if called for a non-exitent
disk.
XXX: DIOCGDISKINFO returns strange error codes
2015-06-03 17:53:23 +00:00
christos 15f5b75638 abort earlier. 2014-12-29 16:35:38 +00:00
christos 59069b7aab Provide a simple getdisksize() api for gpt(8). 2014-12-29 16:27:43 +00:00
mlelstv a62f667a0a fix logic that handles command line arguments. Now you can:
fsck /mnt/point
fsck dkX
fsck rdkX
fsck /dev/dkX
fsck /dev/rdkX
fsck NAME=wedge
2014-10-25 22:00:19 +00:00
jakllsch aff82b369b Make getdiskinfo() always return correct dkwedge_info for the raw partition.
A real disk's raw partition does not implement DIOCGWEDGEINFO, but does
implement DIOCGDINFO.  This was resulting in the returned wedge information
containing 32-bit-clamped values for size of the raw partition, with no
indication thereof.
2013-04-13 22:08:57 +00:00
mlelstv 9fc3186941 Support symlinks to a block device to resolve the name of the
corresponding raw device.
2013-01-13 19:53:16 +00:00
christos ba7ad7276d Don't re-use the same buffer that we pass in for newname in the cooked->raw
conversion. Better variable names.
2012-04-08 04:19:14 +00:00
christos ca11e1e667 factor out rawname() from dump, fsck, savecore. 2012-04-07 16:44:10 +00:00
christos 5727fadda2 use getfsspecname() 2012-04-07 04:52:20 +00:00
christos 29c49ee745 use getfstypename 2011-11-13 22:04:51 +00:00
joerg 6923d07c1a Use __dead and __printflike. 2011-08-27 17:34:44 +00:00
christos 453164da22 fix compilation. 2011-06-09 21:23:29 +00:00
christos 23ffdf5bd3 share more code. 2011-06-09 19:57:50 +00:00
wiz b882daa546 New sentence, new line. Sort sections. 2011-04-28 12:16:10 +00:00
christos c6af1de885 - use warn/err properly
- wrap long lines
2010-03-06 00:30:54 +00:00
hannken 626b19f88a Dont pass option -x down to fsck_xxxfs.
Hi christos ...
2010-02-24 13:56:07 +00:00
wiz e386b4ea79 Use Dq for double quotes; remove trailing whitespace. 2010-02-18 06:57:17 +00:00
christos 639f597520 Add -x <mountpoint> ``exclude'' option. 2010-02-17 23:30:21 +00:00
christos c68c36a514 Centralize time printing and deal with ctime possibly returning NULL. 2010-02-04 23:55:42 +00:00
snj 550147bd6a Remove 3rd and 4th clauses in christos' license. OK christos. 2009-10-21 01:07:44 +00:00
dyoung ca53a4b923 Callers expect getdiskinfo() to return -1 on error, so do that.
Simplify getdiskinfo() a bit while I am here: don't save error
codes that we will never refer to again.
2009-07-16 23:50:32 +00:00
haad 44141aa6ee Remove bogus warn, which was printed when DIOCGDISKINFO failed. 2009-06-14 21:06:18 +00:00
haad 63b509d1c8 Add support for devices which do not support DIOCGDISKINFO ioctl yet. This
change  will restore fsck/newfs on vnd device.
2009-06-06 18:31:29 +00:00
haad 42c8b251b8 Remove debug printfs. 2009-06-06 17:47:50 +00:00
haad f5b48500f1 Add support for DIOCGDISKINFO to disk like device drivers. Change
partutil.c::getdiskinfo to use it to get disk geometry info.
Use DIOCGWEDGEINFO ioctl to get information about partition size, if disk
driver doesn't support it use old DIOCGDINFO. This patch adds support for
wedge like devices(lvm logical volumes, ZFS zvol partitions) to newfs and
other tools.

No objections on tech-userlevel@.
2009-06-05 21:52:31 +00:00
lukem cefb0777de fix sign-compare issues 2009-04-11 06:48:36 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
lukem 481ad7b03a errexit() now provides the trailing \n (since fsck_ffs assumed that
from a conversion from err(3)), so "make it so".
2008-03-16 23:17:55 +00:00
reed baa9962260 Fix typo. 2008-02-24 00:34:51 +00:00
christos 742b48d55e Make sure that the exit values are always sane, and use symbolic instead
of magic constants. Reviewed by go@
2008-02-23 21:41:47 +00:00
christos 1fe4bceb66 Say what our exit values mean (this is not correct right now, because not
all fsck programs have been fixed but it will be soon).
2008-02-23 20:38:53 +00:00
ragge 9949926272 __attribute -> __attribute__. 2007-09-15 14:35:33 +00:00
christos fede0a77fc kill MFSNAMELEN 2007-07-17 20:03:10 +00:00
rumble 0a71191807 Cross-reference fsck_lfs and fsck_ext2fs. 2007-02-23 19:32:16 +00:00
christos df99a4dd43 Sprinkle volatile, instead of using the (void)&foo; which does not work on
gcc 4.
2006-12-13 16:08:26 +00:00
apb f93df16b06 Improve the progress bar displayed by fsck_ffs -p -P.
The progress bar will now travel from 0 to 20% during pass 1, from 20%
to 95% during pass 2, and from 95% to 100% during passes 3, 4, and 5.
Previously, the progress bar was not displayed at all during pass 1,
slowly traveled from 0 to about 50% during pass 2, and then very rapidly
traveled from 50% to 100% during passes 3, 4, and 5.

Note that fsck_ffs is the only user of fsck/progress.{c,h}.
2006-11-14 21:01:46 +00:00
christos 56641252ba - add volatile
- static before const
2006-10-16 02:44:46 +00:00
christos e0811114bb add a const 2006-08-27 09:20:53 +00:00
christos 09e8908e10 - make preen recognize wedges and insert their parent disks in the disk list
so that we don't run multiple fsck's on the same spindle at the same time!
- Add some partition getting utilities that are wedge aware (soon to be able
  to use the native geometry ioctl), so that we can fsck wedges.
2006-08-26 21:54:05 +00:00