summaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_replay.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2017-10-27 12:46:35 -0700
committerGitHub <[email protected]>2017-10-27 12:46:35 -0700
commit867959b5887c5211c520ad10ef8d12990a6d79fa (patch)
tree67f85de9d6658c01108a3542e9f6e585dc30edff /module/zfs/zfs_replay.c
parenta94d38c0f382c16244912de83a7356ae35e63322 (diff)
OpenZFS 8081 - Compiler warnings in zdb
Fix compiler warnings in zdb. With these changes, FreeBSD can compile zdb with all compiler warnings enabled save -Wunused-parameter. usr/src/cmd/zdb/zdb.c usr/src/cmd/zdb/zdb_il.c usr/src/uts/common/fs/zfs/sys/sa.h usr/src/uts/common/fs/zfs/sys/spa.h Fix numerous warnings, including: * const-correctness * shadowing global definitions * signed vs unsigned comparisons * missing prototypes, or missing static declarations * unused variables and functions * Unreadable array initializations * Missing struct initializers usr/src/cmd/zdb/zdb.h Add a header file to declare common symbols usr/src/lib/libzpool/common/sys/zfs_context.h usr/src/uts/common/fs/zfs/arc.c usr/src/uts/common/fs/zfs/dbuf.c usr/src/uts/common/fs/zfs/spa.c usr/src/uts/common/fs/zfs/txg.c Add a function prototype for zk_thread_create, and ensure that every callback supplied to this function actually matches the prototype. usr/src/cmd/ztest/ztest.c usr/src/uts/common/fs/zfs/sys/zil.h usr/src/uts/common/fs/zfs/zfs_replay.c usr/src/uts/common/fs/zfs/zvol.c Add a function prototype for zil_replay_func_t, and ensure that every function of this type actually matches the prototype. usr/src/uts/common/fs/zfs/sys/refcount.h Change FTAG so it discards any constness of __func__, necessary since existing APIs expect it passed as void *. Porting Notes: - Many of these fixes have already been applied to Linux. For consistency the OpenZFS version of a change was applied if the warning was addressed in an equivalent but different fashion. Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Prakash Surya <[email protected]> Authored by: Alan Somers <[email protected]> Approved by: Richard Lowe <[email protected]> Ported-by: Brian Behlendorf <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/8081 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/843abe1b8a Closes #6787
Diffstat (limited to 'module/zfs/zfs_replay.c')
-rw-r--r--module/zfs/zfs_replay.c91
1 files changed, 56 insertions, 35 deletions
diff --git a/module/zfs/zfs_replay.c b/module/zfs/zfs_replay.c
index c2a9a8fde..bfba2fea0 100644
--- a/module/zfs/zfs_replay.c
+++ b/module/zfs/zfs_replay.c
@@ -72,7 +72,7 @@ zfs_init_vattr(vattr_t *vap, uint64_t mask, uint64_t mode,
/* ARGSUSED */
static int
-zfs_replay_error(zfsvfs_t *zfsvfs, lr_t *lr, boolean_t byteswap)
+zfs_replay_error(void *arg1, void *arg2, boolean_t byteswap)
{
return (SET_ERROR(ENOTSUP));
}
@@ -265,9 +265,10 @@ zfs_replay_swap_attrs(lr_attr_t *lrattr)
* as option FUID information.
*/
static int
-zfs_replay_create_acl(zfsvfs_t *zfsvfs,
- lr_acl_create_t *lracl, boolean_t byteswap)
+zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_acl_create_t *lracl = arg2;
char *name = NULL; /* location determined later */
lr_create_t *lr = (lr_create_t *)lracl;
znode_t *dzp;
@@ -413,8 +414,10 @@ bail:
}
static int
-zfs_replay_create(zfsvfs_t *zfsvfs, lr_create_t *lr, boolean_t byteswap)
+zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_create_t *lr = arg2;
char *name = NULL; /* location determined later */
char *link; /* symlink content follows name */
znode_t *dzp;
@@ -545,8 +548,10 @@ out:
}
static int
-zfs_replay_remove(zfsvfs_t *zfsvfs, lr_remove_t *lr, boolean_t byteswap)
+zfs_replay_remove(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_remove_t *lr = arg2;
char *name = (char *)(lr + 1); /* name follows lr_remove_t */
znode_t *dzp;
int error;
@@ -578,8 +583,10 @@ zfs_replay_remove(zfsvfs_t *zfsvfs, lr_remove_t *lr, boolean_t byteswap)
}
static int
-zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boolean_t byteswap)
+zfs_replay_link(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_link_t *lr = arg2;
char *name = (char *)(lr + 1); /* name follows lr_link_t */
znode_t *dzp, *zp;
int error;
@@ -608,8 +615,10 @@ zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boolean_t byteswap)
}
static int
-zfs_replay_rename(zfsvfs_t *zfsvfs, lr_rename_t *lr, boolean_t byteswap)
+zfs_replay_rename(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_rename_t *lr = arg2;
char *sname = (char *)(lr + 1); /* sname and tname follow lr_rename_t */
char *tname = sname + strlen(sname) + 1;
znode_t *sdzp, *tdzp;
@@ -639,8 +648,10 @@ zfs_replay_rename(zfsvfs_t *zfsvfs, lr_rename_t *lr, boolean_t byteswap)
}
static int
-zfs_replay_write(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap)
+zfs_replay_write(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_write_t *lr = arg2;
char *data = (char *)(lr + 1); /* data follows lr_write_t */
znode_t *zp;
int error, written;
@@ -708,8 +719,10 @@ zfs_replay_write(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap)
* the file is grown.
*/
static int
-zfs_replay_write2(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap)
+zfs_replay_write2(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_write_t *lr = arg2;
znode_t *zp;
int error;
uint64_t end;
@@ -753,8 +766,10 @@ top:
}
static int
-zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap)
+zfs_replay_truncate(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_truncate_t *lr = arg2;
znode_t *zp;
flock64_t fl;
int error;
@@ -780,8 +795,10 @@ zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap)
}
static int
-zfs_replay_setattr(zfsvfs_t *zfsvfs, lr_setattr_t *lr, boolean_t byteswap)
+zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_setattr_t *lr = arg2;
znode_t *zp;
xvattr_t xva;
vattr_t *vap = &xva.xva_vattr;
@@ -834,8 +851,10 @@ zfs_replay_setattr(zfsvfs_t *zfsvfs, lr_setattr_t *lr, boolean_t byteswap)
}
static int
-zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, boolean_t byteswap)
+zfs_replay_acl_v0(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_acl_v0_t *lr = arg2;
ace_t *ace = (ace_t *)(lr + 1); /* ace array follows lr_acl_t */
vsecattr_t vsa;
znode_t *zp;
@@ -878,8 +897,10 @@ zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, boolean_t byteswap)
*
*/
static int
-zfs_replay_acl(zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap)
+zfs_replay_acl(void *arg1, void *arg2, boolean_t byteswap)
{
+ zfsvfs_t *zfsvfs = arg1;
+ lr_acl_t *lr = arg2;
ace_t *ace = (ace_t *)(lr + 1);
vsecattr_t vsa;
znode_t *zp;
@@ -928,26 +949,26 @@ zfs_replay_acl(zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap)
/*
* Callback vectors for replaying records
*/
-zil_replay_func_t zfs_replay_vector[TX_MAX_TYPE] = {
- (zil_replay_func_t)zfs_replay_error, /* no such type */
- (zil_replay_func_t)zfs_replay_create, /* TX_CREATE */
- (zil_replay_func_t)zfs_replay_create, /* TX_MKDIR */
- (zil_replay_func_t)zfs_replay_create, /* TX_MKXATTR */
- (zil_replay_func_t)zfs_replay_create, /* TX_SYMLINK */
- (zil_replay_func_t)zfs_replay_remove, /* TX_REMOVE */
- (zil_replay_func_t)zfs_replay_remove, /* TX_RMDIR */
- (zil_replay_func_t)zfs_replay_link, /* TX_LINK */
- (zil_replay_func_t)zfs_replay_rename, /* TX_RENAME */
- (zil_replay_func_t)zfs_replay_write, /* TX_WRITE */
- (zil_replay_func_t)zfs_replay_truncate, /* TX_TRUNCATE */
- (zil_replay_func_t)zfs_replay_setattr, /* TX_SETATTR */
- (zil_replay_func_t)zfs_replay_acl_v0, /* TX_ACL_V0 */
- (zil_replay_func_t)zfs_replay_acl, /* TX_ACL */
- (zil_replay_func_t)zfs_replay_create_acl, /* TX_CREATE_ACL */
- (zil_replay_func_t)zfs_replay_create, /* TX_CREATE_ATTR */
- (zil_replay_func_t)zfs_replay_create_acl, /* TX_CREATE_ACL_ATTR */
- (zil_replay_func_t)zfs_replay_create_acl, /* TX_MKDIR_ACL */
- (zil_replay_func_t)zfs_replay_create, /* TX_MKDIR_ATTR */
- (zil_replay_func_t)zfs_replay_create_acl, /* TX_MKDIR_ACL_ATTR */
- (zil_replay_func_t)zfs_replay_write2, /* TX_WRITE2 */
+zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE] = {
+ zfs_replay_error, /* no such type */
+ zfs_replay_create, /* TX_CREATE */
+ zfs_replay_create, /* TX_MKDIR */
+ zfs_replay_create, /* TX_MKXATTR */
+ zfs_replay_create, /* TX_SYMLINK */
+ zfs_replay_remove, /* TX_REMOVE */
+ zfs_replay_remove, /* TX_RMDIR */
+ zfs_replay_link, /* TX_LINK */
+ zfs_replay_rename, /* TX_RENAME */
+ zfs_replay_write, /* TX_WRITE */
+ zfs_replay_truncate, /* TX_TRUNCATE */
+ zfs_replay_setattr, /* TX_SETATTR */
+ zfs_replay_acl_v0, /* TX_ACL_V0 */
+ zfs_replay_acl, /* TX_ACL */
+ zfs_replay_create_acl, /* TX_CREATE_ACL */
+ zfs_replay_create, /* TX_CREATE_ATTR */
+ zfs_replay_create_acl, /* TX_CREATE_ACL_ATTR */
+ zfs_replay_create_acl, /* TX_MKDIR_ACL */
+ zfs_replay_create, /* TX_MKDIR_ATTR */
+ zfs_replay_create_acl, /* TX_MKDIR_ACL_ATTR */
+ zfs_replay_write2, /* TX_WRITE2 */
};