Commit Graph

265 Commits

Author SHA1 Message Date
christos 7bf1a6f81d Avoid zero-divides from Anon Ymous 2007-08-22 16:30:28 +00:00
pooka 704e075311 Make all mount(2) return value error checks against -1. Some file
systems just checked != 0, breaking MNT_GETARGS.  Others worked with < 0,
but make them check against -1 too for consistency.  And sprinkle some
stylish line wrapping where appropriate.
2007-07-16 17:06:52 +00:00
dsl 7af7206539 Add additional 'sizeof args' parameter to mount(2). 2007-07-14 15:57:24 +00:00
chs cb9ef1cfbd apply revision 1.31 yet again:
"make sure that we don't try to allocate negative memory when blks == 0."
or on amd64, "make sure that we don't allocate 32 GB when blks == 0."
2007-04-12 05:19:18 +00:00
drochner 628f1591c1 include <signal.h> where signal(3) is used 2007-02-08 21:36:58 +00:00
hubertf df06563bc3 Remove more duplicate #includes,
from Slava Semushin <slava.semushin@gmail.com>
2007-01-17 21:59:49 +00:00
apb 324b3b8a78 Fix error in previous. Pass 1 needs to use progress_setrange(),
not progress_sethighlim().
2006-11-14 22:51:11 +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 0e84886f1c comment out impossible code. 2006-10-16 03:09:26 +00:00
christos fef0df6d6b c99 initializers 2006-10-16 03:09:06 +00:00
christos 5a70d8a008 - Deal with wedges and the new disk geometry structures, instead of using
struct disklabel.

Functionality lost:
  1. struct disklabel used to be updated to contain bsize, fsize, cpg.
     This information was used to locate the alternative superblock in
     the filesystem if the primary superblock was corrupted. We need
     to find a new place to store this information if we need this
     functionality.
  2. On vax SMD drives that contained bad sector lists, the newfs program
     knew how to get the offset and skip to the correct location in order
     to place the label.
