Commit Graph

45 Commits (a25fffae5cbdb9349fa3c358c9714584e9de7b33)

Author SHA1 Message Date
Eric Whitney a25fffae5c debugfs: restore and tweak original error messaging
In response to reviewer comments, commit fe56188b07 included changes
that modified some of the code used to output error messages when
checking user-supplied block numbers.  These changes converted calls
to parse_ulonglong() to calls to strtoblk().  Because strtoblk() calls
parse_ulonglong(), and both output error messages, two redundant and
relatively generic messages were output on each error.

Fix this by removing the error message output from strtoblk(), and
extending it to accept an optional error message argument that it
supplies in lieu of a default to parse_ulonglong().  Also, revert to
the more descriptive original error messages with mods per reviewer
comments, and fix an error message in do_replace_node().

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-30 16:56:19 -05:00
Theodore Ts'o f404167dda Clean up sparse warnings
Mostly by adding static and removing excess extern qualifiers.  Also
convert a few remaining non-ANSI function declarations to ANSI.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-16 18:56:36 -05:00
Darrick J. Wong fe56188b07 debugfs: handle 64bit block numbers
debugfs should use strtoull wrappers for reading block numbers from
the command line.  "unsigned long" isn't wide enough to handle block
numbers on 32bit platforms.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-12 12:49:17 -05:00
Theodore Ts'o 6854ab1d4a debugfs: interpret date strings of the form @dddd
Debugfs will now interpret date strings of the form @123 as 123
seconds after the start of the epoch.  This is handy when editing an
orphan inode linked list using the inode's deletion time field.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-06-11 22:02:17 -04:00
Eric Sandeen 97a67c40dc debugfs: fix strtoblk for 64bit block numbers
Affects icheck, freeb, setb, testb...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-05-27 22:12:01 -04:00
Theodore Ts'o 8a1da3c5ae debugfs: use ss_safe_getenv() instead of getenv()
In the case where debugfs (or rdebugfs) is installed setgid disk, or
some such, we need to disable the use of environment variables for the
obvious reasons.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-15 16:18:29 -05:00
Theodore Ts'o 8bf1e9184e debugfs: add ncheck -c option
Add a -c option to ncheck will verifies the file type information in
the directory entry.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-01-17 17:08:39 -05:00
Theodore Ts'o d1154eb460 Shorten compile commands run by the build system
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and
this was starting to cause some tools heartburn.  It also made "make
V=1" almost useless, since trying to following the individual commands
run by make was lost in the noise of all of the defines.

So fix this by putting the configure-generated defines in lib/config.h
and the directory pathnames to lib/dirpaths.h.

In addition, clean up some vestigal defines in configure.in and in the
Makefiles to further shorten the cc command lines.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-18 17:34:37 -04:00
Theodore Ts'o 16c581d0e8 debugfs: add 64-bit support to the set_field commands
The set_fields commands (set_super_value, set_inode_field,
set_block_group) now handle fields which store in split fields on
ext4's on-disk format.  For example, the superblock fields
s_blocks_count and s_blocks_count_hi.

The user can either set the low or high part of the field via
"blocks_count_lo" or "blocks_count_hi", or both parts can be set via
"blocks_count".

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-16 10:32:02 -04:00
Valerie Aurora Henson 048786d7e8 debugfs: Convert to support 64-bit filesystems
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 22:46:17 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Theodore Ts'o ebabf2ad6d Define _XOPEN_SOURCE to 600 consistently for Solaris C99 support
Solaris's header files are very picky about which C compiler can be
used for SUSv3 conformance.  Use of C99 is not compatible with SUSv2
(_XOPEN_SOURCE=500), and C89 is not compatible with SUSv3
(_XOPEN_SOURCE=600).  Since we need some SUSv3 functions, consistently
use SUSv3 so that e2fsprogs will build on Solaris using c99.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-07-13 16:06:57 -04:00
Theodore Ts'o a70f10dbc4 Merge branch 'maint' 2008-03-30 14:03:51 -04:00
Theodore Ts'o a2ff0f31c1 debugfs, tune2fs: Handle daylight savings time when parsing a time string
We need to set tm_isdst to -1 so that mktime will automatically
determine whether or not daylight savings time (DST) is in effect.
Previously tm_isdst was set to 0, which caused mktime to interpret the
time as if it was always not using DST.

