Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
nfs4j
Commits
0eaa5c94
Commit
0eaa5c94
authored
Nov 30, 2011
by
Tigran Mkrtchyan
☕
Browse files
nfsv4: add constructors with String argument to utf8stringX classes
parent
d34b01fe
Changes
16
Hide whitespace changes
Inline
Side-by-side
src/org/dcache/chimera/nfs/v4/ClientCB.java
View file @
0eaa5c94
...
...
@@ -110,7 +110,7 @@ class ClientCB {
cbCompound
.
minorversion
=
new
uint32_t
(
1
);
cbCompound
.
callback_ident
=
new
uint32_t
(
0
);
cbCompound
.
tag
=
new
utf8str_cs
(
new
utf8string
(
tag
.
getBytes
())
);
cbCompound
.
tag
=
new
utf8str_cs
(
tag
);
return
cbCompound
;
}
...
...
src/org/dcache/chimera/nfs/v4/HimeraNFS4Utils.java
View file @
0eaa5c94
...
...
@@ -50,31 +50,4 @@ public class HimeraNFS4Utils {
}
}
/**
* Convert String to a case sensitive string of UTF-8 characters.
* @param str
* @return utf8str_cs representation of <i>str</i>
*/
public
static
utf8str_cs
string2utf8str_cs
(
String
str
)
{
return
new
utf8str_cs
(
new
utf8string
(
str
.
getBytes
()));
}
/**
* Convert String to a case insensitive string of UTF-8 characters.
* @param str
* @return utf8str_cis representation of <i>str</i>
*/
public
static
utf8str_cis
string2utf8str_cis
(
String
str
)
{
return
new
utf8str_cis
(
new
utf8string
(
str
.
getBytes
()));
}
/**
* Convert String to a case insensitive string of UTF-8 characters.
* @param str
* @return utf8str_mixed representation of <i>str</i>
*/
public
static
utf8str_mixed
string2utf8str_mixed
(
String
str
)
{
return
new
utf8str_mixed
(
new
utf8string
(
str
.
getBytes
()));
}
}
src/org/dcache/chimera/nfs/v4/OperationEXCHANGE_ID.java
View file @
0eaa5c94
...
...
@@ -17,22 +17,7 @@
package
org.dcache.chimera.nfs.v4
;
import
org.dcache.chimera.nfs.v4.xdr.state_protect4_r
;
import
org.dcache.chimera.nfs.v4.xdr.nfs4_prot
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_argop4
;
import
org.dcache.chimera.nfs.v4.xdr.clientid4
;
import
org.dcache.chimera.nfs.v4.xdr.state_protect_how4
;
import
org.dcache.chimera.nfs.v4.xdr.sequenceid4
;
import
org.dcache.chimera.nfs.nfsstat
;
import
org.dcache.chimera.nfs.v4.xdr.uint32_t
;
import
org.dcache.chimera.nfs.v4.xdr.nfstime4
;
import
org.dcache.chimera.nfs.v4.xdr.server_owner4
;
import
org.dcache.chimera.nfs.v4.xdr.uint64_t
;
import
org.dcache.chimera.nfs.v4.xdr.int64_t
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_impl_id4
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_opnum4
;
import
org.dcache.chimera.nfs.v4.xdr.EXCHANGE_ID4res
;
import
org.dcache.chimera.nfs.v4.xdr.EXCHANGE_ID4resok
;
import
org.dcache.chimera.nfs.ChimeraNFSException
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -43,15 +28,12 @@ import java.security.ProtectionDomain;
import
java.util.jar.Attributes
;
import
java.util.jar.JarInputStream
;
import
java.util.jar.Manifest
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_resop4
;
import
org.dcache.chimera.nfs.v4.xdr.verifier4
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
static
org
.
dcache
.
chimera
.
nfs
.
v4
.
NFSv4Defaults
.
NFS4_IMPLEMENTATION_DOMAIN
;
import
static
org
.
dcache
.
chimera
.
nfs
.
v4
.
NFSv4Defaults
.
NFS4_IMPLEMENTATION_ID
;
import
static
org
.
dcache
.
chimera
.
nfs
.
v4
.
HimeraNFS4Utils
.
string2utf8str_cis
;
import
static
org
.
dcache
.
chimera
.
nfs
.
v4
.
HimeraNFS4Utils
.
string2utf8str_cs
;
import
org.dcache.chimera.nfs.v4.xdr.*
;
public
class
OperationEXCHANGE_ID
extends
AbstractNFSv4Operation
{
...
...
@@ -252,8 +234,8 @@ public class OperationEXCHANGE_ID extends AbstractNFSv4Operation {
res
.
eir_resok4
.
eir_server_impl_id
=
new
nfs_impl_id4
[
1
];
res
.
eir_resok4
.
eir_server_impl_id
[
0
]
=
new
nfs_impl_id4
();
res
.
eir_resok4
.
eir_server_impl_id
[
0
].
nii_domain
=
string2
utf8str_cis
(
NFS4_IMPLEMENTATION_DOMAIN
);
res
.
eir_resok4
.
eir_server_impl_id
[
0
].
nii_name
=
string2
utf8str_cs
(
NFS4_IMPLEMENTATION_ID
+
" build-time "
+
COMPILTE_TIME
);
res
.
eir_resok4
.
eir_server_impl_id
[
0
].
nii_domain
=
new
utf8str_cis
(
NFS4_IMPLEMENTATION_DOMAIN
);
res
.
eir_resok4
.
eir_server_impl_id
[
0
].
nii_name
=
new
utf8str_cs
(
NFS4_IMPLEMENTATION_ID
+
" build-time "
+
COMPILTE_TIME
);
nfstime4
releaseDate
=
new
nfstime4
();
releaseDate
.
nseconds
=
new
uint32_t
(
0
);
releaseDate
.
seconds
=
new
int64_t
(
System
.
currentTimeMillis
()
/
1000
);
...
...
src/org/dcache/chimera/nfs/v4/OperationGETATTR.java
View file @
0eaa5c94
...
...
@@ -375,13 +375,13 @@ public class OperationGETATTR extends AbstractNFSv4Operation {
break
;
case
nfs4_prot
.
FATTR4_OWNER
:
String
owner_s
=
context
.
getIdMapping
().
uidToPrincipal
(
inode
.
statCache
().
getUid
());
utf8str_mixed
user
=
new
utf8str_mixed
(
new
utf8string
(
owner_s
.
getBytes
())
);
utf8str_mixed
user
=
new
utf8str_mixed
(
owner_s
);
fattr4_owner
owner
=
new
fattr4_owner
(
user
);
ret
=
owner
;
break
;
case
nfs4_prot
.
FATTR4_OWNER_GROUP
:
String
group_s
=
context
.
getIdMapping
().
gidToPrincipal
(
inode
.
statCache
().
getGid
());
utf8str_mixed
group
=
new
utf8str_mixed
(
new
utf8string
(
group_s
.
getBytes
())
);
utf8str_mixed
group
=
new
utf8str_mixed
(
group_s
);
fattr4_owner
owner_group
=
new
fattr4_owner
(
group
);
ret
=
owner_group
;
break
;
...
...
src/org/dcache/chimera/nfs/v4/OperationREADDIR.java
View file @
0eaa5c94
...
...
@@ -33,7 +33,6 @@ import org.dcache.chimera.nfs.v4.xdr.uint64_t;
import
org.dcache.chimera.nfs.v4.xdr.nfs4_prot
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_argop4
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_opnum4
;
import
org.dcache.chimera.nfs.v4.xdr.utf8string
;
import
org.dcache.chimera.nfs.v4.xdr.READDIR4resok
;
import
org.dcache.chimera.nfs.v4.xdr.READDIR4res
;
import
org.dcache.chimera.nfs.ChimeraNFSException
;
...
...
@@ -213,7 +212,7 @@ public class OperationREADDIR extends AbstractNFSv4Operation {
Inode
ei
=
le
.
getInode
();
currentEntry
.
name
=
new
component4
(
new
utf8str_cs
(
new
utf8string
(
name
.
getBytes
())
));
currentEntry
.
name
=
new
component4
(
new
utf8str_cs
(
name
));
// keep offset
currentEntry
.
cookie
=
new
nfs_cookie4
(
new
uint64_t
(
i
)
);
...
...
src/org/dcache/chimera/nfs/v4/acl/Ace.java
View file @
0eaa5c94
...
...
@@ -115,14 +115,14 @@ public class Ace {
ownerAceAllow
.
access_mask
=
new
acemask4
(
new
uint32_t
(
maskAllow
)
);
ownerAceAllow
.
type
=
new
acetype4
(
new
uint32_t
(
nfs4_prot
.
ACE4_ACCESS_ALLOWED_ACE_TYPE
)
);
ownerAceAllow
.
flag
=
new
aceflag4
(
new
uint32_t
(
0
)
);
ownerAceAllow
.
who
=
new
utf8str_mixed
(
new
utf8string
(
"OWNER@"
.
getBytes
()
)
);
ownerAceAllow
.
who
=
new
utf8str_mixed
(
"OWNER@"
);
ownerAceDeny
.
access_mask
=
new
acemask4
(
new
uint32_t
(
maskDeny
)
);
ownerAceDeny
.
type
=
new
acetype4
(
new
uint32_t
(
nfs4_prot
.
ACE4_ACCESS_DENIED_ACE_TYPE
)
);
ownerAceDeny
.
flag
=
new
aceflag4
(
new
uint32_t
(
0
)
);
ownerAceDeny
.
who
=
new
utf8str_mixed
(
new
utf8string
(
"OWNER@"
.
getBytes
()
)
);
ownerAceDeny
.
who
=
new
utf8str_mixed
(
"OWNER@"
);
...
...
@@ -161,12 +161,12 @@ public class Ace {
groupAceAllow
.
access_mask
=
new
acemask4
(
new
uint32_t
(
maskAllow
)
);
groupAceAllow
.
type
=
new
acetype4
(
new
uint32_t
(
nfs4_prot
.
ACE4_ACCESS_ALLOWED_ACE_TYPE
)
);
groupAceAllow
.
flag
=
new
aceflag4
(
new
uint32_t
(
0
)
);
groupAceAllow
.
who
=
new
utf8str_mixed
(
new
utf8string
(
"GROUP@"
.
getBytes
()
)
);
groupAceAllow
.
who
=
new
utf8str_mixed
(
"GROUP@"
);
groupAceDeny
.
access_mask
=
new
acemask4
(
new
uint32_t
(
maskDeny
)
);
groupAceDeny
.
type
=
new
acetype4
(
new
uint32_t
(
nfs4_prot
.
ACE4_ACCESS_DENIED_ACE_TYPE
)
);
groupAceDeny
.
flag
=
new
aceflag4
(
new
uint32_t
(
0
)
);
groupAceDeny
.
who
=
new
utf8str_mixed
(
new
utf8string
(
"GROUP@"
.
getBytes
()
)
);
groupAceDeny
.
who
=
new
utf8str_mixed
(
"GROUP@"
);
/*
...
...
@@ -204,12 +204,12 @@ public class Ace {
otherAceAllow
.
access_mask
=
new
acemask4
(
new
uint32_t
(
maskAllow
)
);
otherAceAllow
.
type
=
new
acetype4
(
new
uint32_t
(
nfs4_prot
.
ACE4_ACCESS_ALLOWED_ACE_TYPE
)
);
otherAceAllow
.
flag
=
new
aceflag4
(
new
uint32_t
(
0
)
);
otherAceAllow
.
who
=
new
utf8str_mixed
(
new
utf8string
(
"EVERYONE@"
.
getBytes
()
)
);
otherAceAllow
.
who
=
new
utf8str_mixed
(
"EVERYONE@"
);
otherAceDeny
.
access_mask
=
new
acemask4
(
new
uint32_t
(
maskDeny
)
);
otherAceDeny
.
type
=
new
acetype4
(
new
uint32_t
(
nfs4_prot
.
ACE4_ACCESS_DENIED_ACE_TYPE
)
);
otherAceDeny
.
flag
=
new
aceflag4
(
new
uint32_t
(
0
)
);
otherAceDeny
.
who
=
new
utf8str_mixed
(
new
utf8string
(
"EVERYONE@"
.
getBytes
()
)
);
otherAceDeny
.
who
=
new
utf8str_mixed
(
"EVERYONE@"
);
return
new
Ace
(
ace
);
...
...
src/org/dcache/chimera/nfs/v4/client/ExchangeIDStub.java
View file @
0eaa5c94
...
...
@@ -17,20 +17,8 @@
package
org.dcache.chimera.nfs.v4.client
;
import
org.dcache.chimera.nfs.v4.xdr.EXCHANGE_ID4args
;
import
org.dcache.chimera.nfs.v4.xdr.client_owner4
;
import
org.dcache.chimera.nfs.v4.xdr.int64_t
;
import
org.dcache.chimera.nfs.v4.xdr.nfs4_prot
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_argop4
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_impl_id4
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_opnum4
;
import
org.dcache.chimera.nfs.v4.xdr.nfstime4
;
import
org.dcache.chimera.nfs.v4.xdr.state_protect4_a
;
import
org.dcache.chimera.nfs.v4.xdr.uint32_t
;
import
org.dcache.chimera.nfs.v4.xdr.verifier4
;
import
static
org
.
dcache
.
chimera
.
nfs
.
v4
.
HimeraNFS4Utils
.
string2utf8str_cis
;
import
static
org
.
dcache
.
chimera
.
nfs
.
v4
.
HimeraNFS4Utils
.
string2utf8str_cs
;
import
org.dcache.chimera.nfs.v4.xdr.*
;
public
class
ExchangeIDStub
{
...
...
@@ -43,8 +31,8 @@ public class ExchangeIDStub {
op
.
opexchange_id
=
new
EXCHANGE_ID4args
();
op
.
opexchange_id
.
eia_client_impl_id
=
new
nfs_impl_id4
[
1
];
nfs_impl_id4
n4
=
new
nfs_impl_id4
();
n4
.
nii_domain
=
string2
utf8str_cis
(
nii_domain
);
n4
.
nii_name
=
string2
utf8str_cs
(
nii_name
);
n4
.
nii_domain
=
new
utf8str_cis
(
nii_domain
);
n4
.
nii_name
=
new
utf8str_cs
(
nii_name
);
op
.
opexchange_id
.
eia_client_impl_id
[
0
]
=
n4
;
nfstime4
releaseDate
=
new
nfstime4
();
...
...
src/org/dcache/chimera/nfs/v4/client/LookupStub.java
View file @
0eaa5c94
...
...
@@ -22,7 +22,6 @@ import org.dcache.chimera.nfs.v4.xdr.component4;
import
org.dcache.chimera.nfs.v4.xdr.nfs_argop4
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_opnum4
;
import
org.dcache.chimera.nfs.v4.xdr.utf8str_cs
;
import
org.dcache.chimera.nfs.v4.xdr.utf8string
;
public
class
LookupStub
{
...
...
@@ -31,8 +30,7 @@ public class LookupStub {
op
.
argop
=
nfs_opnum4
.
OP_LOOKUP
;
op
.
oplookup
=
new
LOOKUP4args
();
op
.
oplookup
.
objname
=
new
component4
(
new
utf8str_cs
(
new
utf8string
(
path
.
getBytes
())));
op
.
oplookup
.
objname
=
new
component4
(
new
utf8str_cs
(
path
));
return
op
;
}
...
...
src/org/dcache/chimera/nfs/v4/client/Main.java
View file @
0eaa5c94
...
...
@@ -68,7 +68,6 @@ import org.dcache.chimera.nfs.v4.xdr.stateid4;
import
org.dcache.chimera.nfs.v4.xdr.uint32_t
;
import
org.dcache.chimera.nfs.v4.xdr.uint64_t
;
import
org.dcache.chimera.nfs.v4.xdr.utf8str_cs
;
import
org.dcache.chimera.nfs.v4.xdr.utf8string
;
import
org.dcache.chimera.nfs.v4.xdr.verifier4
;
import
org.dcache.chimera.posix.Stat
;
import
org.dcache.utils.net.InetSocketAddresses
;
...
...
@@ -96,7 +95,7 @@ public class Main {
List
<
nfs_argop4
>
opList
)
{
COMPOUND4args
compound4args
=
new
COMPOUND4args
();
compound4args
.
tag
=
new
utf8str_cs
(
new
utf8string
(
tag
.
getBytes
())
);
compound4args
.
tag
=
new
utf8str_cs
(
tag
);
compound4args
.
minorversion
=
new
uint32_t
(
1
);
compound4args
.
argarray
=
opList
.
toArray
(
new
nfs_argop4
[
opList
.
size
()]);
...
...
src/org/dcache/chimera/nfs/v4/client/MkdirStub.java
View file @
0eaa5c94
...
...
@@ -36,7 +36,6 @@ import org.dcache.chimera.nfs.v4.xdr.nfs_ftype4;
import
org.dcache.chimera.nfs.v4.xdr.nfs_opnum4
;
import
org.dcache.chimera.nfs.v4.xdr.uint32_t
;
import
org.dcache.chimera.nfs.v4.xdr.utf8str_cs
;
import
org.dcache.chimera.nfs.v4.xdr.utf8string
;
import
org.dcache.xdr.OncRpcException
;
import
org.dcache.xdr.XdrBuffer
;
import
org.dcache.xdr.XdrDecodingStream
;
...
...
@@ -49,8 +48,7 @@ public class MkdirStub {
CREATE4args
args
=
new
CREATE4args
();
args
.
objname
=
new
component4
(
new
utf8str_cs
(
new
utf8string
(
path
.
getBytes
())));
args
.
objname
=
new
component4
(
new
utf8str_cs
(
path
));
args
.
objtype
=
new
createtype4
();
args
.
objtype
.
type
=
nfs_ftype4
.
NF4DIR
;
args
.
createattrs
=
new
fattr4
();
...
...
src/org/dcache/chimera/nfs/v4/client/OpenStub.java
View file @
0eaa5c94
...
...
@@ -94,8 +94,7 @@ public class OpenStub {
open_claim4
claim
=
new
open_claim4
();
claim
.
claim
=
open_claim_type4
.
CLAIM_NULL
;
claim
.
file
=
new
component4
(
new
utf8str_cs
(
new
utf8string
(
path
.
getBytes
())));
claim
.
file
=
new
component4
(
new
utf8str_cs
(
path
));
claim
.
delegate_type
=
nfs4_prot
.
OPEN4_SHARE_ACCESS_WANT_NO_DELEG
;
claim
.
file_delegate_prev
=
null
;
claim
.
oc_delegate_stateid
=
null
;
...
...
@@ -137,8 +136,7 @@ public class OpenStub {
open_claim4
claim
=
new
open_claim4
();
claim
.
claim
=
open_claim_type4
.
CLAIM_NULL
;
claim
.
file
=
new
component4
(
new
utf8str_cs
(
new
utf8string
(
path
.
getBytes
())));
claim
.
file
=
new
component4
(
new
utf8str_cs
(
path
));
claim
.
delegate_type
=
nfs4_prot
.
OPEN4_SHARE_ACCESS_WANT_NO_DELEG
;
claim
.
file_delegate_prev
=
null
;
claim
.
oc_delegate_stateid
=
null
;
...
...
src/org/dcache/chimera/nfs/v4/client/RemoveStub.java
View file @
0eaa5c94
...
...
@@ -22,7 +22,6 @@ import org.dcache.chimera.nfs.v4.xdr.component4;
import
org.dcache.chimera.nfs.v4.xdr.nfs_opnum4
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_argop4
;
import
org.dcache.chimera.nfs.v4.xdr.utf8str_cs
;
import
org.dcache.chimera.nfs.v4.xdr.utf8string
;
public
class
RemoveStub
{
...
...
@@ -32,7 +31,7 @@ public class RemoveStub {
REMOVE4args
args
=
new
REMOVE4args
();
args
.
target
=
new
component4
();
args
.
target
.
value
=
new
utf8str_cs
(
new
utf8string
(
path
.
getBytes
())
);
args
.
target
.
value
=
new
utf8str_cs
(
path
);
nfs_argop4
op
=
new
nfs_argop4
();
...
...
src/org/dcache/chimera/nfs/v4/xdr/utf8str_cis.java
View file @
0eaa5c94
...
...
@@ -14,6 +14,10 @@ public class utf8str_cis implements XdrAble {
public
utf8str_cis
()
{
}
public
utf8str_cis
(
String
s
)
{
this
.
value
=
new
utf8string
(
s
);
}
public
utf8str_cis
(
utf8string
value
)
{
this
.
value
=
value
;
}
...
...
src/org/dcache/chimera/nfs/v4/xdr/utf8str_cs.java
View file @
0eaa5c94
...
...
@@ -14,6 +14,10 @@ public class utf8str_cs implements XdrAble {
public
utf8str_cs
()
{
}
public
utf8str_cs
(
String
s
)
{
this
.
value
=
new
utf8string
(
s
);
}
public
utf8str_cs
(
utf8string
value
)
{
this
.
value
=
value
;
}
...
...
src/org/dcache/chimera/nfs/v4/xdr/utf8str_mixed.java
View file @
0eaa5c94
...
...
@@ -14,6 +14,10 @@ public class utf8str_mixed implements XdrAble {
public
utf8str_mixed
()
{
}
public
utf8str_mixed
(
String
s
)
{
this
.
value
=
new
utf8string
(
s
);
}
public
utf8str_mixed
(
utf8string
value
)
{
this
.
value
=
value
;
}
...
...
src/org/dcache/chimera/nfs/v4/xdr/utf8string.java
View file @
0eaa5c94
...
...
@@ -16,6 +16,10 @@ public class utf8string implements XdrAble {
public
utf8string
()
{
}
public
utf8string
(
String
s
)
{
this
.
value
=
s
.
getBytes
(
UTF8
);
}
public
utf8string
(
byte
[]
value
)
{
this
.
value
=
value
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment