Skip to content
Snippets Groups Projects
Commit c4cb94d2 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan :coffee:
Browse files

rquota: add xdrs for rquota protocol

Motivation:
Despite the fact that the NFS v4 protocol specifies attributes to query the quota
(https://tools.ietf.org/html/rfc5661#section-5.8.2.28), the Linux client does not
implement it, as the quota is not associated with a user or a group.

To support classic user and group quotas, the rquota protocol can be implemented.

Modification:
Add required xdr and server sub.

Result:
required building block to implement quota protocol.

Issue: #133
Acked-by:  Lea Morschel
Target: master
parent 02a7c555
No related branches found
No related tags found
No related merge requests found
Pipeline #125189 passed
Showing
with 621 additions and 0 deletions
......@@ -42,6 +42,7 @@
<module>dlm</module>
<module>benchmarks</module>
<module>basic-server</module>
<module>rquota</module>
</modules>
<properties>
......
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.dcache</groupId>
<artifactId>nfs4j</artifactId>
<version>0.26.0-SNAPSHOT</version>
</parent>
<groupId>org.dcache</groupId>
<artifactId>rquota</artifactId>
<packaging>jar</packaging>
<description>Remote quota protocol implementation</description>
<!--
EXTERNAL DEPENDENCIES
-->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<!-- to get console logging during development/debug -->
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.dcache</groupId>
<artifactId>oncrpc4j-core</artifactId>
</dependency>
</dependencies>
</project>
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
import org.dcache.oncrpc4j.rpc.*;
import org.dcache.oncrpc4j.rpc.net.*;
import org.dcache.oncrpc4j.xdr.*;
import java.io.IOException;
public class ext_getquota_args implements XdrAble {
public String gqa_pathp;
public int gqa_type;
public int gqa_id;
public ext_getquota_args() {
}
public ext_getquota_args(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeString(gqa_pathp);
xdr.xdrEncodeInt(gqa_type);
xdr.xdrEncodeInt(gqa_id);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
gqa_pathp = xdr.xdrDecodeString();
gqa_type = xdr.xdrDecodeInt();
gqa_id = xdr.xdrDecodeInt();
}
}
// End of ext_getquota_args.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
import org.dcache.oncrpc4j.rpc.*;
import org.dcache.oncrpc4j.rpc.net.*;
import org.dcache.oncrpc4j.xdr.*;
import java.io.IOException;
public class ext_setquota_args implements XdrAble {
public int sqa_qcmd;
public String sqa_pathp;
public int sqa_id;
public int sqa_type;
public sq_dqblk sqa_dqblk;
public ext_setquota_args() {
}
public ext_setquota_args(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeInt(sqa_qcmd);
xdr.xdrEncodeString(sqa_pathp);
xdr.xdrEncodeInt(sqa_id);
xdr.xdrEncodeInt(sqa_type);
sqa_dqblk.xdrEncode(xdr);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
sqa_qcmd = xdr.xdrDecodeInt();
sqa_pathp = xdr.xdrDecodeString();
sqa_id = xdr.xdrDecodeInt();
sqa_type = xdr.xdrDecodeInt();
sqa_dqblk = new sq_dqblk(xdr);
}
}
// End of ext_setquota_args.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
import org.dcache.oncrpc4j.rpc.*;
import org.dcache.oncrpc4j.rpc.net.*;
import org.dcache.oncrpc4j.xdr.*;
import java.io.IOException;
public class getquota_args implements XdrAble {
public String gqa_pathp;
public int gqa_uid;
public getquota_args() {
}
public getquota_args(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeString(gqa_pathp);
xdr.xdrEncodeInt(gqa_uid);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
gqa_pathp = xdr.xdrDecodeString();
gqa_uid = xdr.xdrDecodeInt();
}
}
// End of getquota_args.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
import org.dcache.oncrpc4j.rpc.*;
import org.dcache.oncrpc4j.rpc.net.*;
import org.dcache.oncrpc4j.xdr.*;
import java.io.IOException;
public class getquota_rslt implements XdrAble {
public int status;
public rquota gqr_rquota;
public getquota_rslt() {
}
public getquota_rslt(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeInt(status);
switch ( status ) {
case qr_status.Q_OK:
gqr_rquota.xdrEncode(xdr);
break;
case qr_status.Q_NOQUOTA:
break;
case qr_status.Q_EPERM:
break;
}
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
status = xdr.xdrDecodeInt();
switch ( status ) {
case qr_status.Q_OK:
gqr_rquota = new rquota(xdr);
break;
case qr_status.Q_NOQUOTA:
break;
case qr_status.Q_EPERM:
break;
}
}
}
// End of getquota_rslt.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
/**
* Enumeration (collection of constants).
*/
public interface qr_status {
public static final int Q_OK = 1;
public static final int Q_NOQUOTA = 2;
public static final int Q_EPERM = 3;
}
// End of qr_status.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
import org.dcache.oncrpc4j.rpc.*;
import org.dcache.oncrpc4j.rpc.net.*;
import org.dcache.oncrpc4j.xdr.*;
import java.io.IOException;
public class rquota implements XdrAble {
public int rq_bsize;
public boolean rq_active;
public int rq_bhardlimit;
public int rq_bsoftlimit;
public int rq_curblocks;
public int rq_fhardlimit;
public int rq_fsoftlimit;
public int rq_curfiles;
public int rq_btimeleft;
public int rq_ftimeleft;
public rquota() {
}
public rquota(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeInt(rq_bsize);
xdr.xdrEncodeBoolean(rq_active);
xdr.xdrEncodeInt(rq_bhardlimit);
xdr.xdrEncodeInt(rq_bsoftlimit);
xdr.xdrEncodeInt(rq_curblocks);
xdr.xdrEncodeInt(rq_fhardlimit);
xdr.xdrEncodeInt(rq_fsoftlimit);
xdr.xdrEncodeInt(rq_curfiles);
xdr.xdrEncodeInt(rq_btimeleft);
xdr.xdrEncodeInt(rq_ftimeleft);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
rq_bsize = xdr.xdrDecodeInt();
rq_active = xdr.xdrDecodeBoolean();
rq_bhardlimit = xdr.xdrDecodeInt();
rq_bsoftlimit = xdr.xdrDecodeInt();
rq_curblocks = xdr.xdrDecodeInt();
rq_fhardlimit = xdr.xdrDecodeInt();
rq_fsoftlimit = xdr.xdrDecodeInt();
rq_curfiles = xdr.xdrDecodeInt();
rq_btimeleft = xdr.xdrDecodeInt();
rq_ftimeleft = xdr.xdrDecodeInt();
}
}
// End of rquota.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
/**
* A collection of constants used by the "rquota" ONC/RPC program.
*/
public interface rquota {
public static final int RQUOTAPROC_GETQUOTA_1 = 1;
public static final int RQUOTAPROC_GETACTIVEQUOTA_1 = 2;
public static final int RQUOTAPROC_GETQUOTA_2 = 1;
public static final int RQUOTAPROC_SETQUOTA_1 = 3;
public static final int RQUOTAPROC_GETACTIVEQUOTA_2 = 2;
public static final int RQUOTAPROC_SETQUOTA_2 = 3;
public static final int RQUOTAVERS = 1;
public static final int RQ_PATHLEN = 1024;
public static final int RQUOTAPROG = 100011;
public static final int RQUOTAPROC_SETACTIVEQUOTA_1 = 4;
public static final int RQUOTAPROC_SETACTIVEQUOTA_2 = 4;
public static final int EXT_RQUOTAVERS = 2;
}
// End of rquota.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
import org.dcache.oncrpc4j.rpc.*;
import java.io.IOException;
/**
*/
public abstract class rquotaServerStub implements RpcDispatchable {
public void dispatchOncRpcCall(RpcCall call)
throws OncRpcException, IOException {
int version = call.getProgramVersion();
int procedure = call.getProcedure();
if ( version == 1 ) {
switch ( procedure ) {
case 1: {
getquota_args args$ = new getquota_args();
call.retrieveCall(args$);
getquota_rslt result$ = RQUOTAPROC_GETQUOTA_1(call, args$);
call.reply(result$);
break;
}
case 2: {
getquota_args args$ = new getquota_args();
call.retrieveCall(args$);
getquota_rslt result$ = RQUOTAPROC_GETACTIVEQUOTA_1(call, args$);
call.reply(result$);
break;
}
case 3: {
setquota_args args$ = new setquota_args();
call.retrieveCall(args$);
setquota_rslt result$ = RQUOTAPROC_SETQUOTA_1(call, args$);
call.reply(result$);
break;
}
case 4: {
setquota_args args$ = new setquota_args();
call.retrieveCall(args$);
setquota_rslt result$ = RQUOTAPROC_SETACTIVEQUOTA_1(call, args$);
call.reply(result$);
break;
}
default:
call.failProcedureUnavailable();
}
} else if ( version == 2 ) {
switch ( procedure ) {
case 1: {
ext_getquota_args args$ = new ext_getquota_args();
call.retrieveCall(args$);
getquota_rslt result$ = RQUOTAPROC_GETQUOTA_2(call, args$);
call.reply(result$);
break;
}
case 2: {
ext_getquota_args args$ = new ext_getquota_args();
call.retrieveCall(args$);
getquota_rslt result$ = RQUOTAPROC_GETACTIVEQUOTA_2(call, args$);
call.reply(result$);
break;
}
case 3: {
ext_setquota_args args$ = new ext_setquota_args();
call.retrieveCall(args$);
setquota_rslt result$ = RQUOTAPROC_SETQUOTA_2(call, args$);
call.reply(result$);
break;
}
case 4: {
ext_setquota_args args$ = new ext_setquota_args();
call.retrieveCall(args$);
setquota_rslt result$ = RQUOTAPROC_SETACTIVEQUOTA_2(call, args$);
call.reply(result$);
break;
}
default:
call.failProcedureUnavailable();
}
} else {
call.failProgramUnavailable();
}
}
public abstract getquota_rslt RQUOTAPROC_GETQUOTA_1(RpcCall call$, getquota_args arg1);
public abstract getquota_rslt RQUOTAPROC_GETACTIVEQUOTA_1(RpcCall call$, getquota_args arg1);
public abstract setquota_rslt RQUOTAPROC_SETQUOTA_1(RpcCall call$, setquota_args arg1);
public abstract setquota_rslt RQUOTAPROC_SETACTIVEQUOTA_1(RpcCall call$, setquota_args arg1);
public abstract getquota_rslt RQUOTAPROC_GETQUOTA_2(RpcCall call$, ext_getquota_args arg1);
public abstract getquota_rslt RQUOTAPROC_GETACTIVEQUOTA_2(RpcCall call$, ext_getquota_args arg1);
public abstract setquota_rslt RQUOTAPROC_SETQUOTA_2(RpcCall call$, ext_setquota_args arg1);
public abstract setquota_rslt RQUOTAPROC_SETACTIVEQUOTA_2(RpcCall call$, ext_setquota_args arg1);
}
// End of rquotaServerStub.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
import org.dcache.oncrpc4j.rpc.*;
import org.dcache.oncrpc4j.rpc.net.*;
import org.dcache.oncrpc4j.xdr.*;
import java.io.IOException;
public class setquota_args implements XdrAble {
public int sqa_qcmd;
public String sqa_pathp;
public int sqa_id;
public sq_dqblk sqa_dqblk;
public setquota_args() {
}
public setquota_args(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeInt(sqa_qcmd);
xdr.xdrEncodeString(sqa_pathp);
xdr.xdrEncodeInt(sqa_id);
sqa_dqblk.xdrEncode(xdr);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
sqa_qcmd = xdr.xdrDecodeInt();
sqa_pathp = xdr.xdrDecodeString();
sqa_id = xdr.xdrDecodeInt();
sqa_dqblk = new sq_dqblk(xdr);
}
}
// End of setquota_args.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
import org.dcache.oncrpc4j.rpc.*;
import org.dcache.oncrpc4j.rpc.net.*;
import org.dcache.oncrpc4j.xdr.*;
import java.io.IOException;
public class setquota_rslt implements XdrAble {
public int status;
public rquota sqr_rquota;
public setquota_rslt() {
}
public setquota_rslt(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeInt(status);
switch ( status ) {
case qr_status.Q_OK:
sqr_rquota.xdrEncode(xdr);
break;
case qr_status.Q_NOQUOTA:
break;
case qr_status.Q_EPERM:
break;
}
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
status = xdr.xdrDecodeInt();
switch ( status ) {
case qr_status.Q_OK:
sqr_rquota = new rquota(xdr);
break;
case qr_status.Q_NOQUOTA:
break;
case qr_status.Q_EPERM:
break;
}
}
}
// End of setquota_rslt.java
/*
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.rquota.xdr;
import org.dcache.oncrpc4j.rpc.*;
import org.dcache.oncrpc4j.rpc.net.*;
import org.dcache.oncrpc4j.xdr.*;
import java.io.IOException;
public class sq_dqblk implements XdrAble {
public int rq_bhardlimit;
public int rq_bsoftlimit;
public int rq_curblocks;
public int rq_fhardlimit;
public int rq_fsoftlimit;
public int rq_curfiles;
public int rq_btimeleft;
public int rq_ftimeleft;
public sq_dqblk() {
}
public sq_dqblk(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeInt(rq_bhardlimit);
xdr.xdrEncodeInt(rq_bsoftlimit);
xdr.xdrEncodeInt(rq_curblocks);
xdr.xdrEncodeInt(rq_fhardlimit);
xdr.xdrEncodeInt(rq_fsoftlimit);
xdr.xdrEncodeInt(rq_curfiles);
xdr.xdrEncodeInt(rq_btimeleft);
xdr.xdrEncodeInt(rq_ftimeleft);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
rq_bhardlimit = xdr.xdrDecodeInt();
rq_bsoftlimit = xdr.xdrDecodeInt();
rq_curblocks = xdr.xdrDecodeInt();
rq_fhardlimit = xdr.xdrDecodeInt();
rq_fsoftlimit = xdr.xdrDecodeInt();
rq_curfiles = xdr.xdrDecodeInt();
rq_btimeleft = xdr.xdrDecodeInt();
rq_ftimeleft = xdr.xdrDecodeInt();
}
}
// End of sq_dqblk.java
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment