nfsd4: properly type op_get_currentstateid callbacks
Pass union nfsd4_op_u to the op_set_currentstateid callbacks instead of using unsafe function pointer casts. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
b60e985980
commit
57832e7bd8
@ -20,13 +20,21 @@ extern void nfsd4_set_closestateid(struct nfsd4_compound_state *,
|
|||||||
/*
|
/*
|
||||||
* functions to consume current state id
|
* functions to consume current state id
|
||||||
*/
|
*/
|
||||||
extern void nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *cstate, struct nfsd4_open_downgrade *);
|
extern void nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *,
|
||||||
extern void nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *, struct nfsd4_delegreturn *);
|
union nfsd4_op_u *);
|
||||||
extern void nfsd4_get_freestateid(struct nfsd4_compound_state *, struct nfsd4_free_stateid *);
|
extern void nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *,
|
||||||
extern void nfsd4_get_setattrstateid(struct nfsd4_compound_state *, struct nfsd4_setattr *);
|
union nfsd4_op_u *);
|
||||||
extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
|
extern void nfsd4_get_freestateid(struct nfsd4_compound_state *,
|
||||||
extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *, struct nfsd4_locku *);
|
union nfsd4_op_u *);
|
||||||
extern void nfsd4_get_readstateid(struct nfsd4_compound_state *, struct nfsd4_read *);
|
extern void nfsd4_get_setattrstateid(struct nfsd4_compound_state *,
|
||||||
extern void nfsd4_get_writestateid(struct nfsd4_compound_state *, struct nfsd4_write *);
|
union nfsd4_op_u *);
|
||||||
|
extern void nfsd4_get_closestateid(struct nfsd4_compound_state *,
|
||||||
|
union nfsd4_op_u *);
|
||||||
|
extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *,
|
||||||
|
union nfsd4_op_u *);
|
||||||
|
extern void nfsd4_get_readstateid(struct nfsd4_compound_state *,
|
||||||
|
union nfsd4_op_u *);
|
||||||
|
extern void nfsd4_get_writestateid(struct nfsd4_compound_state *,
|
||||||
|
union nfsd4_op_u *);
|
||||||
|
|
||||||
#endif /* _NFSD4_CURRENT_STATE_H */
|
#endif /* _NFSD4_CURRENT_STATE_H */
|
||||||
|
@ -1525,8 +1525,6 @@ typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
|
|||||||
void *);
|
void *);
|
||||||
typedef u32(*nfsd4op_rsize)(struct svc_rqst *, struct nfsd4_op *op);
|
typedef u32(*nfsd4op_rsize)(struct svc_rqst *, struct nfsd4_op *op);
|
||||||
|
|
||||||
typedef void(*stateid_getter)(struct nfsd4_compound_state *, void *);
|
|
||||||
|
|
||||||
enum nfsd4_op_flags {
|
enum nfsd4_op_flags {
|
||||||
ALLOWED_WITHOUT_FH = 1 << 0, /* No current filehandle required */
|
ALLOWED_WITHOUT_FH = 1 << 0, /* No current filehandle required */
|
||||||
ALLOWED_ON_ABSENT_FS = 1 << 1, /* ops processed on absent fs */
|
ALLOWED_ON_ABSENT_FS = 1 << 1, /* ops processed on absent fs */
|
||||||
@ -1563,7 +1561,8 @@ struct nfsd4_operation {
|
|||||||
char *op_name;
|
char *op_name;
|
||||||
/* Try to get response size before operation */
|
/* Try to get response size before operation */
|
||||||
nfsd4op_rsize op_rsize_bop;
|
nfsd4op_rsize op_rsize_bop;
|
||||||
stateid_getter op_get_currentstateid;
|
void (*op_get_currentstateid)(struct nfsd4_compound_state *,
|
||||||
|
union nfsd4_op_u *);
|
||||||
void (*op_set_currentstateid)(struct nfsd4_compound_state *,
|
void (*op_set_currentstateid)(struct nfsd4_compound_state *,
|
||||||
union nfsd4_op_u *);
|
union nfsd4_op_u *);
|
||||||
};
|
};
|
||||||
@ -2104,7 +2103,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
|
|||||||
.op_flags = OP_MODIFIES_SOMETHING,
|
.op_flags = OP_MODIFIES_SOMETHING,
|
||||||
.op_name = "OP_CLOSE",
|
.op_name = "OP_CLOSE",
|
||||||
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
|
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
|
||||||
.op_get_currentstateid = (stateid_getter)nfsd4_get_closestateid,
|
.op_get_currentstateid = nfsd4_get_closestateid,
|
||||||
.op_set_currentstateid = nfsd4_set_closestateid,
|
.op_set_currentstateid = nfsd4_set_closestateid,
|
||||||
},
|
},
|
||||||
[OP_COMMIT] = {
|
[OP_COMMIT] = {
|
||||||
@ -2124,7 +2123,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
|
|||||||
.op_flags = OP_MODIFIES_SOMETHING,
|
.op_flags = OP_MODIFIES_SOMETHING,
|
||||||
.op_name = "OP_DELEGRETURN",
|
.op_name = "OP_DELEGRETURN",
|
||||||
.op_rsize_bop = nfsd4_only_status_rsize,
|
.op_rsize_bop = nfsd4_only_status_rsize,
|
||||||
.op_get_currentstateid = (stateid_getter)nfsd4_get_delegreturnstateid,
|
.op_get_currentstateid = nfsd4_get_delegreturnstateid,
|
||||||
},
|
},
|
||||||
[OP_GETATTR] = {
|
[OP_GETATTR] = {
|
||||||
.op_func = (nfsd4op_func)nfsd4_getattr,
|
.op_func = (nfsd4op_func)nfsd4_getattr,
|
||||||
@ -2161,7 +2160,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
|
|||||||
.op_flags = OP_MODIFIES_SOMETHING,
|
.op_flags = OP_MODIFIES_SOMETHING,
|
||||||
.op_name = "OP_LOCKU",
|
.op_name = "OP_LOCKU",
|
||||||
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
|
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
|
||||||
.op_get_currentstateid = (stateid_getter)nfsd4_get_lockustateid,
|
.op_get_currentstateid = nfsd4_get_lockustateid,
|
||||||
},
|
},
|
||||||
[OP_LOOKUP] = {
|
[OP_LOOKUP] = {
|
||||||
.op_func = (nfsd4op_func)nfsd4_lookup,
|
.op_func = (nfsd4op_func)nfsd4_lookup,
|
||||||
@ -2198,7 +2197,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
|
|||||||
.op_flags = OP_MODIFIES_SOMETHING,
|
.op_flags = OP_MODIFIES_SOMETHING,
|
||||||
.op_name = "OP_OPEN_DOWNGRADE",
|
.op_name = "OP_OPEN_DOWNGRADE",
|
||||||
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
|
.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
|
||||||
.op_get_currentstateid = (stateid_getter)nfsd4_get_opendowngradestateid,
|
.op_get_currentstateid = nfsd4_get_opendowngradestateid,
|
||||||
.op_set_currentstateid = nfsd4_set_opendowngradestateid,
|
.op_set_currentstateid = nfsd4_set_opendowngradestateid,
|
||||||
},
|
},
|
||||||
[OP_PUTFH] = {
|
[OP_PUTFH] = {
|
||||||
@ -2226,7 +2225,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
|
|||||||
.op_func = (nfsd4op_func)nfsd4_read,
|
.op_func = (nfsd4op_func)nfsd4_read,
|
||||||
.op_name = "OP_READ",
|
.op_name = "OP_READ",
|
||||||
.op_rsize_bop = (nfsd4op_rsize)nfsd4_read_rsize,
|
.op_rsize_bop = (nfsd4op_rsize)nfsd4_read_rsize,
|
||||||
.op_get_currentstateid = (stateid_getter)nfsd4_get_readstateid,
|
.op_get_currentstateid = nfsd4_get_readstateid,
|
||||||
},
|
},
|
||||||
[OP_READDIR] = {
|
[OP_READDIR] = {
|
||||||
.op_func = (nfsd4op_func)nfsd4_readdir,
|
.op_func = (nfsd4op_func)nfsd4_readdir,
|
||||||
@ -2282,7 +2281,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
|
|||||||
.op_name = "OP_SETATTR",
|
.op_name = "OP_SETATTR",
|
||||||
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
|
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
|
||||||
.op_rsize_bop = (nfsd4op_rsize)nfsd4_setattr_rsize,
|
.op_rsize_bop = (nfsd4op_rsize)nfsd4_setattr_rsize,
|
||||||
.op_get_currentstateid = (stateid_getter)nfsd4_get_setattrstateid,
|
.op_get_currentstateid = nfsd4_get_setattrstateid,
|
||||||
},
|
},
|
||||||
[OP_SETCLIENTID] = {
|
[OP_SETCLIENTID] = {
|
||||||
.op_func = (nfsd4op_func)nfsd4_setclientid,
|
.op_func = (nfsd4op_func)nfsd4_setclientid,
|
||||||
@ -2308,7 +2307,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
|
|||||||
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
|
.op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
|
||||||
.op_name = "OP_WRITE",
|
.op_name = "OP_WRITE",
|
||||||
.op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize,
|
.op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize,
|
||||||
.op_get_currentstateid = (stateid_getter)nfsd4_get_writestateid,
|
.op_get_currentstateid = nfsd4_get_writestateid,
|
||||||
},
|
},
|
||||||
[OP_RELEASE_LOCKOWNER] = {
|
[OP_RELEASE_LOCKOWNER] = {
|
||||||
.op_func = (nfsd4op_func)nfsd4_release_lockowner,
|
.op_func = (nfsd4op_func)nfsd4_release_lockowner,
|
||||||
@ -2388,7 +2387,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
|
|||||||
.op_func = (nfsd4op_func)nfsd4_free_stateid,
|
.op_func = (nfsd4op_func)nfsd4_free_stateid,
|
||||||
.op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,
|
.op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,
|
||||||
.op_name = "OP_FREE_STATEID",
|
.op_name = "OP_FREE_STATEID",
|
||||||
.op_get_currentstateid = (stateid_getter)nfsd4_get_freestateid,
|
.op_get_currentstateid = nfsd4_get_freestateid,
|
||||||
.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,
|
.op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,
|
||||||
},
|
},
|
||||||
#ifdef CONFIG_NFSD_PNFS
|
#ifdef CONFIG_NFSD_PNFS
|
||||||
|
@ -7135,49 +7135,57 @@ nfsd4_set_lockstateid(struct nfsd4_compound_state *cstate,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *cstate, struct nfsd4_open_downgrade *odp)
|
nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *cstate,
|
||||||
|
union nfsd4_op_u *u)
|
||||||
{
|
{
|
||||||
get_stateid(cstate, &odp->od_stateid);
|
get_stateid(cstate, &u->open_downgrade.od_stateid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *cstate, struct nfsd4_delegreturn *drp)
|
nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *cstate,
|
||||||
|
union nfsd4_op_u *u)
|
||||||
{
|
{
|
||||||
get_stateid(cstate, &drp->dr_stateid);
|
get_stateid(cstate, &u->delegreturn.dr_stateid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nfsd4_get_freestateid(struct nfsd4_compound_state *cstate, struct nfsd4_free_stateid *fsp)
|
nfsd4_get_freestateid(struct nfsd4_compound_state *cstate,
|
||||||
|
union nfsd4_op_u *u)
|
||||||
{
|
{
|
||||||
get_stateid(cstate, &fsp->fr_stateid);
|
get_stateid(cstate, &u->free_stateid.fr_stateid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nfsd4_get_setattrstateid(struct nfsd4_compound_state *cstate, struct nfsd4_setattr *setattr)
|
nfsd4_get_setattrstateid(struct nfsd4_compound_state *cstate,
|
||||||
|
union nfsd4_op_u *u)
|
||||||
{
|
{
|
||||||
get_stateid(cstate, &setattr->sa_stateid);
|
get_stateid(cstate, &u->setattr.sa_stateid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nfsd4_get_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
|
nfsd4_get_closestateid(struct nfsd4_compound_state *cstate,
|
||||||
|
union nfsd4_op_u *u)
|
||||||
{
|
{
|
||||||
get_stateid(cstate, &close->cl_stateid);
|
get_stateid(cstate, &u->close.cl_stateid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nfsd4_get_lockustateid(struct nfsd4_compound_state *cstate, struct nfsd4_locku *locku)
|
nfsd4_get_lockustateid(struct nfsd4_compound_state *cstate,
|
||||||
|
union nfsd4_op_u *u)
|
||||||
{
|
{
|
||||||
get_stateid(cstate, &locku->lu_stateid);
|
get_stateid(cstate, &u->locku.lu_stateid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nfsd4_get_readstateid(struct nfsd4_compound_state *cstate, struct nfsd4_read *read)
|
nfsd4_get_readstateid(struct nfsd4_compound_state *cstate,
|
||||||
|
union nfsd4_op_u *u)
|
||||||
{
|
{
|
||||||
get_stateid(cstate, &read->rd_stateid);
|
get_stateid(cstate, &u->read.rd_stateid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nfsd4_get_writestateid(struct nfsd4_compound_state *cstate, struct nfsd4_write *write)
|
nfsd4_get_writestateid(struct nfsd4_compound_state *cstate,
|
||||||
|
union nfsd4_op_u *u)
|
||||||
{
|
{
|
||||||
get_stateid(cstate, &write->wr_stateid);
|
get_stateid(cstate, &u->write.wr_stateid);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user