Commit 2b803c0d authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfs: define error codes defined in rfc8276 (xattr)

Motivation;
The rfc8276 that specifies extended attribute support over NFS defines
new error codes that should be handled by servers.

Modification:
define new error codes and add corresponding exceptions.

Result:
Ground work for xattr support.

Acked-by: Paul Millar
Acked-by: Lea Morschel
Target: master
parent fa8ebf93
......@@ -143,6 +143,8 @@ public final class nfsstat {
public static final int NFS4ERR_WRONG_LFS = 10092;
public static final int NFS4ERR_BADLABEL = 10093;
public static final int NFS4ERR_OFFLOAD_NO_REQS = 10094;
public static final int NFSERR_NOXATTR = 10095;
public static final int NFSERR_XATTR2BIG = 10096;
private nfsstat() {/* no instance allowed */};
......@@ -377,6 +379,10 @@ public final class nfsstat {
return "NFS4ERR_BADLABEL";
case nfsstat.NFS4ERR_OFFLOAD_NO_REQS:
return "NFS4ERR_OFFLOAD_NO_REQS";
case nfsstat.NFSERR_NOXATTR:
return "NFSERR_NOXATTR";
case nfsstat.NFSERR_XATTR2BIG:
return "NFSERR_XATTR2BIG";
default:
return "NFSERR_UNKNON(" + errorCode + ")";
}
......@@ -601,6 +607,10 @@ public final class nfsstat {
throw new RejectDelegException();
case nfsstat.NFSERR_RETURNCONFLICT:
throw new ReturnConflictException();
case nfsstat.NFSERR_NOXATTR:
throw new NoXattrException();
case nfsstat.NFSERR_XATTR2BIG:
throw new XattrTooBigException();
default:
throw new BadXdrException();
}
......
/*
* Copyright (c) 2019 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program (see the file COPYING.LIB for more
* details); if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.dcache.nfs.status;
import org.dcache.nfs.ChimeraNFSException;
import static org.dcache.nfs.nfsstat.*;
public class NoXattrException extends ChimeraNFSException {
private static final long serialVersionUID = 4870445562399804190L;
public NoXattrException() {
super(NFSERR_NOXATTR);
}
public NoXattrException(String msg) {
super(NFSERR_NOXATTR, msg);
}
public NoXattrException(String msg, Throwable cause) {
super(NFSERR_NOXATTR, msg, cause);
}
}
/*
* Copyright (c) 2019 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program (see the file COPYING.LIB for more
* details); if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.dcache.nfs.status;
import org.dcache.nfs.ChimeraNFSException;
import static org.dcache.nfs.nfsstat.*;
public class XattrTooBigException extends ChimeraNFSException {
private static final long serialVersionUID = -3256563578469911503L;
public XattrTooBigException() {
super(NFSERR_XATTR2BIG);
}
public XattrTooBigException(String msg) {
super(NFSERR_XATTR2BIG, msg);
}
public XattrTooBigException(String msg, Throwable cause) {
super(NFSERR_XATTR2BIG, msg, cause);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment