2001-12-16 Theodore Tso <tytso@valinux.com>
+ * setsuper.c (print_possible_fields),
+ logdump.c (dump_journal): Fix gcc -Wall nits
+
* Makefile.in, jfs_user.h: linux/jfs.h has been renamed to
linux/jbd.h
#include "debugfs.h"
#include "jfs_user.h"
+#include <uuid/uuid.h>
enum journal_location {JOURNAL_IS_INTERNAL, JOURNAL_IS_EXTERNAL};
(sb->s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) {
blocksize = EXT2_BLOCK_SIZE(sb);
blocknr = (blocksize == 1024) ? 2 : 1;
- uuid_unparse(&sb->s_uuid, jsb_buffer);
+ uuid_unparse(sb->s_uuid, jsb_buffer);
fprintf(out_file, "Ext2 superblock header found.\n");
if (dump_all) {
fprintf(out_file, "\tuuid=%s\n", jsb_buffer);
fprintf(out_file, "\tblocksize=%d\n", blocksize);
fprintf(out_file, "\tjournal data size %ld\n",
- sb->s_blocks_count);
+ (long) sb->s_blocks_count);
}
}
static void print_possible_fields()
{
struct super_set_info *ss;
- char *type;
+ const char *type;
printf("Superblock fields supported by the set_super_value command:\n");
for (ss = super_fields ; ss->name ; ss++) {
2001-12-16 Theodore Tso <tytso@valinux.com>
+ * e2fsck.h (ext2fs_get_refcount_size), unix.c (check_mount, PRS),
+ pass1.c (adjust_extattr_refcount),
+ ea_refcount.c (ea_refcount_create): Fix gcc -Wall nits.
+
* recovery.c, revoke.c: Update to versions from 2.4.17-pre8.
* journal.c, jfs_user.h: Update support code for new version of
blk_t blk, int *ret);
extern errcode_t ea_refcount_store(ext2_refcount_t refcount,
blk_t blk, int count);
+extern blk_t ext2fs_get_refcount_size(ext2_refcount_t refcount);
extern void ea_refcount_intr_begin(ext2_refcount_t refcount);
extern blk_t ea_refcount_intr_next(ext2_refcount_t refcount, int *ret);
ext2_refcount_t refcount;
errcode_t retval;
size_t bytes;
- int i;
retval = ext2fs_get_mem(sizeof(struct ea_refcount),
(void **) &refcount);
struct ext2_ext_attr_header *header;
struct problem_context pctx;
ext2_filsys fs = ctx->fs;
- errcode_t retval;
blk_t blk;
__u32 should_be;
int count;
static void check_mount(e2fsck_t ctx)
{
errcode_t retval;
- int mount_flags, cont, fd;
+ int mount_flags, cont;
retval = ext2fs_check_if_mounted(ctx->filesystem_name, &mount_flags);
if (retval) {
ctx->options |= E2F_OPT_READONLY;
ctx->filesystem_name = argv[optind];
if (flush) {
- int fd = open(ctx->filesystem_name, O_RDONLY, 0);
-
+ fd = open(ctx->filesystem_name, O_RDONLY, 0);
if (fd < 0) {
com_err("open", errno,
_("while opening %s for flushing"),
+2001-12-16 Theodore Tso <tytso@valinux.com>
+
+ * pf.c: Add const to struct flags_name to avoid -Wall complaints.
+
2001-11-05 Theodore Tso <tytso@valinux.com>
* pf.c: Add a new file attribute, EXT2_NOTAIL_FL
struct flags_name {
unsigned long flag;
- char *short_name;
- char *long_name;
+ const char *short_name;
+ const char *long_name;
};
static struct flags_name flags_array[] = {
2001-12-16 Theodore Tso <tytso@valinux.com>
+ * bitops.h (ext2fs_mark_generic_bitmap, ext2fs_unmark_generic_bitmap),
+ ext_attr.c (ext2fs_read_ext_attr, ext2fs_write_ext_attr),
+ fileio.c (ext2fs_file_write): Fix gcc -Wall nits
+
* Makefile.in, jfs_user.h: linux/jfs.h has been renamed to
linux/jbd.h
blk_t block, int num);
extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
+/* These two routines moved to gen_bitmap.c */
+extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
+ __u32 bitno);
+extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
+ blk_t bitno);
/*
* The inline routines themselves...
*
}
#endif
-/* These two routines moved to gen_bitmap.c */
-extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
- __u32 bitno);
-extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
- blk_t bitno);
_INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
blk_t bitno);
errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf)
{
errcode_t retval;
- struct ext2_ext_attr_entry *entry;
retval = io_channel_read_blk(fs->io, block, 1, buf);
if (retval)
errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf)
{
errcode_t retval;
- char *p, *end, *write_buf;
+ char *write_buf;
char *buf = NULL;
- struct ext2_dir_entry *dirent;
#ifdef EXT2FS_ENABLE_SWAPFS
if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
unsigned int nbytes, unsigned int *written)
{
ext2_filsys fs;
- blk_t pb;
errcode_t retval = 0;
unsigned int start, c, count = 0;
char *ptr = (char *) buf;
- int dontfill;
EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
fs = file->fs;
2001-12-16 Theodore Tso <tytso@valinux.com>
+ * dumpe2fs.c (list_desc), fsck.c (fs_match),
+ get_device_by_label.c (get_label_uuid),
+ mke2fs.c (set_fs_defaults, zap_sector, PRS),
+ tune2fs.c (remove_journal_device, update_feature_set),
+ util.c (figure_journal_size), util.h: Fix gcc -Wall nits.
+
+ * e2image.c (write_raw_image_file): Fix gcc -Wall nits, and use
+ the stashed inode functions to optimize away system calls.
+
* Makefile.in, jfs_user.h: linux/jfs.h has been renamed to
linux/jbd.h
#include "ext2fs/ext2fs.h"
#include "e2p/e2p.h"
#include "jfs_user.h"
+#include <uuid/uuid.h>
#include "../version.h"
#include "nls-enable.h"
const char * program_name = "dumpe2fs";
char * device_name = NULL;
-char *num_format = "%lu";
+const char *num_format = "%lu";
static void usage(void)
{
printf(num_format, fs->group_desc[i].bg_block_bitmap);
diff = fs->group_desc[i].bg_block_bitmap - group_blk;
if (diff >= 0)
- printf(" (+%d)", diff);
+ printf(" (+%ld)", diff);
fputs(_(", Inode bitmap at "), stdout);
printf(num_format, fs->group_desc[i].bg_inode_bitmap);
diff = fs->group_desc[i].bg_inode_bitmap - group_blk;
if (diff >= 0)
- printf(" (+%d)", diff);
+ printf(" (+%ld)", diff);
fputs(_("\n Inode table at "), stdout);
printf(num_format, fs->group_desc[i].bg_inode_table);
fputc('-', stdout);
inode_blocks_per_group - 1);
diff = fs->group_desc[i].bg_inode_table - group_blk;
if (diff > 0)
- printf(" (+%d)", diff);
+ printf(" (+%ld)", diff);
printf (_("\n %d free blocks, %d free inodes, "
"%d directories\n Free blocks: "),
fs->group_desc[i].bg_free_blocks_count,
return 0;
}
+static errcode_t meta_check_directory(ext2_filsys fs, ext2_ino_t ino)
+{
+ if ((ino != stashed_ino) || !stashed_inode)
+ return EXT2_ET_CALLBACK_NOTHANDLED;
+
+ if (!LINUX_S_ISDIR(stashed_inode->i_mode))
+ return EXT2_ET_NO_DIRECTORY;
+ return 0;
+}
+
static errcode_t meta_read_inode(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode)
{
return 0;
}
+static void use_inode_shortcuts(ext2_filsys fs, int bool)
+{
+ if (bool) {
+ fs->get_blocks = meta_get_blocks;
+ fs->check_directory = meta_check_directory;
+ fs->read_inode = meta_read_inode;
+ stashed_ino = 0;
+ } else {
+ fs->get_blocks = 0;
+ fs->check_directory = 0;
+ fs->read_inode = 0;
+ }
+}
+
static int process_dir_block(ext2_filsys fs, blk_t *block_nr,
e2_blkcnt_t blockcnt, blk_t ref_block,
int ref_offset, void *priv_data)
}
}
-static output_meta_data_blocks(ext2_filsys fs, int fd)
+static void output_meta_data_blocks(ext2_filsys fs, int fd)
{
errcode_t retval;
blk_t blk;
exit(1);
}
+ use_inode_shortcuts(fs, 1);
stashed_inode = &inode;
while (1) {
retval = ext2fs_get_next_inode(scan, &ino, &inode);
}
}
}
-
+ use_inode_shortcuts(fs, 0);
output_meta_data_blocks(fs, fd);
}
if (cmp->list == 0 || cmp->list[0] == 0)
return 1;
- for (n=0; cp = cmp->list[n]; n++) {
+ for (n=0; (cp = cmp->list[n]); n++) {
switch (cmp->type[n]) {
case FS_TYPE_NORMAL:
checked_type++;
#include <fcntl.h>
#include <sys/types.h>
+#include "fsck.h"
+
struct fs_magic {
- const char *fs_name;
- int offset;
- int len;
- char *magic;
+ const char *fs_name;
+ int offset;
+ int len;
+ const char *magic;
};
struct fs_magic type_array[] = {
/* should merge these later */
int fd;
size_t label_size;
- char *sb_uuid = 0, *sb_label = 0;
+ unsigned char *sb_uuid = 0, *sb_label = 0;
struct ext2_super_block e2sb;
struct xfs_super_block xfsb;
{ 0, 0, 0, 0},
};
-static void set_fs_defaults(char *fs_type, struct ext2_super_block *super,
+static void set_fs_defaults(const char *fs_type,
+ struct ext2_super_block *super,
int blocksize, int *inode_ratio)
{
int megs;
};
static void progress_init(struct progress_struct *progress,
- char *label,__u32 max)
+ const char *label,__u32 max)
{
int i;
buf = malloc(512*nsect);
if (!buf) {
- printf(_("Warning: out of memory erasing sectors %d-%d: %s\n"),
- sect, sect + nsect - 1, error_message(retval));
+ printf(_("Out of memory erasing sectors %d-%d\n"),
+ sect, sect + nsect - 1);
exit(1);
}
memset(buf, 0, 512*nsect);
errcode_t retval;
char * oldpath = getenv("PATH");
char * raid_opts = 0;
- char * fs_type = 0;
+ const char * fs_type = 0;
int default_features = 1;
blk_t dev_size;
#ifdef linux
*/
static void remove_journal_device(ext2_filsys fs)
{
- char *journal_device;
+ char *journal_path;
ext2_filsys jfs;
char buf[1024];
journal_superblock_t *jsb;
commit_remove_journal = 1; /* force removal even if error */
uuid_unparse(fs->super->s_journal_uuid, buf);
- journal_device = get_spec_by_uuid(buf);
+ journal_path = get_spec_by_uuid(buf);
- if (!journal_device) {
- journal_device =
+ if (!journal_path) {
+ journal_path =
ext2fs_find_block_device(fs->super->s_journal_dev);
- if (!journal_device)
+ if (!journal_path)
return;
}
- retval = ext2fs_open(journal_device, EXT2_FLAG_RW|
+ retval = ext2fs_open(journal_path, EXT2_FLAG_RW|
EXT2_FLAG_JOURNAL_DEV_OK, 0,
fs->blocksize, unix_io_manager, &jfs);
if (retval) {
}
if (!(jfs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) {
fprintf(stderr, _("%s is not a journal device.\n"),
- journal_device);
+ journal_path);
goto no_valid_journal;
}
sizeof(fs->super->s_journal_uuid));
ext2fs_mark_super_dirty(fs);
printf(_("Journal removed\n"));
- free(journal_device);
+ free(journal_path);
}
/* Helper function for remove_journal_inode */
{
int sparse, old_sparse, filetype, old_filetype;
int journal, old_journal;
- struct ext2_inode inode;
struct ext2_super_block *sb= fs->super;
- errcode_t retval;
old_sparse = sb->s_feature_ro_compat &
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
* in the filesystem. For very small filesystems, it is not reasonable to
* have a journal that fills more than half of the filesystem.
*/
-int figure_journal_size(int journal_size, ext2_filsys fs)
+int figure_journal_size(int size, ext2_filsys fs)
{
blk_t j_blocks;
return 0;
}
- if (journal_size >= 0) {
- j_blocks = journal_size * 1024 /
- (fs->blocksize / 1024);
+ if (size >= 0) {
+ j_blocks = size * 1024 / (fs->blocksize / 1024);
if (j_blocks < 1024 || j_blocks > 102400) {
fprintf(stderr, _("\nThe requested journal "
"size is %d blocks; it must be\n"
extern void check_plausibility(const char *device);
extern void parse_journal_opts(const char *opts);
extern void check_mount(const char *device, int force, const char *type);
-extern int figure_journal_size(int journal_size, ext2_filsys fs);
+extern int figure_journal_size(int size, ext2_filsys fs);
extern void print_check_message(ext2_filsys fs);