void *buf;
size_t i, offset;
blk64_t curr_blk;
- int sz, csum_size = 0;
+ unsigned int sz;
+ unsigned csum_size = 0;
struct buffer_head *bh;
errcode_t err;
__s64 t;
__u32 t_low, t_high;
__u32 *ptr_low, *ptr_high;
- int suffix = check_suffix(field);
if (check_suffix(field))
return parse_uint(info, field, arg);
if (!journal_has_csum_v2or3(j))
return 1;
- tail = (struct journal_block_tail *)(buf + j->j_blocksize -
+ tail = (struct journal_block_tail *)((char *)buf + j->j_blocksize -
sizeof(struct journal_block_tail));
provided = tail->t_checksum;
tail->t_checksum = 0;
memcpy(nbh->b_data, obh->b_data,
journal->j_blocksize);
if (flags & JFS_FLAG_ESCAPE) {
- *((__u32 *)nbh->b_data) =
- ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER);
+ __u32 magic = ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER);
+ memcpy(nbh->b_data, &magic,
+ sizeof(magic));
}
BUFFER_TRACE(nbh, "marking dirty");
if (!journal_has_csum_v2or3(j))
return 1;
- tail = (struct journal_revoke_tail *)(buf + j->j_blocksize -
+ tail = (struct journal_revoke_tail *)((char *)buf + j->j_blocksize -
sizeof(struct journal_revoke_tail));
provided = tail->r_checksum;
tail->r_checksum = 0;
{
journal_revoke_header_t *header;
int offset, max;
- int csum_size = 0;
+ unsigned csum_size = 0;
__u32 rcount;
int record_len = 4;
errcode_t retval;
struct ext2_inode inode;
char *dir_buf = 0;
- struct fill_dir_struct fd = { NULL };
- struct out_dir outdir = { 0 };
+ struct fill_dir_struct fd = { NULL, NULL, 0, 0, 0, NULL,
+ 0, 0, 0, 0, 0, 0 };
+ struct out_dir outdir = { 0, 0, 0, 0 };
e2fsck_read_inode(ctx, ino, &inode, "rehash_dir");
char *name;
struct dir_list *next;
};
-extern void blkid__scan_dir(char *, dev_t, struct dir_list **, char **);
+extern void blkid__scan_dir(const char *, dev_t, struct dir_list **, char **);
/* lseek.c */
extern blkid_loff_t blkid_llseek(int fd, blkid_loff_t offset, int whence);
*list = NULL;
}
-void blkid__scan_dir(char *dirname, dev_t devno, struct dir_list **list,
+void blkid__scan_dir(const char *dirname, dev_t devno, struct dir_list **list,
char **devname)
{
DIR *dir;
js = (struct jfs_super_block *)buf;
- if (blkid_le32(js->js_bsize) != (1 << blkid_le16(js->js_l2bsize)))
+ if (blkid_le32(js->js_bsize) != (1U << blkid_le16(js->js_l2bsize)))
return 1;
- if (blkid_le32(js->js_pbsize) != (1 << blkid_le16(js->js_l2pbsize)))
+ if (blkid_le32(js->js_pbsize) != (1U << blkid_le16(js->js_l2pbsize)))
return 1;
if ((blkid_le16(js->js_l2bsize) - blkid_le16(js->js_l2pbsize)) !=
}
static int probe_f2fs(struct blkid_probe *probe,
- struct blkid_magic *id,
+ struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct f2fs_super_block *bs;
JFS_FEATURE_INCOMPAT_CSUM_V2|\
JFS_FEATURE_INCOMPAT_CSUM_V3)
-
+#ifdef NO_INLINE_FUNCS
+extern size_t journal_tag_bytes(journal_t *journal);
+extern int journal_has_csum_v2or3(journal_t *journal);
+extern int tid_gt(tid_t x, tid_t y) EXT2FS_ATTR((unused));
+extern int tid_geq(tid_t x, tid_t y) EXT2FS_ATTR((unused));
+#endif
#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
#ifdef E2FSCK_INCLUDE_INLINE_FUNCS
/* journal feature predicate functions */
#define JFS_FEATURE_COMPAT_FUNCS(name, flagname) \
+_INLINE_ int jfs_has_feature_##name(journal_t *j); \
_INLINE_ int jfs_has_feature_##name(journal_t *j) \
{ \
return ((j)->j_format_version >= 2 && \
((j)->j_superblock->s_feature_compat & \
ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_##flagname)) != 0); \
} \
+_INLINE_ void jfs_set_feature_##name(journal_t *j); \
_INLINE_ void jfs_set_feature_##name(journal_t *j) \
{ \
(j)->j_superblock->s_feature_compat |= \
ext2fs_cpu_to_be32(JFS_FEATURE_COMPAT_##flagname); \
} \
+_INLINE_ void jfs_clear_feature_##name(journal_t *j); \
_INLINE_ void jfs_clear_feature_##name(journal_t *j) \
{ \
(j)->j_superblock->s_feature_compat &= \
}
#define JFS_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
- _INLINE_ int jfs_has_feature_##name(journal_t *j) \
+_INLINE_ int jfs_has_feature_##name(journal_t *j); \
+_INLINE_ int jfs_has_feature_##name(journal_t *j) \
{ \
return ((j)->j_format_version >= 2 && \
((j)->j_superblock->s_feature_ro_compat & \
ext2fs_cpu_to_be32(JFS_FEATURE_RO_COMPAT_##flagname)) != 0); \
} \
+_INLINE_ void jfs_set_feature_##name(journal_t *j); \
_INLINE_ void jfs_set_feature_##name(journal_t *j) \
{ \
(j)->j_superblock->s_feature_ro_compat |= \
ext2fs_cpu_to_be32(JFS_FEATURE_RO_COMPAT_##flagname); \
} \
+_INLINE_ void jfs_clear_feature_##name(journal_t *j); \
_INLINE_ void jfs_clear_feature_##name(journal_t *j) \
{ \
(j)->j_superblock->s_feature_ro_compat &= \
}
#define JFS_FEATURE_INCOMPAT_FUNCS(name, flagname) \
+_INLINE_ int jfs_has_feature_##name(journal_t *j); \
_INLINE_ int jfs_has_feature_##name(journal_t *j) \
{ \
return ((j)->j_format_version >= 2 && \
((j)->j_superblock->s_feature_incompat & \
ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_##flagname)) != 0); \
} \
+_INLINE_ void jfs_set_feature_##name(journal_t *j); \
_INLINE_ void jfs_set_feature_##name(journal_t *j) \
{ \
(j)->j_superblock->s_feature_incompat |= \
ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_##flagname); \
} \
+_INLINE_ void jfs_clear_feature_##name(journal_t *j); \
_INLINE_ void jfs_clear_feature_##name(journal_t *j) \
{ \
(j)->j_superblock->s_feature_incompat &= \
~ext2fs_cpu_to_be32(JFS_FEATURE_INCOMPAT_##flagname); \
}
+#else
+#define JFS_FEATURE_COMPAT_FUNCS(name, flagname) \
+extern int jfs_has_feature_##name(journal_t *j); \
+extern void jfs_set_feature_##name(journal_t *j); \
+extern void jfs_clear_feature_##name(journal_t *j);
+
+#define JFS_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
+extern int jfs_has_feature_##name(journal_t *j); \
+extern void jfs_set_feature_##name(journal_t *j); \
+extern void jfs_clear_feature_##name(journal_t *j);
+
+#define JFS_FEATURE_INCOMPAT_FUNCS(name, flagname) \
+extern int jfs_has_feature_##name(journal_t *j); \
+extern void jfs_set_feature_##name(journal_t *j); \
+extern void jfs_clear_feature_##name(journal_t *j);
+
+#endif /* (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) */
+
JFS_FEATURE_COMPAT_FUNCS(checksum, CHECKSUM)
JFS_FEATURE_INCOMPAT_FUNCS(revoke, REVOKE)
JFS_FEATURE_INCOMPAT_FUNCS(csum2, CSUM_V2)
JFS_FEATURE_INCOMPAT_FUNCS(csum3, CSUM_V3)
+#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
/*
* helper functions to deal with 32 or 64bit block numbers.
*/
return 0;
}
-_INLINE_ int tid_gt(tid_t x, tid_t y) EXT2FS_ATTR((unused));
-_INLINE_ int tid_geq(tid_t x, tid_t y) EXT2FS_ATTR((unused));
-
/* Comparison functions for transaction IDs: perform comparisons using
* modulo arithmetic so that they work over sequence number wraps. */
int difference = (x - y);
return (difference >= 0);
}
+#endif /* (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) */
#undef _INLINE_
-#endif
extern int journal_blocks_per_page(struct inode *inode);
return err;
}
-int parse_quota_opts(const char *opts, int (*func)(char *, void *), void *data)
+int parse_quota_opts(const char *opts, int (*func)(char *))
{
char *buf, *token, *next, *p;
int len;
*p = 0;
next = p + 1;
}
- ret = func(token, data);
+ ret = func(token);
if (ret)
break;
}
void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, enum quota_type qtype);
errcode_t quota_compare_and_update(quota_ctx_t qctx, enum quota_type qtype,
int *usage_inconsistent);
-int parse_quota_opts(const char *opts, int (*func)(char *, void *), void *data);
+int parse_quota_opts(const char *opts, int (*func)(char *));
/* parse_qtype.c */
int parse_quota_types(const char *in_str, unsigned int *qtype_bits,
/* Write dquot to file */
void qtree_write_dquot(struct dquot *dquot)
{
- ssize_t ret;
+ errcode_t retval;
+ unsigned int ret;
char *ddquot;
struct quota_handle *h = dquot->dq_h;
struct qtree_mem_dqinfo *info =
log_debug("writing ddquot 1: off=%llu, info->dqi_entry_size=%u",
dquot->dq_dqb.u.v2_mdqb.dqb_off,
info->dqi_entry_size);
- ret = ext2fs_get_mem(info->dqi_entry_size, &ddquot);
- if (ret) {
+ retval = ext2fs_get_mem(info->dqi_entry_size, &ddquot);
+ if (retval) {
errno = ENOMEM;
log_err("Quota write failed (id %u): %s",
(unsigned int)dquot->dq_id, strerror(errno));
{
struct qtree_mem_dqinfo *info = &h->qh_info.u.v2_mdqi.dqi_qtree;
ext2_loff_t offset;
- ssize_t ret;
+ unsigned int ret;
char *ddquot;
struct dquot *dquot = get_empty_dquot();
return err;
}
+#if defined(SEEK_DATA) && defined(SEEK_HOLE)
static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf,
ext2_file_t e2_file, char *buf, char *zerobuf)
{
-#if defined(SEEK_DATA) && defined(SEEK_HOLE)
off_t data = 0, hole;
off_t data_blk, hole_blk;
errcode_t err;
}
return err;
-#else
- return EXT2_ET_UNIMPLEMENTED;
-#endif /* SEEK_DATA and SEEK_HOLE */
}
+#endif /* SEEK_DATA and SEEK_HOLE */
+#if defined(FS_IOC_FIEMAP)
static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file,
char *buf, char *zerobuf)
{
-#if defined(FS_IOC_FIEMAP)
#define EXTENT_MAX_COUNT 512
struct fiemap *fiemap_buf;
struct fiemap_extent *ext_buf, *ext;
out:
ext2fs_free_mem(&fiemap_buf);
return err;
-#else
- return EXT2_ET_UNIMPLEMENTED;
-#endif /* FS_IOC_FIEMAP */
}
+#endif /* FS_IOC_FIEMAP */
static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf,
ext2_ino_t ino)
if (err)
goto out;
+#if defined(SEEK_DATA) && defined(SEEK_HOLE)
err = try_lseek_copy(fs, fd, statbuf, e2_file, buf, zerobuf);
if (err != EXT2_ET_UNIMPLEMENTED)
goto out;
+#endif
+#if defined(FS_IOC_FIEMAP)
err = try_fiemap_copy(fs, fd, e2_file, buf, zerobuf);
if (err != EXT2_ET_UNIMPLEMENTED)
goto out;
+#endif
err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
zerobuf);
return;
}
-static int option_handle_function(char *token, void *data)
+static int option_handle_function(char *token)
{
if (strncmp(token, "usr", 3) == 0) {
quota_enable[USRQUOTA] = QOPT_ENABLE;
break;
case 'Q':
Q_flag = 1;
- ret = parse_quota_opts(optarg, option_handle_function,
- NULL);
+ ret = parse_quota_opts(optarg, option_handle_function);
if (ret)
exit(1);
open_flag = EXT2_FLAG_RW;
#define HAVE_STRCASECMP 1
#define HAVE_STRDUP 1
#define HAVE_STRINGS_H 1
+#define HAVE_STRNLEN 1
#define HAVE_STRPTIME 1
#define HAVE_SYSCONF 1
#define HAVE_SYS_IOCTL_H 1
/traditional C rejects string concatenation/d
/integer constant is unsigned in ANSI C, signed with -traditional/d
/ISO C forbids conversion of object pointer to function pointer type/,+2d
+/ISO C does not support ‘__FUNCTION__’ predefined identifier/d
/At top level:/d
/In file included from/d
/In function `.*':/d