Skip to content

Commit

Permalink
rquota: add xdrs for rquota protocol
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kofemann committed Jul 16, 2024
1 parent 02a7c55 commit c4cb94d
Show file tree
Hide file tree
Showing 13 changed files with 621 additions and 0 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<module>dlm</module>
<module>benchmarks</module>
<module>basic-server</module>
<module>rquota</module>
</modules>

<properties>
Expand Down
50 changes: 50 additions & 0 deletions rquota/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<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>
43 changes: 43 additions & 0 deletions rquota/src/main/java/org/dcache/rquota/xdr/ext_getquota_args.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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
49 changes: 49 additions & 0 deletions rquota/src/main/java/org/dcache/rquota/xdr/ext_setquota_args.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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
40 changes: 40 additions & 0 deletions rquota/src/main/java/org/dcache/rquota/xdr/getquota_args.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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
56 changes: 56 additions & 0 deletions rquota/src/main/java/org/dcache/rquota/xdr/getquota_rslt.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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
20 changes: 20 additions & 0 deletions rquota/src/main/java/org/dcache/rquota/xdr/qr_status.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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
64 changes: 64 additions & 0 deletions rquota/src/main/java/org/dcache/rquota/xdr/rquota.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* 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
27 changes: 27 additions & 0 deletions rquota/src/main/java/org/dcache/rquota/xdr/rquota.java~
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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
Loading

0 comments on commit c4cb94d

Please sign in to comment.