Skip to content

Commit c4cb94d

Browse files
committed
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
1 parent 02a7c55 commit c4cb94d

13 files changed

+621
-0
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<module>dlm</module>
4343
<module>benchmarks</module>
4444
<module>basic-server</module>
45+
<module>rquota</module>
4546
</modules>
4647

4748
<properties>

rquota/pom.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<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">
2+
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>org.dcache</groupId>
7+
<artifactId>nfs4j</artifactId>
8+
<version>0.26.0-SNAPSHOT</version>
9+
</parent>
10+
11+
<groupId>org.dcache</groupId>
12+
<artifactId>rquota</artifactId>
13+
<packaging>jar</packaging>
14+
<description>Remote quota protocol implementation</description>
15+
16+
<!--
17+
EXTERNAL DEPENDENCIES
18+
-->
19+
<dependencies>
20+
<dependency>
21+
<groupId>junit</groupId>
22+
<artifactId>junit</artifactId>
23+
<scope>test</scope>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.mockito</groupId>
27+
<artifactId>mockito-core</artifactId>
28+
<scope>test</scope>
29+
</dependency>
30+
<dependency>
31+
<!-- to get console logging during development/debug -->
32+
<groupId>ch.qos.logback</groupId>
33+
<artifactId>logback-classic</artifactId>
34+
<scope>test</scope>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.slf4j</groupId>
38+
<artifactId>slf4j-api</artifactId>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.google.guava</groupId>
42+
<artifactId>guava</artifactId>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.dcache</groupId>
46+
<artifactId>oncrpc4j-core</artifactId>
47+
</dependency>
48+
</dependencies>
49+
50+
</project>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
3+
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
4+
* See http://remotetea.sourceforge.net for details
5+
*
6+
* This version of jrpcgen adopted by dCache project
7+
* See http://www.dCache.ORG for details
8+
*/
9+
package org.dcache.rquota.xdr;
10+
import org.dcache.oncrpc4j.rpc.*;
11+
import org.dcache.oncrpc4j.rpc.net.*;
12+
import org.dcache.oncrpc4j.xdr.*;
13+
import java.io.IOException;
14+
15+
public class ext_getquota_args implements XdrAble {
16+
public String gqa_pathp;
17+
public int gqa_type;
18+
public int gqa_id;
19+
20+
public ext_getquota_args() {
21+
}
22+
23+
public ext_getquota_args(XdrDecodingStream xdr)
24+
throws OncRpcException, IOException {
25+
xdrDecode(xdr);
26+
}
27+
28+
public void xdrEncode(XdrEncodingStream xdr)
29+
throws OncRpcException, IOException {
30+
xdr.xdrEncodeString(gqa_pathp);
31+
xdr.xdrEncodeInt(gqa_type);
32+
xdr.xdrEncodeInt(gqa_id);
33+
}
34+
35+
public void xdrDecode(XdrDecodingStream xdr)
36+
throws OncRpcException, IOException {
37+
gqa_pathp = xdr.xdrDecodeString();
38+
gqa_type = xdr.xdrDecodeInt();
39+
gqa_id = xdr.xdrDecodeInt();
40+
}
41+
42+
}
43+
// End of ext_getquota_args.java
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
3+
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
4+
* See http://remotetea.sourceforge.net for details
5+
*
6+
* This version of jrpcgen adopted by dCache project
7+
* See http://www.dCache.ORG for details
8+
*/
9+
package org.dcache.rquota.xdr;
10+
import org.dcache.oncrpc4j.rpc.*;
11+
import org.dcache.oncrpc4j.rpc.net.*;
12+
import org.dcache.oncrpc4j.xdr.*;
13+
import java.io.IOException;
14+
15+
public class ext_setquota_args implements XdrAble {
16+
public int sqa_qcmd;
17+
public String sqa_pathp;
18+
public int sqa_id;
19+
public int sqa_type;
20+
public sq_dqblk sqa_dqblk;
21+
22+
public ext_setquota_args() {
23+
}
24+
25+
public ext_setquota_args(XdrDecodingStream xdr)
26+
throws OncRpcException, IOException {
27+
xdrDecode(xdr);
28+
}
29+
30+
public void xdrEncode(XdrEncodingStream xdr)
31+
throws OncRpcException, IOException {
32+
xdr.xdrEncodeInt(sqa_qcmd);
33+
xdr.xdrEncodeString(sqa_pathp);
34+
xdr.xdrEncodeInt(sqa_id);
35+
xdr.xdrEncodeInt(sqa_type);
36+
sqa_dqblk.xdrEncode(xdr);
37+
}
38+
39+
public void xdrDecode(XdrDecodingStream xdr)
40+
throws OncRpcException, IOException {
41+
sqa_qcmd = xdr.xdrDecodeInt();
42+
sqa_pathp = xdr.xdrDecodeString();
43+
sqa_id = xdr.xdrDecodeInt();
44+
sqa_type = xdr.xdrDecodeInt();
45+
sqa_dqblk = new sq_dqblk(xdr);
46+
}
47+
48+
}
49+
// End of ext_setquota_args.java
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
3+
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
4+
* See http://remotetea.sourceforge.net for details
5+
*
6+
* This version of jrpcgen adopted by dCache project
7+
* See http://www.dCache.ORG for details
8+
*/
9+
package org.dcache.rquota.xdr;
10+
import org.dcache.oncrpc4j.rpc.*;
11+
import org.dcache.oncrpc4j.rpc.net.*;
12+
import org.dcache.oncrpc4j.xdr.*;
13+
import java.io.IOException;
14+
15+
public class getquota_args implements XdrAble {
16+
public String gqa_pathp;
17+
public int gqa_uid;
18+
19+
public getquota_args() {
20+
}
21+
22+
public getquota_args(XdrDecodingStream xdr)
23+
throws OncRpcException, IOException {
24+
xdrDecode(xdr);
25+
}
26+
27+
public void xdrEncode(XdrEncodingStream xdr)
28+
throws OncRpcException, IOException {
29+
xdr.xdrEncodeString(gqa_pathp);
30+
xdr.xdrEncodeInt(gqa_uid);
31+
}
32+
33+
public void xdrDecode(XdrDecodingStream xdr)
34+
throws OncRpcException, IOException {
35+
gqa_pathp = xdr.xdrDecodeString();
36+
gqa_uid = xdr.xdrDecodeInt();
37+
}
38+
39+
}
40+
// End of getquota_args.java
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
3+
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
4+
* See http://remotetea.sourceforge.net for details
5+
*
6+
* This version of jrpcgen adopted by dCache project
7+
* See http://www.dCache.ORG for details
8+
*/
9+
package org.dcache.rquota.xdr;
10+
import org.dcache.oncrpc4j.rpc.*;
11+
import org.dcache.oncrpc4j.rpc.net.*;
12+
import org.dcache.oncrpc4j.xdr.*;
13+
import java.io.IOException;
14+
15+
public class getquota_rslt implements XdrAble {
16+
public int status;
17+
public rquota gqr_rquota;
18+
19+
public getquota_rslt() {
20+
}
21+
22+
public getquota_rslt(XdrDecodingStream xdr)
23+
throws OncRpcException, IOException {
24+
xdrDecode(xdr);
25+
}
26+
27+
public void xdrEncode(XdrEncodingStream xdr)
28+
throws OncRpcException, IOException {
29+
xdr.xdrEncodeInt(status);
30+
switch ( status ) {
31+
case qr_status.Q_OK:
32+
gqr_rquota.xdrEncode(xdr);
33+
break;
34+
case qr_status.Q_NOQUOTA:
35+
break;
36+
case qr_status.Q_EPERM:
37+
break;
38+
}
39+
}
40+
41+
public void xdrDecode(XdrDecodingStream xdr)
42+
throws OncRpcException, IOException {
43+
status = xdr.xdrDecodeInt();
44+
switch ( status ) {
45+
case qr_status.Q_OK:
46+
gqr_rquota = new rquota(xdr);
47+
break;
48+
case qr_status.Q_NOQUOTA:
49+
break;
50+
case qr_status.Q_EPERM:
51+
break;
52+
}
53+
}
54+
55+
}
56+
// End of getquota_rslt.java
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
3+
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
4+
* See http://remotetea.sourceforge.net for details
5+
*
6+
* This version of jrpcgen adopted by dCache project
7+
* See http://www.dCache.ORG for details
8+
*/
9+
package org.dcache.rquota.xdr;
10+
/**
11+
* Enumeration (collection of constants).
12+
*/
13+
public interface qr_status {
14+
15+
public static final int Q_OK = 1;
16+
public static final int Q_NOQUOTA = 2;
17+
public static final int Q_EPERM = 3;
18+
19+
}
20+
// End of qr_status.java
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
3+
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
4+
* See http://remotetea.sourceforge.net for details
5+
*
6+
* This version of jrpcgen adopted by dCache project
7+
* See http://www.dCache.ORG for details
8+
*/
9+
package org.dcache.rquota.xdr;
10+
import org.dcache.oncrpc4j.rpc.*;
11+
import org.dcache.oncrpc4j.rpc.net.*;
12+
import org.dcache.oncrpc4j.xdr.*;
13+
import java.io.IOException;
14+
15+
public class rquota implements XdrAble {
16+
public int rq_bsize;
17+
public boolean rq_active;
18+
public int rq_bhardlimit;
19+
public int rq_bsoftlimit;
20+
public int rq_curblocks;
21+
public int rq_fhardlimit;
22+
public int rq_fsoftlimit;
23+
public int rq_curfiles;
24+
public int rq_btimeleft;
25+
public int rq_ftimeleft;
26+
27+
public rquota() {
28+
}
29+
30+
public rquota(XdrDecodingStream xdr)
31+
throws OncRpcException, IOException {
32+
xdrDecode(xdr);
33+
}
34+
35+
public void xdrEncode(XdrEncodingStream xdr)
36+
throws OncRpcException, IOException {
37+
xdr.xdrEncodeInt(rq_bsize);
38+
xdr.xdrEncodeBoolean(rq_active);
39+
xdr.xdrEncodeInt(rq_bhardlimit);
40+
xdr.xdrEncodeInt(rq_bsoftlimit);
41+
xdr.xdrEncodeInt(rq_curblocks);
42+
xdr.xdrEncodeInt(rq_fhardlimit);
43+
xdr.xdrEncodeInt(rq_fsoftlimit);
44+
xdr.xdrEncodeInt(rq_curfiles);
45+
xdr.xdrEncodeInt(rq_btimeleft);
46+
xdr.xdrEncodeInt(rq_ftimeleft);
47+
}
48+
49+
public void xdrDecode(XdrDecodingStream xdr)
50+
throws OncRpcException, IOException {
51+
rq_bsize = xdr.xdrDecodeInt();
52+
rq_active = xdr.xdrDecodeBoolean();
53+
rq_bhardlimit = xdr.xdrDecodeInt();
54+
rq_bsoftlimit = xdr.xdrDecodeInt();
55+
rq_curblocks = xdr.xdrDecodeInt();
56+
rq_fhardlimit = xdr.xdrDecodeInt();
57+
rq_fsoftlimit = xdr.xdrDecodeInt();
58+
rq_curfiles = xdr.xdrDecodeInt();
59+
rq_btimeleft = xdr.xdrDecodeInt();
60+
rq_ftimeleft = xdr.xdrDecodeInt();
61+
}
62+
63+
}
64+
// End of rquota.java
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM
3+
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
4+
* See http://remotetea.sourceforge.net for details
5+
*
6+
* This version of jrpcgen adopted by dCache project
7+
* See http://www.dCache.ORG for details
8+
*/
9+
package org.dcache.rquota.xdr;
10+
/**
11+
* A collection of constants used by the "rquota" ONC/RPC program.
12+
*/
13+
public interface rquota {
14+
public static final int RQUOTAPROC_GETQUOTA_1 = 1;
15+
public static final int RQUOTAPROC_GETACTIVEQUOTA_1 = 2;
16+
public static final int RQUOTAPROC_GETQUOTA_2 = 1;
17+
public static final int RQUOTAPROC_SETQUOTA_1 = 3;
18+
public static final int RQUOTAPROC_GETACTIVEQUOTA_2 = 2;
19+
public static final int RQUOTAPROC_SETQUOTA_2 = 3;
20+
public static final int RQUOTAVERS = 1;
21+
public static final int RQ_PATHLEN = 1024;
22+
public static final int RQUOTAPROG = 100011;
23+
public static final int RQUOTAPROC_SETACTIVEQUOTA_1 = 4;
24+
public static final int RQUOTAPROC_SETACTIVEQUOTA_2 = 4;
25+
public static final int EXT_RQUOTAVERS = 2;
26+
}
27+
// End of rquota.java

0 commit comments

Comments
 (0)