mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 15:03:53 +02:00
nfsd: switch to autogenerated definitions for open_delegation_type4
Rename the enum with the same name in include/linux/nfs4.h, add the proper enum to nfs4_1.x and regenerate the headers and source files. Do a mass rename of all NFS4_OPEN_DELEGATE_* to OPEN_DELEGATE_* in the nfsd directory. Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
8e1d32273a
commit
8dfbea8bde
|
@ -161,6 +161,13 @@ pragma public fattr4_time_deleg_modify;
|
|||
const FATTR4_TIME_DELEG_ACCESS = 84;
|
||||
const FATTR4_TIME_DELEG_MODIFY = 85;
|
||||
|
||||
|
||||
const OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS = 0x100000;
|
||||
|
||||
enum open_delegation_type4 {
|
||||
OPEN_DELEGATE_NONE = 0,
|
||||
OPEN_DELEGATE_READ = 1,
|
||||
OPEN_DELEGATE_WRITE = 2,
|
||||
OPEN_DELEGATE_NONE_EXT = 3, /* new to v4.1 */
|
||||
OPEN_DELEGATE_READ_ATTRS_DELEG = 4,
|
||||
OPEN_DELEGATE_WRITE_ATTRS_DELEG = 5
|
||||
};
|
||||
|
|
|
@ -2965,7 +2965,7 @@ static int nfs4_show_deleg(struct seq_file *s, struct nfs4_stid *st)
|
|||
seq_puts(s, ": { type: deleg, ");
|
||||
|
||||
seq_printf(s, "access: %s",
|
||||
ds->dl_type == NFS4_OPEN_DELEGATE_READ ? "r" : "w");
|
||||
ds->dl_type == OPEN_DELEGATE_READ ? "r" : "w");
|
||||
|
||||
/* XXX: lease time, whether it's being recalled. */
|
||||
|
||||
|
@ -5581,7 +5581,7 @@ retry:
|
|||
static inline __be32
|
||||
nfs4_check_delegmode(struct nfs4_delegation *dp, int flags)
|
||||
{
|
||||
if ((flags & WR_STATE) && (dp->dl_type == NFS4_OPEN_DELEGATE_READ))
|
||||
if ((flags & WR_STATE) && (dp->dl_type == OPEN_DELEGATE_READ))
|
||||
return nfserr_openmode;
|
||||
else
|
||||
return nfs_ok;
|
||||
|
@ -5823,7 +5823,7 @@ static struct file_lease *nfs4_alloc_init_lease(struct nfs4_delegation *dp,
|
|||
return NULL;
|
||||
fl->fl_lmops = &nfsd_lease_mng_ops;
|
||||
fl->c.flc_flags = FL_DELEG;
|
||||
fl->c.flc_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK;
|
||||
fl->c.flc_type = flag == OPEN_DELEGATE_READ ? F_RDLCK : F_WRLCK;
|
||||
fl->c.flc_owner = (fl_owner_t)dp;
|
||||
fl->c.flc_pid = current->tgid;
|
||||
fl->c.flc_file = dp->dl_stid.sc_file->fi_deleg_file->nf_file;
|
||||
|
@ -5969,7 +5969,7 @@ nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
|
|||
*/
|
||||
if ((open->op_share_access & NFS4_SHARE_ACCESS_BOTH) == NFS4_SHARE_ACCESS_BOTH) {
|
||||
nf = find_rw_file(fp);
|
||||
dl_type = NFS4_OPEN_DELEGATE_WRITE;
|
||||
dl_type = OPEN_DELEGATE_WRITE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5978,7 +5978,7 @@ nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
|
|||
*/
|
||||
if (!nf && (open->op_share_access & NFS4_SHARE_ACCESS_READ)) {
|
||||
nf = find_readable_file(fp);
|
||||
dl_type = NFS4_OPEN_DELEGATE_READ;
|
||||
dl_type = OPEN_DELEGATE_READ;
|
||||
}
|
||||
|
||||
if (!nf)
|
||||
|
@ -6067,7 +6067,7 @@ out_delegees:
|
|||
|
||||
static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status)
|
||||
{
|
||||
open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
|
||||
open->op_delegate_type = OPEN_DELEGATE_NONE_EXT;
|
||||
if (status == -EAGAIN)
|
||||
open->op_why_no_deleg = WND4_CONTENTION;
|
||||
else {
|
||||
|
@ -6183,20 +6183,20 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
|
|||
destroy_delegation(dp);
|
||||
goto out_no_deleg;
|
||||
}
|
||||
open->op_delegate_type = NFS4_OPEN_DELEGATE_WRITE;
|
||||
open->op_delegate_type = OPEN_DELEGATE_WRITE;
|
||||
dp->dl_cb_fattr.ncf_cur_fsize = stat.size;
|
||||
dp->dl_cb_fattr.ncf_initial_cinfo = nfsd4_change_attribute(&stat);
|
||||
trace_nfsd_deleg_write(&dp->dl_stid.sc_stateid);
|
||||
} else {
|
||||
open->op_delegate_type = NFS4_OPEN_DELEGATE_READ;
|
||||
open->op_delegate_type = OPEN_DELEGATE_READ;
|
||||
trace_nfsd_deleg_read(&dp->dl_stid.sc_stateid);
|
||||
}
|
||||
nfs4_put_stid(&dp->dl_stid);
|
||||
return;
|
||||
out_no_deleg:
|
||||
open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE;
|
||||
open->op_delegate_type = OPEN_DELEGATE_NONE;
|
||||
if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS &&
|
||||
open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) {
|
||||
open->op_delegate_type != OPEN_DELEGATE_NONE) {
|
||||
dprintk("NFSD: WARNING: refusing delegation reclaim\n");
|
||||
open->op_recall = true;
|
||||
}
|
||||
|
@ -6211,17 +6211,17 @@ static void nfsd4_deleg_xgrade_none_ext(struct nfsd4_open *open,
|
|||
struct nfs4_delegation *dp)
|
||||
{
|
||||
if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG &&
|
||||
dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
|
||||
open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
|
||||
dp->dl_type == OPEN_DELEGATE_WRITE) {
|
||||
open->op_delegate_type = OPEN_DELEGATE_NONE_EXT;
|
||||
open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE;
|
||||
} else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG &&
|
||||
dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
|
||||
open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
|
||||
dp->dl_type == OPEN_DELEGATE_WRITE) {
|
||||
open->op_delegate_type = OPEN_DELEGATE_NONE_EXT;
|
||||
open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE;
|
||||
}
|
||||
/* Otherwise the client must be confused wanting a delegation
|
||||
* it already has, therefore we don't return
|
||||
* NFS4_OPEN_DELEGATE_NONE_EXT and reason.
|
||||
* OPEN_DELEGATE_NONE_EXT and reason.
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -6311,7 +6311,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
|
|||
|
||||
if (nfsd4_has_session(&resp->cstate)) {
|
||||
if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) {
|
||||
open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
|
||||
open->op_delegate_type = OPEN_DELEGATE_NONE_EXT;
|
||||
open->op_why_no_deleg = WND4_NOT_WANTED;
|
||||
goto nodeleg;
|
||||
}
|
||||
|
@ -6327,7 +6327,7 @@ nodeleg:
|
|||
trace_nfsd_open(&stp->st_stid.sc_stateid);
|
||||
out:
|
||||
/* 4.1 client trying to upgrade/downgrade delegation? */
|
||||
if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&
|
||||
if (open->op_delegate_type == OPEN_DELEGATE_NONE && dp &&
|
||||
open->op_deleg_want)
|
||||
nfsd4_deleg_xgrade_none_ext(open, dp);
|
||||
|
||||
|
|
|
@ -4233,18 +4233,18 @@ nfsd4_encode_open_delegation4(struct xdr_stream *xdr, struct nfsd4_open *open)
|
|||
if (xdr_stream_encode_u32(xdr, open->op_delegate_type) != XDR_UNIT)
|
||||
return nfserr_resource;
|
||||
switch (open->op_delegate_type) {
|
||||
case NFS4_OPEN_DELEGATE_NONE:
|
||||
case OPEN_DELEGATE_NONE:
|
||||
status = nfs_ok;
|
||||
break;
|
||||
case NFS4_OPEN_DELEGATE_READ:
|
||||
case OPEN_DELEGATE_READ:
|
||||
/* read */
|
||||
status = nfsd4_encode_open_read_delegation4(xdr, open);
|
||||
break;
|
||||
case NFS4_OPEN_DELEGATE_WRITE:
|
||||
case OPEN_DELEGATE_WRITE:
|
||||
/* write */
|
||||
status = nfsd4_encode_open_write_delegation4(xdr, open);
|
||||
break;
|
||||
case NFS4_OPEN_DELEGATE_NONE_EXT:
|
||||
case OPEN_DELEGATE_NONE_EXT:
|
||||
/* od_whynone */
|
||||
status = nfsd4_encode_open_none_delegation4(xdr, open);
|
||||
break;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Generated by xdrgen. Manual edits will be lost.
|
||||
// XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x
|
||||
// XDR specification modification time: Thu Oct 3 11:30:59 2024
|
||||
// XDR specification modification time: Sat Oct 12 08:10:54 2024
|
||||
|
||||
#include <linux/sunrpc/svc.h>
|
||||
|
||||
|
@ -135,6 +135,17 @@ xdrgen_decode_fattr4_time_deleg_modify(struct xdr_stream *xdr, fattr4_time_deleg
|
|||
return xdrgen_decode_nfstime4(xdr, ptr);
|
||||
};
|
||||
|
||||
static bool __maybe_unused
|
||||
xdrgen_decode_open_delegation_type4(struct xdr_stream *xdr, open_delegation_type4 *ptr)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
if (xdr_stream_decode_u32(xdr, &val) < 0)
|
||||
return false;
|
||||
*ptr = val;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool __maybe_unused
|
||||
xdrgen_encode_int64_t(struct xdr_stream *xdr, const int64_t value)
|
||||
{
|
||||
|
@ -237,3 +248,9 @@ xdrgen_encode_fattr4_time_deleg_modify(struct xdr_stream *xdr, const fattr4_time
|
|||
{
|
||||
return xdrgen_encode_nfstime4(xdr, value);
|
||||
};
|
||||
|
||||
static bool __maybe_unused
|
||||
xdrgen_encode_open_delegation_type4(struct xdr_stream *xdr, open_delegation_type4 value)
|
||||
{
|
||||
return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Generated by xdrgen. Manual edits will be lost. */
|
||||
/* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */
|
||||
/* XDR specification modification time: Thu Oct 3 11:30:59 2024 */
|
||||
/* XDR specification modification time: Sat Oct 12 08:10:54 2024 */
|
||||
|
||||
#ifndef _LINUX_XDRGEN_NFS4_1_DECL_H
|
||||
#define _LINUX_XDRGEN_NFS4_1_DECL_H
|
||||
|
|
|
@ -366,7 +366,7 @@ enum limit_by4 {
|
|||
NFS4_LIMIT_BLOCKS = 2
|
||||
};
|
||||
|
||||
enum open_delegation_type4 {
|
||||
enum nfs4_open_delegation_type4 {
|
||||
NFS4_OPEN_DELEGATE_NONE = 0,
|
||||
NFS4_OPEN_DELEGATE_READ = 1,
|
||||
NFS4_OPEN_DELEGATE_WRITE = 2,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Generated by xdrgen. Manual edits will be lost. */
|
||||
/* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_1.x */
|
||||
/* XDR specification modification time: Thu Oct 3 11:30:59 2024 */
|
||||
/* XDR specification modification time: Sat Oct 12 08:10:54 2024 */
|
||||
|
||||
#ifndef _LINUX_XDRGEN_NFS4_1_DEF_H
|
||||
#define _LINUX_XDRGEN_NFS4_1_DEF_H
|
||||
|
@ -98,6 +98,16 @@ enum { FATTR4_TIME_DELEG_MODIFY = 85 };
|
|||
|
||||
enum { OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS = 0x100000 };
|
||||
|
||||
enum open_delegation_type4 {
|
||||
OPEN_DELEGATE_NONE = 0,
|
||||
OPEN_DELEGATE_READ = 1,
|
||||
OPEN_DELEGATE_WRITE = 2,
|
||||
OPEN_DELEGATE_NONE_EXT = 3,
|
||||
OPEN_DELEGATE_READ_ATTRS_DELEG = 4,
|
||||
OPEN_DELEGATE_WRITE_ATTRS_DELEG = 5,
|
||||
};
|
||||
typedef enum open_delegation_type4 open_delegation_type4;
|
||||
|
||||
#define NFS4_int64_t_sz \
|
||||
(XDR_hyper)
|
||||
#define NFS4_uint32_t_sz \
|
||||
|
@ -120,5 +130,6 @@ enum { OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS = 0x100000 };
|
|||
(NFS4_nfstime4_sz)
|
||||
#define NFS4_fattr4_time_deleg_modify_sz \
|
||||
(NFS4_nfstime4_sz)
|
||||
#define NFS4_open_delegation_type4_sz (XDR_int)
|
||||
|
||||
#endif /* _LINUX_XDRGEN_NFS4_1_DEF_H */
|
||||
|
|
Loading…
Reference in New Issue
Block a user