2006-08-26 22:03:47 +00:00
christos f06e8d55c6 Revert previous. It is not ready for public consumption. 2006-08-17 22:21:27 +00:00
christos 2e4a4ae4c9 Don't use || if you need &&. 2006-08-17 20:06:06 +00:00
mrg 9bf1d4a9b8 work around some GCC4 internal problems on m68000 platform.
document the hack, and update another GCC4 list.
2006-06-24 05:21:11 +00:00
mrg aadd7d4847 sprinkle some -fno-strict-aliasing and -Wno-pointer-sign with GCC4. 2006-05-11 23:16:28 +00:00
skrll 7ba7efe154 Don't use cast expressions as lvalues as newer versions of gcc warn. 2006-04-21 15:00:49 +00:00
christos 3401a36160 Coverity CID 2074: Fix memory leak. 2006-03-20 01:30:34 +00:00
rumble e948e1b17f Check for allocation failures in malloc, calloc, realloc, asprintf, and
vasprintf and try to handle them.
2006-03-17 15:53:46 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
yamt 0616e4b566 linkup: reparent() only when lost+found is created successfully. 2005-12-23 12:58:11 +00:00
christos 9fe740f63c ndb is daddr_t which is 64 bits, by truncating it to j which is an int, it
can get negative causing segmentation faults. Check against this.
2005-12-05 23:59:43 +00:00
jmmv 2a3e5eeb7c Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
  function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
  file sys/nfs/nfs_export.c.  The former was becoming large and its code
  is always compiled, regardless of the build options.  Using the latter,
  the code is only compiled in when NFSSERVER is enabled.  While doing this,
  also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
  path and a set of export entries.  At the moment it can only clear the
  exports list or append entries, one by one, but it is done in a way that
  allows setting the whole set of entries atomically in the future (see the
  comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
  that it becomes file system agnostic.  In fact, all this whole thing was
  done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
  exports initialization; done internally by the kernel when initializing
  the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
  subsystems can run arbitrary code upon receipt of specific VFS events.
  At the moment, this only provides support for unmount and is used to
  destroy NFS exports lists from the file systems being unmounted, though it
  has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 12:10:31 +00:00
tron 1dbccd015b Use FFS_MAXNAMLEN instead of MAXNAMLEN. 2005-08-23 11:10:23 +00:00
christos c4ee9f6d2e 64 bit inode changes 2005-08-19 02:07:18 +00:00
christos c236bddb0f sprinkle const. 2005-06-27 01:25:35 +00:00
dbj 36c3355e33 add code to handle inodes with extended attribute blocks
this is currently turned off with "#ifdef notyet" since the
kernel will not correctly clean up extended attribute blocks on truncation

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
2005-06-08 20:34:06 +00:00
dbj ab963542e1 for ufs2, assume FS_44INODEFMT
this is necessary for freebsd compatbility, since they do not initialize
the old field.
2005-06-02 01:23:19 +00:00
lukem 700088dc7f appease gcc -Wuninitialized 2005-06-02 00:38:41 +00:00
christos ae0d3ab2e1 Remove stray " I" from message. 2005-04-30 20:29:56 +00:00
christos f77e3699c8 Dammit, get rid of the debugging abort() calls. It is no fun to have a broken
fsck program on a busted filesystem.
2005-04-30 20:24:32 +00:00
xtraeme 76500fc2f9 WARNS=2 is the default defined in sbin/Makefile.inc. (thanks wiz) 2005-01-20 16:39:22 +00:00
xtraeme e3c8f73b9a whitespace (pointed out by wiz@) 2005-01-20 15:29:40 +00:00
xtraeme 52781d1897 Kill __P(), ANSIfy and WARNS=2 2005-01-19 17:33:58 +00:00
wiz 442b6cb908 Add -P to usage. 2005-01-19 16:42:14 +00:00
wiz b15d62ff8b Sort options. Bump date for -P. Remove superfluous -. 2005-01-19 16:41:04 +00:00
christos d90f13b3bf Use -DPROGRESS to enable the progress bar, don't depend on SMALL. 2005-01-13 19:56:02 +00:00
christos a73c2bd574 Add a progress meter to fsck_ffs based on the work by thorpej presented
to the mailing lists last January. This is optional.
2005-01-13 15:22:35 +00:00
dsl 09993d7a4e Rewrite getdisklabelpart() to avoid problems with isdigit(*ch_ptr) and
an incorrect check for a (probably impossible) empty string.
Add comments to avoid confusion...
2004-10-29 19:02:17 +00:00
dbj 0f5aab3826 always print warning and return non-zero exit when there are unresolved inconsistencies. 2004-10-11 15:24:09 +00:00
ragge 801400d3c7 Cast to (long long int) to make last change compile on amd64. 2004-10-09 20:08:44 +00:00
dbj 43cd78416c when allocating inodes, such as for the lost+found directory,
extend the inostat array if needed.  Otherwise, inoinfo() will
return the static "unallocated" inode template, which was
getting improperly modified.
Before this fix, any time the lost+found directory got created,
fsck would set all of the inode/directory counts wrong since
suddenly unallocated inodes would turn into directory inodes
2004-10-08 17:33:52 +00:00
dbj 6ca6b809d3 have allocdir fail cleanly when allocino fails 2004-10-08 17:29:29 +00:00
dbj a10669f5c2 if debug, print found/expected block & inode counts when incorrect 2004-10-08 16:42:55 +00:00
mycroft 20f54b189f Reduce memory usage slightly. 2004-07-20 15:05:32 +00:00
wiz 0747ba10a5 Add -a to usage. Closes PR 25916 by Kouichirou Hiratsuka. 2004-06-25 14:50:15 +00:00
mycroft b98bb8c608 Use pread()/pwrite(). 2004-06-12 01:35:46 +00:00
fair 0b112129b9 Correct a misnumbering of options, as noted in PR 25784. 2004-06-02 19:27:24 +00:00
hannken 8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
wiz 65a50720b0 Various improvements; mostly mention arguments of flags by name to
simplify the description and improve lists.
2004-05-05 14:30:59 +00:00
dbj 78877ce800 fix 64bit bug in chkrange()
problem noticed by nathanw
fix from freebsd
2004-04-26 23:46:22 +00:00