Addresses-Debian-Bug: #471882

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-21 09:10:09 -04:00
Theodore Ts'o abe85c9f1b Merge branch 'maint' into next 2008-03-20 15:31:03 -04:00
Theodore Ts'o a7ee4e0183 debugfs: Don't use a pager if stdout is not a tty
If we are redirecting the output of debugfs to a file or to another
process via a pipe, there's no point sending the output to a pager.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-20 10:57:55 -04:00
Theodore Ts'o 2d328bb76d Fix miscellaneous gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-17 23:17:13 -04:00
Theodore Ts'o d8d12558dc debugfs: Fix error handling in strtoblk() and common_block_args_process()
Fix strtoblk() to allow a block number 0, and
common_block_args_process() so it prints an error message if a block
number that can't be parsed by strtoul().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 15:27:04 -05:00
Theodore Ts'o d4e0b1c6f5 Fix gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 18:56:01 -04:00
Andreas Dilger de8f3a7621 Fix gcc -Wall warnings, especially on 64-bit systems
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-05-25 11:18:11 -04:00
Theodore Ts'o a4ea6b98f3 Fix debugfs's date parser so that it accepts integer values
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-10 21:10:55 -04:00
Eric Sandeen 3e41913c48 Handle large setb/testb/freeb commands in debugfs
Fix a signed vs. unsigned problem by using blk_t instead of int

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
2007-04-10 15:40:04 -04:00
Theodore Ts'o 9c07dc00b8 Add missing backwards compatibility for ancient Linux systems
This fixes some (but not all) of the compatibility bugs which prevented
e2fsprogs from being compiled on a Linux 2.0.35 system.  There are still
some unprotected use of long long's, and apparently some type problems
with the uuid library, but these can be fixed up later.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-05-29 11:06:16 -04:00
Theodore Ts'o 4efae606bf New debugfs command: set_current_time
Generalize the time parsing code and move it to
util.c:string_to_time().  Add new command, set_current_time, which
sets the time used to set the filesystems's time fields.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-24 21:56:38 -04:00
Theodore Ts'o 030970ed75 Fix e2fsck, debugfs, and the ext2fs_mkdir function so that when we create
a new inode we make sure that the extra information in the inode (any extra
fields in a large inode and any ea-in-inode information) is cleared.  This 
can happen when e2fsck creates a new root inode or a new lost+found directory,
or when the user uses the debugfs write, mknod, or mkdir commands.  Otherwise,
the newly create inode could inherit garbage (or old EA information) from
a previously deleted inode.
2005-03-20 20:05:22 -05:00
Theodore Ts'o ea822eeba3 Enhance debugfs's stat command so it can dump extended attributes
which are stored in the inode body.
2005-03-20 18:03:58 -05:00
Theodore Ts'o acb79d9d19 Fix stupid core dumping bug if the TZ environment variable isn't set. 2004-12-15 12:21:41 -05:00
Theodore Ts'o 8ff1a86005 If the TZ environment variable is set to GMT, use gmtime()
instead of localtime() or ctime() to force the use of GMT.  
This is because the dietlibc doesn't honor the TZ environment 
variable.
2004-11-30 19:57:20 -05:00
Theodore Ts'o 0f72ab6461 util.c (open_pager): Use DEBUGFS_PAGER in preference to PAGER
(Addresses Debian Bug #239547)
2004-04-11 17:06:58 -04:00
Theodore Ts'o 2b5ddd75c9 For debugfs, use the "more" pager in preference to "less",
since "less" doesn't work terribly well for debugfs's purpose.

Document the DEBUGFS_PAGER and PAGER environment variables.
2004-01-24 18:54:41 -05:00
Theodore Ts'o 2b696a9856 Try to use the DEBUGFS_PAGER environment
variable first, and then fall back to the PAGER
	environment variable.  Finally, search for an appropriate
	pager executable.
2003-12-25 14:28:55 -05:00
Theodore Ts'o ec7fdb8f76 util.c (open_pager): Search for the pager to use, starting with
'pager', and then falling back to 'less' and then 'more'.
	(Addresses Debian Bug: #221977)
2003-12-07 13:16:25 -05:00
Theodore Ts'o 88494bb6d4 util.c, ls.c, logdump.c, htree.c, dump.c, debugfs.h, debugfs.c, ChangeLog:
util.c (reset_getopt), debugfs.c (do_open_filesys,
  	do_show_super_stats), ls.c (do_list_dir), dump.c (do_dump),
  	htree.c (do_htree_dump, do_dx_hash), logdump.c (do_logdump):
  	Define and use a new function, reset_getopt(), which does whatever
  	is necessary to reset getopt() again.  This is different for
  	different implementations, so the portabilty issues are a bit of a
  	nightmare.  (Addresses Debian bug #192834)
2003-05-13 23:03:43 -04:00
Theodore Ts'o b38cd28363 Add a new command "bmap" to debugfs which calculates the logical->physical block
mapping for a particular inode.

Fixed a bug in the libext2 library which broke ext2fs_bmap if no inode structre
was passed inside for here.

Fixed bad calling parameters to parse_ulong which broken the -b  and -s
options to debugfs, as well as do_init, and the testb, setb, clearb functions.
2002-05-11 22:13:20 -04:00
Theodore Ts'o e5b3b27966 util.c (parse_ulong): Fix typo which cases parse_ulong to
coredump if the err variable is filled in (for example, if
	the -b or -s options are passed to the debugfs's
	command-line invocation).
2002-04-01 15:42:21 -05:00
Theodore Ts'o df614db6ef Add initial support in debugfs for examining directory indexing
information.
2002-02-25 04:28:45 -05:00
Theodore Ts'o e1018eeaa3 Add new debugfs commands and arguments which make it easier to
recover deleted files.  The lsdel command now takes an optional
argument which allows the user to only see the most recently
deleted files.  Also added a new command, undel, which automates
undeleting a deleted inode and linking it back to a directory.
Also added an optional count argument to the testb, freeb, setb,
and find_free_block commands.  The ls command now takes a new
option, -d, which lists deleted directory entries.

Factored out out commonly used code into utility subroutines
for ease of maintenance and to make the executable size smaller.
2002-01-03 04:55:25 -05:00
Theodore Ts'o 571fc5a89c Fixes necessary for e2fsprogs to work using the diet libc.
- Renamed linux/list.h to be linux/linked_list.h to work around a
  problem caused by diet libc insistence to search the kernel
  header files ahead of all other files in the include path, 
  including the user specified include files.

- Worked around a bug in diet libc which core dumps when using 
  putc with stderr by using fputs instead.  As a bonus, this
  also shaved a few bytes off of com_err.o.

- Fixed a real bug in debugfs which was detected because diet libc
  was more sensitive than glibc when incorrectly using fclose()
  where pclose() is required.
2001-12-02 17:23:27 +01:00
Theodore Ts'o b044c2e02a Many files:
debugfs.c, debugfs.h, dump.c, icheck.c, ls.c, lsdel.c, ncheck.c,
  	setsuper.c, util.c: Change ino_t to ext2_ino_t.  Fix a few minor
  	gcc-wall complaints while we're at it.
2001-01-11 15:26:39 +00:00
Theodore Ts'o 9131a75931 ChangeLog, util.c:
util.c (string_to_inode): Use strtoul instead of atoi, so that hex
  	inode numbers will be accepted.
2000-08-23 04:36:25 +00:00
Theodore Ts'o 2c4a540636 debugfs.c:
Fixup one more missing use of lb->f instead stdout when printing the
  comma separator.
ChangeLog, util.c:
  util.c (open_pager): Set SIGPIPE to be ignored, so that quitting out
  	of the pager doesn't blow away debugfs.
2000-08-19 17:33:28 +00:00
Theodore Ts'o c6bd0c97e4 Makefile.in, debug_cmds.ct, setsuper.c, ChangeLog:
setsuper.c: New function which implements the set_super_value command.
  	Allows the user to set arbitrary superblock fields.
ChangeLog, util.c:
  util.c (open_pager): If the PAGER environment variable is not set,
  	default to using "more".
2000-08-14 20:37:09 +00:00
Theodore Ts'o d61f617602 Makefile.in:
Fix stupid dependency bug.
ChangeLog, debugfs.c, debugfs.h, util.c:
  debugfs.c (do_testb, do_testi): Call check_fs_bitmaps to avoid
  	coredumping if the bitmaps aren't loaded.
  util.c (check_fs_bitmaps): New function which checks whether or not
  	the bitmaps are loaded.
2000-05-27 16:04:00 +00:00
Theodore Ts'o 1e3472c5f3 Many files:
Checked in e2fsprogs 1.05
1997-04-29 14:53:37 +00:00
Theodore Ts'o 3839e65723 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:21:57 +00:00