return;
}
-void do_dump_extents(int argc, char *argv[])
+void do_dump_extents(int argc, char **argv)
{
struct ext2_inode inode;
ext2_ino_t ino;
}
}
- if (argc != optind+1) {
- print_usage:
+ if (argc != optind + 1) {
com_err(0, 0, "Usage: dump_extents [-n] [-l] file");
return;
}
extern void do_find_free_block(int argc, char **argv);
extern void do_find_free_inode(int argc, char **argv);
extern void do_stat(int argc, char **argv);
+extern void do_dump_extents(int argc, char **argv);
extern void do_chroot(int argc, char **argv);
extern void do_clri(int argc, char **argv);
* under the terms of the GNU Public License.
*/
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* for O_LARGEFILE */
+#endif
#include <stdio.h>
#include <unistd.h>
{
struct ext2_inode *inode;
struct ext2_inode_large *large_inode;
- time_t t;
if (!ctx || !ctx->inode)
goto no_inode;
struct ext2_dir_entry *dirent;
const char *old_op;
errcode_t retval;
- blk64_t blk, first_dir_blk;
+ blk64_t blk;
unsigned int i, rec_len, not_device = 0;
int extent_fs;
* with it.
*/
- extent_fs = (ctx->fs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS);
+ extent_fs = (ctx->fs->super->s_feature_incompat &
+ EXT3_FEATURE_INCOMPAT_EXTENTS);
if (extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) {
/* extent mapped */
if (ext2fs_bmap2(ctx->fs, pctx->ino, inode, 0, 0, 0, 0,
struct ext2_dir_entry *dirent,
ext2_ino_t ino, struct problem_context *pctx)
{
- int rec_len, problem = 0;
+ int problem = 0;
+ unsigned int rec_len;
if (!dirent->inode)
problem = PR_2_MISSING_DOT_DOT;
blk64_t start, blk64_t count)
{
ext2_filsys fs = ctx->fs;
- int ret = 0;
/*
* If the filesystem has changed it means that there was an corruption
return retval;
dirent = (struct ext2_dir_entry *) block_start;
prev_rec_len = 0;
+ rec_len = 0;
left = fs->blocksize;
slack = fd->compress ? 12 :
(fs->blocksize * ctx->htree_slack_percentage)/100;
if (slack < 12)
slack = 12;
- for (i=0; i < fd->num_array; i++) {
+ for (i = 0; i < fd->num_array; i++) {
ent = fd->harray + i;
if (ent->dir->inode == 0)
continue;
%{_includedir}/blkid
%{_includedir}/e2p
%{_includedir}/et
+%{_includedir}/com_err.h
%{_includedir}/ext2fs
%{_includedir}/ss
%{_includedir}/uuid
{
#ifdef __linux__
struct utsname ut;
- static version_code = -1;
+ static int version_code = -1;
int major, minor, rev;
char *endptr;
const char *cp;
sprintf(uuid_str, "%016llX", uuid);
blkid_set_tag(probe->dev, "UUID", uuid_str, 0);
}
- blkid_set_tag(probe->dev, "LABEL", hfs->label, hfs->label_len);
+ blkid_set_tag(probe->dev, "LABEL", (char *)hfs->label, hfs->label_len);
return 0;
}
return 0;
label_len = blkid_be16(key->unicode_len) * 2;
- unicode_16be_to_utf8(label, sizeof(label), key->unicode, label_len);
+ unicode_16be_to_utf8((unsigned char *)label, sizeof(label),
+ key->unicode, label_len);
blkid_set_tag(probe->dev, "LABEL", label, 0);
return 0;
}
tm = sb->s_first_error_time;
fprintf(f, "First error time: %s", ctime(&tm));
memset(buf, 0, sizeof(buf));
- strncpy(buf, sb->s_first_error_func,
+ strncpy(buf, (char *)sb->s_first_error_func,
sizeof(sb->s_first_error_func));
fprintf(f, "First error function: %s\n", buf);
fprintf(f, "First error line #: %u\n",
tm = sb->s_last_error_time;
fprintf(f, "Last error time: %s", ctime(&tm));
memset(buf, 0, sizeof(buf));
- strncpy(buf, sb->s_last_error_func,
+ strncpy(buf, (char *)sb->s_last_error_func,
sizeof(sb->s_last_error_func));
fprintf(f, "Last error function: %s\n", buf);
fprintf(f, "Last error line #: %u\n",
if (align == 0)
align = 8;
- if (retval = posix_memalign((void **) ptr, align, size)) {
+ retval = posix_memalign((void **) ptr, align, size);
+ if (retval) {
if (retval == ENOMEM)
return EXT2_ET_NO_MEMORY;
return retval;
truncate_block = ((size + file->fs->blocksize - 1) >>
EXT2_BLOCK_SIZE_BITS(file->fs->super)) + 1;
old_size = file->inode.i_size +
- ((blk64_t) file->inode.i_size_high) << 32;
+ ((blk64_t)file->inode.i_size_high << 32);
old_truncate = ((old_size + file->fs->blocksize - 1) >>
EXT2_BLOCK_SIZE_BITS(file->fs->super)) + 1;
*/
if (superblock > 1 && EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
- struct ext2_group_desc *gd;
dgrp_t group;
for (group = 0; group < fs->group_desc_count; group++) {
struct ext2fs_numeric_progress_struct * progress,
const char *message)
{
- unsigned int len;
-
if (!(fs->flags & EXT2_FLAG_PRINT_PROGRESS))
return;
fprintf(stdout, "%.*s", (2*progress->log_max)+1, spaces);
retval = ext2fs_get_array(2, fs->blocksize, &dindir_buf);
if (retval)
- goto out_free;
+ return retval;
gdt_buf = (__u32 *)((char *)dindir_buf + fs->blocksize);
retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode);
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <stdio.h>
#include <string.h>
* list. (Work done by David Beattie)
*/
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* for O_DIRECT */
+#endif
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
unsigned long total_chunks;
char *unitp = "KMGTPEZY";
int units = 10;
- unsigned long start = 0, end, cum;
+ unsigned long start = 0, end;
int i, retval = 0;
scan_block_bitmap(fs, info);
void collect_info(ext2_filsys fs, struct chunk_info *chunk_info)
{
- unsigned int retval = 0, i, free_blks;
+ unsigned int retval = 0;
printf("Device: %s\n", fs->device_name);
printf("Blocksize: %u bytes\n", fs->blocksize);
char *prg_name;
-static void usage(char *prg_name)
+static void usage(void)
{
fprintf(stderr,
_("Usage: %s <transaction file> <filesystem>\n"), prg_name);
exit(1);
-
}
static int check_filesystem(TDB_CONTEXT *tdb, io_channel channel)
force = 1;
break;
default:
- usage(prg_name);
+ usage();
}
}
- if (argc != optind+2)
- usage(prg_name);
+ if (argc != optind + 2)
+ usage();
tdb_file = argv[optind];
device_name = argv[optind+1];
{
struct ext2_super_block *sb = fs->super;
struct ext2_group_desc *gd;
- errcode_t retval;
__u32 old_features[3];
int i, type_err;
unsigned int mask_err;
"Extended mount options too long\n");
continue;
}
- strcpy(fs->super->s_mount_opts, arg);
+ strcpy((char *)fs->super->s_mount_opts, arg);
ext2fs_mark_super_dirty(fs);
} else
r_usage++;
{
char *buf;
- dgrp_t group;
+ dgrp_t group = 0;
errcode_t retval;
int meta_data = 0;
blk64_t blk, new_blk, goal;