"<filename>", CHECK_FS_RW))
return;
- retval = do_mkdir_internal(current_fs, cwd, argv[1], NULL, root);
+ retval = do_mkdir_internal(current_fs, cwd, argv[1], root);
if (retval)
com_err(argv[0], retval, 0);
}
+#if CONFIG_MMP
void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
{
-#if CONFIG_MMP
struct mmp_struct *mmp_s;
time_t t;
errcode_t retval = 0;
fprintf(stdout, "device_name: %s\n", mmp_s->mmp_bdevname);
fprintf(stdout, "magic: 0x%x\n", mmp_s->mmp_magic);
fprintf(stdout, "checksum: 0x%08x\n", mmp_s->mmp_checksum);
+ fprintf(stdout, "MMP is unsupported, please recompile with "
+ "--enable-mmp\n");
+}
#else
+void do_dump_mmp(int argc EXT2FS_ATTR((unused)),
+ char *argv[] EXT2FS_ATTR((unused)))
+{
fprintf(stdout, "MMP is unsupported, please recompile with "
"--enable-mmp\n");
-#endif
}
+#endif
static int source_file(const char *cmd_file, int ss_idx)
{
/* util.c */
extern time_t string_to_time(const char *arg);
-errcode_t read_list(const char *str, blk64_t **list, size_t *len);
+errcode_t read_list(char *str, blk64_t **list, size_t *len);
/* xattrs.c */
void dump_inode_attributes(FILE *out, ext2_ino_t ino);
static journal_t *current_journal = NULL;
-static void journal_dump_trans(journal_transaction_t *trans, const char *tag)
+static void journal_dump_trans(journal_transaction_t *trans EXT2FS_ATTR((unused)),
+ const char *tag EXT2FS_ATTR((unused)))
{
dbg_printf("TRANS %p(%s): tid=%d start=%llu block=%llu end=%llu "
"flags=0x%x\n", trans, tag, trans->tid, trans->start,
com_err(argv[0], err, "while examining journal");
}
-void do_journal_close(int argc, char *argv[])
+void do_journal_close(int argc EXT2FS_ATTR((unused)),
+ char *argv[] EXT2FS_ATTR((unused)))
{
if (current_journal == NULL) {
printf("Journal not open.\n");
ext2fs_close_journal(current_fs, ¤t_journal);
}
-void do_journal_run(int argc, char *argv[])
+void do_journal_run(int argc EXT2FS_ATTR((unused)), char *argv[])
{
errcode_t err;
}
-static int list_quota_callback(struct dquot *dq, void *cb_data)
+static int list_quota_callback(struct dquot *dq,
+ void *cb_data EXT2FS_ATTR((unused)))
{
printf("%8u %8lld %8lld %8lld %8lld %8lld %8lld\n",
dq->dq_id, (long long)dq->dq_dqb.dqb_curspace,
return 1; /* we don't need the MMP block written again */
}
+#ifdef CONFIG_MMP
void do_set_mmp_value(int argc, char *argv[])
{
-#ifdef CONFIG_MMP
const char *usage = "<field> <value>\n"
"\t\"set_mmp_value -l\" will list the names of "
"MMP fields\n\twhich can be set.";
&set_mmp);
*mmp_s = set_mmp;
}
+}
#else
+void do_set_mmp_value(int argc EXT2FS_ATTR((unused)),
+ char *argv[] EXT2FS_ATTR((unused)))
+{
fprintf(stdout, "MMP is unsupported, please recompile with "
"--enable-mmp\n");
-#endif
}
+#endif
return 0;
}
-errcode_t read_list(const char *str, blk64_t **list, size_t *len)
+errcode_t read_list(char *str, blk64_t **list, size_t *len)
{
blk64_t *lst = *list;
size_t ln = *len;
- char *tok, *p = optarg;
+ char *tok, *p = str;
errcode_t retval;
while ((tok = strtok(p, ","))) {
}
/* If it looks short enough to be inline data, try to clear extents */
- if (EXT2_INODE_SIZE(fs->super) > EXT2_GOOD_OLD_INODE_SIZE)
- max_inline_ea_size = EXT2_INODE_SIZE(fs->super) -
+ if (inode_size > EXT2_GOOD_OLD_INODE_SIZE)
+ max_inline_ea_size = inode_size -
(EXT2_GOOD_OLD_INODE_SIZE +
((struct ext2_inode_large *)inode)->i_extra_isize);
else
unsigned int save_type;
int imagic_fs, extent_fs, inlinedata_fs;
int low_dtime_check = 1;
- int inode_size;
+ int inode_size = EXT2_INODE_SIZE(fs->super);
int failed_csum = 0;
ext2_ino_t ino_threshold = 0;
dgrp_t ra_group = 0;
ctx->flags |= E2F_FLAG_ABORT;
return;
}
- inode_size = EXT2_INODE_SIZE(fs->super);
inode = (struct ext2_inode *)
e2fsck_allocate_memory(ctx, inode_size, "scratch inode");
*/
static int check_name(e2fsck_t ctx,
struct ext2_dir_entry *dirent,
- ext2_ino_t dir_ino,
struct problem_context *pctx)
{
int i;
}
}
- if (!encrypted && check_name(ctx, dirent, ino, &cd->pctx))
+ if (!encrypted && check_name(ctx, dirent, &cd->pctx))
dir_modified++;
if (check_filetype(ctx, dirent, ino, &cd->pctx))
return 0;
}
-static int probe_zfs(struct blkid_probe *probe, struct blkid_magic *id,
- unsigned char *buf)
+static int probe_zfs(struct blkid_probe *probe __BLKID_ATTR((unused)),
+ struct blkid_magic *id __BLKID_ATTR((unused)),
+ unsigned char *buf __BLKID_ATTR((unused)))
{
#if 0
char *vdev_label;
}
static int probe_btrfs(struct blkid_probe *probe,
- struct blkid_magic *id,
+ struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct btrfs_super_block *bs;
sizeof(struct ext2fs_ba_private_struct));
}
#else
-static void ba_print_stats(ext2fs_generic_bitmap bitmap) {}
+static void ba_print_stats(ext2fs_generic_bitmap bitmap EXT2FS_ATTR((unused)))
+{
+}
#endif
/* Find the first zero bit between start and end, inclusive. */
#define put_bh(x) brelse(x)
#define be64_to_cpu(x) ext2fs_be64_to_cpu(x)
-static inline __u32 jbd2_chksum(journal_t *j, __u32 crc, const void *address,
- unsigned int length)
+static inline __u32 jbd2_chksum(journal_t *j EXT2FS_ATTR((unused)),
+ __u32 crc, const void *address,
+ unsigned int length)
{
return ext2fs_crc32c_le(crc, address, length);
}
#define O_DIRECT 0
#endif
+#pragma GCC diagnostic push
+#ifndef CONFIG_MMP
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
+
errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf)
{
#ifdef CONFIG_MMP
return EXT2_ET_OP_NOT_SUPPORTED;
#endif
}
+#pragma GCC diagnostic pop
static errcode_t ext2fs_punch_inline_data(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
- blk64_t start, blk64_t end)
+ blk64_t start,
+ blk64_t end EXT2FS_ATTR((unused)))
{
errcode_t retval;
return EXT2_ET_UNIMPLEMENTED;
}
+/* parameters might not be used if OS doesn't support zeroout */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
static errcode_t unix_zeroout(io_channel channel, unsigned long long block,
unsigned long long count)
{
unimplemented:
return EXT2_ET_UNIMPLEMENTED;
}
+#pragma GCC diagnostic pop
static struct struct_io_manager struct_unix_manager = {
.magic = EXT2_ET_MAGIC_IO_MANAGER,
/* Libraries we will try to use for readline/editline functionality */
#define DEFAULT_LIBPATH "libreadline.so.6:libreadline.so.5:libreadline.so.4:libreadline.so:libedit.so.2:libedit.so:libeditline.so.0:libeditline.so"
+#ifdef HAVE_DLOPEN
void ss_get_readline(int sci_idx)
{
-#ifdef HAVE_DLOPEN
void *handle = NULL;
ss_data *info = ss_info(sci_idx);
const char **t, *libpath = 0;
dlsym(handle, "rl_attempted_completion_function")) != NULL)
*completion_func = ss_rl_completion;
info->readline_shutdown = ss_release_readline;
-#endif
}
-
-
+#else
+void ss_get_readline(int sci_idx __SS_ATTR((unused)))
+{
+}
+#endif
dq->dq_dqb.dqb_isoftlimit, dq->dq_dqb.dqb_ihardlimit);
}
#else
-static void print_dquot(const char *desc, struct dquot *dq)
+static void print_dquot(const char *desc EXT2FS_ATTR((unused)),
+ struct dquot *dq EXT2FS_ATTR((unused)))
{
}
#endif
* Returns 0 if not able to find the quota file, otherwise returns its
* inode number.
*/
-int quota_file_exists(ext2_filsys fs, int qtype, int fmt)
+int quota_file_exists(ext2_filsys fs, int qtype)
{
char qf_name[256];
errcode_t ret;
/*
* Called to update the blocks used by a particular inode
*/
-void quota_data_add(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino,
+void quota_data_add(quota_ctx_t qctx, struct ext2_inode *inode,
+ ext2_ino_t ino EXT2FS_ATTR((unused)),
qsize_t space)
{
struct dquot *dq;
/*
* Called to remove some blocks used by a particular inode
*/
-void quota_data_sub(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino,
+void quota_data_sub(quota_ctx_t qctx, struct ext2_inode *inode,
+ ext2_ino_t ino EXT2FS_ATTR((unused)),
qsize_t space)
{
struct dquot *dq;
* Called to count the files used by an inode's user/group
*/
void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode *inode,
- ext2_ino_t ino, int adjust)
+ ext2_ino_t ino EXT2FS_ATTR((unused)), int adjust)
{
struct dquot *dq;
dict_t *dict;
* return 1 if there is no partition table, 0 if a partition table is
* detected, and -1 on an error.
*/
+#ifdef HAVE_BLKID_PROBE_ENABLE_PARTITIONS
static int check_partition_table(const char *device)
{
-#ifdef HAVE_BLKID_PROBE_ENABLE_PARTITIONS
blkid_probe pr;
const char *value;
int ret;
errout:
blkid_free_probe(pr);
return ret;
+}
#else
+static int check_partition_table(const char *device EXT2FS_ATTR((unused)))
+{
return -1;
-#endif
}
+#endif
/*
* return 1 if the device looks plausible, creating the file if necessary
return buf;
}
-const char *quota_get_qf_path(const char *mntpt, int qtype, int fmt,
- char *path_buf, size_t path_buf_size)
-{
- char qf_name[QUOTA_NAME_LEN];
-
- if (!mntpt || !path_buf || !path_buf_size)
- return NULL;
-
- strncpy(path_buf, mntpt, path_buf_size);
- strncat(path_buf, "/", 1);
- strncat(path_buf, quota_get_qf_name(qtype, fmt, qf_name),
- path_buf_size - strlen(path_buf));
-
- return path_buf;
-}
-
/*
* Set grace time if needed
*/
}
}
-static int compute_num_blocks_proc(ext2_filsys fs, blk64_t *blocknr,
- e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
- blk64_t ref_block EXT2FS_ATTR((unused)),
- int ref_offset EXT2FS_ATTR((unused)),
- void *private)
+static int compute_num_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
+ blk64_t *blocknr EXT2FS_ATTR((unused)),
+ e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
+ blk64_t ref_block EXT2FS_ATTR((unused)),
+ int ref_offset EXT2FS_ATTR((unused)),
+ void *private)
{
blk64_t *num_blocks = private;
#define QUOTA_NAME_LEN 16
const char *quota_get_qf_name(int type, int fmt, char *buf);
-const char *quota_get_qf_path(const char *mntpt, int qtype, int fmt,
- char *path_buf, size_t path_buf_size);
/* In mkquota.c */
errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs, int qtype);
void quota_release_context(quota_ctx_t *qctx);
errcode_t quota_remove_inode(ext2_filsys fs, int qtype);
-int quota_file_exists(ext2_filsys fs, int qtype, int fmt);
+int quota_file_exists(ext2_filsys fs, int qtype);
void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, int qtype);
errcode_t quota_compare_and_update(quota_ctx_t qctx, int qtype,
int *usage_inconsistent);
* TODO: Not used right now, but we should be able to use this when we add
* support to debugfs to read quota files.
*/
-static int v2_report(struct quota_handle *h, int verbose)
+static int v2_report(struct quota_handle *h EXT2FS_ATTR((unused)),
+ int verbose EXT2FS_ATTR((unused)))
{
log_err("Not Implemented.");
return -1;
}
#endif /* defined(USE_UUIDD) && defined(HAVE_SYS_UN_H) */
+#pragma GCC diagnostic push
+#if !defined(USE_UUIDD) || !defined(HAVE_SYS_UN_H)
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
/*
* Try using the uuidd daemon to generate the UUID
*
#endif
return -1;
}
+#pragma GCC diagnostic pop
void uuid__generate_time(uuid_t out, int *num)
{
}
/* Set the uid, gid, mode and time for the inode */
-static errcode_t set_inode_extra(ext2_filsys fs, ext2_ino_t cwd,
- ext2_ino_t ino, struct stat *st)
+static errcode_t set_inode_extra(ext2_filsys fs, ext2_ino_t ino,
+ struct stat *st)
{
errcode_t retval;
struct ext2_inode inode;
return retval;
}
+#ifdef HAVE_LLISTXATTR
static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino,
const char *filename)
{
-#ifdef HAVE_LLISTXATTR
errcode_t retval, close_retval;
struct ext2_xattr_handle *handle;
ssize_t size, value_size;
retval = retval ? retval : close_retval;
}
return retval;
+ return 0;
+}
#else /* HAVE_LLISTXATTR */
+static errcode_t set_inode_xattr(ext2_filsys fs EXT2FS_ATTR((unused)),
+ ext2_ino_t ino EXT2FS_ATTR((unused)),
+ const char *filename EXT2FS_ATTR((unused)))
+{
return 0;
-#endif /* HAVE_LLISTXATTR */
}
+#endif /* HAVE_LLISTXATTR */
/* Make a special files (block and character devices), fifo's, and sockets */
errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
/* Make a directory in the fs */
errcode_t do_mkdir_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
- struct stat *st, ext2_ino_t root)
+ ext2_ino_t root)
{
char *cp;
ext2_ino_t parent_ino;
if (parent_ino == EXT2_ROOT_INO &&
strcmp(name, "lost+found") == 0)
goto find_lnf;
- retval = do_mkdir_internal(fs, parent_ino, name, &st,
+ retval = do_mkdir_internal(fs, parent_ino, name,
root);
if (retval) {
com_err(__func__, retval,
goto out;
}
- retval = set_inode_extra(fs, parent_ino, ino, &st);
+ retval = set_inode_extra(fs, ino, &st);
if (retval) {
com_err(__func__, retval,
_("while setting inode for \"%s\""), name);
const char *name, char *target,
ext2_ino_t root);
extern errcode_t do_mkdir_internal(ext2_filsys fs, ext2_ino_t cwd,
- const char *name, struct stat *st,
- ext2_ino_t root);
+ const char *name, ext2_ino_t root);
extern errcode_t do_write_internal(ext2_filsys fs, ext2_ino_t cwd,
const char *src, const char *dest,
ext2_ino_t root);
memset(passphrase, 0, sizeof(passphrase));
}
-static void die_signal_handler(int signum, siginfo_t *siginfo,
- void *context)
+static void die_signal_handler(int signum EXT2FS_ATTR((unused)),
+ siginfo_t *siginfo EXT2FS_ATTR((unused)),
+ void *context EXT2FS_ATTR((unused)))
{
clear_secrets();
exit(-1);
"Give the invoking process (typically a shell) a new session keyring,\n" \
"discarding its old session keyring.\n"
-void do_new_session(int argc, char **argv, const struct cmd_desc *cmd)
+void do_new_session(int argc, char **argv EXT2FS_ATTR((unused)),
+ const struct cmd_desc *cmd)
{
long keyid, ret;
{ NULL, NULL, NULL, NULL, 0 }
};
-void do_help(int argc, char **argv, const struct cmd_desc *cmd)
+void do_help(int argc, char **argv,
+ const struct cmd_desc *cmd EXT2FS_ATTR((unused)))
{
const struct cmd_desc *p;
quota_compute_usage(qctx);
if (usrquota == QOPT_ENABLE && !fs->super->s_usr_quota_inum) {
- if ((qf_ino = quota_file_exists(fs, USRQUOTA,
- QFMT_VFS_V1)) > 0)
+ if ((qf_ino = quota_file_exists(fs, USRQUOTA)) > 0)
quota_update_limits(qctx, qf_ino, USRQUOTA);
quota_write_inode(qctx, USRQUOTA);
} else if (usrquota == QOPT_DISABLE) {
}
if (grpquota == QOPT_ENABLE && !fs->super->s_grp_quota_inum) {
- if ((qf_ino = quota_file_exists(fs, GRPQUOTA,
- QFMT_VFS_V1)) > 0)
+ if ((qf_ino = quota_file_exists(fs, GRPQUOTA)) > 0)
quota_update_limits(qctx, qf_ino, GRPQUOTA);
quota_write_inode(qctx, GRPQUOTA);
} else if (grpquota == QOPT_DISABLE) {
static jmp_buf alarm_env;
-static void alarm_signal(int signal)
+static void alarm_signal(int signal EXT2FS_ATTR((unused)))
{
longjmp(alarm_env, 1);
}
}
}
-static errcode_t resize2fs_get_alloc_block(ext2_filsys fs, blk64_t goal,
+static errcode_t resize2fs_get_alloc_block(ext2_filsys fs,
+ blk64_t goal EXT2FS_ATTR((unused)),
blk64_t *ret)
{
ext2_resize_t rfs = (ext2_resize_t) fs->priv_data;
return errcode;
}
-static void quiet_com_err_proc(const char *whoami, errcode_t code,
- const char *fmt, va_list args)
+static void quiet_com_err_proc(const char *whoami EXT2FS_ATTR((unused)),
+ errcode_t code EXT2FS_ATTR((unused)),
+ const char *fmt EXT2FS_ATTR((unused)),
+ va_list args EXT2FS_ATTR((unused)))
{
}
#define HAVE_LSEEK64_PROTOTYPE 1
#define HAVE_MMAP 1
#define HAVE_NETINET_IN_H 1
+#define HAVE_NET_IF_H 1
#define HAVE_SETJMP_H 1
+#define HAVE_SNPRINTF 1
#define HAVE_STDLIB_H 1
#define HAVE_STRCASECMP 1
#define HAVE_STRDUP 1