Commit 235e266d authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfsv3: simplify uid3, gid3 objects

Motivation:
uid3 and gid3 object are wraps around uint32, which is by itself wrap around
int.

Modification:
simplify buid3 and gid3y wrapping directly int

Result:
less load on GC.

Acked-by: Paul Millar
Acked-by: Marina Sahakyan
Target: master
parent 2056c670
......@@ -66,10 +66,10 @@ public class HimeraNfsUtils {
at.nlink= new uint32( stat.getNlink() );
//public int uid;
at.uid= new uid3( new uint32(stat.getUid()) );
at.uid= new uid3(stat.getUid());
//public int gid;
at.gid=new gid3(new uint32( stat.getGid()) );
at.gid=new gid3(stat.getGid());
//public int rdev;
at.rdev = new specdata3();
......@@ -122,11 +122,11 @@ public class HimeraNfsUtils {
long now = System.currentTimeMillis();
if( s.uid.set_it ) {
stat.setUid( s.uid.uid.value.value);
stat.setUid( s.uid.uid.value);
}
if( s.gid.set_it ) {
stat.setGid(s.gid.gid.value.value);
stat.setGid(s.gid.gid.value);
}
if( s.mode.set_it ) {
......
......@@ -311,7 +311,7 @@ public class NfsServerV3 extends nfs3_protServerStub {
if (newAttr != null) {
fmode = newAttr.mode.mode.value.value | Stat.S_IFREG;
if( newAttr.uid.set_it || newAttr.gid.set_it) {
actualSubject = UnixSubjects.toSubject(newAttr.uid.uid.value.value, newAttr.gid.gid.value.value);
actualSubject = UnixSubjects.toSubject(newAttr.uid.uid.value, newAttr.gid.gid.value);
}
}
inode = fs.create(parent, Stat.Type.REGULAR, path, actualSubject, fmode);
......@@ -611,7 +611,7 @@ public class NfsServerV3 extends nfs3_protServerStub {
if (attr != null) {
mode = attr.mode.mode.value.value | Stat.S_IFDIR;
if( attr.uid.set_it || attr.gid.set_it) {
actualSubject = UnixSubjects.toSubject(attr.uid.uid.value.value, attr.gid.gid.value.value);
actualSubject = UnixSubjects.toSubject(attr.uid.uid.value, attr.gid.gid.value);
}
}
......
/*
* Copyright (c) 2009 - 2012 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2021 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
......@@ -26,12 +26,12 @@ import java.io.IOException;
public class gid3 implements XdrAble {
public uint32 value;
public int value;
public gid3() {
}
public gid3(uint32 value) {
public gid3(int value) {
this.value = value;
}
......@@ -42,12 +42,12 @@ public class gid3 implements XdrAble {
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
value.xdrEncode(xdr);
xdr.xdrEncodeInt(value);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
value = new uint32(xdr);
value = xdr.xdrDecodeInt();
}
}
......
/*
* Copyright (c) 2009 - 2012 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2021 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
......@@ -26,12 +26,12 @@ import java.io.IOException;
public class uid3 implements XdrAble {
public uint32 value;
public int value;
public uid3() {
}
public uid3(uint32 value) {
public uid3(int value) {
this.value = value;
}
......@@ -42,12 +42,12 @@ public class uid3 implements XdrAble {
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
value.xdrEncode(xdr);
xdr.xdrEncodeInt(value);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
value = new uint32(xdr);
value = xdr.xdrDecodeInt();
}
}
......
Markdown is supported
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