* [PATCH 15/24] pynfs: python3 support plan: fix 'socket' has no attribute '_socketobject'
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/lib/rpc/rpc.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py
index 86075b2..93f20dc 100644
--- a/nfs4.0/lib/rpc/rpc.py
+++ b/nfs4.0/lib/rpc/rpc.py
@@ -176,9 +176,14 @@ def _send_record(self, data, chunksize=2048):
mark = struct.pack('>L', last | len(chunk))
self.sendall(mark + chunk)
-socket._socketobject.recv_all = _recv_all
-socket._socketobject.recv_record = _recv_record
-socket._socketobject.send_record = _send_record
+try: #for python2
+ socket._socketobject.recv_all = _recv_all
+ socket._socketobject.recv_record = _recv_record
+ socket._socketobject.send_record = _send_record
+except: #for python3
+ socket.recv_all = _recv_all
+ socket.recv_record = _recv_record
+ socket.send_record = _send_record
#################################################
--
2.17.1
^ permalink raw reply related
* [U-Boot] [PATCH V3 1/2] mmc: add HS400 support
From: Faiz Abbas @ 2018-07-24 8:39 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20180519125448.16563-1-peng.fan@nxp.com>
Hi,
On Saturday 19 May 2018 06:24 PM, Peng Fan wrote:
> Add HS400 support.
> Selecting HS400 needs first select HS199 according to spec, so use
> a dedicated function for HS400.
> Add HS400 related macros.
> Remove the restriction of only using the low 6 bits of
> EXT_CSD_CARD_TYPE, using all the 8 bits.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> V3:
> Simplify code
> add error msg
>
> V2:
> remove 4bits support from HS400, as HS400 does not support 4bits per spec.
>
> drivers/mmc/Kconfig | 7 +++
> drivers/mmc/mmc.c | 137 +++++++++++++++++++++++++++++++++++++++++-----------
> include/mmc.h | 11 +++++
> 3 files changed, 128 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index 3f15f85efd..a535a87a8e 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -104,6 +104,13 @@ config SPL_MMC_UHS_SUPPORT
> cards. The IO voltage must be switchable from 3.3v to 1.8v. The bus
> frequency can go up to 208MHz (SDR104)
>
> +config MMC_HS400_SUPPORT
> + bool "enable HS400 support"
> + select MMC_HS200_SUPPORT
> + help
> + The HS400 mode is support by some eMMC. The bus frequency is up to
> + 200MHz. This mode requires tuning the IO.
> +
Please add SPL_MMC_HS400_SUPPORT also.
Thanks,
Faiz
^ permalink raw reply
* [PATCH 14/24] pynfs: python3 support plan: Relative Import -> Absolute Import
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/lib/rpc/rpc.py | 23 ++++++++++++-----------
nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py | 2 +-
nfs4.0/lib/rpc/rpcsec/sec_auth_none.py | 2 +-
nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py | 2 +-
nfs4.0/nfs4lib.py | 20 +++++++++++---------
xdr/xdrgen.py | 4 +++-
6 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py
index be14658..86075b2 100644
--- a/nfs4.0/lib/rpc/rpc.py
+++ b/nfs4.0/lib/rpc/rpc.py
@@ -7,6 +7,7 @@
# Information Technology Integration
#
+from __future__ import absolute_import
import struct
import xdrlib
import socket
@@ -14,17 +15,17 @@ import select
import threading
import errno
-from rpc_const import *
-from rpc_type import *
-import rpc_pack
+from rpc.rpc_const import *
+from rpc.rpc_type import *
+import rpc.rpc_pack as rpc_pack
# Import security flavors and store valid ones
-from rpcsec.sec_auth_none import SecAuthNone
-from rpcsec.sec_auth_sys import SecAuthSys
+from .rpcsec.sec_auth_none import SecAuthNone
+from .rpcsec.sec_auth_sys import SecAuthSys
supported = {'none' : SecAuthNone,
'sys' : SecAuthSys }
try:
- from rpcsec.sec_auth_gss import SecAuthGss
+ from .rpcsec.sec_auth_gss import SecAuthGss
supported['gss'] = SecAuthGss
except ImportError:
pass
@@ -427,11 +428,11 @@ class RPCClient(object):
cred = self.security.make_cred()
p.pack_uint(xid)
p.pack_enum(CALL)
- p.pack_uint(RPCVERSION)
- p.pack_uint(prog)
- p.pack_uint(vers)
- p.pack_uint(proc)
- p.pack_opaque_auth(cred)
+ p.pack_uint(RPCVERSION)
+ p.pack_uint(prog)
+ p.pack_uint(vers)
+ p.pack_uint(proc)
+ p.pack_opaque_auth(cred)
verf = self.security.make_verf(p.get_buffer())
p.pack_opaque_auth(verf)
return p.get_buffer(), cred
diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
index ee6ad53..1b5eb93 100644
--- a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
+++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
@@ -1,4 +1,4 @@
-from base import SecFlavor, SecError
+from .base import SecFlavor, SecError
from rpc.rpc_const import RPCSEC_GSS
from rpc.rpc_type import opaque_auth
from gss_const import *
diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_none.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_none.py
index 7058203..ec8896a 100644
--- a/nfs4.0/lib/rpc/rpcsec/sec_auth_none.py
+++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_none.py
@@ -1,4 +1,4 @@
-from base import SecFlavor
+from .base import SecFlavor
class SecAuthNone(SecFlavor):
pass
diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py
index 27fc52e..778d379 100644
--- a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py
+++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py
@@ -1,4 +1,4 @@
-from base import SecFlavor, SecError
+from .base import SecFlavor, SecError
from rpc.rpc_const import AUTH_SYS
from rpc.rpc_type import opaque_auth
from xdrlib import Packer, Error
diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py
index 6f6d2f9..79e386e 100644
--- a/nfs4.0/nfs4lib.py
+++ b/nfs4.0/nfs4lib.py
@@ -24,16 +24,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+from __future__ import absolute_import
-
-import rpc
-import threading
-from xdrlib import Error as XDRError
-import xdrdef.nfs4_const as nfs4_const
-from xdrdef.nfs4_const import *
-import xdrdef.nfs4_type as nfs4_type
-from xdrdef.nfs4_type import *
-import xdrdef.nfs4_pack as nfs4_pack
import time
import struct
import socket
@@ -41,6 +33,16 @@ import sys
import re
import inspect
from os.path import basename
+import threading
+
+import rpc.rpc as rpc
+import rpc.rpc_const as rpc_const
+import xdrdef.nfs4_const as nfs4_const
+from xdrdef.nfs4_const import *
+import xdrdef.nfs4_type as nfs4_type
+from xdrdef.nfs4_type import *
+from xdrlib import Error as XDRError
+import xdrdef.nfs4_pack as nfs4_pack
import nfs_ops
op4 = nfs_ops.NFS4ops()
diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py
index 6303184..abfc8d7 100755
--- a/xdr/xdrgen.py
+++ b/xdr/xdrgen.py
@@ -1354,6 +1354,8 @@ allow_attr_passthrough = True # Option which allows substructure attrs to
# be referenced directly, in cases where there
# is a unique substructure to search.
pack_header = """\
+import sys,os
+sys.path.append(os.path.dirname(__file__))
import %s as const
import %s as types
import xdrlib
@@ -1438,7 +1440,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False):
const_fd.write(comment_string)
type_fd = open(types_file + ".py", "w")
type_fd.write(comment_string)
- type_fd.write("import %s as const\n" % constants_file)
+ type_fd.write("import sys,os\nsys.path.append(os.path.dirname(__file__))\nimport %s as const\n" % constants_file)
pack_fd = open(packer_file + ".py", "w")
pack_fd.write(comment_string)
pack_fd.write(pack_header % (constants_file, types_file))
--
2.17.1
^ permalink raw reply related
* [PATCH 13/24] pynfs: python3 support plan: list.sort() -> newlist = sorted(list)
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
xdr/xdrgen.py | 56 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 35 insertions(+), 21 deletions(-)
diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py
index bed2181..6303184 100755
--- a/xdr/xdrgen.py
+++ b/xdr/xdrgen.py
@@ -305,7 +305,7 @@ def t_linecomment(t):
def t_error(t):
print("Illegal character %s at %d type %s" % (repr(t.value[0]), t.lexer.lineno, t.type))
t.lexer.skip(1)
-
+
# Build the lexer
lex.lex(debug=0)
@@ -641,7 +641,7 @@ def p_proc_firstarg(t):
def p_type_specifier_list(t):
'''type_specifier_list : COMMA type_specifier type_specifier_list
| empty'''
-
+
##########################################################################
# #
@@ -718,7 +718,7 @@ class Info(object):
def const_output(self):
return None
-
+
def type_output(self):
return None
@@ -853,7 +853,7 @@ class Info(object):
else:
subheader = array = varindent = ''
return prefix+varindent, newdata, subheader, array
-
+
def packenum(self, prefix, data='data'):
prefix, data, subheader, array = self._array_pack(prefix, data)
varlist = ["const.%s" % l.id for l in self.body]
@@ -952,7 +952,7 @@ class Info(object):
else:
unpack += "%s%sraise XDRError('bad switch=%%s' %% %s.%s)\n" % \
(prefix, indent, data, switch.id)
-
+
return subheader + unpack + array
def xdrbody(self, prefix=''):
@@ -977,7 +977,7 @@ class Info(object):
''.join(["%s\n" % d.xdrout(prefix + indent)
for d in self.body[-1].declarations])
return body
-
+
class const_info(Info):
"""The result of 'CONST ID EQUALS constant SEMI' or inside of enum as
'ID EQUALS value' """
@@ -988,13 +988,16 @@ class const_info(Info):
self.lineno = self.sortno = lineno
self.type = 'const'
self.enum = enum
-
+
def __repr__(self):
return "constant %s=%s at line %s" % (self.id, self.value, self.lineno)
+ def __lt__(self, other):
+ return self.sortno < other.sortno
+
def xdrout(self, prefix=''):
return "%s%s = %s" % (prefix, self.id, self.value)
-
+
def const_output(self):
return "%s = %s\n" % (self.id, self.value)
@@ -1016,6 +1019,9 @@ class enum_info(Info):
self.array = False
self.parent = True
+ def __lt__(self, other):
+ return self.sortno < other.sortno
+
def const_output(self):
body = ''.join(["%s%s : '%s',\n" % (indent, l.value, l.id)
for l in self.body])
@@ -1029,7 +1035,7 @@ class enum_info(Info):
header = "%sdef unpack_%s(self):\n" % (indent, self.id)
return header + self.unpackenum(indent2) + \
self._get_unpack_footer()
-
+
class struct_info(Info):
"""The result of 'TYPEDEF STRUCT <struct_body> ID <array> SEMI' or
'STRUCT ID <struct_body> SEMI'
@@ -1048,6 +1054,9 @@ class struct_info(Info):
self.array = False
self.parent = True
+ def __lt__(self, other):
+ return self.sortno < other.sortno
+
def type_output(self):
comment = '%s# ' % indent
xdrbody = self.xdrbody(comment)
@@ -1079,11 +1088,11 @@ class struct_info(Info):
(indent, indent2, candidates[0].id)
else:
return ''
-
+
def pack_output(self):
header = self._get_pack_header()
return header + self.packstruct(indent2)
-
+
def unpack_output(self):
header = "%sdef unpack_%s(self):\n" % (indent, self.id)
return header + self.unpackstruct(indent2) + \
@@ -1107,6 +1116,9 @@ class union_info(Info):
self.array = False
self.parent = True
+ def __lt__(self, other):
+ return self.sortno < other.sortno
+
def union_getattr(self, prefix=indent):
return "%sdef __getattr__(self, attr):\n"\
"%s%sreturn getattr(self.switch, attr)\n" % \
@@ -1174,6 +1186,9 @@ class type_info(Info):
self.fixed = False
self.parent = False
+ def __lt__(self, other):
+ return self.sortno < other.sortno
+
def __str__(self):
return "%s %s at line %s" % (self.type, self.id, self.lineno)
@@ -1198,14 +1213,14 @@ class type_info(Info):
x.len = self.len
x.fixed = self.fixed
return x
-
+
def xdrout(self, prefix=''):
if self.type == 'void':
return "%svoid;" % prefix
elif self.type == 'enum':
body = self.xdrbody(prefix)
name = "%senum {\n%s%s}" % (prefix, body, prefix)
-
+
elif self.type == 'struct':
body = self.xdrbody(prefix)
name = "%sstruct {\n%s%s}" % (prefix, body, prefix)
@@ -1260,7 +1275,7 @@ class type_info(Info):
return "%s = %s\n" % (self.id, self.type)
elif cast.type == "enum":
return "%s = const.%s\n" % (self.id, self.type)
-
+
def pack_output(self):
if not self.array:
return "%spack_%s = pack_%s\n" % (indent, self.id, self.type)
@@ -1297,7 +1312,7 @@ class type_info(Info):
pack = "%sself.pack_%s%s(%s%s%s)\n" % \
(prefix, fixchar, type, fixnum, data, packer)
return limit + pack
-
+
def _unpack_array(self, prefix, data='data'):
if self.fixed or self.len is None:
limit = ''
@@ -1322,9 +1337,9 @@ class type_info(Info):
pack = "%s%s = self.unpack_%s%s(%s)\n" % \
(prefix, data, fixchar, type, ', '.join(fixnum+packer))
return pack + limit
-
-
-
+
+
+
##########################################################################
# #
# Main Loop #
@@ -1430,8 +1445,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False):
pack_fd.write(pack_init % name_base.upper())
pack_fd.write(packer_start)
- type_list = name_dict.values()
- type_list.sort()
+ type_list = sorted(name_dict.values())
for value in type_list:
#print(value)
output = value.const_output()
@@ -1454,7 +1468,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False):
if output is not None:
pack_fd.write(output)
pack_fd.write('\n')
-
+
const_fd.close()
type_fd.close()
pack_fd.close()
--
2.17.1
^ permalink raw reply related
* [PATCH 12/24] pynfs: python3 support plan: file() -> open()
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/testserver.py | 2 +-
nfs4.1/testclient.py | 2 +-
nfs4.1/testserver.py | 2 +-
showresults.py | 2 +-
xdr/xdrgen.py | 6 +++---
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py
index 96012a1..fcee8e9 100755
--- a/nfs4.0/testserver.py
+++ b/nfs4.0/testserver.py
@@ -354,7 +354,7 @@ def main():
print(sys.exc_info()[1])
sys.exit(1)
if opt.outfile is not None:
- fd = file(opt.outfile, 'w')
+ fd = open(opt.outfile, 'w')
try:
clean_finish = False
testmod.runtests(tests, opt, env, run_filter)
diff --git a/nfs4.1/testclient.py b/nfs4.1/testclient.py
index 1027fa6..47b74bd 100755
--- a/nfs4.1/testclient.py
+++ b/nfs4.1/testclient.py
@@ -313,7 +313,7 @@ def main():
print(sys.exc_info()[1])
sys.exit(1)
if opt.outfile is not None:
- fd = file(opt.outfile, 'w')
+ fd = open(opt.outfile, 'w')
try:
clean_finish = False
testmod.runtests(tests, opt, env, run_filter)
diff --git a/nfs4.1/testserver.py b/nfs4.1/testserver.py
index 101cfb1..c21221e 100755
--- a/nfs4.1/testserver.py
+++ b/nfs4.1/testserver.py
@@ -333,7 +333,7 @@ def main():
print(sys.exc_info()[1])
sys.exit(1)
if opt.outfile is not None:
- fd = file(opt.outfile, 'w')
+ fd = open(opt.outfile, 'w')
try:
clean_finish = False
testmod.runtests(tests, opt, env, run_filter)
diff --git a/showresults.py b/showresults.py
index 962407d..ed23f7b 100755
--- a/showresults.py
+++ b/showresults.py
@@ -38,7 +38,7 @@ class MyUnpickler(pickle.Unpickler):
return self.Unknown(name)
def show(filename, opt):
- fd = file(filename, 'r')
+ fd = open(filename, 'r')
p = MyUnpickler(fd)
tests = p.load()
testmod.printresults(tests, opt)
diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py
index b5119cc..bed2181 100755
--- a/xdr/xdrgen.py
+++ b/xdr/xdrgen.py
@@ -1419,12 +1419,12 @@ def run(infile, filters=True, pass_attrs=True, debug=False):
comment_string = "# Generated by rpcgen.py from %s on %s\n" % \
(infile, time.asctime())
- const_fd = file(constants_file + ".py", "w")
+ const_fd = open(constants_file + ".py", "w")
const_fd.write(comment_string)
- type_fd = file(types_file + ".py", "w")
+ type_fd = open(types_file + ".py", "w")
type_fd.write(comment_string)
type_fd.write("import %s as const\n" % constants_file)
- pack_fd = file(packer_file + ".py", "w")
+ pack_fd = open(packer_file + ".py", "w")
pack_fd.write(comment_string)
pack_fd.write(pack_header % (constants_file, types_file))
pack_fd.write(pack_init % name_base.upper())
--
2.17.1
^ permalink raw reply related
* [PATCH 11/24] pynfs: python3 support plan: xdrgen: remove 'L' suffix of long integer
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
xdr/xdrgen.py | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py
index 8856b4c..b5119cc 100755
--- a/xdr/xdrgen.py
+++ b/xdr/xdrgen.py
@@ -341,10 +341,7 @@ def p_constant(t):
'''constant : CONST10
| CONST8
| CONST16'''
- if len(t[1]) > 9:
- t[0] = t[1] + 'L'
- else:
- t[0] = t[1]
+ t[0] = t[1]
def p_value(t):
'''value : constant
--
2.17.1
^ permalink raw reply related
* [PATCH 10/24] pynfs: python3 support plan: not equal op s/ <> / != /
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/nfs4lib.py | 4 ++--
nfs4.0/nfs4server.py | 4 ++--
nfs4.1/nfs4client.py | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py
index dddbf91..6f6d2f9 100644
--- a/nfs4.0/nfs4lib.py
+++ b/nfs4.0/nfs4lib.py
@@ -227,7 +227,7 @@ class CBServer(rpc.RPCServer):
cbid = cmp4args.callback_ident
except XDRError:
return NFS4ERR_BADXDR, [], tag
- if cmp4args.minorversion <> 0:
+ if cmp4args.minorversion != 0:
return NFS4ERR_MINOR_VERS_MISMATCH, [], tag
results = []
ok = NFS4_OK
@@ -239,7 +239,7 @@ class CBServer(rpc.RPCServer):
resop4 = CB_ILLEGAL4res(NFS4ERR_OP_ILLEGAL)
result = nfs_cb_resop4(resop=OP_ILLEGAL, opcbillegal=resop4)
results += [ result ]
- if ok <> NFS4_OK:
+ if ok != NFS4_OK:
break
return ok, results, tag
diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py
index 18b0aad..753372e 100755
--- a/nfs4.0/nfs4server.py
+++ b/nfs4.0/nfs4server.py
@@ -171,7 +171,7 @@ class NFS4Server(rpc.RPCServer):
return NFS4ERR_BADXDR, [], tag
print("TCP NFSv4 COMPOUND call, tag: %s, n_ops: %d" % \
(repr(tag), len(cmp4args.argarray)))
- if cmp4args.minorversion <> 0:
+ if cmp4args.minorversion != 0:
return NFS4ERR_MINOR_VERS_MISMATCH, [], tag
if not verify_utf8(tag):
return NFS4ERR_INVAL, [], tag
@@ -183,7 +183,7 @@ class NFS4Server(rpc.RPCServer):
print("*** %s (%d) ***" % (opname, op.argop))
ok, result = getattr(self, opname.lower())(op)
results += [ result ]
- if ok <> NFS4_OK:
+ if ok != NFS4_OK:
print(" ! error %s" % nfsstat4[ok])
break
print("Replying. Status %s (%d)" % (nfsstat4[ok], ok))
diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index 5288942..0588d7b 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -177,7 +177,7 @@ class NFS4Client(rpc.Client, rpc.Server):
def op_cb_compound(self, args, cred):
env = CompoundState(args, cred)
# Check for problems with the compound itself
- if args.minorversion <> 0:
+ if args.minorversion != 0:
if args.minorversion not in self.minor_versions:
env.results.set_empty_return(NFS4ERR_MINOR_VERS_MISMATCH)
return env
--
2.17.1
^ permalink raw reply related
* [U-Boot] [PATCH v2 13/13] sunxi: add support for Pine H64 board
From: Maxime Ripard @ 2018-07-24 8:39 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20180721082032.39980-14-icenowy@aosc.io>
On Sat, Jul 21, 2018 at 04:20:32PM +0800, Icenowy Zheng wrote:
> Pine H64 is a SBC with Allwinner H6 SoC produced by Pine64. It features
> 1GiB/2GiB/4GiB(3GiB usable) DRAM, two USB 2.0 ports, one USB 3.0 port
> and a mPCIE slot.
>
> Add support for it.
>
> The device tree is from Linux next-20180720.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180724/3f0fa86c/attachment.sig>
^ permalink raw reply
* [PATCH 09/24] pynfs: python3 support plan: dict.has_key -> key in dict
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
and rename DirList.has_key() to DirList.has_name()
to avoid confuse
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/lib/rpc/rpc.py | 2 +-
nfs4.0/nfs4lib.py | 2 +-
nfs4.0/nfs4server.py | 4 ++--
nfs4.0/nfs4state.py | 10 +++++-----
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py
index d9c1401..be14658 100644
--- a/nfs4.0/lib/rpc/rpc.py
+++ b/nfs4.0/lib/rpc/rpc.py
@@ -514,7 +514,7 @@ class RPCServer(Server):
'sys': AUTH_SYS,
'gss': RPCSEC_GSS,
}.iteritems():
- if supported.has_key(secname):
+ if secname in supported:
self.security[sectype] = supported[secname]()
self.readbufs = {}
diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py
index 5c9e853..dddbf91 100644
--- a/nfs4.0/nfs4lib.py
+++ b/nfs4.0/nfs4lib.py
@@ -232,7 +232,7 @@ class CBServer(rpc.RPCServer):
results = []
ok = NFS4_OK
for op in cmp4args.argarray:
- if self.opcodes.has_key(op.argop):
+ if op.argop in self.opcodes:
ok, result = self.opcodes[op.argop](op, cbid)
else:
ok = NFS4ERR_OP_ILLEGAL
diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py
index 163bd60..18b0aad 100755
--- a/nfs4.0/nfs4server.py
+++ b/nfs4.0/nfs4server.py
@@ -504,7 +504,7 @@ class NFS4Server(rpc.RPCServer):
if op.opopen.openhow.how.mode == GUARDED4:
raise NFS4Error(NFS4ERR_EXIST)
# with an existing file ignore attrs except size=0
- if attrs.has_key(FATTR4_SIZE) and attrs[FATTR4_SIZE]==0:
+ if FATTR4_SIZE in attrs and attrs[FATTR4_SIZE]==0:
attrset = existing.set_attributes(attrdict={FATTR4_SIZE:0})
# Now break out and use existing as is
else:
@@ -593,7 +593,7 @@ class NFS4Server(rpc.RPCServer):
def op_putfh(self, op):
print(" FILEHANDLE '%s'" % repr(op.opputfh.object))
# check access!
- if not self.fhcache.has_key(op.opputfh.object):
+ if not op.opputfh.object in self.fhcache:
return simple_error(NFS4ERR_BADHANDLE)
self.curr_fh = self.fhcache[op.opputfh.object]
return simple_error(NFS4_OK)
diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py
index cd36edd..8aca178 100755
--- a/nfs4.0/nfs4state.py
+++ b/nfs4.0/nfs4state.py
@@ -1014,7 +1014,7 @@ class VirtualHandle(NFSFileHandle):
# Must make sure that if it fails, nothing is changed
if self.fattr4_type != NF4DIR:
raise "create called on non-directory (%s)" % self.ref
- if self.dirent.has_key(name):
+ if self.dirent.has_name(name):
raise "attempted to create already existing file."
fh = VirtualHandle(name, type, self)
if FATTR4_SIZE in attrs and type.type != NF4REG:
@@ -1116,7 +1116,7 @@ class VirtualHandle(NFSFileHandle):
mapping = nfs4lib.list2bitmap
ret_list = []
for attr in attrdict.keys():
- if not self.supported.has_key(attr):
+ if not attr in self.supported:
raise NFS4Error(NFS4ERR_ATTRNOTSUPP, attrs=mapping(ret_list))
if 'w' not in self.supported[attr]:
raise NFS4Error(NFS4ERR_INVAL, attrs=mapping(ret_list))
@@ -1182,7 +1182,7 @@ class VirtualHandle(NFSFileHandle):
# Make sure any error is recorded in fattr4_rdattr_error
ret_dict = {}
for attr in attrlist:
- if not self.supported.has_key(attr):
+ if not attr in self.supported:
# Ignore unknown attributes
continue
if 'r' not in self.supported[attr]:
@@ -1419,7 +1419,7 @@ class HardHandle(NFSFileHandle):
self.oldfiles = self.dirent.keys()
for i in os.listdir(self.file):
fullfile = os.path.join(self.file, i)
- if not self.dirent.has_key(i):
+ if not self.dirent.has_name(i):
self.dirent[i] = HardHandle(i, self, fullfile)
else:
self.oldfiles.remove(i)
@@ -1520,7 +1520,7 @@ class DirList:
else:
return self.list[i:]
- def has_key(self, name):
+ def has_name(self, name):
for x in self.list:
if x.name == name:
return True
--
2.17.1
^ permalink raw reply related
* [PATCH 08/24] pynfs: python3 support plan: cStringIO -> StringIO
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
try: # python2
import cStringIO.StringIO as StringIO
except: # python3
from io import StringIO
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/nfs4state.py | 5 ++---
nfs4.1/fs.py | 5 ++++-
xdr/xdrgen.py | 5 ++++-
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py
index 180e642..cd36edd 100755
--- a/nfs4.0/nfs4state.py
+++ b/nfs4.0/nfs4state.py
@@ -5,10 +5,9 @@ import nfs4acl
import nfs4lib
import os, time, array, random, string
try:
- import cStringIO
- StringIO = cStringIO
+ import cStringIO.StringIO as StringIO
except:
- import StringIO
+ from io import StringIO
from stat import *
import sha
diff --git a/nfs4.1/fs.py b/nfs4.1/fs.py
index e2c7eca..e8d413e 100644
--- a/nfs4.1/fs.py
+++ b/nfs4.1/fs.py
@@ -6,7 +6,10 @@ from nfs4lib import NFS4Error
import struct
import logging
from locking import Lock, RWLock
-from cStringIO import StringIO
+try:
+ import cStringIO.StringIO as StringIO
+except:
+ from io import StringIO
import time
from xdrdef.nfs4_pack import NFS4Packer
diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py
index 0aa1a52..8856b4c 100755
--- a/xdr/xdrgen.py
+++ b/xdr/xdrgen.py
@@ -215,7 +215,10 @@
import sys
import keyword
-import StringIO
+try:
+ import cStringIO.StringIO as StringIO
+except:
+ from io import StringIO
import time
import os
# Allow to be run stright from package
--
2.17.1
^ permalink raw reply related
* [PATCH 06/24] pynfs: python3 support plan: octal literal 0644 -> 0o644
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
s/\<0([0-9]{3})\>/0o\1/g
s/\<0([0-9]{2})\>/0o\1/g
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/nfs4acl.py | 8 ++++----
nfs4.0/nfs4lib.py | 10 +++++-----
nfs4.0/nfs4state.py | 4 ++--
nfs4.0/servertests/st_close.py | 4 ++--
nfs4.0/servertests/st_create.py | 2 +-
nfs4.0/servertests/st_delegation.py | 2 +-
nfs4.0/servertests/st_lock.py | 2 +-
nfs4.0/servertests/st_locku.py | 2 +-
nfs4.0/servertests/st_lookup.py | 10 +++++-----
nfs4.0/servertests/st_open.py | 18 +++++++++---------
nfs4.0/servertests/st_read.py | 4 ++--
nfs4.0/servertests/st_readdir.py | 8 ++++----
nfs4.0/servertests/st_reboot.py | 4 ++--
nfs4.0/servertests/st_setattr.py | 18 +++++++++---------
nfs4.0/servertests/st_write.py | 16 ++++++++--------
nfs4.1/client41tests/environment.py | 8 ++++----
nfs4.1/dataserver.py | 6 +++---
nfs4.1/fs.py | 2 +-
nfs4.1/nfs4client.py | 2 +-
nfs4.1/server41tests/environment.py | 14 +++++++-------
nfs4.1/server41tests/st_lookup.py | 4 ++--
21 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/nfs4.0/nfs4acl.py b/nfs4.0/nfs4acl.py
index 91a0316..b7f033e 100644
--- a/nfs4.0/nfs4acl.py
+++ b/nfs4.0/nfs4acl.py
@@ -66,9 +66,9 @@ def mode2acl(mode, dir=False):
"""Translate a 3-digit octal mode into a posix compatible acl"""
if dir: modes = DMODES
else: modes = MODES
- owner = modes[(mode & 0700)//0100] | FLAG_ALL | FLAG_OWN
- group = modes[(mode & 0070)//010] | FLAG_ALL
- other = modes[(mode & 0007)] | FLAG_ALL
+ owner = modes[(mode & 0o700)//0o100] | FLAG_ALL | FLAG_OWN
+ group = modes[(mode & 0o070)//0o10] | FLAG_ALL
+ other = modes[(mode & 0o007)] | FLAG_ALL
return [ nfsace4(ALLOWED, 0, owner, "OWNER@"),
nfsace4(DENIED, 0, negate(owner), "OWNER@"),
@@ -102,7 +102,7 @@ def acl2mode(acl):
for key in perms:
if perms[key] is None:
perm[keys] = 0
- return perms["OWNER@"]*0100 + perms["GROUP@"]*010 + perms["EVERYONE@"]
+ return perms["OWNER@"]*0o100 + perms["GROUP@"]*0o10 + perms["EVERYONE@"]
def maps_to_posix(acl):
"""Raises ACLError if acl does not map to posix """
diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py
index d255eb7..5c9e853 100644
--- a/nfs4.0/nfs4lib.py
+++ b/nfs4.0/nfs4lib.py
@@ -463,7 +463,7 @@ class NFS4Client(rpc.RPCClient):
return self.compound(ops)
def open(self, owner, name=None, type=OPEN4_NOCREATE,
- mode=UNCHECKED4, attrs={FATTR4_MODE:0644}, verf=None,
+ mode=UNCHECKED4, attrs={FATTR4_MODE:0o644}, verf=None,
access=OPEN4_SHARE_ACCESS_READ,
deny=OPEN4_SHARE_DENY_WRITE,
claim_type=CLAIM_NULL, deleg_type=None, deleg_cur_info=None):
@@ -568,7 +568,7 @@ class NFS4Client(rpc.RPCClient):
for e in entries:
# We separate setattr and remove to avoid an inode locking bug
ops = [op4.putfh(fh), op4.lookup(e.name)]
- ops += [op4.setattr(stateid, {FATTR4_MODE:0755})]
+ ops += [op4.setattr(stateid, {FATTR4_MODE:0o755})]
res = self.compound(ops)
check_result(res, "Making sure %s is writable" % repr(e.name))
ops = [op4.putfh(fh), op4.remove(e.name)]
@@ -589,7 +589,7 @@ class NFS4Client(rpc.RPCClient):
d = self.do_getattrdict([], [FATTR4_LEASE_TIME])
return d[FATTR4_LEASE_TIME]
- def create_obj(self, path, type=NF4DIR, attrs={FATTR4_MODE:0755},
+ def create_obj(self, path, type=NF4DIR, attrs={FATTR4_MODE:0o755},
linkdata="/etc/X11"):
if __builtins__['type'](path) is str:
path = self.homedir + [path]
@@ -613,7 +613,7 @@ class NFS4Client(rpc.RPCClient):
ops += [op4.rename(oldpath[-1], newpath[-1])]
return self.compound(ops)
- def create_file(self, owner, path=None, attrs={FATTR4_MODE: 0644},
+ def create_file(self, owner, path=None, attrs={FATTR4_MODE: 0o644},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_WRITE,
mode=UNCHECKED4, verifier=None,
@@ -702,7 +702,7 @@ class NFS4Client(rpc.RPCClient):
return (fhandle, stateid)
- def create_confirm(self, owner, path=None, attrs={FATTR4_MODE: 0644},
+ def create_confirm(self, owner, path=None, attrs={FATTR4_MODE: 0o644},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_WRITE,
mode=GUARDED4):
diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py
index 484a284..180e642 100755
--- a/nfs4.0/nfs4state.py
+++ b/nfs4.0/nfs4state.py
@@ -953,7 +953,7 @@ class VirtualHandle(NFSFileHandle):
if self.fattr4_type == NF4DIR:
self.dirent = DirList()
- self.fattr4_mode = 0755
+ self.fattr4_mode = 0o755
if self.fattr4_type == NF4REG:
self.file = StringIO.StringIO()
self.state = NFSFileState()
@@ -987,7 +987,7 @@ class VirtualHandle(NFSFileHandle):
self.fattr4_maxname = 128 # Are these enforced?
self.fattr4_maxread = 1000 # Are these enforced?
self.fattr4_maxwrite = 1000 # Are these enforced?
- self.fattr4_mode = 0644 # Currently no access restrictions enforced
+ self.fattr4_mode = 0o644 # Currently no access restrictions enforced
self.fattr4_acl = nfs4acl.mode2acl(self.fattr4_mode,
self.fattr4_type == NF4DIR)
self.fattr4_numlinks = 1 # Updated? - Yes
diff --git a/nfs4.0/servertests/st_close.py b/nfs4.0/servertests/st_close.py
index 1690fad..89ccbba 100644
--- a/nfs4.0/servertests/st_close.py
+++ b/nfs4.0/servertests/st_close.py
@@ -110,7 +110,7 @@ def testTimedoutClose1(t, env):
sleeptime = c.getLeaseTime() * 2
c.init_connection()
fh, stateid = c.create_confirm(t.code, deny=OPEN4_SHARE_DENY_WRITE,
- attrs={FATTR4_MODE: 0666})
+ attrs={FATTR4_MODE: 0o666})
env.sleep(sleeptime)
# Conflicting open should force server to drop state
c2 = env.c2
@@ -132,7 +132,7 @@ def testTimedoutClose2(t, env):
sleeptime = c.getLeaseTime() * 2
c.init_connection()
fh, stateid = c.create_confirm(t.code, deny=OPEN4_SHARE_DENY_WRITE,
- attrs={FATTR4_MODE: 0666})
+ attrs={FATTR4_MODE: 0o666})
res = c.lock_file(t.code, fh, stateid)
check(res)
env.sleep(sleeptime)
diff --git a/nfs4.0/servertests/st_create.py b/nfs4.0/servertests/st_create.py
index ac57aaf..c7256e5 100644
--- a/nfs4.0/servertests/st_create.py
+++ b/nfs4.0/servertests/st_create.py
@@ -8,7 +8,7 @@ def getDefaultAttr(c):
attr = {}
#attr[FATTR4_OWNER] = c.security.get_owner()
#attr[FATTR4_OWNER_GROUP] = c.security.get_group()
- attr[FATTR4_MODE] = 0755
+ attr[FATTR4_MODE] = 0o755
return attr
def _test_create(t, env, type, name, **keywords):
diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py
index 8e0d891..937d95f 100644
--- a/nfs4.0/servertests/st_delegation.py
+++ b/nfs4.0/servertests/st_delegation.py
@@ -706,7 +706,7 @@ def testServerChmod(t, env):
c.init_connection('pynfs%i_%s' % (os.getpid(), t.code), cb_ident=0)
c.create_confirm(t.code, path=c.homedir + [t.code + '-2'])
_get_deleg(t, c, c.homedir + [t.code], _recall, NFS4_OK)
- env.serverhelper("chmod 0777 " + _listToPath(c.homedir + [t.code]))
+ env.serverhelper("chmod 0o777 " + _listToPath(c.homedir + [t.code]))
_verify_cb_occurred(t, c, count)
def testServerSelfConflict(t, env):
diff --git a/nfs4.0/servertests/st_lock.py b/nfs4.0/servertests/st_lock.py
index 1cdbea3..060236a 100644
--- a/nfs4.0/servertests/st_lock.py
+++ b/nfs4.0/servertests/st_lock.py
@@ -529,7 +529,7 @@ def testReadLocks2(t, env):
file = c1.homedir + [t.code]
# Client1 creates a file
fh1, stateid1 = c1.create_confirm('owner1', file,
- attrs={FATTR4_MODE: 0666},
+ attrs={FATTR4_MODE: 0o666},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE)
# Client2 opens the file
diff --git a/nfs4.0/servertests/st_locku.py b/nfs4.0/servertests/st_locku.py
index 3006445..74b464a 100644
--- a/nfs4.0/servertests/st_locku.py
+++ b/nfs4.0/servertests/st_locku.py
@@ -256,7 +256,7 @@ def testTimedoutUnlock(t, env):
c = env.c1
sleeptime = c.getLeaseTime() * 3 // 2
c.init_connection()
- fh, stateid = c.create_confirm(t.code, attrs={FATTR4_MODE: 0666})
+ fh, stateid = c.create_confirm(t.code, attrs={FATTR4_MODE: 0o666})
res1 = c.lock_file(t.code, fh, stateid)
check(res1)
env.sleep(sleeptime)
diff --git a/nfs4.0/servertests/st_lookup.py b/nfs4.0/servertests/st_lookup.py
index cd1b93c..a57d4cb 100644
--- a/nfs4.0/servertests/st_lookup.py
+++ b/nfs4.0/servertests/st_lookup.py
@@ -206,7 +206,7 @@ def testNonAccessable(t, env):
DEPEND: MKDIR
CODE: LOOK6
"""
- # Create dir/foo, and set mode of dir to 000
+ # Create dir/foo, and set mode of dir to 0o000
c = env.c1
dir = c.homedir + [t.code]
res = c.create_obj(dir)
@@ -220,9 +220,9 @@ def testNonAccessable(t, env):
check(res)
res = c.compound(c.use_obj(dir + ['foo']))
if env.opts.uid == 0:
- check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP object in a dir with mode=000")
+ check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP object in a dir with mode=0o000")
else:
- check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=000")
+ check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=0o000")
def testInvalidUtf8(t, env):
"""LOOKUP with bad UTF-8 name strings should return NFS4ERR_INVAL
@@ -283,9 +283,9 @@ def testUnaccessibleDir(t, env):
check(res, msg="Setting mode=0 on directory %s" % t.code)
res = c.compound(c.use_obj(path + ['hidden']))
if env.opts.uid == 0:
- check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP off of dir with mode=000")
+ check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP off of dir with mode=0o000")
else:
- check(res, NFS4ERR_ACCESS, "LOOKUP off of dir with mode=000")
+ check(res, NFS4ERR_ACCESS, "LOOKUP off of dir with mode=0o000")
def testBadOpaque(t, env):
"""LOOKUP with a path component that has an incorrect array length
diff --git a/nfs4.0/servertests/st_open.py b/nfs4.0/servertests/st_open.py
index 437fb67..12db5df 100644
--- a/nfs4.0/servertests/st_open.py
+++ b/nfs4.0/servertests/st_open.py
@@ -25,7 +25,7 @@ def testCreateUncheckedFile(t, env):
c.init_connection()
# Create the file
- orig_attrs = { FATTR4_MODE: 0644, FATTR4_SIZE: 32 }
+ orig_attrs = { FATTR4_MODE: 0o644, FATTR4_SIZE: 32 }
res = c.create_file(t.code, attrs=orig_attrs, deny=OPEN4_SHARE_DENY_NONE)
check(res, msg="Trying to create file %s" % t.code)
fh, stateid = c.confirm(t.code, res)
@@ -33,7 +33,7 @@ def testCreateUncheckedFile(t, env):
checkdict(orig_attrs, rcvd_attrs, get_bitnumattr_dict(),
"Checking attrs on creation")
# Create the file again...it should ignore attrs
- attrs = { FATTR4_MODE: 0600, FATTR4_SIZE: 16 }
+ attrs = { FATTR4_MODE: 0o600, FATTR4_SIZE: 16 }
res = c.create_file(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE)
check(res, msg="Trying to recreate file %s" % t.code)
fh, stateid = c.confirm(t.code, res)
@@ -41,12 +41,12 @@ def testCreateUncheckedFile(t, env):
checkdict(orig_attrs, rcvd_attrs, get_bitnumattr_dict(),
"Attrs on recreate should be ignored")
# Create the file again, should truncate size to 0 and ignore other attrs
- attrs = { FATTR4_MODE: 0600, FATTR4_SIZE: 0 }
+ attrs = { FATTR4_MODE: 0o600, FATTR4_SIZE: 0 }
res = c.create_file(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE)
check(res, msg="Trying to truncate file %s" % t.code)
fh, stateid = c.confirm(t.code, res)
rcvd_attrs = c.do_getattrdict(fh, orig_attrs.keys())
- expect = { FATTR4_MODE: 0644, FATTR4_SIZE: 0 }
+ expect = { FATTR4_MODE: 0o644, FATTR4_SIZE: 0 }
checkdict(expect, rcvd_attrs, get_bitnumattr_dict(),
"Attrs on recreate should be ignored, except for size")
@@ -327,13 +327,13 @@ def testModeChange(t, env):
check(res)
ops = c.use_obj(fh) + [c.setattr({FATTR4_MODE:0})]
res = c.compound(ops)
- check(res, msg="Setting mode of file %s to 000" % t.code)
+ check(res, msg="Setting mode of file %s to 0o000" % t.code)
res = c.open_file(t.code, access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE)
if env.opts.uid == 0:
- check(res, [NFS4_OK, NFS4ERR_ACCESS], "Opening file %s with mode=000" % t.code)
+ check(res, [NFS4_OK, NFS4ERR_ACCESS], "Opening file %s with mode=0o000" % t.code)
else:
- check(res, NFS4ERR_ACCESS, "Opening file %s with mode=000" % t.code)
+ check(res, NFS4ERR_ACCESS, "Opening file %s with mode=0o000" % t.code)
def testShareConflict1(t, env):
"""OPEN conflicting with previous share
@@ -361,13 +361,13 @@ def testFailedOpen(t, env):
c1.init_connection()
# Client 1: create a file and deny others access
fh, stateid = c1.create_confirm(t.code)
- ops = c1.use_obj(fh) + [c1.setattr({FATTR4_MODE: 0700})]
+ ops = c1.use_obj(fh) + [c1.setattr({FATTR4_MODE: 0o700})]
check(c1.compound(ops))
# Client 2: try to open the file
c2 = env.c2
c2.init_connection()
res = c2.open_file(t.code)
- check(res, NFS4ERR_ACCESS, "Opening file with mode 0700 as 'other'")
+ check(res, NFS4ERR_ACCESS, "Opening file with mode 0o700 as 'other'")
# Client 1: try to use fh, stateid
res1 = c1.lock_file(t.code, fh, stateid)
check(res1, msg="Locking file after another client had a failed open")
diff --git a/nfs4.0/servertests/st_read.py b/nfs4.0/servertests/st_read.py
index 9b2203b..15f8795 100644
--- a/nfs4.0/servertests/st_read.py
+++ b/nfs4.0/servertests/st_read.py
@@ -74,7 +74,7 @@ def testLargeCount(t, env):
c = env.c1
c.init_connection()
fh, stateid = c.create_confirm(t.code, attrs={FATTR4_SIZE: 10000000,
- FATTR4_MODE: 0644})
+ FATTR4_MODE: 0o644})
res = c.read_file(fh, 0, 9000000, stateid)
check(res, msg="Reading file %s" % t.code)
_compare(t, res, '\x00'*9000000, False)
@@ -234,7 +234,7 @@ def testStolenStateid(t, env):
"""
c = env.c1
c.init_connection()
- res = c.create_file(t.code, attrs={FATTR4_MODE: 0600})
+ res = c.create_file(t.code, attrs={FATTR4_MODE: 0o600})
fh, stateid = c.confirm(t.code, res)
security=c.security
c.security=rpc.SecAuthSys(0, "whatever", 3912, 2422, [])
diff --git a/nfs4.0/servertests/st_readdir.py b/nfs4.0/servertests/st_readdir.py
index 5a70145..fb484b6 100644
--- a/nfs4.0/servertests/st_readdir.py
+++ b/nfs4.0/servertests/st_readdir.py
@@ -232,9 +232,9 @@ def testUnaccessibleDir(t, env):
ops = c.use_obj(path) + [c.readdir()]
res = c.compound(ops)
if env.opts.uid == 0:
- check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=000")
+ check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=0o000")
else:
- check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=000")
+ check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=0o000")
def testUnaccessibleDirAttrs(t, env):
"""READDIR with (cfh) in unaccessible directory requesting attrs
@@ -253,9 +253,9 @@ def testUnaccessibleDirAttrs(t, env):
[c.readdir(attr_request=[FATTR4_RDATTR_ERROR, FATTR4_TYPE])]
res = c.compound(ops)
if env.opts.uid == 0:
- check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=000")
+ check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=0o000")
else:
- check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=000")
+ check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=0o000")
###########################################
diff --git a/nfs4.0/servertests/st_reboot.py b/nfs4.0/servertests/st_reboot.py
index 33c3a4a..16cb008 100644
--- a/nfs4.0/servertests/st_reboot.py
+++ b/nfs4.0/servertests/st_reboot.py
@@ -116,7 +116,7 @@ def testEdge1(t, env):
c1 = env.c1
c1.init_connection()
# Client 1: lock file
- fh1, stateid1 = c1.create_confirm(t.code, attrs={FATTR4_MODE:0666},
+ fh1, stateid1 = c1.create_confirm(t.code, attrs={FATTR4_MODE:0o666},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE)
res1 = c1.lock_file(t.code, fh1, stateid1)
@@ -161,7 +161,7 @@ def testEdge2(t, env):
c1 = env.c1
c1.init_connection()
# Client 1: lock file
- fh1, stateid1 = c1.create_confirm(t.code, attrs={FATTR4_MODE:0666},
+ fh1, stateid1 = c1.create_confirm(t.code, attrs={FATTR4_MODE:0o666},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE)
res1 = c1.lock_file(t.code, fh1, stateid1)
diff --git a/nfs4.0/servertests/st_setattr.py b/nfs4.0/servertests/st_setattr.py
index 4a80f65..aa7123b 100644
--- a/nfs4.0/servertests/st_setattr.py
+++ b/nfs4.0/servertests/st_setattr.py
@@ -7,7 +7,7 @@ op = nfs_ops.NFS4ops()
def _set_mode(t, c, file, stateid=None, msg=" using stateid=0",
warnlist=[]):
- mode = 0740
+ mode = 0o740
dict = {FATTR4_MODE: mode}
ops = c.use_obj(file) + [c.setattr(dict, stateid)]
res = c.compound(ops)
@@ -399,7 +399,7 @@ def testInvalidAttr1(t, env):
path = c.homedir + [t.code]
res = c.create_obj(path)
check(res)
- badattr = dict2fattr({FATTR4_MODE: 0644})
+ badattr = dict2fattr({FATTR4_MODE: 0o644})
badattr.attr_vals = ''
res = c.compound(c.use_obj(path) + [op.setattr(env.stateid0, badattr)])
check(res, NFS4ERR_BADXDR, "SETATTR(FATTR4_MODE) with no data")
@@ -418,7 +418,7 @@ def testInvalidAttr2(t, env):
path = c.homedir + [t.code]
res = c.create_obj(path)
check(res)
- badattr = dict2fattr({FATTR4_MODE: 0644})
+ badattr = dict2fattr({FATTR4_MODE: 0o644})
badattr.attr_vals += 'Garbage data'
res = c.compound(c.use_obj(path) + [op.setattr(env.stateid0, badattr)])
check(res, NFS4ERR_BADXDR,
@@ -674,7 +674,7 @@ def testInodeLocking(t, env):
# In a single compound statement, setattr on dir and then
# do a state operation on a file in dir (like write or remove)
- ops = c.use_obj(basedir) + [c.setattr({FATTR4_MODE:0754})]
+ ops = c.use_obj(basedir) + [c.setattr({FATTR4_MODE:0o754})]
ops += [op.lookup('file'), op.write(stateid, 0, 0, 'blahblah')]
res = c.compound(ops)
check(res, msg="SETATTR on dir and state operation on file in dir")
@@ -690,7 +690,7 @@ def testChange(t, env):
c.init_connection()
fh, stateid = c.create_confirm(t.code)
change = c.do_getattr(FATTR4_CHANGE, fh)
- ops = c.use_obj(fh) + [c.setattr({FATTR4_MODE: 0740})]
+ ops = c.use_obj(fh) + [c.setattr({FATTR4_MODE: 0o740})]
res = c.compound(ops)
check(res)
change2 = c.do_getattr(FATTR4_CHANGE, fh)
@@ -708,10 +708,10 @@ def testChangeGranularity(t, env):
c.init_connection()
fh, stateid = c.create_confirm(t.code)
ops = c.use_obj(fh) + [c.getattr([FATTR4_CHANGE])] \
- + [c.setattr({FATTR4_MODE: 0740})] + [c.getattr([FATTR4_CHANGE])] \
- + [c.setattr({FATTR4_MODE: 0741})] + [c.getattr([FATTR4_CHANGE])] \
- + [c.setattr({FATTR4_MODE: 0742})] + [c.getattr([FATTR4_CHANGE])] \
- + [c.setattr({FATTR4_MODE: 0743})] + [c.getattr([FATTR4_CHANGE])]
+ + [c.setattr({FATTR4_MODE: 0o740})] + [c.getattr([FATTR4_CHANGE])] \
+ + [c.setattr({FATTR4_MODE: 0o741})] + [c.getattr([FATTR4_CHANGE])] \
+ + [c.setattr({FATTR4_MODE: 0o742})] + [c.getattr([FATTR4_CHANGE])] \
+ + [c.setattr({FATTR4_MODE: 0o743})] + [c.getattr([FATTR4_CHANGE])]
res = c.compound(ops)
check(res)
chattr1 = res.resarray[1].obj_attributes
diff --git a/nfs4.0/servertests/st_write.py b/nfs4.0/servertests/st_write.py
index 2f73cbb..4777e1b 100644
--- a/nfs4.0/servertests/st_write.py
+++ b/nfs4.0/servertests/st_write.py
@@ -38,7 +38,7 @@ def testSimpleWrite(t, env):
"""
c = env.c1
c.init_connection()
- attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644}
+ attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644}
fh, stateid = c.create_confirm(t.code, attrs=attrs,
deny=OPEN4_SHARE_DENY_NONE)
res = c.write_file(fh, _text, how=UNSTABLE4)
@@ -55,7 +55,7 @@ def testSimpleWrite2(t, env):
"""
c = env.c1
c.init_connection()
- attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644}
+ attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644}
fh, stateid = c.create_confirm(t.code, attrs=attrs,
deny=OPEN4_SHARE_DENY_NONE)
res = c.write_file(fh, _text, 30)
@@ -72,7 +72,7 @@ def testStateidOne(t, env):
"""
c = env.c1
c.init_connection()
- attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644}
+ attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644}
fh, stateid = c.create_confirm(t.code, attrs=attrs,
deny=OPEN4_SHARE_DENY_NONE)
res = c.write_file(fh, _text, 5, env.stateid1, DATA_SYNC4)
@@ -91,7 +91,7 @@ def testWithOpen(t, env):
"""
c = env.c1
c.init_connection()
- attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644}
+ attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644}
fh, stateid = c.create_confirm(t.code, attrs=attrs)
res = c.write_file(fh, _text, 50, stateid, FILE_SYNC4)
check(res, msg="WRITE with openstateid and FILE_SYNC4")
@@ -109,7 +109,7 @@ def testNoData(t, env):
"""
c = env.c1
c.init_connection()
- attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644}
+ attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644}
fh, stateid = c.create_confirm(t.code, attrs=attrs)
time_prior = c.do_getattr(FATTR4_TIME_MODIFY, fh)
env.sleep(1)
@@ -281,7 +281,7 @@ def testOpenMode(t, env):
"""
c = env.c1
c.init_connection()
- attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644}
+ attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644}
fh, stateid = c.create_confirm(t.code, attrs=attrs,
access=OPEN4_SHARE_ACCESS_READ)
res = c.write_file(fh, _text, 0, stateid)
@@ -298,7 +298,7 @@ def testShareDeny(t, env):
"""
c = env.c1
c.init_connection()
- attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644}
+ attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644}
fh, stateid = c.create_confirm(t.code, attrs=attrs,
deny=OPEN4_SHARE_DENY_WRITE)
res = c.write_file(fh, _text)
@@ -520,7 +520,7 @@ def testStolenStateid(t, env):
"""
c = env.c1
c.init_connection()
- res = c.create_file(t.code, attrs={FATTR4_MODE: 0600})
+ res = c.create_file(t.code, attrs={FATTR4_MODE: 0o600})
fh, stateid = c.confirm(t.code, res)
security=c.security
c.security=rpc.SecAuthSys(0, "whatever", 3912, 2422, [])
diff --git a/nfs4.1/client41tests/environment.py b/nfs4.1/client41tests/environment.py
index 7c7bb0c..933264c 100644
--- a/nfs4.1/client41tests/environment.py
+++ b/nfs4.1/client41tests/environment.py
@@ -362,7 +362,7 @@ def clean_dir(sess, path):
for e in entries:
# We separate setattr and remove to avoid an inode locking bug
ops = use_obj(path + [e.name])
- ops += [op.setattr(stateid, {FATTR4_MODE:0755})]
+ ops += [op.setattr(stateid, {FATTR4_MODE:0o755})]
res = sess.compound(ops)
check(res, msg="Setting mode on %s" % repr(e.name))
ops = use_obj(path)
@@ -405,7 +405,7 @@ def use_obj(file):
else:
return [op.putrootfh()] + [op.lookup(comp) for comp in file]
-def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0755}):
+def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0o755}):
"""Return ops needed to create given non-file object"""
# Ensure using createtype4
if not hasattr(kind, "type"):
@@ -413,7 +413,7 @@ def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0755}):
ops = use_obj(path[:-1]) + [op.create(kind, path[-1], attrs)]
return sess.compound(ops)
-def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
+def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0o644},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE,
mode=GUARDED4, verifier=None, want_deleg=False):
@@ -434,7 +434,7 @@ def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
open_claim4(CLAIM_NULL, name))
return sess.compound(use_obj(dir) + [open_op, op.getfh()])
-def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
+def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0o644},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE,
mode=GUARDED4):
diff --git a/nfs4.1/dataserver.py b/nfs4.1/dataserver.py
index 80179f8..af0e35a 100644
--- a/nfs4.1/dataserver.py
+++ b/nfs4.1/dataserver.py
@@ -130,7 +130,7 @@ class DataServer41(DataServer):
self.sess.compound([op4.reclaim_complete(const4.FALSE)])
def make_root(self):
- attrs = {const4.FATTR4_MODE:0777}
+ attrs = {const4.FATTR4_MODE:0o777}
existing_path = []
kind = type4.createtype4(const4.NF4DIR)
for comp in self.path:
@@ -153,7 +153,7 @@ class DataServer41(DataServer):
seqid=0
access = const4.OPEN4_SHARE_ACCESS_BOTH
deny = const4.OPEN4_SHARE_DENY_NONE
- attrs = {const4.FATTR4_MODE: 0777}
+ attrs = {const4.FATTR4_MODE: 0o777}
owner = "mds"
mode = const4.GUARDED4
verifier = self.sess.c.verifier
@@ -257,7 +257,7 @@ class DataServer3(DataServer):
def open_file(self, mds_fh):
name = self.fh_to_name(mds_fh)
where = type3.diropargs3(self.rootfh, name)
- attr = type3.sattr3(mode=type3.set_mode3(True, 0777),
+ attr = type3.sattr3(mode=type3.set_mode3(True, 0o777),
uid=type3.set_uid3(True, 0),
gid=type3.set_gid3(True, 0),
size=type3.set_size3(False),
diff --git a/nfs4.1/fs.py b/nfs4.1/fs.py
index b0b06d5..e2c7eca 100644
--- a/nfs4.1/fs.py
+++ b/nfs4.1/fs.py
@@ -25,7 +25,7 @@ class MetaData(object):
self.refcnt = 0
self.createverf = ""
self.owner = ""
- self.mode = 0777
+ self.mode = 0o777
self.time_access = self.time_modify = self.time_create = nfs4lib.get_nfstime()
if 1:
self.parent = 0
diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index 135981d..5288942 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -560,7 +560,7 @@ class SessionRecord(object):
return res
## def open(self, owner, name=None, type=OPEN4_NOCREATE,
-## mode=UNCHECKED4, attrs={FATTR4_MODE:0644}, verf=None,
+## mode=UNCHECKED4, attrs={FATTR4_MODE:0o644}, verf=None,
## access=OPEN4_SHARE_ACCESS_READ,
## deny=OPEN4_SHARE_DENY_WRITE,
## claim_type=CLAIM_NULL, deleg_type=None, deleg_cur_info=None):
diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index 823dfe3..3020371 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -418,7 +418,7 @@ def clean_dir(sess, path):
for e in entries:
# We separate setattr and remove to avoid an inode locking bug
ops = use_obj(path + [e.name])
- ops += [op.setattr(stateid, {FATTR4_MODE:0755})]
+ ops += [op.setattr(stateid, {FATTR4_MODE:0o755})]
res = sess.compound(ops)
check(res, msg="Setting mode on %s" % repr(e.name))
ops = use_obj(path)
@@ -460,7 +460,7 @@ def do_getattrdict(sess, file, attrlist):
check(res)
return res.resarray[-1].obj_attributes
-def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0755}):
+def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0o755}):
"""Return ops needed to create given non-file object"""
# Ensure using createtype4
if not hasattr(kind, "type"):
@@ -468,7 +468,7 @@ def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0755}):
ops = use_obj(path[:-1]) + [op.create(kind, path[-1], attrs)]
return sess.compound(ops)
-def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
+def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0o644},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE,
mode=GUARDED4, verifier=None,
@@ -483,7 +483,7 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
return sess.compound(open_op)
-def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
+def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0o644},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE,
mode=GUARDED4, verifier=None,
@@ -526,7 +526,7 @@ def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
return fh_op + [open_op, op.getfh()]
-def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
+def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0o644},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE,
mode=GUARDED4, verifier=None, want_deleg=False,
@@ -559,7 +559,7 @@ def open_file(sess, owner, path=None,
verifier, claim_type, want_deleg, deleg_type,
open_create, seqid, clientid)
-def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
+def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0o644},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE,
mode=GUARDED4):
@@ -572,7 +572,7 @@ def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
fh = res.resarray[-1].object
return fh, res.resarray[-2].stateid
-def create_close(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
+def create_close(sess, owner, path=None, attrs={FATTR4_MODE: 0o644},
access=OPEN4_SHARE_ACCESS_BOTH,
deny=OPEN4_SHARE_DENY_NONE,
mode=GUARDED4):
diff --git a/nfs4.1/server41tests/st_lookup.py b/nfs4.1/server41tests/st_lookup.py
index 9f50004..3899425 100644
--- a/nfs4.1/server41tests/st_lookup.py
+++ b/nfs4.1/server41tests/st_lookup.py
@@ -270,7 +270,7 @@ if 0:
DEPEND: MKDIR
CODE: LOOK6
"""
- # Create dir/foo, and set mode of dir to 000
+ # Create dir/foo, and set mode of dir to 0o000
c = env.c1
dir = c.homedir + [t.code]
res = c.create_obj(dir)
@@ -283,7 +283,7 @@ if 0:
res = c.compound(c.use_obj(dir))
check(res)
res = c.compound(c.use_obj(dir + ['foo']))
- check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=000")
+ check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=0o000")
def testInvalidUtf8(t, env):
"""LOOKUP with bad UTF-8 name strings should return NFS4ERR_INVAL
--
2.17.1
^ permalink raw reply related
* [PATCH 07/24] pynfs: python3 support plan: sys.maxint -> sys.maxsize
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
s/sys.maxint/sys.maxsize/g
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.1/testmod.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
index 21e9915..0cb76da 100644
--- a/nfs4.1/testmod.py
+++ b/nfs4.1/testmod.py
@@ -333,7 +333,7 @@ def parseversions(t):
raise RuntimeError("Test %s has invalid version range %s"
% (t.fullname, t.vers_list))
if len(t.vers_list) == 0:
- return (0, sys.maxint)
+ return (0, sys.maxsize)
limits = t.vers_list[0].split("-")
if len(limits) != 2:
raise RuntimeError("Test %s has invalid version range %s"
@@ -343,7 +343,7 @@ def parseversions(t):
else:
left = int(limits[0])
if limits[1] == '':
- right = sys.maxint
+ right = sys.maxsize
else:
right = int(limits[1])
return (left, right)
--
2.17.1
^ permalink raw reply related
* Re: [PATCH v4 1/4] x86/boot: Add acpitb.h to help parse acpi tables
From: Chao Fan @ 2018-07-24 8:36 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, x86, hpa, tglx, mingo, keescook, yasu.isimatu,
indou.takao, caoj.fnst, douly.fnst
In-Reply-To: <20180724060257.GE6480@MiWiFi-R3L-srv>
On Tue, Jul 24, 2018 at 02:02:57PM +0800, Baoquan He wrote:
>Hi chao,
>
>On 07/23/18 at 05:29pm, Chao Fan wrote:
>> In order to parse ACPI tables, reuse the head file linux/acpi.h,
>> so that the files in 'compressed' directory can read ACPI table
>> by including this head file.
>>
>> Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
>> ---
>> arch/x86/boot/compressed/acpitb.h | 7 +++++++
>> 1 file changed, 7 insertions(+)
>> create mode 100644 arch/x86/boot/compressed/acpitb.h
>>
>> diff --git a/arch/x86/boot/compressed/acpitb.h b/arch/x86/boot/compressed/acpitb.h
>> new file mode 100644
>> index 000000000000..f8ab6e5b3e06
>> --- /dev/null
>> +++ b/arch/x86/boot/compressed/acpitb.h
>> @@ -0,0 +1,7 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#include <linux/acpi.h>
>> +
>> +#define ACPI_MAX_TABLES 128
>> +
>> +/* Function to get ACPI SRAT table pointer. */
>> +struct acpi_table_header *get_acpi_srat_table(void);
>
>Since acpitb.h includes so few lines of code, not sure if we can move
>them into .c files directly.
>
>By the way, you might need to rebase this patchset on top of
>tip/x86/boot.
Sorry Baoquan,
I tried to add this patcheset to the tip/x86/boot branch using both 'patch'
command and 'git am'. I found no problem and no offset.
So is there some problems when you use them?
Thanks,
Chao Fan
>
>Thanks
>Baoquan
>
>
^ permalink raw reply
* [PATCH 05/24] pynfs: python3 support plan: remove suffix 'L' of long integer
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
s/(0x[[:xdigit:]]+)L\>/\1/g
s/(\<[[:digit:]]+)L\>/\1/g
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/lib/rpc/rpc.py | 14 +++++++-------
nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py | 2 +-
nfs4.0/nfs4lib.py | 8 ++++----
nfs4.0/nfs4server.py | 6 +++---
nfs4.0/nfs4state.py | 4 ++--
nfs4.0/servertests/environment.py | 2 +-
nfs4.0/servertests/st_commit.py | 8 ++++----
nfs4.1/client41tests/environment.py | 2 +-
nfs4.1/dataserver.py | 2 +-
nfs4.1/fs.py | 2 +-
nfs4.1/nfs4client.py | 2 +-
nfs4.1/nfs4lib.py | 10 +++++-----
nfs4.1/nfs4server.py | 4 ++--
nfs4.1/server41tests/environment.py | 4 ++--
nfs4.1/server41tests/st_debug.py | 2 +-
nfs4.1/testmod.py | 2 +-
rpc/rpc.py | 8 ++++----
17 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py
index 83a51c4..d9c1401 100644
--- a/nfs4.0/lib/rpc/rpc.py
+++ b/nfs4.0/lib/rpc/rpc.py
@@ -157,9 +157,9 @@ def _recv_record(self):
while not last:
rec_mark = self.recv_all(4)
count = struct.unpack('>L', rec_mark)[0]
- last = count & 0x80000000L
+ last = count & 0x80000000
if last:
- count &= 0x7fffffffL
+ count &= 0x7fffffff
data += self.recv_all(count)
return data
@@ -171,7 +171,7 @@ def _send_record(self, data, chunksize=2048):
chunk = data[i:i+chunksize]
i += chunksize
if i >= dlen:
- last = 0x80000000L
+ last = 0x80000000
mark = struct.pack('>L', last | len(chunk))
self.sendall(mark + chunk)
@@ -202,7 +202,7 @@ class RPCClient(object):
self._rpcunpacker = {t : rpc_pack.RPCUnpacker('')}
self.default_prog = program
self.default_vers = version
- self.xid = 0L
+ self.xid = 0
self._xidlist = {}
if sec_list is None:
sec_list = [SecAuthNone()]
@@ -558,8 +558,8 @@ class RPCServer(Server):
str = self.readbufs[fd]
if len(str) >= 4:
packetlen = struct.unpack('>L', str[0:4])[0]
- last = 0x80000000L & packetlen
- packetlen &= 0x7fffffffL
+ last = 0x80000000 & packetlen
+ packetlen &= 0x7fffffff
if len(str) >= 4 + packetlen:
self.packetbufs[fd].append(str[4:4 + packetlen])
self.readbufs[fd] = str[4 + packetlen:]
@@ -593,7 +593,7 @@ class RPCServer(Server):
last = 0
self.recordbufs[fd][0] = data[chunksize:]
else:
- last = 0x80000000L
+ last = 0x80000000
del self.recordbufs[fd][0]
mark = struct.pack('>L', last | len(chunk))
self.writebufs[fd] = (mark + chunk)
diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
index 6351355..ee6ad53 100644
--- a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
+++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
@@ -72,7 +72,7 @@ def show_major(m):
"""Return string corresponding to major code"""
if m == 0:
return gss_major_codes[0]
- call = m & 0xff000000L
+ call = m & 0xff000000
routine = m & 0xff0000
supp = m & 0xffff
out = []
diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py
index a0fdce1..d255eb7 100644
--- a/nfs4.0/nfs4lib.py
+++ b/nfs4.0/nfs4lib.py
@@ -93,7 +93,7 @@ class FancyNFS4Packer(nfs4_pack.NFS4Packer):
def filter_bitmap4(self, data):
out = []
while data:
- out.append(data & 0xffffffffL)
+ out.append(data & 0xffffffff)
data >>= 32
return out
@@ -108,7 +108,7 @@ class FancyNFS4Packer(nfs4_pack.NFS4Packer):
class FancyNFS4Unpacker(nfs4_pack.NFS4Unpacker):
def filter_bitmap4(self, data):
"""Put bitmap into single long, instead of array of 32bit chunks"""
- out = 0L
+ out = 0
shift = 0
for i in data:
out |= (long(i) << shift)
@@ -1006,9 +1006,9 @@ def fattr2dict(obj):
def list2bitmap(list):
"""Construct a bitmap from a list of bit numbers"""
- mask = 0L
+ mask = 0
for bit in list:
- mask |= 1L << bit
+ mask |= 1 << bit
return mask
def bitmap2list(bitmap):
diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py
index cb3ea72..163bd60 100755
--- a/nfs4.0/nfs4server.py
+++ b/nfs4.0/nfs4server.py
@@ -475,7 +475,7 @@ class NFS4Server(rpc.RPCServer):
e = verify_name(filename)
if e: raise NFS4Error(e)
# At this point we know it is CLAIM_NULL with valid filename and cfh
- attrset = 0L
+ attrset = 0
ci_old = self.curr_fh.fattr4_change
if op.opopen.openhow.opentype == OPEN4_CREATE:
print(" CREATING FILE.")
@@ -812,13 +812,13 @@ class NFS4Server(rpc.RPCServer):
print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
print(op.opsetattr.obj_attributes)
if not self.curr_fh:
- return simple_error(NFS4ERR_NOFILEHANDLE, 0L)
+ return simple_error(NFS4ERR_NOFILEHANDLE, 0)
try:
attrdict = op.opsetattr.obj_attributes
if FATTR4_SIZE in attrdict:
# This counts as a write, so must do some checking
if self.curr_fh.get_type() != NF4REG:
- return simple_error(NFS4ERR_BAD_STATEID, 0L)
+ return simple_error(NFS4ERR_BAD_STATEID, 0)
oldsize = self.curr_fh.fattr4_size
newsize = attrdict[FATTR4_SIZE]
if oldsize <= newsize:
diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py
index e854b3b..484a284 100755
--- a/nfs4.0/nfs4state.py
+++ b/nfs4.0/nfs4state.py
@@ -26,7 +26,7 @@ POSIXLOCK = True # If True, allow locks to be split/joined automatically
POSIXACL = True # If True, forces acls to follow posix mapping rules
class NFS4Error(Exception):
- def __init__(self, code, msg=None, attrs=0L, lock_denied=None):
+ def __init__(self, code, msg=None, attrs=0, lock_denied=None):
self.code = code
self.name = nfsstat4[code]
if msg is None:
@@ -384,7 +384,7 @@ class NFSServerState:
# Check for special stateids
if stateid.seqid==0 and stateid.other==chr(0)*12:
return 0
- if stateid.seqid==0xffffffffL and stateid.other==chr(0xff)*12:
+ if stateid.seqid==0xffffffff and stateid.other==chr(0xff)*12:
return 1
# Check for self consistency
if stateid.other[:4] != self.instance:
diff --git a/nfs4.0/servertests/environment.py b/nfs4.0/servertests/environment.py
index a848ed4..a5cfe60 100644
--- a/nfs4.0/servertests/environment.py
+++ b/nfs4.0/servertests/environment.py
@@ -119,7 +119,7 @@ class Environment(testmod.Environment):
self.filedata = "This is the file test data."
self.linkdata = "/etc/X11"
self.stateid0 = stateid4(0, '')
- self.stateid1 = stateid4(0xffffffffL, '\xff'*12)
+ self.stateid1 = stateid4(0xffffffff, '\xff'*12)
def _get_security(self, opts):
if opts.security == 'none':
diff --git a/nfs4.0/servertests/st_commit.py b/nfs4.0/servertests/st_commit.py
index e903739..eecf2c8 100644
--- a/nfs4.0/servertests/st_commit.py
+++ b/nfs4.0/servertests/st_commit.py
@@ -42,7 +42,7 @@ def testCommitOffsetMax1(t, env):
DEPEND: MKFILE
CODE: CMT1c
"""
- _commit(t, env.c1, 0xffffffffffffffffL, statlist=[NFS4_OK, NFS4ERR_INVAL])
+ _commit(t, env.c1, 0xffffffffffffffff, statlist=[NFS4_OK, NFS4ERR_INVAL])
def testCommitOffsetMax2(t, env):
"""COMMIT
@@ -51,7 +51,7 @@ def testCommitOffsetMax2(t, env):
DEPEND: MKFILE
CODE: CMT1d
"""
- _commit(t, env.c1, 0xfffffffffffffffeL, statlist=[NFS4_OK, NFS4ERR_INVAL])
+ _commit(t, env.c1, 0xfffffffffffffffe, statlist=[NFS4_OK, NFS4ERR_INVAL])
def testCommitCount1(t, env):
"""COMMIT
@@ -69,7 +69,7 @@ def testCommitCountMax(t, env):
DEPEND: MKFILE
CODE: CMT1f
"""
- _commit(t, env.c1, 0, 0xffffffffL)
+ _commit(t, env.c1, 0, 0xffffffff)
def testLink(t, env):
"""COMMIT
@@ -159,5 +159,5 @@ def testCommitOverflow(t, env):
fh, stateid = c.create_confirm(t.code)
res = c.write_file(fh, _text, 0, stateid, how=UNSTABLE4)
check(res, msg="WRITE with how=UNSTABLE4")
- res = c.commit_file(fh, 0xfffffffffffffff0L, 64)
+ res = c.commit_file(fh, 0xfffffffffffffff0, 64)
check(res, NFS4ERR_INVAL, "COMMIT with offset + count overflow")
diff --git a/nfs4.1/client41tests/environment.py b/nfs4.1/client41tests/environment.py
index 6b48d12..7c7bb0c 100644
--- a/nfs4.1/client41tests/environment.py
+++ b/nfs4.1/client41tests/environment.py
@@ -373,7 +373,7 @@ def clean_dir(sess, path):
res = sess.compound(ops)
check(res, msg="Trying to remove %s" % repr(e.name))
-def do_readdir(sess, file, cookie=0, cookieverf='', attrs=0L,
+def do_readdir(sess, file, cookie=0, cookieverf='', attrs=0,
dircount=4096, maxcount=4096):
# Since we may not get whole directory listing in one readdir request,
# loop until we do. For each request result, create a flat list
diff --git a/nfs4.1/dataserver.py b/nfs4.1/dataserver.py
index f32f3d7..80179f8 100644
--- a/nfs4.1/dataserver.py
+++ b/nfs4.1/dataserver.py
@@ -206,7 +206,7 @@ class DataServer41(DataServer):
def get_size(self, fh):
ops = [op4.putfh(fh),
- op4.getattr(1L << const4.FATTR4_SIZE)]
+ op4.getattr(1 << const4.FATTR4_SIZE)]
res = self._execute(ops)
attrdict = res.resarray[-1].obj_attributes
return attrdict.get(const4.FATTR4_SIZE, 0)
diff --git a/nfs4.1/fs.py b/nfs4.1/fs.py
index d9b58f2..b0b06d5 100644
--- a/nfs4.1/fs.py
+++ b/nfs4.1/fs.py
@@ -306,7 +306,7 @@ class FSObject(object):
# STUB - need to check principal, and set owner/group if needed
log_o.log(5, "FSObject.set_attrs(%r)" % attrs)
info = nfs4lib.attr_info
- bitmap = 0L
+ bitmap = 0
try:
for attr in attrs:
if self.fs.fattr4_supported_attrs & attr == 0:
diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index 708850d..135981d 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -611,7 +611,7 @@ sha256 = '`\x86H\x01e\x03\x04\x02\x01'
binding_opts = conn_binding4args(True, ["gibberish", sha256])
fore_attrs = channel_attrs4(4096,4096,4096,128,8,[])
cb_sec= callback_sec_parms4(0)
-C.compound([C.create_session_op(0,1,0L,0,binding_opts, fore_attrs, fore_attrs,123,[cb_sec])])
+C.compound([C.create_session_op(0,1,0,0,binding_opts, fore_attrs, fore_attrs,123,[cb_sec])])
"""
""" SEQUENCE
diff --git a/nfs4.1/nfs4lib.py b/nfs4.1/nfs4lib.py
index 96752c2..20eae0f 100644
--- a/nfs4.1/nfs4lib.py
+++ b/nfs4.1/nfs4lib.py
@@ -194,7 +194,7 @@ class FancyNFS4Packer(NFS4Packer):
def filter_bitmap4(self, data):
out = []
while data:
- out.append(data & 0xffffffffL)
+ out.append(data & 0xffffffff)
data >>= 32
return out
@@ -217,7 +217,7 @@ class FancyNFS4Packer(NFS4Packer):
class FancyNFS4Unpacker(NFS4Unpacker):
def filter_bitmap4(self, data):
"""Put bitmap into single long, instead of array of 32bit chunks"""
- out = 0L
+ out = 0
shift = 0
for i in data:
out |= (long(i) << shift)
@@ -276,9 +276,9 @@ def fattr2dict(obj):
def list2bitmap(list):
"""Construct a bitmap from a list of bit numbers"""
- mask = 0L
+ mask = 0
for bit in list:
- mask |= 1L << bit
+ mask |= 1 << bit
return mask
def bitmap2list(bitmap):
@@ -565,7 +565,7 @@ def attr_name(bitnum):
return bitnum2attr.get(bitnum, "unknown_%r" % bitnum)
class NFS4Error(Exception):
- def __init__(self, status, attrs=0L, lock_denied=None, tag=None, check_msg=None):
+ def __init__(self, status, attrs=0, lock_denied=None, tag=None, check_msg=None):
self.status = status
self.name = xdrdef.nfs4_const.nfsstat4[status]
if check_msg is None:
diff --git a/nfs4.1/nfs4server.py b/nfs4.1/nfs4server.py
index f8bd251..cd78082 100755
--- a/nfs4.1/nfs4server.py
+++ b/nfs4.1/nfs4server.py
@@ -212,7 +212,7 @@ class ClientList(object):
def __init__(self):
self._data = {}
self.lock = Lock("ClientList")
- self._nextid = 0L
+ self._nextid = 0
def __getitem__(self, key):
return self._data.get(key)
@@ -1381,7 +1381,7 @@ class NFS4Server(rpc.Server):
def open_claim_null(self, arg, env):
"""Simulated switch function from op_open that handles CLAIM_NULL"""
- bitmask = 0L
+ bitmask = 0
# cfh holds dir, claim.file holds name
if not env.cfh.isdir:
raise NFS4Error(NFS4ERR_NOTDIR)
diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index 1a837ee..823dfe3 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -139,7 +139,7 @@ class Environment(testmod.Environment):
self.filedata = "This is the file test data."
self.linkdata = "/etc/X11"
self.stateid0 = stateid4(0, '')
- self.stateid1 = stateid4(0xffffffffL, '\xff'*12)
+ self.stateid1 = stateid4(0xffffffff, '\xff'*12)
log.info("Created client to %s, %i" % (opts.server, opts.port))
@@ -429,7 +429,7 @@ def clean_dir(sess, path):
res = sess.compound(ops)
check(res, msg="Trying to remove %s" % repr(e.name))
-def do_readdir(sess, file, cookie=0, cookieverf='', attrs=0L,
+def do_readdir(sess, file, cookie=0, cookieverf='', attrs=0,
dircount=4096, maxcount=4096):
# Since we may not get whole directory listing in one readdir request,
# loop until we do. For each request result, create a flat list
diff --git a/nfs4.1/server41tests/st_debug.py b/nfs4.1/server41tests/st_debug.py
index e34d03f..345fc77 100644
--- a/nfs4.1/server41tests/st_debug.py
+++ b/nfs4.1/server41tests/st_debug.py
@@ -89,7 +89,7 @@ def testDeadlock(t, env):
def ops(i):
return [op.putfh(fh),
op.write(stateid, i*1000, UNSTABLE4, chr(97+i)*100),
- op.getattr(42950721818L)
+ op.getattr(42950721818)
]
xids = [sess1.compound_async(ops(i), slot=i) for i in range(4)]
for xid in xids:
diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
index 8108a23..21e9915 100644
--- a/nfs4.1/testmod.py
+++ b/nfs4.1/testmod.py
@@ -374,7 +374,7 @@ def createtests(testdir):
# Reduce doc string info into format easier to work with
used_codes = {}
flag_dict = {}
- bit = 1L
+ bit = 1
for t in tests:
## if not t.flags_list:
## raise RuntimeError("%s has no flags" % t.fullname)
diff --git a/rpc/rpc.py b/rpc/rpc.py
index 834fedd..af2b325 100644
--- a/rpc/rpc.py
+++ b/rpc/rpc.py
@@ -265,8 +265,8 @@ class Pipe(object):
# We don't even have the packet length yet, wait for more data
break
packetlen = struct.unpack('>L', buf[0:4])[0]
- last = 0x80000000L & packetlen
- packetlen &= 0x7fffffffL
+ last = 0x80000000 & packetlen
+ packetlen &= 0x7fffffff
packetlen += 4 # Include size of record mark
if len(buf) < packetlen:
# We don't have a full packet yet, wait for more data
@@ -310,7 +310,7 @@ class Pipe(object):
chunk = record[i: i + count]
i += count
if i >= dlen:
- last = 0x80000000L
+ last = 0x80000000
mark = struct.pack('>L', last | len(chunk))
out += mark + chunk
return out
@@ -351,7 +351,7 @@ class RpcPipe(Pipe):
Pipe.__init__(self, *args, **kwargs)
self._pending = {} # {xid:defer}
self._lock = threading.Lock() # Protects fields below
- self._xid = random.randint(0, 0x7fffffffL)
+ self._xid = random.randint(0, 0x7fffffff)
self.set_active()
def _get_xid(self):
--
2.17.1
^ permalink raw reply related
* [PATCH 04/24] pynfs: python3 support plan: "raise E, args:" -> "raise E(args)"
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
'/raise / { :loop /[^\\]$/! {N; b loop};
s/\<raise *([[:alnum:]]+), *(.+)$/raise \1(\2)/;
s/%sraise *([[:alnum:]]+), *([^"]+)\\n"/%sraise \1(\2)\\n"/; }'
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py | 52 +++++++++++++--------------
nfs4.0/nfs4state.py | 28 +++++++--------
nfs4.1/config.py | 2 +-
nfs4.1/nfs4state.py | 4 +--
xdr/xdrgen.py | 22 ++++++------
5 files changed, 54 insertions(+), 54 deletions(-)
diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
index 2c68875..6351355 100644
--- a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
+++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
@@ -127,8 +127,8 @@ class SecAuthGss(SecFlavor):
self.gss_seq_num = 0
d = gssapi.importName("nfs@%s" % client.remotehost)
if d['major'] != gssapi.GSS_S_COMPLETE:
- raise SecError, "gssapi.importName returned: %s" % \
- show_major(d['major'])
+ raise SecError("gssapi.importName returned: %s" % \
+ show_major(d['major']))
name = d['name']
# We need to send NULLPROCs with token from initSecContext
good_major = [gssapi.GSS_S_COMPLETE, gssapi.GSS_S_CONTINUE_NEEDED]
@@ -141,11 +141,11 @@ class SecAuthGss(SecFlavor):
major = d['major']
context = d['context']
if major not in good_major:
- raise SecError, "gssapi.initSecContext returned: %s" % \
- show_major(major)
+ raise SecError("gssapi.initSecContext returned: %s" % \
+ show_major(major))
if (major == gssapi.GSS_S_CONTINUE_NEEDED) and \
(reply_major == gssapi.GSS_S_COMPLETE):
- raise SecError, "Unexpected GSS_S_COMPLETE from server"
+ raise SecError("Unexpected GSS_S_COMPLETE from server")
token = d['token']
if reply_major != gssapi.GSS_S_COMPLETE:
# FRED - sec 5.2.2 of RFC 2203 mentions possibility that
@@ -161,13 +161,13 @@ class SecAuthGss(SecFlavor):
up.done()
reply_major = res.gss_major
if reply_major not in good_major:
- raise SecError, "Server returned: %s" % \
- show_major(reply_major)
+ raise SecError("Server returned: %s" % \
+ show_major(reply_major))
self.init = 2
reply_token = res.gss_token
if major == gssapi.GSS_S_COMPLETE:
if reply_major != gssapi.GSS_S_COMPLETE:
- raise SecError, "Unexpected COMPLETE from client"
+ raise SecError("Unexpected COMPLETE from client")
break
self.gss_context = context
self.gss_handle = res.handle
@@ -240,8 +240,8 @@ class SecAuthGss(SecFlavor):
d = gssapi.getMIC(self.gss_context, data)
major = d['major']
if major != gssapi.GSS_S_COMPLETE:
- raise SecError, "gssapi.getMIC returned: %s" % \
- show_major(major)
+ raise SecError("gssapi.getMIC returned: %s" % \
+ show_major(major))
return opaque_auth(RPCSEC_GSS, d['token'])
def _make_cred_gss(self, handle, service, gss_proc=RPCSEC_GSS_DATA, seq=0):
@@ -266,8 +266,8 @@ class SecAuthGss(SecFlavor):
data = p.get_buffer() + data
d = gssapi.getMIC(self.gss_context, data)
if d['major'] != gssapi.GSS_S_COMPLETE:
- raise SecError, "gssapi.getMIC returned: %s" % \
- show_major(d['major'])
+ raise SecError("gssapi.getMIC returned: %s" % \
+ show_major(d['major']))
p.reset()
p.pack_opaque(data)
p.pack_opaque(d['token'])
@@ -280,14 +280,14 @@ class SecAuthGss(SecFlavor):
data = p.get_buffer() + data
d = gssapi.wrap(self.gss_context, data)
if d['major'] != gssapi.GSS_S_COMPLETE:
- raise SecError, "gssapi.wrap returned: %s" % \
- show_major(d['major'])
+ raise SecError("gssapi.wrap returned: %s" % \
+ show_major(d['major']))
p.reset()
p.pack_opaque(d['msg'])
data = p.get_buffer()
else:
# Not really necessary, should have already raised XDRError
- raise SecError, "Unknown service %i for RPCSEC_GSS" % gss_cred.service
+ raise SecError("Unknown service %i for RPCSEC_GSS" % gss_cred.service)
return data
def unsecure_data(self, data, cred):
@@ -305,14 +305,14 @@ class SecAuthGss(SecFlavor):
p.done()
d = gssapi.verifyMIC(self.gss_context, data, checksum)
if d['major'] != gssapi.GSS_S_COMPLETE:
- raise SecError, "gssapi.verifyMIC returned: %s" % \
- show_major(d['major'])
+ raise SecError("gssapi.verifyMIC returned: %s" % \
+ show_major(d['major']))
p.reset(data)
seqnum = p.unpack_uint()
if seqnum != gss_cred.seq_num:
- raise SecError, \
+ raise SecError(\
"Mismatched seqnum in reply: got %i, expected %i" % \
- (seqnum, gss_cred.seq_num)
+ (seqnum, gss_cred.seq_num))
data = p.get_buffer()[p.get_position():]
elif gss_cred.service == rpc_gss_svc_privacy:
# data = opaque[wrap([gss_seq_num+data])]
@@ -322,18 +322,18 @@ class SecAuthGss(SecFlavor):
p.done()
d = gssapi.unwrap(self.gss_context, data)
if d['major'] != gssapi.GSS_S_COMPLETE:
- raise SecError, "gssapi.unwrap returned %s" % \
- show_major(d['major'])
+ raise SecError("gssapi.unwrap returned %s" % \
+ show_major(d['major']))
p.reset(d['msg'])
seqnum = p.unpack_uint()
if seqnum != gss_cred.seq_num:
- raise SecError, \
+ raise SecError(\
"Mismatched seqnum in reply: got %i, expected %i" % \
- (seqnum, self.gss_cred.seq_num)
+ (seqnum, self.gss_cred.seq_num))
data = p.get_buffer()[p.get_position():]
else:
# Not really necessary, should have already raised XDRError
- raise SecError, "Unknown service %i for RPCSEC_GSS" % gss_cred.service
+ raise SecError("Unknown service %i for RPCSEC_GSS" % gss_cred.service)
return data
def _gss_cred_from_opaque_auth(self, auth):
@@ -361,8 +361,8 @@ class SecAuthGss(SecFlavor):
p.pack_uint(i)
d = gssapi.getMIC(self.gss_context, p.get_buffer())
if d['major'] != gssapi.GSS_S_COMPLETE:
- raise SecError, "gssapi.getMIC returned: %s" % \
- show_major(d['major'])
+ raise SecError("gssapi.getMIC returned: %s" % \
+ show_major(d['major']))
return opaque_auth(RPCSEC_GSS, d['token'])
def check_verf(self, rverf, cred):
diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py
index 064aadd..e854b3b 100755
--- a/nfs4.0/nfs4state.py
+++ b/nfs4.0/nfs4state.py
@@ -146,7 +146,7 @@ class NFSServerState:
def addentry(self, entry):
if not isinstance(entry, self.CacheEntry):
- raise TypeError, "Bad entry: %s" % str(entry)
+ raise TypeError("Bad entry: %s" % str(entry))
if self.exists(x=entry.x) or self.exists(c=entry.c):
raise "Bad Cache"
self.list.append(entry)
@@ -200,7 +200,7 @@ class NFSServerState:
elif isinstance(owner, lock_owner4):
self.openid = openid
else:
- raise TypeError, "Passed in owner = %s" % str(owner)
+ raise TypeError("Passed in owner = %s" % str(owner))
# An owner is confirmed with OpenConfirm, a lock by sending stateid
self.confirmed = False
self.owner = owner
@@ -323,7 +323,7 @@ class NFSServerState:
Conflict will raise NFS4Error.
"""
if not isinstance(owner, open_owner4):
- raise TypeError, "Owner was given as %s" % str(owner)
+ raise TypeError("Owner was given as %s" % str(owner))
info = self.__getinfo(owner)
if not info.confirmed:
# Remove any pending open (RFC 3530 sec 14.2.18)
@@ -380,7 +380,7 @@ class NFSServerState:
def __state2id(self, stateid, checkseq=False):
"""Translate nfs4 stateid to internal id"""
if not isinstance(stateid, stateid4):
- raise TypeError, "State was given as %s" % str(stateid)
+ raise TypeError("State was given as %s" % str(stateid))
# Check for special stateids
if stateid.seqid==0 and stateid.other==chr(0)*12:
return 0
@@ -407,11 +407,11 @@ class NFSServerState:
info = self.__owner2info(owner, allownew)
try:
if fh is None:
- raise ValueError, "File is None"
+ raise ValueError("File is None")
return info.files[fh.handle]
except KeyError:
if not allownew:
- raise ValueError, "File %s not open for %s" % (fh.name, info)
+ raise ValueError("File %s not open for %s" % (fh.name, info))
#print("Creating new id %i for fh %s" % (self.next_id, fh.handle))
id = info.files[fh.handle] = self.next_id
self.next_id += 1
@@ -428,12 +428,12 @@ class NFSServerState:
elif isinstance(owner, lock_owner4):
ownerdict = self.lockowners
else:
- raise TypeError, "Gave owner as %s" % str(owner)
+ raise TypeError("Gave owner as %s" % str(owner))
self.__check_clientid(owner.clientid)
try:
info = ownerdict[owner.clientid][owner.owner]
except KeyError:
- if not allownew: raise ValueError, "Unknown owner %s" % str(owner)
+ if not allownew: raise ValueError("Unknown owner %s" % str(owner))
#print("Creating new info")
info = self.OwnerInfo(owner)
if owner.clientid in ownerdict:
@@ -694,8 +694,8 @@ class NFSFileState:
self.start = start
self.end = end
if start < 0 or end < start:
- raise ValueError, "Bad values for start and end (%s, %s)" % \
- (start, end)
+ raise ValueError("Bad values for start and end (%s, %s)" % \
+ (start, end))
def __repr__(self):
if self.type & 1: str = "READ"
@@ -1478,7 +1478,7 @@ class DirList:
for x in self.list:
if x.name == name:
return x.fh
- raise KeyError, "Invalid key %s" % name
+ raise KeyError("Invalid key %s" % name)
def __setitem__(self, name, fh):
"""Allows self[name] = fh"""
@@ -1499,18 +1499,18 @@ class DirList:
if x.name == name:
self.list.remove(x)
return
- raise KeyError, "Invalid key %s" % name
+ raise KeyError("Invalid key %s" % name)
def getcookie(self, name):
for x in self.list:
if x.name == name:
return x.cookie
- raise KeyError, "Invalid key %s" % name
+ raise KeyError("Invalid key %s" % name)
def readdir(self, cookie):
"""Returns DirEnt list containing all entries larger than cookie"""
if cookie < 0 or cookie > self.__lastcookie:
- raise IndexError, "Invalid cookie %i" % cookie
+ raise IndexError("Invalid cookie %i" % cookie)
i = None
for x in self.list:
if x.cookie > cookie:
diff --git a/nfs4.1/config.py b/nfs4.1/config.py
index 23b5b9a..b4a45d7 100644
--- a/nfs4.1/config.py
+++ b/nfs4.1/config.py
@@ -56,7 +56,7 @@ def _opline(value):
l = value
else:
print(' OPLINE type ', type(value))
- raise TypeError, 'Only type list or str accepted'
+ raise TypeError('Only type list or str accepted')
if l[0] == "ERROR":
if not len(l) == 3:
print(' OPLINE length ', len)
diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py
index 2214c0d..95f84df 100644
--- a/nfs4.1/nfs4state.py
+++ b/nfs4.1/nfs4state.py
@@ -99,8 +99,8 @@ class ByteLock(object):
self.start = start
self.end = end
if start < 0 or end < start:
- raise ValueError, "Bad values for start and end (%s, %s)" % \
- (start, end)
+ raise ValueError("Bad values for start and end (%s, %s)" % \
+ (start, end))
def __repr__(self):
str = ("WRITE" if self.iswrite else "READ")
diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py
index 6353835..0aa1a52 100755
--- a/xdr/xdrgen.py
+++ b/xdr/xdrgen.py
@@ -819,7 +819,7 @@ class Info(object):
(prefix, self.id)
if self.len is not None:
limit = "%sif len(data) > %s:\n" \
- "%s%sraise XDRError, 'array length too long'\n" %\
+ "%s%sraise XDRError('array length too long')\n" %\
(prefix, self.fullname(self.len), prefix, varindent)
array = limit + array
else:
@@ -846,7 +846,7 @@ class Info(object):
(prefix, newdata, self.id)
if self.len is not None:
limit = "%sif len(%s) > %s:\n" \
- "%s%sraise XDRError, 'array length too long'\n" %\
+ "%s%sraise XDRError('array length too long')\n" %\
(prefix, newdata, self.fullname(self.len), prefix, indent)
array += limit
newdata = 'data'
@@ -858,7 +858,7 @@ class Info(object):
prefix, data, subheader, array = self._array_pack(prefix, data)
varlist = ["const.%s" % l.id for l in self.body]
check = "%sif self.check_enum and %s not in [%s]:\n" \
- "%s%sraise XDRError, 'value=%%s not in enum %s' %% %s\n" % \
+ "%s%sraise XDRError('value=%%s not in enum %s' %% %s)\n" % \
(prefix, data, ', '.join(varlist),
prefix, indent, self.id, data)
pack = check + "%sself.pack_int(%s)\n" % (prefix, data)
@@ -868,7 +868,7 @@ class Info(object):
prefix, data, subheader, array = self._array_unpack(prefix, data)
varlist = ["const.%s" % l.id for l in self.body]
check = "%sif self.check_enum and %s not in [%s]:\n" \
- "%s%sraise XDRError, 'value=%%s not in enum %s' %% %s\n" % \
+ "%s%sraise XDRError('value=%%s not in enum %s' %% %s)\n" % \
(prefix, data, ', '.join(varlist),
prefix, indent, self.id, data)
unpack = "%s%s = self.unpack_int()\n" % (prefix, data)
@@ -908,7 +908,7 @@ class Info(object):
if default != []:
pack += default[0].packout(prefix + indent, data)
else:
- pack += "%s%sraise XDRError, 'bad switch=%%s' %% %s.%s\n" % \
+ pack += "%s%sraise XDRError('bad switch=%%s' %% %s.%s)\n" % \
(prefix, indent, data, switch.id)
return subheader + pack + array
@@ -950,7 +950,7 @@ class Info(object):
## (prefix, indent, data, data, default[0].id)
## unpack += arm
else:
- unpack += "%s%sraise XDRError, 'bad switch=%%s' %% %s.%s\n" % \
+ unpack += "%s%sraise XDRError('bad switch=%%s' %% %s.%s)\n" % \
(prefix, indent, data, switch.id)
return subheader + unpack + array
@@ -1220,7 +1220,7 @@ class type_info(Info):
def packout(self, prefix='', data='data'):
check = "%sif %s.%s is None:\n" \
- "%s%sraise TypeError, '%s.%s == None'\n" % \
+ "%s%sraise TypeError('%s.%s == None')\n" % \
(prefix, data, self.id, prefix, indent, data, self.id)
if self.type == 'void':
return prefix + 'pass\n'
@@ -1279,8 +1279,8 @@ class type_info(Info):
limit = ''
else:
limit = "%sif len(%s) > %s and self.check_array:\n" \
- "%s%sraise XDRError, " \
- "'array length too long for %s'\n" % \
+ "%s%sraise XDRError(" \
+ "'array length too long for %s')\n" % \
(prefix, data, self.fullname(self.len), prefix, indent, data)
if self.fixed:
fixchar = 'f'
@@ -1303,8 +1303,8 @@ class type_info(Info):
limit = ''
else:
limit = "%sif len(%s) > %s and self.check_array:\n" \
- "%s%sraise XDRError, " \
- "'array length too long for %s'\n" % \
+ "%s%sraise XDRError(" \
+ "'array length too long for %s')\n" % \
(prefix, data, self.fullname(self.len), prefix, indent, data)
if self.fixed:
fixchar = 'f'
--
2.17.1
^ permalink raw reply related
* [PATCH 03/24] pynfs: python3 support plan: "except E,e:" -> "except E as e:"
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
s/except *([^,]+), *([^ ]+):/except \1 as \2:/
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/lib/rpc/rpc.py | 8 +++---
nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py | 2 +-
nfs4.0/nfs4server.py | 32 +++++++++++------------
nfs4.0/nfs4state.py | 8 +++---
nfs4.0/servertests/st_compound.py | 4 +--
nfs4.0/servertests/st_create.py | 2 +-
nfs4.0/servertests/st_delegation.py | 4 +--
nfs4.0/servertests/st_gss.py | 28 ++++++++++----------
nfs4.0/servertests/st_link.py | 2 +-
nfs4.0/servertests/st_lookup.py | 6 ++---
nfs4.0/servertests/st_readdir.py | 6 ++---
nfs4.0/servertests/st_remove.py | 4 +--
nfs4.0/servertests/st_rename.py | 6 ++---
nfs4.0/testserver.py | 8 +++---
nfs4.1/config.py | 2 +-
nfs4.1/fs.py | 4 +--
nfs4.1/nfs4client.py | 6 ++---
nfs4.1/nfs4server.py | 24 ++++++++---------
nfs4.1/server41tests/st_compound.py | 2 +-
nfs4.1/server41tests/st_create_session.py | 2 +-
nfs4.1/server41tests/st_exchange_id.py | 2 +-
nfs4.1/server41tests/st_lookup.py | 4 +--
nfs4.1/testclient.py | 8 +++---
nfs4.1/testmod.py | 8 +++---
nfs4.1/testserver.py | 8 +++---
rpc/rpc.py | 16 ++++++------
rpc/rpclib.py | 4 +--
rpc/security.py | 8 +++---
28 files changed, 109 insertions(+), 109 deletions(-)
diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py
index 48e3093..83a51c4 100644
--- a/nfs4.0/lib/rpc/rpc.py
+++ b/nfs4.0/lib/rpc/rpc.py
@@ -226,7 +226,7 @@ class RPCClient(object):
try:
sock.bind(('', port))
return
- except socket.error, why:
+ except socket.error as why:
if why[0] == errno.EADDRINUSE:
port += 1
else:
@@ -330,7 +330,7 @@ class RPCClient(object):
self.socket.send_record(header + data)
except socket.timeout:
raise
- except socket.error, e:
+ except socket.error as e:
print("Got error:", e)
if self.debug: print("resend", xid)
try:
@@ -360,7 +360,7 @@ class RPCClient(object):
reply = self.socket.recv_record()
except socket.timeout:
raise
- except socket.error, e:
+ except socket.error as e:
print("Got error:", e)
if self.debug: print("relisten", xid)
try:
@@ -635,7 +635,7 @@ class RPCServer(Server):
self.rpcunpacker.reset(recv_data)
try:
recv_msg = self.rpcunpacker.unpack_rpc_msg()
- except xdrlib.Error, e:
+ except xdrlib.Error as e:
print("XDRError", e)
return
if recv_msg.body.mtype != CALL:
diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py
index 5b5691d..27fc52e 100644
--- a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py
+++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py
@@ -18,7 +18,7 @@ class SecAuthSys(SecFlavor):
p.pack_uint(gid)
p.pack_array(gids, p.pack_uint)
self.cred = p.get_buffer()
- except Error, e:
+ except Error as e:
raise SecError("Packing error: %s", str(e))
self.uid = uid
self.gid = gid
diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py
index d5aea34..cb3ea72 100755
--- a/nfs4.0/nfs4server.py
+++ b/nfs4.0/nfs4server.py
@@ -227,7 +227,7 @@ class NFS4Server(rpc.RPCServer):
raise NFS4Error(NFS4ERR_NOFILEHANDLE)
print(" CLOSE fh", self.curr_fh.handle)
self.state.close(stateid)
- except NFS4Error, e:
+ except NFS4Error as e:
self.state.advance_seqid(stateid, op, (e.code,))
return simple_error(e.code)
# Return a garbage state id
@@ -269,7 +269,7 @@ class NFS4Server(rpc.RPCServer):
attrset = self.curr_fh.create(op.opcreate.objname, op.opcreate.objtype, attrs)
new_cinfo = self.curr_fh.fattr4_change
self.curr_fh = self.curr_fh.lookup(op.opcreate.objname)
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code)
cin4 = change_info4(before=old_cinfo, after=new_cinfo, atomic=1)
c4resok = CREATE4resok(cinfo=cin4, attrset = attrset)
@@ -290,7 +290,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4ERR_NOFILEHANDLE)
attrs = nfs4lib.bitmap2list(op.opgetattr.attr_request)
attrvals = self.curr_fh.get_attributes(attrs)
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code)
garesok = GETATTR4resok(attrvals)
return simple_error(NFS4_OK, garesok)
@@ -351,7 +351,7 @@ class NFS4Server(rpc.RPCServer):
self.state.new_lockowner(op.oplock.locker.open_owner)
stateid = self.state.lock(self.curr_fh, owner, op.oplock.locktype,
op.oplock.offset, op.oplock.length)
- except NFS4Error, e:
+ except NFS4Error as e:
if op.oplock.locker.new_lock_owner:
# FIXME - a bug? compare with replay=check_seqid() above
self.state.advance_seqid(openstateid, op, (e.code,))
@@ -376,7 +376,7 @@ class NFS4Server(rpc.RPCServer):
self.state.testlock(self.curr_fh,
op.oplockt.owner, op.oplockt.locktype,
op.oplockt.offset, op.oplockt.length)
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code, e.lock_denied)
return simple_error(NFS4_OK)
@@ -393,7 +393,7 @@ class NFS4Server(rpc.RPCServer):
raise NFS4Error(NFS4ERR_NOFILEHANDLE)
sid = self.state.unlock(self.curr_fh, stateid, op.oplocku.locktype,
op.oplocku.offset, op.oplocku.length)
- except NFS4Error, e:
+ except NFS4Error as e:
self.state.advance_seqid(stateid, op, (e.code,))
return simple_error(e.code)
self.state.advance_seqid(stateid, op, (NFS4_OK, sid), self.curr_fh)
@@ -438,7 +438,7 @@ class NFS4Server(rpc.RPCServer):
if FATTR4_RDATTR_ERROR in attrreq:
return simple_error(NFS4ERR_INVAL)
attrvals = self.curr_fh.get_attributes(attrreq.keys(), ignore=False)
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code)
if attrvals == attrreq:
return simple_error(NFS4ERR_SAME)
@@ -524,7 +524,7 @@ class NFS4Server(rpc.RPCServer):
# 'existing' now points to a valid file, so check and set shares
sid, flags = self.state.open(existing, owner,
op.opopen.share_access, op.opopen.share_deny)
- except NFS4Error, e:
+ except NFS4Error as e:
print("Open error")
self.state.advance_seqid(owner, op, (e.code,))
return simple_error(e.code)
@@ -560,7 +560,7 @@ class NFS4Server(rpc.RPCServer):
if self.curr_fh.get_type() != NF4REG:
raise NFS4Error(NFS4ERR_INVAL)
sid = self.state.confirm(self.curr_fh, stateid)
- except NFS4Error, e:
+ except NFS4Error as e:
self.state.advance_seqid(stateid, op, (e.code,))
return simple_error(e.code)
oc4resok = OPEN_CONFIRM4resok(sid)
@@ -583,7 +583,7 @@ class NFS4Server(rpc.RPCServer):
sid = self.state.downgrade(self.curr_fh, stateid,
op.opopen_downgrade.share_access,
op.opopen_downgrade.share_deny)
- except NFS4Error, e:
+ except NFS4Error as e:
self.state.advance_seqid(stateid, op, (e.code,))
return simple_error(e.code)
od4resok = OPEN_DOWNGRADE4resok(sid)
@@ -626,7 +626,7 @@ class NFS4Server(rpc.RPCServer):
offset, count)
read_data = self.curr_fh.read(offset, count)
print(" READ DATA: len=%i" % len(read_data))
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code)
if len(read_data) < count:
read_eof = 1
@@ -693,7 +693,7 @@ class NFS4Server(rpc.RPCServer):
d4 = dirlist4(e4, eof=0)
else:
d4 = dirlist4(e4, eof=1)
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code)
rdresok = READDIR4resok(cookieverf=verifier, reply=d4)
return simple_error(NFS4_OK, rdresok)
@@ -777,7 +777,7 @@ class NFS4Server(rpc.RPCServer):
def op_renew(self, op):
try:
self.state.renew(op.oprenew.clientid)
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code)
return simple_error(NFS4_OK)
@@ -830,7 +830,7 @@ class NFS4Server(rpc.RPCServer):
self.state.check_write(self.curr_fh, op.opsetattr.stateid,
offset, length)
attrset = self.curr_fh.set_attributes(attrdict)
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code, e.attrs)
return simple_error(NFS4_OK, attrset)
@@ -908,7 +908,7 @@ class NFS4Server(rpc.RPCServer):
if FATTR4_RDATTR_ERROR in attrreq:
return simple_error(NFS4ERR_INVAL)
attrvals = self.curr_fh.get_attributes(attrreq.keys(), ignore=False)
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code)
if attrvals == attrreq:
return simple_error(NFS4_OK)
@@ -935,7 +935,7 @@ class NFS4Server(rpc.RPCServer):
offset, len(data))
count = self.curr_fh.write(offset, data)
print(" wrote %i bytes" % count)
- except NFS4Error, e:
+ except NFS4Error as e:
return simple_error(e.code)
w4resok = WRITE4resok(count, FILE_SYNC4, self.state.write_verifier)
return simple_error(NFS4_OK, w4resok)
diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py
index fb3fd5c..064aadd 100755
--- a/nfs4.0/nfs4state.py
+++ b/nfs4.0/nfs4state.py
@@ -249,7 +249,7 @@ class NFSServerState:
mustexist = True
try:
info = self.__getinfo(obj, allownew=not mustexist)
- except ValueError, e:
+ except ValueError as e:
if mustexist: raise
#print(" check_seqid: %s" % info)
if info is None:
@@ -286,7 +286,7 @@ class NFSServerState:
# RFC 3530 sec 8.1.5
try:
info = self.__getinfo(owner)
- except (ValueError, NFS4Error):
+ except (ValueError as NFS4Error):
# An unknown owner, do nothing
return
if info is None:
@@ -1132,7 +1132,7 @@ class VirtualHandle(NFSFileHandle):
except AttributeError:
# Otherwise, just set the variable
setattr(self, name, attrdict[attr])
- except NFS4Error, e:
+ except NFS4Error as e:
# Note attributes set so far in any error that occurred
e.attrs = mapping(ret_list)
raise
@@ -1170,7 +1170,7 @@ class VirtualHandle(NFSFileHandle):
if POSIXACL:
try:
nfs4acl.maps_to_posix(acl)
- except nfs4acl.ACLError, e:
+ except nfs4acl.ACLError as e:
print("*"*50)
print(e)
print("*"*50)
diff --git a/nfs4.0/servertests/st_compound.py b/nfs4.0/servertests/st_compound.py
index 4919289..59a279d 100644
--- a/nfs4.0/servertests/st_compound.py
+++ b/nfs4.0/servertests/st_compound.py
@@ -82,7 +82,7 @@ def testUndefined(t, env):
try:
res = c.compound([nfs_argop4(argop=opnum)])
check(res, NFS4ERR_OP_ILLEGAL, "Sent illegal op=%i" % opnum)
- except RPCError, e:
+ except RPCError as e:
t.fail("COMPOUND with illegal op=%i got %s, "
"expected NFS4ERR_OP_ILLEGAL" % (opnum,e))
finally:
@@ -106,6 +106,6 @@ def testLongCompound(t, env):
"COMPOUND with len=%i argarry" % (3*count))
if res.status == NFS4ERR_RESOURCE:
return
- except RPCError, e:
+ except RPCError as e:
t.fail("COMPOUND with len=%i argarry got %s, "
"expected NFS4ERR_RESOURCE" % (3*count, e))
diff --git a/nfs4.0/servertests/st_create.py b/nfs4.0/servertests/st_create.py
index 7017fdf..ac57aaf 100644
--- a/nfs4.0/servertests/st_create.py
+++ b/nfs4.0/servertests/st_create.py
@@ -290,5 +290,5 @@ def testLongName(t, env):
(x, rejected_names_create) = self.try_file_names(creator=self.create_via_create)
self.failIf(rejected_names_open != rejected_names_create,
"CREATE does not obey OPEN naming policy")
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py
index a2bce04..8e0d891 100644
--- a/nfs4.0/servertests/st_delegation.py
+++ b/nfs4.0/servertests/st_delegation.py
@@ -21,7 +21,7 @@ class _handle_error(object):
_lock.acquire()
try:
self.c.compound(ops)
- except Exception, e:
+ except Exception as e:
print("CALLBACK error in _recall:", e)
pass
_lock.release()
@@ -33,7 +33,7 @@ def _recall(c, thisop, cbid):
_lock.acquire()
try:
res = c.compound(ops)
- except Exception, e:
+ except Exception as e:
print("CALLBACK error in _recall:", e)
res = None
_lock.release()
diff --git a/nfs4.0/servertests/st_gss.py b/nfs4.0/servertests/st_gss.py
index c67a802..414883e 100644
--- a/nfs4.0/servertests/st_gss.py
+++ b/nfs4.0/servertests/st_gss.py
@@ -109,11 +109,11 @@ def testInconsistentGssSeqnum(t, env):
try:
res = c.compound([op.putrootfh()])
e = "operation erroneously suceeding"
- except rpc.RPCAcceptError, e:
+ except rpc.RPCAcceptError as e:
if e.stat == rpc.GARBAGE_ARGS:
# This is correct response
return
- except Exception, e:
+ except Exception as e:
pass
t.fail("Using inconsistent gss_seq_nums in header and body of message "
"should return GARBAGE_ARGS, instead got %s" % e)
@@ -138,11 +138,11 @@ def testBadVerfChecksum(t, env):
try:
res = c.compound([op.putrootfh()])
e = "peration erroneously suceeding"
- except rpc.RPCDeniedError, e:
+ except rpc.RPCDeniedError as e:
if e.stat == rpc.AUTH_ERROR and e.astat == rpc.RPCSEC_GSS_CREDPROBLEM:
# This is correct response
return
- except Exception, e:
+ except Exception as e:
pass
t.fail("Using bad verifier checksum in header "
"should return RPCSEC_GSS_CREDPROBLEM, instead got %s" % e)
@@ -174,11 +174,11 @@ def testBadDataChecksum(t, env):
try:
res = c.compound([op.putrootfh()])
e = "operation erroneously suceeding"
- except rpc.RPCAcceptError, e:
+ except rpc.RPCAcceptError as e:
if e.stat == rpc.GARBAGE_ARGS:
# This is correct response
return
- except Exception, e:
+ except Exception as e:
pass
t.fail("Using bad data checksum for body of message "
"should return GARBAGE_ARGS, instead got %s" % e)
@@ -214,11 +214,11 @@ def testBadVersion(t, env):
try:
res = c.compound([op.putrootfh()])
e = "operation erroneously suceeding"
- except rpc.RPCDeniedError, e:
+ except rpc.RPCDeniedError as e:
if e.stat == rpc.AUTH_ERROR and e.astat == rpc.AUTH_BADCRED:
# This is correct response
e = None
- except Exception, e:
+ except Exception as e:
pass
if e is not None:
t.fail("Using bad gss version number %i "
@@ -241,11 +241,11 @@ def testHighSeqNum(t, env):
try:
res = c.compound([op.putrootfh()])
e = "operation erroneously suceeding"
- except rpc.RPCDeniedError, e:
+ except rpc.RPCDeniedError as e:
if e.stat == rpc.AUTH_ERROR and e.astat == rpc.RPCSEC_GSS_CTXPROBLEM:
# This is correct response
return
- except Exception, e:
+ except Exception as e:
pass
t.fail("Using gss_seq_num over MAXSEQ "
"should return RPCSEC_GSS_CTXPROBLEM, instead got %s" % e)
@@ -279,11 +279,11 @@ def testBadProcedure(t, env):
try:
res = c.compound([op.putrootfh()])
e = "operation erroneously suceeding"
- except rpc.RPCDeniedError, e:
+ except rpc.RPCDeniedError as e:
if e.stat == rpc.AUTH_ERROR and e.astat == rpc.AUTH_BADCRED:
# This is correct response
e = None
- except Exception, e:
+ except Exception as e:
pass
if e is not None:
t.fail("Using bad gss procedure number %i "
@@ -321,11 +321,11 @@ def testBadService(t, env):
try:
res = c.compound([op.putrootfh()])
e = "operation erroneously suceeding"
- except rpc.RPCDeniedError, e:
+ except rpc.RPCDeniedError as e:
if e.stat == rpc.AUTH_ERROR and e.astat == rpc.AUTH_BADCRED:
# This is correct response
e = None
- except Exception, e:
+ except Exception as e:
pass
if e is not None:
t.fail("Using bad gss service number %i "
diff --git a/nfs4.0/servertests/st_link.py b/nfs4.0/servertests/st_link.py
index 49e0538..feddf1e 100644
--- a/nfs4.0/servertests/st_link.py
+++ b/nfs4.0/servertests/st_link.py
@@ -264,6 +264,6 @@ def testDots(t, env):
(x, rejected_names_link) = self.try_file_names(creator=self.create_via_link)
self.failIf(rejected_names_open != rejected_names_link,
"LINK does not obey OPEN naming policy")
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
diff --git a/nfs4.0/servertests/st_lookup.py b/nfs4.0/servertests/st_lookup.py
index c3203f9..cd1b93c 100644
--- a/nfs4.0/servertests/st_lookup.py
+++ b/nfs4.0/servertests/st_lookup.py
@@ -312,7 +312,7 @@ def testBadOpaque(t, env):
res = c.compound([op.putrootfh(), op.lookup("setlength=0xcccccccc")])
e = "operation erroneously suceeding"
check(res, NFS4ERR_BADXDR)
- except rpc.RPCAcceptError, e:
+ except rpc.RPCAcceptError as e:
if e.stat == rpc.GARBAGE_ARGS:
# This is correct response
return
@@ -336,7 +336,7 @@ def testBadOpaque(t, env):
# Saved files for LOOKUP
try:
(accepted_names, rejected_names) = self.try_file_names(0)
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
# Ok, lets try LOOKUP on all accepted names
@@ -363,7 +363,7 @@ def testBadOpaque(t, env):
try:
(accepted_names, rejected_names) = self.try_file_names()
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
# Ok, lets try LOOKUP on all rejected names
diff --git a/nfs4.0/servertests/st_readdir.py b/nfs4.0/servertests/st_readdir.py
index a88c370..5a70145 100644
--- a/nfs4.0/servertests/st_readdir.py
+++ b/nfs4.0/servertests/st_readdir.py
@@ -272,7 +272,7 @@ def testUnaccessibleDirAttrs(t, env):
try:
(accepted_names, rejected_names) = self.try_file_names(remove_files=0)
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
fh = self.do_rpc(self.ncl.do_getfh, self.tmp_dir)
@@ -309,11 +309,11 @@ def testUnaccessibleDirAttrs(t, env):
try:
(accepted_names, rejected_names) = self.small_try_file_names(remove_files=0)
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
try: self.clean_dir(self.tmp_dir)
- except SkipException, e:
+ except SkipException as e:
self.fail(e)
def small_try_file_names(self, remove_files=1, creator=None):
diff --git a/nfs4.0/servertests/st_remove.py b/nfs4.0/servertests/st_remove.py
index 076ca41..5f531f4 100644
--- a/nfs4.0/servertests/st_remove.py
+++ b/nfs4.0/servertests/st_remove.py
@@ -274,7 +274,7 @@ def testNotEmpty(t, env):
# Save files for REMOVE
try:
(accepted_names, rejected_names) = self.try_file_names(remove_files=0)
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
# Ok, lets try REMOVE on all accepted names
@@ -299,7 +299,7 @@ def testNotEmpty(t, env):
self.init_connection()
try:
(accepted_names, rejected_names) = self.try_file_names()
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
# Ok, lets try REMOVE on all rejected names
diff --git a/nfs4.0/servertests/st_rename.py b/nfs4.0/servertests/st_rename.py
index 5698a8c..8f41763 100644
--- a/nfs4.0/servertests/st_rename.py
+++ b/nfs4.0/servertests/st_rename.py
@@ -534,7 +534,7 @@ def testLinkRename(t, env):
(x, rejected_names_rename) = self.try_file_names(creator=self.create_via_rename)
self.failIf(rejected_names_open != rejected_names_rename,
"RENAME does not obey OPEN naming policy")
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
def testValidNames(t, env):
@@ -550,7 +550,7 @@ def testLinkRename(t, env):
# Saved files for
try:
(accepted_names, rejected_names) = self.try_file_names(remove_files=0)
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
# Ok, lets try RENAME on all accepted names
@@ -573,7 +573,7 @@ def testLinkRename(t, env):
try:
(accepted_names, rejected_names) = self.try_file_names()
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
# Ok, lets try RENAME on all rejected names
diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py
index c049a5a..96012a1 100755
--- a/nfs4.0/testserver.py
+++ b/nfs4.0/testserver.py
@@ -297,7 +297,7 @@ def main():
p.error("Can't use dir for --%s" %attr)
try:
path = unixpath2comps(path)
- except Exception, e:
+ except Exception as e:
p.error(e)
setattr(opt, attr, [comp for comp in path if comp])
@@ -341,12 +341,12 @@ def main():
try:
env = environment.Environment(opt)
env.init()
- except socket.gaierror, e:
+ except socket.gaierror as e:
if e.args[0] == -2:
print("Unknown server '%s'" % opt.server)
print(sys.exc_info()[1])
sys.exit(1)
- except Exception, e:
+ except Exception as e:
print("Initialization failed, no tests run.")
if not opt.maketree:
print("Perhaps you need to use the --maketree option")
@@ -367,7 +367,7 @@ def main():
try:
fail = False
env.finish()
- except Exception, e:
+ except Exception as e:
fail = True
nfail = testmod.printresults(tests, opt)
if fail:
diff --git a/nfs4.1/config.py b/nfs4.1/config.py
index 1dbb2ac..23b5b9a 100644
--- a/nfs4.1/config.py
+++ b/nfs4.1/config.py
@@ -74,7 +74,7 @@ class ConfigLine(object):
def _set_value(self, value):
try:
self._value = self.verify(value)
- except ConfigAction, e:
+ except ConfigAction as e:
e.name = self.name
e.value = value
raise
diff --git a/nfs4.1/fs.py b/nfs4.1/fs.py
index 8947014..d9b58f2 100644
--- a/nfs4.1/fs.py
+++ b/nfs4.1/fs.py
@@ -323,7 +323,7 @@ class FSObject(object):
base = self.meta
try:
setattr(base, name, attrs[attr])
- except NFS4Error, e:
+ except NFS4Error as e:
# Note attributes set so far in any error that occurred
e.attrs = bitmap
raise
@@ -747,7 +747,7 @@ class ConfigObj(FSObject):
return
try:
self.configline.value = lines[0]
- except ConfigAction, e:
+ except ConfigAction as e:
if e.name == "reboot":
self.fs.server.reboot()
except:
diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index 3e28103..708850d 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -161,7 +161,7 @@ class NFS4Client(rpc.Client, rpc.Server):
env.results.cache.results))
env.cache.data = p.get_buffer()
env.cache.valid.set()
- except NFS4Replay, e:
+ except NFS4Replay as e:
log_cb.info("Replay...waiting for valid data")
e.cache.valid.wait()
log_cb.info("Replay...sending data")
@@ -183,7 +183,7 @@ class NFS4Client(rpc.Client, rpc.Server):
return env
try:
self.check_utf8str_cs(args.tag)
- except NFS4Errror, e:
+ except NFS4Errror as e:
env.results.set_empty_return(e.status, "Invalid utf8 tag")
return env
# Handle the individual operations
@@ -202,7 +202,7 @@ class NFS4Client(rpc.Client, rpc.Server):
try:
# Otherwise, call the function
result = funct(arg, env)
- except NFS4Error, e:
+ except NFS4Error as e:
# XXX NOTE this only works for error returns that
# include no data. Must ensure others (eg setattr)
# catch error themselves to encode properly.
diff --git a/nfs4.1/nfs4server.py b/nfs4.1/nfs4server.py
index 8856a82..f8bd251 100755
--- a/nfs4.1/nfs4server.py
+++ b/nfs4.1/nfs4server.py
@@ -350,7 +350,7 @@ class ClientRecord(object):
state.delete()
# STUB - what about LAYOUT?
# STUB - config whether DELEG OK or not
- except StandardError, e:
+ except StandardError as e:
log_41.exception("Ignoring problem during state removal")
self.state = {}
self.lastused = time.time()
@@ -721,7 +721,7 @@ class NFS4Server(rpc.Server):
env.results.cache.results))
env.cache.data = p.get_buffer()
env.cache.valid.set()
- except NFS4Replay, e:
+ except NFS4Replay as e:
log_41.info("Replay...waiting for valid data")
e.cache.valid.wait()
log_41.info("Replay...sending data")
@@ -808,7 +808,7 @@ class NFS4Server(rpc.Server):
return env
try:
self.check_utf8str_cs(args.tag)
- except NFS4Errror, e:
+ except NFS4Errror as e:
env.results.set_empty_return(e.status, "Invalid utf8 tag")
return env
# Handle the individual operations
@@ -828,7 +828,7 @@ class NFS4Server(rpc.Server):
try:
# Otherwise, call the function
result = funct(arg, env)
- except NFS4Error, e:
+ except NFS4Error as e:
# XXX NOTE this only works for error returns that
# include no data. Must ensure others (eg setattr)
# catch error themselves to encode properly.
@@ -876,7 +876,7 @@ class NFS4Server(rpc.Server):
# We have a session. Check for injected errors
try:
self.check_opsconfig(env, "sequence")
- except NFS4Error, e:
+ except NFS4Error as e:
self.error_set_session(session, arg.sa_sessionid, e.status)
# Check connection binding
@@ -962,7 +962,7 @@ class NFS4Server(rpc.Server):
self.cb_null(session.cb_prog, connection, credinfo=None)
flags |= CREATE_SESSION4_FLAG_CONN_BACK_CHAN
cb_channel.connections.append(connection)
- except rpc.RPCError, e:
+ except rpc.RPCError as e:
log_41.warn("cb_null failed with %r, no backchannel created", e)
# STUB: backchannel is down: set sequence bits, disable layouts, etc.
pass
@@ -1604,7 +1604,7 @@ class NFS4Server(rpc.Server):
finally:
state.mark_done_writing()
return encode_status(NFS4_OK, bitmap)
- except NFS4Error, e:
+ except NFS4Error as e:
# SETATTR failure does not encode just status
return encode_status(e.status, e.attrs)
@@ -1702,7 +1702,7 @@ class NFS4Server(rpc.Server):
if FATTR4_RDATTR_ERROR in attrreq:
raise NFS4Error(NFS4ERR_INVAL)
attrvals = self.get_attributes(env.cfh, attrreq.keys(), ignore=False)
- except NFS4Error, e:
+ except NFS4Error as e:
return encode_status(e.code)
if attrvals == attrreq:
return encode_status(NFS4ERR_SAME)
@@ -1717,7 +1717,7 @@ class NFS4Server(rpc.Server):
if FATTR4_RDATTR_ERROR in attrreq:
raise NFS4Error(NFS4ERR_INVAL)
attrvals = self.get_attributes(env.cfh, attrreq.keys(), ignore=False)
- except NFS4Error, e:
+ except NFS4Error as e:
return encode_status(e.code)
if attrvals != attrreq:
return encode_status(NFS4ERR_NOT_SAME)
@@ -1806,7 +1806,7 @@ class NFS4Server(rpc.Server):
with find_state(env, arg.lock_stateid, allow_0=False) as state:
state.add_lock(arg.locktype, arg.offset, end)
stateid = state.get_id()
- except NFS4Error, e:
+ except NFS4Error as e:
return encode_status(e.status, denied=e.lock_denied)
l4resok = LOCK4resok(stateid)
return encode_status(NFS4_OK, l4resok)
@@ -1820,7 +1820,7 @@ class NFS4Server(rpc.Server):
with env.cfh.state:
env.cfh.state.test_lock(env.session.client, arg.owner.owner,
arg.locktype, arg.offset, end)
- except NFS4Error, e:
+ except NFS4Error as e:
return encode_status(e.status, denied=e.lock_denied)
return encode_status(NFS4_OK)
@@ -1904,7 +1904,7 @@ class NFS4Server(rpc.Server):
return_on_close = False
res = LAYOUTGET4resok(return_on_close, entry.get_id(), [layout])
return encode_status(NFS4_OK, res)
- except NFS4Error, e:
+ except NFS4Error as e:
# LAYOUTGET failure does not encode just status
if e.status == NFS4ERR_LAYOUTTRYLATER:
return encode_status(e.status, None, False)
diff --git a/nfs4.1/server41tests/st_compound.py b/nfs4.1/server41tests/st_compound.py
index 05ad5b3..3915dd8 100644
--- a/nfs4.1/server41tests/st_compound.py
+++ b/nfs4.1/server41tests/st_compound.py
@@ -118,7 +118,7 @@ def testUndefined(t, env):
check(res, NFS4ERR_OP_ILLEGAL)
if res.resarray[-1].resop != OP_ILLEGAL:
t.fail('Server echoed invalid opcode: Should return OP_ILLEGAL')
- except RPCAcceptError, e:
+ except RPCAcceptError as e:
if e.stat == GARBAGE_ARGS:
pass
else:
diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
index 2ab8ba0..5018ec6 100644
--- a/nfs4.1/server41tests/st_create_session.py
+++ b/nfs4.1/server41tests/st_create_session.py
@@ -311,7 +311,7 @@ def testRdmaArray2(t, env):
try:
res = c.listen(xid)
print(res)
- except RPCAcceptError, e:
+ except RPCAcceptError as e:
if e.stat == GARBAGE_ARGS:
# Legitimate return
return
diff --git a/nfs4.1/server41tests/st_exchange_id.py b/nfs4.1/server41tests/st_exchange_id.py
index 68f3b09..9becec6 100644
--- a/nfs4.1/server41tests/st_exchange_id.py
+++ b/nfs4.1/server41tests/st_exchange_id.py
@@ -119,7 +119,7 @@ def testLongArray(t, env):
try:
res = c.listen(xid)
print(res)
- except RPCAcceptError, e:
+ except RPCAcceptError as e:
if e.stat == GARBAGE_ARGS:
# Legitimate return
return
diff --git a/nfs4.1/server41tests/st_lookup.py b/nfs4.1/server41tests/st_lookup.py
index 7ba6918..9f50004 100644
--- a/nfs4.1/server41tests/st_lookup.py
+++ b/nfs4.1/server41tests/st_lookup.py
@@ -360,7 +360,7 @@ if 0:
# Saved files for LOOKUP
try:
(accepted_names, rejected_names) = self.try_file_names(0)
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
# Ok, lets try LOOKUP on all accepted names
@@ -387,7 +387,7 @@ if 0:
try:
(accepted_names, rejected_names) = self.try_file_names()
- except SkipException, e:
+ except SkipException as e:
self.skip(e)
# Ok, lets try LOOKUP on all rejected names
diff --git a/nfs4.1/testclient.py b/nfs4.1/testclient.py
index 8a1be9f..1027fa6 100755
--- a/nfs4.1/testclient.py
+++ b/nfs4.1/testclient.py
@@ -257,7 +257,7 @@ def main():
p.error("Can't use dir for --%s" %attr)
try:
path = nfs4lib.path_components(path)
- except Exception, e:
+ except Exception as e:
p.error(e)
setattr(opt, attr, [comp for comp in path if comp])
@@ -301,11 +301,11 @@ def main():
try:
env = environment.Environment(opt)
env.init()
- except socket.gaierror, e:
+ except socket.gaierror as e:
if e.args[0] == -2:
print("Unknown server '%s'" % opt.server)
sys.exit(1)
- except Exception, e:
+ except Exception as e:
print("Initialization failed, no tests run.")
if not opt.maketree:
print("Perhaps you need to use the --maketree option")
@@ -326,7 +326,7 @@ def main():
try:
fail = False
env.finish()
- except Exception, e:
+ except Exception as e:
fail = True
testmod.printresults(tests, opt)
if fail:
diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
index a8b4a82..8108a23 100644
--- a/nfs4.1/testmod.py
+++ b/nfs4.1/testmod.py
@@ -226,19 +226,19 @@ class Test(object):
environment.clean_clients()
except KeyboardInterrupt:
raise
- except TestException, e:
+ except TestException as e:
self.result = Result(e.type, e, sys.exc_info())
- except StandardError, e:
+ except StandardError as e:
if verbose:
print_exc()
self.result = Result(TEST_FAIL, '', sys.exc_info())
self.result.msg = self.result.tb[-1]
- except Exception, e:
+ except Exception as e:
self.result = Result(TEST_FAIL, e, sys.exc_info())
self.result.msg = self.result.tb[-1]
try:
environment.shutDown()
- except StandardError, e:
+ except StandardError as e:
self.result = Result(TEST_FAIL, '', sys.exc_info())
self.result.msg = self.result.tb[-1]
diff --git a/nfs4.1/testserver.py b/nfs4.1/testserver.py
index 70b4f62..101cfb1 100755
--- a/nfs4.1/testserver.py
+++ b/nfs4.1/testserver.py
@@ -269,7 +269,7 @@ def main():
p.error("Can't use dir for --%s" %attr)
try:
path = nfs4lib.path_components(path)
- except Exception, e:
+ except Exception as e:
p.error(e)
setattr(opt, attr, [comp for comp in path if comp])
@@ -320,12 +320,12 @@ def main():
try:
env = environment.Environment(opt)
env.init()
- except socket.gaierror, e:
+ except socket.gaierror as e:
if e.args[0] == -2:
print("Unknown server '%s'" % opt.server)
print(sys.exc_info()[1])
sys.exit(1)
- except Exception, e:
+ except Exception as e:
print("Initialization failed, no tests run.")
if not opt.maketree:
print("Perhaps you need to use the --maketree option")
@@ -346,7 +346,7 @@ def main():
try:
fail = False
env.finish()
- except Exception, e:
+ except Exception as e:
fail = True
testmod.printresults(tests, opt)
if fail:
diff --git a/rpc/rpc.py b/rpc/rpc.py
index e06dbbf..834fedd 100644
--- a/rpc/rpc.py
+++ b/rpc/rpc.py
@@ -169,7 +169,7 @@ class Alarm(object):
self._s.setblocking(0)
try:
self._s.connect(address)
- except socket.error, e:
+ except socket.error as e:
if e.args[0] in [EINPROGRESS, EWOULDBLOCK]:
# address has not yet called accept, since this is done in a
# single thread, so get "op in progress error". When the
@@ -330,7 +330,7 @@ class Pipe(object):
raise RuntimeError
try:
count = self._s.send(self._write_buf)
- except socket.error, e:
+ except socket.error as e:
log_p.error("flush_pipe got exception %s" % str(e))
return True # This is to stop retries
self._write_buf = self._write_buf[count:]
@@ -513,13 +513,13 @@ class ConnectionHandler(object):
for fd in w:
try:
self._event_write(fd)
- except socket.error, e:
+ except socket.error as e:
self._event_close(fd)
for fd in r:
if fd in self.listeners:
try:
self._event_connect_incoming(fd)
- except socket.error, e:
+ except socket.error as e:
self._event_close(fd)
elif fd == self._alarm_poll.fileno():
commands = self._alarm_poll.recv(self.rsize)
@@ -527,7 +527,7 @@ class ConnectionHandler(object):
data = self._alarm.pop()
try:
switch[c](data)
- except socket.error, e:
+ except socket.error as e:
self._event_close(fd)
else:
try:
@@ -557,7 +557,7 @@ class ConnectionHandler(object):
s.setblocking(0)
else:
csock, caddr = s.accept()
- except socket.error, e:
+ except socket.error as e:
log_p.error("accept() got error %s" % str(e))
return
csock.setblocking(0)
@@ -700,7 +700,7 @@ class ConnectionHandler(object):
# Silently drop the request
self._notify_drop()
return
- except rpclib.RPCFlowContol, e:
+ except rpclib.RPCFlowContol as e:
body, data = e.body()
except Exception:
log_t.warn("Unexpected exception", exc_info=True)
@@ -832,7 +832,7 @@ class ConnectionHandler(object):
try:
s.bind(('', using))
return
- except socket.error, why:
+ except socket.error as why:
if why[0] == errno.EADDRINUSE:
using += 1
if port < 1024 <= using:
diff --git a/rpc/rpclib.py b/rpc/rpclib.py
index e7bb965..e738870 100644
--- a/rpc/rpclib.py
+++ b/rpc/rpclib.py
@@ -33,7 +33,7 @@ class RPCDeniedReply(RPCFlowContol):
else:
# Something has gone haywire
rreply = rejected_reply(AUTH_ERROR, astat=AUTH_FAILED)
- except Exception, e:
+ except Exception as e:
log.critical("Oops, encountered bug", exc_info=True)
rreply = rejected_reply(AUTH_ERROR, astat=AUTH_FAILED)
return reply_body(MSG_DENIED, rreply=rreply), ''
@@ -52,7 +52,7 @@ class RPCUnsuccessfulReply(RPCFlowContol):
data = rpc_reply_data(self.stat)
if self.stat == PROG_MISMATCH:
data.mismatch_info = rpc_mismatch_info(*self.statdata)
- except Exception, e:
+ except Exception as e:
log.critical("Oops, encountered bug", exc_info=True)
data = rpc_reply_data(SYSTEM_ERR)
areply = accepted_reply(NULL_CRED, data)
diff --git a/rpc/security.py b/rpc/security.py
index 1bfb920..896d7a2 100644
--- a/rpc/security.py
+++ b/rpc/security.py
@@ -379,7 +379,7 @@ class AuthGss(AuthNone):
else:
# Can't get here, but doesn't hurt
log_gss.error("Unknown service %i for RPCSEC_GSS" % cred.service)
- except gssapi.Error, e:
+ except gssapi.Error as e:
log_gss.warn("unsecure_data: gssapi call returned %s" % e.name)
raise rpclib.RPCUnsuccessfulReply(GARBAGE_ARGS)
return data
@@ -413,7 +413,7 @@ class AuthGss(AuthNone):
else:
# Can't get here, but doesn't hurt
log_gss.error("Unknown service %i for RPCSEC_GSS" % cred.service)
- except gssapi.Error, e:
+ except gssapi.Error as e:
# XXX What now?
log_gss.warn("secure_data: gssapi call returned %s" % e.name)
raise
@@ -449,7 +449,7 @@ class AuthGss(AuthNone):
data = self.partially_packed_header(xid, body)
try:
qop = self._get_context(body.cred.body.handle).verifyMIC(data, body.verf.body)
- except gssapi.Error, e:
+ except gssapi.Error as e:
log_gss.warn("Verifier checksum failed verification with %s" %
e.name)
return False
@@ -522,7 +522,7 @@ class AuthGss(AuthNone):
context = self._get_context(cred.body.handle)
try:
token = context.accept(token)
- except gssapi.Error, e:
+ except gssapi.Error as e:
log_gss.debug("RPCSEC_GSS_INIT failed (%s, %i)!" %
(e.name, e.minor))
res = rpc_gss_init_res('', e.major, e.minor, 0, '')
--
2.17.1
^ permalink raw reply related
* [PATCH 01/24] pynfs: python3 support plan: print -> print()
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
From: "Jianhong.Yin" <yin-jianhong@163.com>
'/print / {:lop /[^\\]$/! {N; b lop}; s/print /print(/; s/$/)/; }'
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.0/lib/rpc/rpc.py | 56 +++----
nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py | 8 +-
nfs4.0/nfs4acl.py | 2 +-
nfs4.0/nfs4client.py | 14 +-
nfs4.0/nfs4lib.py | 18 +--
nfs4.0/nfs4server.py | 168 ++++++++++-----------
nfs4.0/nfs4state.py | 32 ++--
nfs4.0/servertests/environment.py | 14 +-
nfs4.0/servertests/st_delegation.py | 6 +-
nfs4.0/servertests/st_fslocations.py | 22 +--
nfs4.0/servertests/st_getattr.py | 10 +-
nfs4.0/servertests/st_reboot.py | 2 +-
nfs4.0/testserver.py | 30 ++--
nfs4.1/block.py | 8 +-
nfs4.1/client41tests/ct_reboot.py | 10 +-
nfs4.1/client41tests/environment.py | 4 +-
nfs4.1/config.py | 10 +-
nfs4.1/errorparser.py | 2 +-
nfs4.1/locking.py | 6 +-
nfs4.1/nfs4lib.py | 6 +-
nfs4.1/nfs4proxy.py | 2 +-
nfs4.1/nfs4server.py | 14 +-
nfs4.1/server41tests/environment.py | 8 +-
nfs4.1/server41tests/st_block.py | 24 +--
nfs4.1/server41tests/st_create_session.py | 6 +-
nfs4.1/server41tests/st_debug.py | 10 +-
nfs4.1/server41tests/st_destroy_session.py | 2 +-
nfs4.1/server41tests/st_exchange_id.py | 4 +-
nfs4.1/server41tests/st_getdevicelist.py | 14 +-
nfs4.1/server41tests/st_secinfo_no_name.py | 2 +-
nfs4.1/setup.py | 6 +-
nfs4.1/testclient.py | 30 ++--
nfs4.1/testmod.py | 29 ++--
nfs4.1/testserver.py | 30 ++--
rpc/rpc.py | 4 +-
setup.py | 4 +-
showresults.py | 3 +-
xdr/xdrgen.py | 34 ++---
38 files changed, 329 insertions(+), 325 deletions(-)
diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py
index 5ef2e3e..48e3093 100644
--- a/nfs4.0/lib/rpc/rpc.py
+++ b/nfs4.0/lib/rpc/rpc.py
@@ -1,6 +1,6 @@
# rpc.py - based on RFC 1831
#
-# Requires python 2.3
+# Requires python 2.7
#
# Written by Fred Isaman <iisaman@citi.umich.edu>
# Copyright (C) 2004 University of Michigan, Center for
@@ -230,7 +230,7 @@ class RPCClient(object):
if why[0] == errno.EADDRINUSE:
port += 1
else:
- print "Could not use low port"
+ print("Could not use low port")
return
def getsocket(self):
@@ -326,13 +326,13 @@ class RPCClient(object):
header, cred = self.get_call_header(xid, program, version, procedure)
data = self.security.secure_data(data, cred)
try:
- if self.debug: print "send %i" % xid
+ if self.debug: print("send %i" % xid)
self.socket.send_record(header + data)
except socket.timeout:
raise
except socket.error, e:
- print "Got error:", e
- if self.debug: print "resend", xid
+ print("Got error:", e)
+ if self.debug: print("resend", xid)
try:
self.reconnect().send_record(header + data)
except socket.error:
@@ -346,7 +346,7 @@ class RPCClient(object):
# If xid not on list, return error.
# Listen until get reply with given xid. Cache others received
# on list. Return error if get one not on list.
- if self.debug: print "listen", xid
+ if self.debug: print("listen", xid)
list = self.get_outstanding_xids()
if xid not in list:
raise
@@ -361,8 +361,8 @@ class RPCClient(object):
except socket.timeout:
raise
except socket.error, e:
- print "Got error:", e
- if self.debug: print "relisten", xid
+ print("Got error:", e)
+ if self.debug: print("relisten", xid)
try:
s = self.reconnect()
s.send_record(list[xid].header + list[xid].data)
@@ -472,21 +472,21 @@ class Server(object):
def run(self, debug=0):
while 1:
- if debug: print "%s: Calling poll" % self.name
+ if debug: print("%s: Calling poll" % self.name)
res = self.p.poll()
- if debug: print "%s: %s" % (self.name, res)
+ if debug: print("%s: %s" % (self.name, res))
for fd, event in res:
if debug:
- print "%s: Handling fd=%i, event=%x" % \
- (self.name, fd, event)
+ print("%s: Handling fd=%i, event=%x" % \
+ (self.name, fd, event))
if event & select.POLLHUP:
self.event_hup(fd)
elif event & select.POLLNVAL:
- if debug: print "%s: POLLNVAL for fd=%i" % (self.name, fd)
+ if debug: print("%s: POLLNVAL for fd=%i" % (self.name, fd))
self.p.unregister(fd)
elif event & ~(select.POLLIN | select.POLLOUT):
- print "%s: ERROR: event %i for fd %i" % \
- (self.name, event, fd)
+ print("%s: ERROR: event %i for fd %i" % \
+ (self.name, event, fd))
self.event_error(fd)
else:
if event & select.POLLOUT:
@@ -534,9 +534,9 @@ class RPCServer(Server):
csock, caddr = self.s.accept()
csock.setblocking(0)
if debug:
- print "SERVER: got connection from %s, " \
+ print("SERVER: got connection from %s, " \
"assigned to fd=%i" % \
- (csock.getpeername(), csock.fileno())
+ (csock.getpeername(), csock.fileno()))
self.p.register(csock, _readmask)
cfd = csock.fileno()
self.readbufs[cfd] = ''
@@ -550,7 +550,7 @@ class RPCServer(Server):
Also responds to command codes sent as encoded integers
"""
- if debug: print "SERVER: In read event for %i" % fd
+ if debug: print("SERVER: In read event for %i" % fd)
self.readbufs[fd] += data
loop = True
while loop:
@@ -566,7 +566,7 @@ class RPCServer(Server):
if self.readbufs[fd]:
loop = True # We've received data past last
if last:
- if debug: print "SERVER: Received record from %i" % fd
+ if debug: print("SERVER: Received record from %i" % fd)
recv_data = ''.join(self.packetbufs[fd])
self.packetbufs[fd] = []
if len(recv_data) == 4:
@@ -579,14 +579,14 @@ class RPCServer(Server):
self.p.register(fd, _bothmask)
def event_write(self, fd, chunksize=2048, debug=0):
- if debug: print "SERVER: In write event for %i" % fd
+ if debug: print("SERVER: In write event for %i" % fd)
if self.writebufs[fd]:
- if debug: print " writing from writebuf"
+ if debug: print(" writing from writebuf")
count = self.sockets[fd].send(self.writebufs[fd])
self.writebufs[fd] = self.writebufs[fd][count:]
# check if done?
elif self.recordbufs[fd]:
- if debug: print " writing from recordbuf"
+ if debug: print(" writing from recordbuf")
data = self.recordbufs[fd][0]
chunk = data[:chunksize]
if len(data) > chunksize:
@@ -601,12 +601,12 @@ class RPCServer(Server):
count = self.sockets[fd].send(self.writebufs[fd])
self.writebufs[fd] = self.writebufs[fd][count:]
else:
- if debug: print " done writing"
+ if debug: print(" done writing")
self.p.register(fd, _readmask)
def event_command(self, cfd, comm, debug=0):
if debug:
- print "SERVER: command = %i, cfd = %i" % (comm, cfd)
+ print("SERVER: command = %i, cfd = %i" % (comm, cfd))
if comm == 0: # Turn off server
self.compute_reply = lambda x: None
return '\0'*4
@@ -616,7 +616,7 @@ class RPCServer(Server):
def event_close(self, fd, debug=0):
if debug:
- print "SERVER: closing %i" % fd
+ print("SERVER: closing %i" % fd)
self.event_error(fd)
def event_error(self, fd):
@@ -636,16 +636,16 @@ class RPCServer(Server):
try:
recv_msg = self.rpcunpacker.unpack_rpc_msg()
except xdrlib.Error, e:
- print "XDRError", e
+ print("XDRError", e)
return
if recv_msg.body.mtype != CALL:
- print "Received a REPLY, expected a CALL"
+ print("Received a REPLY, expected a CALL")
return
# Check for reasons to deny the call
call = recv_msg.body.cbody
cred = call.cred
flavor = cred.flavor
- #print call
+ #print(call)
reply_stat = MSG_ACCEPTED
areply = rreply = None
proc_response = ''
diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
index 314924b..2c68875 100644
--- a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
+++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py
@@ -204,7 +204,7 @@ class SecAuthGss(SecFlavor):
p.done()
d = gssapi.acceptSecContext(token, body.handle)
if d["major"] == GSS_S_COMPLETE:
- print "SUCCESS!"
+ print("SUCCESS!")
class C(object):
pass
out = C()
@@ -223,11 +223,11 @@ class SecAuthGss(SecFlavor):
else:
out = hint_string(d)
if out is not None:
- print out
+ print(out)
return rpc.GARBAGE_ARGS, ''
else:
# Stub
- print "Unable to handle gss_proc==%i" % body.gss_proc
+ print("Unable to handle gss_proc==%i" % body.gss_proc)
return rpc.GARBAGE_ARGS, ''
def make_verf(self, data):
"""Verifier sent with each RPC call
@@ -374,7 +374,7 @@ class SecAuthGss(SecFlavor):
p.reset()
p.pack_uint(cred.seq_num)
d = gssapi.verifyMIC(self.gss_context, p.get_buffer(), rverf.body)
- #print "Verify(%i):"%cred.seq_num, show_major(d['major']), show_minor(d['minor'])
+ #print("Verify(%i):"%cred.seq_num, show_major(d['major']), show_minor(d['minor']))
else:
pass
diff --git a/nfs4.0/nfs4acl.py b/nfs4.0/nfs4acl.py
index 8ae32e2..91a0316 100644
--- a/nfs4.0/nfs4acl.py
+++ b/nfs4.0/nfs4acl.py
@@ -214,6 +214,6 @@ def printableacl(acl):
for ace in acl:
out += "<type=%6s, flag=%2x, access=%8x, who=%s>\n" % \
(type_str[ace.type], ace.flag, ace.access_mask, ace.who)
- #print "leaving printableacl with out = %s" % out
+ #print("leaving printableacl with out = %s" % out)
return out
diff --git a/nfs4.0/nfs4client.py b/nfs4.0/nfs4client.py
index 90c8d2c..5916dcc 100755
--- a/nfs4.0/nfs4client.py
+++ b/nfs4.0/nfs4client.py
@@ -9,8 +9,8 @@
#
import sys
-if sys.hexversion < 0x02030000:
- print "Requires python 2.3 or higher"
+if sys.hexversion < 0x02070000:
+ print("Requires python 2.7 or higher")
sys.exit(1)
import os
# Allow to be run stright from package root
@@ -22,7 +22,7 @@ import readline
try:
import readline
except ImportError:
- print "Module readline not available."
+ print("Module readline not available.")
#else:
# import rlcompleter
# readline.parse_and_bind("tab: complete")
@@ -75,11 +75,11 @@ class PyShell(code.InteractiveConsole):
return self.locals[attr]
else:
return getattr(inst, attr)
- #print "\nCalled complete(%s, %i)" % (text, state)
+ #print("\nCalled complete(%s, %i)" % (text, state))
if text.startswith('.'):
# XXX TODO - handle array indexing
line = readline.get_line_buffer()
- # print "Line: ", repr(line)
+ # print("Line: ", repr(line))
return None
vars = text.split('.')
base = vars[:-1]
@@ -88,7 +88,7 @@ class PyShell(code.InteractiveConsole):
try:
inst = eval('.'.join(base), self.locals)
except:
- print "\nFAIL"
+ print("\nFAIL")
traceback.print_exc()
return None
else:
@@ -125,7 +125,7 @@ class PyShell(code.InteractiveConsole):
def main(server):
c = PyShell(server)
c.interact("Try COMPOUND([PUTROOTFH()])")
- print "Goodbye!"
+ print("Goodbye!")
if __name__ == "__main__":
main(sys.argv[1])
diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py
index 600bce0..a0fdce1 100644
--- a/nfs4.0/nfs4lib.py
+++ b/nfs4.0/nfs4lib.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# nfs4lib.py - NFS4 library for Python
#
-# Requires python 2.3
+# Requires python 2.7
#
# Written by Fred Isaman <iisaman@citi.umich.edu>
# Copyright (C) 2004 University of Michigan, Center for
@@ -199,7 +199,7 @@ class CBServer(rpc.RPCServer):
rpc.RPCServer.run(self)
def handle_0(self, data, cred):
- #print "*****CB received NULL******"
+ #print("*****CB received NULL******")
if data != '':
return rpc.GARBAGE_ARGS, ''
else:
@@ -207,7 +207,7 @@ class CBServer(rpc.RPCServer):
def handle_1(self, data, cred):
"""Deal with CB_COMPOUND"""
- print "*****CB received COMPOUND******"
+ print("*****CB received COMPOUND******")
self.nfs4unpacker.reset(data)
ok, results, tag = self.O_CB_Compound()
try:
@@ -245,7 +245,7 @@ class CBServer(rpc.RPCServer):
# FIXME
def O_CB_GetAttr(self, op, cbid):
- print "******* CB_Getattr *******"
+ print("******* CB_Getattr *******")
self.opcounts[OP_CB_GETATTR] += 1
if not self.curr_fh:
return self.simple_status(NFS4ERR_NOFILEHANDLE)
@@ -254,7 +254,7 @@ class CBServer(rpc.RPCServer):
# FIXME
def O_CB_Recall(self, op, cbid):
- print "******* CB_Recall (id=%i)********" % cbid
+ print("******* CB_Recall (id=%i)********" % cbid)
self.opcounts[OP_CB_RECALL] += 1
if self.recall_funct.get(cbid, None) is not None:
res = self.recall_funct[cbid](self.client, op, cbid)
@@ -301,7 +301,7 @@ class NFS4Client(rpc.RPCClient):
self.cb_control.connect(('127.0.0.1', self.cb_server.port))
break
except socket.error:
- print "Waiting for Callback server to start"
+ print("Waiting for Callback server to start")
def cb_command(self, comm):
self.cb_control.sendall('\x80\x00\x00\x04\x00\x00\x00%s' % chr(comm))
@@ -327,7 +327,7 @@ class NFS4Client(rpc.RPCClient):
minorversion=minorversion)
if SHOW_TRAFFIC:
print
- print compoundargs
+ print(compoundargs)
p = self.nfs4packer
un_p = self.nfs4unpacker
p.reset()
@@ -336,7 +336,7 @@ class NFS4Client(rpc.RPCClient):
un_p.reset(res)
res = un_p.unpack_COMPOUND4res()
if SHOW_TRAFFIC:
- print res
+ print(res)
un_p.done()
# Do some error checking
@@ -688,7 +688,7 @@ class NFS4Client(rpc.RPCClient):
#expect = attrs.keys()
#expect.sort()
#if attrlist != expect:
- # print "WARNING: OPENresok.attrset mismatches requested attrs"
+ # print("WARNING: OPENresok.attrset mismatches requested attrs")
fhandle = res.resarray[-1].switch.switch.object
stateid = res.resarray[-2].switch.switch.stateid
rflags = res.resarray[-2].switch.switch.rflags
diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py
index 37c1528..d5aea34 100755
--- a/nfs4.0/nfs4server.py
+++ b/nfs4.0/nfs4server.py
@@ -16,8 +16,8 @@ except:
pass
import sys
-if sys.hexversion < 0x02030000:
- print "Requires python 2.3 or higher"
+if sys.hexversion < 0x02070000:
+ print("Requires python 2.7 or higher")
sys.exit(1)
import os
# Allow to be run stright from package root
@@ -107,15 +107,15 @@ class NFS4Server(rpc.RPCServer):
def handle_0(self, data, cred):
print
- print "******** TCP RPC NULL CALL ********"
- print " flavor = %i" % cred.flavor
+ print("******** TCP RPC NULL CALL ********")
+ print(" flavor = %i" % cred.flavor)
if cred.flavor == rpc.RPCSEC_GSS:
gss = self.security[cred.flavor]
body = gss.read_cred(cred.body)
if body.gss_proc:
return gss.handle_proc(body, data)
if data != '':
- print " ERROR - unexpected data"
+ print(" ERROR - unexpected data")
return rpc.GARBAGE_ARGS, ''
else:
return rpc.SUCCESS, ''
@@ -123,12 +123,12 @@ class NFS4Server(rpc.RPCServer):
def handle_1(self, data, cred):
self.nfs4unpacker.reset(data)
print
- print "********** TCP RPC CALL ***********"
+ print("********** TCP RPC CALL ***********")
ok, results, tag = self.O_Compound()
try:
self.nfs4unpacker.done()
except XDRError:
- print repr(self.nfs4unpacker.get_buffer())
+ print(repr(self.nfs4unpacker.get_buffer()))
raise
return rpc.GARBAGE_ARGS, ''
@@ -166,11 +166,11 @@ class NFS4Server(rpc.RPCServer):
cmp4args = self.nfs4unpacker.unpack_COMPOUND4args()
tag = cmp4args.tag
except: # [XDRError, StandardError]:
- #print "ERROR"
+ #print("ERROR")
#raise
return NFS4ERR_BADXDR, [], tag
- print "TCP NFSv4 COMPOUND call, tag: %s, n_ops: %d" % \
- (repr(tag), len(cmp4args.argarray))
+ print("TCP NFSv4 COMPOUND call, tag: %s, n_ops: %d" % \
+ (repr(tag), len(cmp4args.argarray)))
if cmp4args.minorversion <> 0:
return NFS4ERR_MINOR_VERS_MISMATCH, [], tag
if not verify_utf8(tag):
@@ -180,26 +180,26 @@ class NFS4Server(rpc.RPCServer):
ok = NFS4_OK
for op in cmp4args.argarray:
opname = nfs_opnum4.get(op.argop, 'op_illegal')
- print "*** %s (%d) ***" % (opname, op.argop)
+ print("*** %s (%d) ***" % (opname, op.argop))
ok, result = getattr(self, opname.lower())(op)
results += [ result ]
if ok <> NFS4_OK:
- print " ! error %s" % nfsstat4[ok]
+ print(" ! error %s" % nfsstat4[ok])
break
- print "Replying. Status %s (%d)" % (nfsstat4[ok], ok)
+ print("Replying. Status %s (%d)" % (nfsstat4[ok], ok))
return (ok, results, tag)
# FIXME
def op_access(self, op):
- print " CURRENT FILEHANDLE: %s" % self.curr_fh
- print " REQUESTED ACCESS: %s" % access2string(op.opaccess.access)
+ print(" CURRENT FILEHANDLE: %s" % self.curr_fh)
+ print(" REQUESTED ACCESS: %s" % access2string(op.opaccess.access))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
all = ACCESS4_READ | ACCESS4_LOOKUP | ACCESS4_MODIFY | \
ACCESS4_EXTEND | ACCESS4_DELETE | ACCESS4_EXECUTE
all = ~all
if op.opaccess.access & all > 0:
- print "!!!! Received invalid ACCESS bits in op.opaccess.access"
+ print("!!!! Received invalid ACCESS bits in op.opaccess.access")
return simple_error(NFS4ERR_INVAL)
a4_supported = self.curr_fh.supported_access()
# according to page 140 of 3530, we only return the supported
@@ -207,25 +207,25 @@ class NFS4Server(rpc.RPCServer):
a4_supported = op.opaccess.access & a4_supported
a4_access = self.curr_fh.evaluate_access()
a4_access = op.opaccess.access & a4_access # bitwise and
- print " RESULT SUPPORTED: %s" % access2string(a4_supported)
- print " RESULT ACCESS: %s" % access2string(a4_access)
+ print(" RESULT SUPPORTED: %s" % access2string(a4_supported))
+ print(" RESULT ACCESS: %s" % access2string(a4_access))
a4resok = ACCESS4resok(a4_supported, a4_access)
return simple_error(NFS4_OK, a4resok)
def op_close(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
- print " SEQID: %i" % op.opclose.seqid
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
+ print(" SEQID: %i" % op.opclose.seqid)
stateid = op.opclose.open_stateid
try:
replay = self.state.check_seqid(stateid, op.opclose.seqid)
if replay:
self.curr_fh, args = self.check_replay(op, replay)
- print "Replay args = %s"%str(args)
+ print("Replay args = %s"%str(args))
return simple_error(*args)
# Note must cache response, so need to call raise instead of return
if not self.curr_fh:
raise NFS4Error(NFS4ERR_NOFILEHANDLE)
- print " CLOSE fh", self.curr_fh.handle
+ print(" CLOSE fh", self.curr_fh.handle)
self.state.close(stateid)
except NFS4Error, e:
self.state.advance_seqid(stateid, op, (e.code,))
@@ -238,7 +238,7 @@ class NFS4Server(rpc.RPCServer):
# Note: since currently using ram based fs, we lie here (and in write)
# and pretend all operations are FILE_SYNC4
def op_commit(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
if self.curr_fh.get_type() == NF4DIR:
@@ -251,7 +251,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, c4resok)
def op_create(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
e = verify_name(op.opcreate.objname)
@@ -265,7 +265,7 @@ class NFS4Server(rpc.RPCServer):
try:
old_cinfo = self.curr_fh.fattr4_change
attrs = op.opcreate.createattrs
- print attrs
+ print(attrs)
attrset = self.curr_fh.create(op.opcreate.objname, op.opcreate.objtype, attrs)
new_cinfo = self.curr_fh.fattr4_change
self.curr_fh = self.curr_fh.lookup(op.opcreate.objname)
@@ -284,7 +284,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4ERR_NOTSUPP)
def op_getattr(self, op):
- print " ATTRMASK: %s" % [nfs4lib.get_attr_name(bit) for bit in nfs4lib.bitmap2list(op.opgetattr.attr_request)]
+ print(" ATTRMASK: %s" % [nfs4lib.get_attr_name(bit) for bit in nfs4lib.bitmap2list(op.opgetattr.attr_request)])
try:
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
@@ -298,15 +298,15 @@ class NFS4Server(rpc.RPCServer):
def op_getfh(self, op):
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
- print " FILEHANDLE %s" % self.curr_fh.handle
+ print(" FILEHANDLE %s" % self.curr_fh.handle)
# XXX BUG - fhcache not set on getattr or readdir(getattr)
self.fhcache[self.curr_fh.handle] = self.curr_fh
confirmres = GETFH4resok(str(self.curr_fh.handle))
return simple_error(NFS4_OK, confirmres)
def op_link(self, op):
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
- print " SOURCE OBJECT %s" % op.oplink.newname
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
+ print(" SOURCE OBJECT %s" % op.oplink.newname)
if self.curr_fh is None or self.saved_fh is None:
return simple_error(NFS4ERR_NOFILEHANDLE)
if self.curr_fh.get_type() != NF4DIR:
@@ -325,7 +325,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, l4resok)
def op_lock(self, op):
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
try:
replay = None
if op.oplock.locker.new_lock_owner:
@@ -364,7 +364,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, l4resok)
def op_lockt(self, op):
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
@@ -381,7 +381,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK)
def op_locku(self, op):
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
stateid = op.oplocku.lock_stateid
try:
replay = self.state.check_seqid(stateid, op.oplocku.seqid)
@@ -400,8 +400,8 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, sid)
def op_lookup(self, op):
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
- print " REQUESTED OBJECT %s" % op.oplookup.objname
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
+ print(" REQUESTED OBJECT %s" % op.oplookup.objname)
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
@@ -418,19 +418,19 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK)
def op_lookupp(self, op):
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
if self.curr_fh.get_type() != NF4DIR:
return simple_error(NFS4ERR_NOTDIR)
self.curr_fh = self.curr_fh.do_lookupp()
- print " PARENT FILEHANDLE %s" % repr(self.curr_fh)
+ print(" PARENT FILEHANDLE %s" % repr(self.curr_fh))
if self.curr_fh is None:
return simple_error(NFS4ERR_NOENT)
return simple_error(NFS4_OK)
def op_nverify(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
try:
@@ -446,11 +446,11 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK)
def op_open(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
- print " SEQID: %i" % op.opopen.seqid
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
+ print(" SEQID: %i" % op.opopen.seqid)
owner = op.opopen.owner
- print " CLIENTID: %d" % owner.clientid
- print " OWNER: '%s'" % repr(owner.owner)
+ print(" CLIENTID: %d" % owner.clientid)
+ print(" OWNER: '%s'" % repr(owner.owner))
try:
if not self.state.confirmed.exists(c=owner.clientid):
if self.state.unconfirmed.exists(c=owner.clientid):
@@ -471,14 +471,14 @@ class NFS4Server(rpc.RPCServer):
if self.curr_fh.get_type() != NF4DIR:
raise NFS4Error(NFS4ERR_NOTDIR)
filename = op.opopen.claim.file
- print " FILE %s" % filename
+ print(" FILE %s" % filename)
e = verify_name(filename)
if e: raise NFS4Error(e)
# At this point we know it is CLAIM_NULL with valid filename and cfh
attrset = 0L
ci_old = self.curr_fh.fattr4_change
if op.opopen.openhow.opentype == OPEN4_CREATE:
- print " CREATING FILE."
+ print(" CREATING FILE.")
type_reg = createtype4(NF4REG)
existing = self.curr_fh.lookup(filename)
if existing is not None:
@@ -511,7 +511,7 @@ class NFS4Server(rpc.RPCServer):
attrset = self.curr_fh.create(filename, type_reg, attrs)
existing = self.curr_fh.lookup(filename)
else:
- print " OPENING EXISTING FILE."
+ print(" OPENING EXISTING FILE.")
existing = self.curr_fh.lookup(filename)
if existing is None:
raise NFS4Error(NFS4ERR_NOENT)
@@ -525,7 +525,7 @@ class NFS4Server(rpc.RPCServer):
sid, flags = self.state.open(existing, owner,
op.opopen.share_access, op.opopen.share_deny)
except NFS4Error, e:
- print "Open error"
+ print("Open error")
self.state.advance_seqid(owner, op, (e.code,))
return simple_error(e.code)
ci_new = self.curr_fh.fattr4_change
@@ -539,12 +539,12 @@ class NFS4Server(rpc.RPCServer):
# FIXME: actually open the attr directory, change the filehandle
def op_openattr(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
return simple_error(NFS4ERR_NOTSUPP)
def op_open_confirm(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
- print " SEQID: %i" % op.opopen_confirm.seqid
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
+ print(" SEQID: %i" % op.opopen_confirm.seqid)
stateid = op.opopen_confirm.open_stateid
try:
replay = self.state.check_seqid(stateid, op.opopen_confirm.seqid,
@@ -568,7 +568,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, oc4resok)
def op_open_downgrade(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
stateid = op.opopen_downgrade.open_stateid
try:
replay = self.state.check_seqid(stateid, op.opopen_downgrade.seqid)
@@ -591,7 +591,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, od4resok)
def op_putfh(self, op):
- print " FILEHANDLE '%s'" % repr(op.opputfh.object)
+ print(" FILEHANDLE '%s'" % repr(op.opputfh.object))
# check access!
if not self.fhcache.has_key(op.opputfh.object):
return simple_error(NFS4ERR_BADHANDLE)
@@ -599,22 +599,22 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK)
def op_putpubfh(self, op):
- print " NEW FILEHANDLE %s" % repr(self.curr_fh)
+ print(" NEW FILEHANDLE %s" % repr(self.curr_fh))
if self.pubfh is None:
return simple_error(NFS4ERR_NOTSUPP)
self.curr_fh = self.pubfh
return simple_error(NFS4_OK)
def op_putrootfh(self, op):
- print " NEW FILEHANDLE %s" % repr(self.curr_fh)
+ print(" NEW FILEHANDLE %s" % repr(self.curr_fh))
self.curr_fh = self.rootfh
return simple_error(NFS4_OK)
def op_read(self, op):
offset = op.opread.offset
count = op.opread.count
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
- print " OFFSET: %d COUNT %d" % (offset, count)
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
+ print(" OFFSET: %d COUNT %d" % (offset, count))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
if self.curr_fh.get_type() == NF4DIR:
@@ -625,7 +625,7 @@ class NFS4Server(rpc.RPCServer):
self.state.check_read(self.curr_fh, op.opread.stateid,
offset, count)
read_data = self.curr_fh.read(offset, count)
- print " READ DATA: len=%i" % len(read_data)
+ print(" READ DATA: len=%i" % len(read_data))
except NFS4Error, e:
return simple_error(e.code)
if len(read_data) < count:
@@ -637,10 +637,10 @@ class NFS4Server(rpc.RPCServer):
def op_readdir(self, op):
# We ignore dircount hint
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
- print " COOKIEVERF: %s, %s" % ( repr(op.opreaddir.cookieverf), repr(op.opreaddir.cookie))
- print " DIRCOUNT: %d MAXCOUNT: %d" % ( op.opreaddir.dircount, op.opreaddir.maxcount)
- print " ATTRMASK: %s" % [nfs4lib.get_attr_name(bit) for bit in nfs4lib.bitmap2list(op.opreaddir.attr_request)]
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
+ print(" COOKIEVERF: %s, %s" % ( repr(op.opreaddir.cookieverf), repr(op.opreaddir.cookie)))
+ print(" DIRCOUNT: %d MAXCOUNT: %d" % ( op.opreaddir.dircount, op.opreaddir.maxcount))
+ print(" ATTRMASK: %s" % [nfs4lib.get_attr_name(bit) for bit in nfs4lib.bitmap2list(op.opreaddir.attr_request)])
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
if self.curr_fh.get_type() != NF4DIR:
@@ -699,19 +699,19 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, rdresok)
def op_readlink(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
if self.curr_fh.get_type() != NF4LNK:
return simple_error(NFS4ERR_INVAL)
link_text = self.curr_fh.read_link()
- print " LINK_TEXT: %s" % link_text
+ print(" LINK_TEXT: %s" % link_text)
rl4resok = READLINK4resok(link_text)
return simple_error(NFS4_OK, rl4resok)
def op_remove(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
- print " TARGET: %s" % op.opremove.target
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
+ print(" TARGET: %s" % op.opremove.target)
#XXX: CHECK ACCESS
if self.curr_fh is None:
return simple_error(NFS4ERR_NOFILEHANDLE)
@@ -732,10 +732,10 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, r4resok)
def op_rename(self, op):
- print " SAVED FILEHANDLE: %s" % repr(self.saved_fh) # old dir
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) # new dir
- print " OLD NAME: %s" % op.oprename.oldname
- print " NEW NAME: %s" % op.oprename.newname
+ print(" SAVED FILEHANDLE: %s" % repr(self.saved_fh) # old dir)
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh) # new dir)
+ print(" OLD NAME: %s" % op.oprename.oldname)
+ print(" NEW NAME: %s" % op.oprename.newname)
if self.curr_fh is None or self.saved_fh is None:
return simple_error(NFS4ERR_NOFILEHANDLE)
oldname = op.oprename.oldname
@@ -782,14 +782,14 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK)
def op_restorefh(self, op):
- print " SAVED FILEHANDLE: %s" % repr(self.saved_fh)
+ print(" SAVED FILEHANDLE: %s" % repr(self.saved_fh))
if not self.saved_fh:
return simple_error(NFS4ERR_RESTOREFH)
self.curr_fh = self.saved_fh
return simple_error(NFS4_OK)
def op_savefh(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
self.saved_fh = self.curr_fh
@@ -798,7 +798,7 @@ class NFS4Server(rpc.RPCServer):
# FIXME: no idea how to set up NFS4_OK conditions; actually get sec information
def op_secinfo(self, op):
# STUB
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
if self.curr_fh.get_type() != NF4DIR:
@@ -809,8 +809,8 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, resok)
def op_setattr(self, op):
- print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh)
- print op.opsetattr.obj_attributes
+ print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh))
+ print(op.opsetattr.obj_attributes)
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE, 0L)
try:
@@ -835,7 +835,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK, attrset)
def op_setclientid(self, op):
- print " ID: %s" % ( op.opsetclientid.client.id)
+ print(" ID: %s" % ( op.opsetclientid.client.id))
x = op.opsetclientid.client.id
v = op.opsetclientid.client.verifier
k = (op.opsetclientid.callback, op.opsetclientid.callback_ident)
@@ -860,7 +860,7 @@ class NFS4Server(rpc.RPCServer):
# This should never happen
return simple_error(NFS4ERR_INVAL)
s = self.nextverf()
- print " VERIFIER: %s" % repr(s)
+ print(" VERIFIER: %s" % repr(s))
self.state.unconfirmed.add(v,x,c,k,s,p)
resok = SETCLIENTID4resok(c, s)
return simple_error(NFS4_OK, resok)
@@ -869,7 +869,7 @@ class NFS4Server(rpc.RPCServer):
c = op.opsetclientid_confirm.clientid
s = op.opsetclientid_confirm.setclientid_confirm
p = "Stub" # Principal
- print " ARGS, clientid %s, verifier %s" % (c, printverf(s))
+ print(" ARGS, clientid %s, verifier %s" % (c, printverf(s)))
# NOTE this makes the assumption that only one entry can match c=c
entry = self.state.confirmed.find(c=c)
entry2 = self.state.unconfirmed.find(c=c)
@@ -900,7 +900,7 @@ class NFS4Server(rpc.RPCServer):
return simple_error(NFS4_OK)
def op_verify(self, op):
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
try:
@@ -920,21 +920,21 @@ class NFS4Server(rpc.RPCServer):
def op_write(self, op):
offset = op.opwrite.offset
data = op.opwrite.data
- print " CURRENT FILEHANDLE %s" % repr(self.curr_fh)
- print " OFFSET: %d COUNT %d" % (offset, len(data))
- print " STATEID { seqid: %s other: %s}" % (repr(op.opwrite.stateid.seqid), repr(op.opwrite.stateid.other))
+ print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh))
+ print(" OFFSET: %d COUNT %d" % (offset, len(data)))
+ print(" STATEID { seqid: %s other: %s}" % (repr(op.opwrite.stateid.seqid), repr(op.opwrite.stateid.other)))
if not self.curr_fh:
return simple_error(NFS4ERR_NOFILEHANDLE)
if self.curr_fh.get_type() == NF4DIR:
return simple_error(NFS4ERR_ISDIR)
if self.curr_fh.get_type() != NF4REG:
return simple_error(NFS4ERR_INVAL)
- #print " DATA: %s" % op.opwrite.data
+ #print(" DATA: %s" % op.opwrite.data)
try:
self.state.check_write(self.curr_fh, op.opwrite.stateid,
offset, len(data))
count = self.curr_fh.write(offset, data)
- print " wrote %i bytes" % count
+ print(" wrote %i bytes" % count)
except NFS4Error, e:
return simple_error(e.code)
w4resok = WRITE4resok(count, FILE_SYNC4, self.state.write_verifier)
@@ -956,10 +956,10 @@ def startup(host, port):
raise
#server.register()
except:
- print "!! unable to register with portmap"
+ print("!! unable to register with portmap")
pass
- print "Python NFSv4 Server, (c) CITI, Regents of the University of Michigan"
- print "Starting Server, root handle: %s" % rootfh
+ print("Python NFSv4 Server, (c) CITI, Regents of the University of Michigan")
+ print("Starting Server, root handle: %s" % rootfh )
server.run()
try:
server.unregister()
diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py
index d32da29..fb3fd5c 100755
--- a/nfs4.0/nfs4state.py
+++ b/nfs4.0/nfs4state.py
@@ -244,14 +244,14 @@ class NFSServerState:
See RFC 3530 sec 8.1.5
"""
# This is getting too complicated. Should split off creation
- #print " check_seqid: Entered"
+ #print(" check_seqid: Entered")
if isinstance(obj, stateid4):
mustexist = True
try:
info = self.__getinfo(obj, allownew=not mustexist)
except ValueError, e:
if mustexist: raise
- #print " check_seqid: %s" % info
+ #print(" check_seqid: %s" % info)
if info is None:
# A reserved stateid
raise NFS4Error(NFS4ERR_BAD_STATEID)
@@ -267,9 +267,9 @@ class NFSServerState:
info.lastseqid = mod32(-1)
return
lastseq = info.lastseqid
- #print " check_seqid: new: %s, last: %s" % (seqid, lastseq)
+ #print(" check_seqid: new: %s, last: %s" % (seqid, lastseq))
if lastseq == seqid:
- print " ***REPLAY*** "
+ print(" ***REPLAY*** ")
return info.cached_response
if not info.confirmed and not open_confirm:
# RFC 3530 sec 14.2.18
@@ -294,7 +294,7 @@ class NFSServerState:
# FIXME - does this behave correctly for reserved stateids?
return
info.cached_response = (cfh, args, op)
- #print " advance_seqid - went from: %s" % info.lastseqid
+ #print(" advance_seqid - went from: %s" % info.lastseqid)
if args[0] not in [NFS4ERR_STALE_CLIENTID, NFS4ERR_STALE_STATEID,
NFS4ERR_BAD_STATEID, NFS4ERR_BAD_SEQID,
NFS4ERR_BADXDR, NFS4ERR_RESOURCE,
@@ -303,7 +303,7 @@ class NFSServerState:
info.lastseqid = 0
else:
info.lastseqid = mod32(info.lastseqid + 1)
- #print " advance_seqid - to: %s" % info.lastseqid
+ #print(" advance_seqid - to: %s" % info.lastseqid)
def confirm(self, fh, stateid):
"""Confirm an open"""
@@ -352,7 +352,7 @@ class NFSServerState:
raise NFS4Error(NFS4ERR_BAD_STATEID)
info = self.state[id].owner
fh = self.__getfh(id)
- #print "Close fh from id", fh.handle
+ #print("Close fh from id", fh.handle)
# Remove locks from file and deal with associated lockowners
for lockinfo in info.lockowners:
if fh.handle in lockinfo.files:
@@ -412,7 +412,7 @@ class NFSServerState:
except KeyError:
if not allownew:
raise ValueError, "File %s not open for %s" % (fh.name, info)
- #print "Creating new id %i for fh %s" % (self.next_id, fh.handle)
+ #print("Creating new id %i for fh %s" % (self.next_id, fh.handle))
id = info.files[fh.handle] = self.next_id
self.next_id += 1
self.state[id] = self.StateIDInfo(fh, info)
@@ -434,7 +434,7 @@ class NFSServerState:
info = ownerdict[owner.clientid][owner.owner]
except KeyError:
if not allownew: raise ValueError, "Unknown owner %s" % str(owner)
- #print "Creating new info"
+ #print("Creating new info")
info = self.OwnerInfo(owner)
if owner.clientid in ownerdict:
ownerdict[owner.clientid][owner.owner] = info
@@ -853,14 +853,14 @@ class NFSFileState:
list[i].type == list[i-1].type:
list[i-1].end = list[i].end
del list[i]
- print list
+ print(list)
def removeposixlock(self, list, type, start, end):
"""Removes lock from sorted list, splitting existing locks as necessary
"""
self.__removerange(list, start, end)
list.sort()
- print list
+ print(list)
def __removerange(self, list, start, end):
"""Removes locks in given range, shrinking locks that half-overlap"""
@@ -1171,9 +1171,9 @@ class VirtualHandle(NFSFileHandle):
try:
nfs4acl.maps_to_posix(acl)
except nfs4acl.ACLError, e:
- print "*"*50
- print e
- print "*"*50
+ print("*"*50)
+ print(e)
+ print("*"*50)
raise NFS4Error(NFS4ERR_INVAL)
self.fattr4_acl = acl
self.fattr4_mode = nfs4acl.acl2mode(acl)
@@ -1257,7 +1257,7 @@ class VirtualHandle(NFSFileHandle):
# FRED - Note this currently does nothing -
# - and should do nothing if link count is positive
if self.fattr4_numlinks > 0: return
- #print "destructing: %s" % repr(self)
+ #print("destructing: %s" % repr(self))
if self.fattr4_type == NF4DIR:
for subfile in self.dirent.values():
subfile.destruct()
@@ -1324,7 +1324,7 @@ class VirtualHandle(NFSFileHandle):
self.fattr4_change += 1
try: self.file.seek(offset)
except MemoryError:
- print "MemError, offset=%s, count=%s" % (str(offset), str(len(data)))
+ print("MemError, offset=%s, count=%s" % (str(offset), str(len(data))))
raise
self.file.write(data)
self.file.seek(0, 2) # Seek to eof
diff --git a/nfs4.0/servertests/environment.py b/nfs4.0/servertests/environment.py
index 4f37d0f..a848ed4 100644
--- a/nfs4.0/servertests/environment.py
+++ b/nfs4.0/servertests/environment.py
@@ -1,7 +1,7 @@
#
# environment.py
#
-# Requires python 2.3
+# Requires python 2.7
#
# Written by Fred Isaman <iisaman@citi.umich.edu>
# Copyright (C) 2004 University of Michigan, Center for
@@ -183,7 +183,7 @@ class Environment(testmod.Environment):
path = tree + [name[type]]
res = c.create_obj(path, type)
if res.status != NFS4_OK:
- print "WARNING - could not create /%s" % '/'.join(path)
+ print("WARNING - could not create /%s" % '/'.join(path))
c.init_connection()
fh, stateid = c.create_confirm('maketree', tree + ['file'],
deny=OPEN4_SHARE_DENY_NONE)
@@ -209,18 +209,18 @@ class Environment(testmod.Environment):
def sleep(self, sec, msg=''):
"""Sleep for given seconds"""
- print "Sleeping for %g seconds:" % sec, msg
+ print("Sleeping for %g seconds:" % sec, msg)
time.sleep(sec)
- print "Woke up"
+ print("Woke up")
def serverhelper(self, args):
"""Perform a special operation on the server side (such as
rebooting the server)"""
if self.opts.serverhelper is None:
- print "Manual operation required on server:"
- print args + " and hit ENTER when done"
+ print("Manual operation required on server:")
+ print(args + " and hit ENTER when done")
sys.stdin.readline()
- print "Continuing with test"
+ print("Continuing with test")
else:
cmd = self.opts.serverhelper
if self.opts.serverhelperarg:
diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py
index bc4effa..a2bce04 100644
--- a/nfs4.0/servertests/st_delegation.py
+++ b/nfs4.0/servertests/st_delegation.py
@@ -22,7 +22,7 @@ class _handle_error(object):
try:
self.c.compound(ops)
except Exception, e:
- print "CALLBACK error in _recall:", e
+ print("CALLBACK error in _recall:", e)
pass
_lock.release()
@@ -34,7 +34,7 @@ def _recall(c, thisop, cbid):
try:
res = c.compound(ops)
except Exception, e:
- print "CALLBACK error in _recall:", e
+ print("CALLBACK error in _recall:", e)
res = None
_lock.release()
if res is not None and res.status != NFS4_OK:
@@ -260,7 +260,7 @@ def testManyReaddeleg(t, env, funct=_recall, response=NFS4_OK):
cbids.append(c.cbid)
if not cbids:
t.pass_warn("Could not get any read delegations")
- print "Got %i out of %i read delegations" % (len(cbids), count)
+ print("Got %i out of %i read delegations" % (len(cbids), count))
# Cause them to be recalled
fh2, stateid2 = _cause_recall(t, env)
miss_count = 0
diff --git a/nfs4.0/servertests/st_fslocations.py b/nfs4.0/servertests/st_fslocations.py
index 102db52..442d5a2 100644
--- a/nfs4.0/servertests/st_fslocations.py
+++ b/nfs4.0/servertests/st_fslocations.py
@@ -20,7 +20,7 @@ def testReference(t, env):
res = c.compound(ops)
check(res, NFS4ERR_MOVED, "GETFH of path indicated by --usespecial")
locs = c.do_getattr(FATTR4_FS_LOCATIONS, path)
- print "After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs
+ print("After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs)
def testReference2(t, env):
"""FSLOCATION test of referral node
@@ -33,7 +33,7 @@ def testReference2(t, env):
c = env.c1
path = env.opts.usespecial
locs = c.do_getattr(FATTR4_FS_LOCATIONS, path)
- print "After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs
+ print("After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs)
def testReference3(t, env):
"""FSLOCATION test of referral node
@@ -46,7 +46,7 @@ def testReference3(t, env):
c = env.c1
path = env.opts.usespecial
locs = c.do_getattr(FATTR4_FS_LOCATIONS, c.homedir)
- print "After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs
+ print("After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs)
def testAttr1a(t, env):
"""GETATTR with attributes should return _MOVED
@@ -104,10 +104,10 @@ def testAttr2b(t, env):
attrlist = [FATTR4_SIZE, FATTR4_FILEHANDLE, FATTR4_RDATTR_ERROR, FATTR4_FSID]
entries = c.do_readdir(path, attr_request=attrlist)
moved = [e for e in entries if e.attrdict[FATTR4_RDATTR_ERROR] == NFS4ERR_MOVED]
- print "RDATTR==MOVED for:", [e.name for e in moved]
+ print("RDATTR==MOVED for:", [e.name for e in moved])
for e in moved:
if len(e.attrdict) != 2:
- print e.attrdict
+ print(e.attrdict)
t.fail("Expected 2 attrs returned for file %s, got %i" % (e.name, len(e.attrdict)))
def testAttr3a(t, env):
@@ -137,7 +137,7 @@ def testAttr3b(t, env):
entries = c.do_readdir(path, attr_request=attrlist)
moved = [e for e in entries if e.name == env.opts.usespecial[-1]][0]
if len(moved.attrdict) != 3:
- print moved.attrdict
+ print(moved.attrdict)
t.fail("Expected 3 attrs returned for file %s, got %i" % (moved.name, len(moved.attrdict)))
def testAttr4a(t, env):
@@ -150,7 +150,7 @@ def testAttr4a(t, env):
path = env.opts.usespecial
attrlist = [FATTR4_SIZE, FATTR4_FILEHANDLE, FATTR4_RDATTR_ERROR, FATTR4_FSID, FATTR4_FS_LOCATIONS]
d = c.do_getattrdict(path, attrlist)
- print d
+ print(d)
if len(d) != 3:
t.fail("Expected 3 attrs returned, got %i" % len(d))
@@ -167,10 +167,10 @@ def testAttr4b(t, env):
attrlist = [FATTR4_SIZE, FATTR4_FILEHANDLE, FATTR4_RDATTR_ERROR, FATTR4_FSID, FATTR4_FS_LOCATIONS]
entries = c.do_readdir(path, attr_request=attrlist)
moved = [e for e in entries if e.attrdict[FATTR4_RDATTR_ERROR] == NFS4ERR_MOVED]
- print "RDATTR==MOVED for:", [e.name for e in moved]
+ print("RDATTR==MOVED for:", [e.name for e in moved])
for e in moved:
if len(e.attrdict) != 3:
- print e.attrdict
+ print(e.attrdict)
t.fail("Expected 3 attrs returned for file %s, got %i" % (e.name, len(e.attrdict)))
def testAttr5a(t, env):
@@ -183,7 +183,7 @@ def testAttr5a(t, env):
path = env.opts.usespecial
attrlist = [FATTR4_SIZE, FATTR4_FILEHANDLE, FATTR4_FSID, FATTR4_FS_LOCATIONS]
d = c.do_getattrdict(path, attrlist)
- print d
+ print(d)
if len(d) != 2:
t.fail("Expected 3 attrs returned, got %i" % len(d))
@@ -201,6 +201,6 @@ def testAttr5b(t, env):
entries = c.do_readdir(path, attr_request=attrlist)
moved = [e for e in entries if e.name == env.opts.usespecial[-1]][0]
if len(moved.attrdict) != 2:
- print moved.attrdict
+ print(moved.attrdict)
t.fail("Expected 2 attrs returned for file %s, got %i" % (moved.name, len(moved.attrdict)))
diff --git a/nfs4.0/servertests/st_getattr.py b/nfs4.0/servertests/st_getattr.py
index eeffa77..500542d 100644
--- a/nfs4.0/servertests/st_getattr.py
+++ b/nfs4.0/servertests/st_getattr.py
@@ -486,7 +486,7 @@ def testFSLocations(t, env):
check(res, [NFS4_OK, NFS4ERR_ATTRNOTSUPP], "GETATTR(fs_locations)")
if res.status == NFS4ERR_ATTRNOTSUPP:
t.fail_support("fs_locations not a supported attribute")
- # print res.resarray[-1].obj_attributes
+ # print(res.resarray[-1].obj_attributes)
def testLotsofGetattrsFile(t, env):
"""Send lots of getattrs
@@ -517,7 +517,7 @@ def testOwnerName(t, env):
check(res, [NFS4_OK, NFS4ERR_ATTRNOTSUPP], "GETATTR(owner)")
if res.status == NFS4ERR_ATTRNOTSUPP:
t.fail_support("owner not a supported attribute")
- # print res.resarray[-1].obj_attributes
+ # print(res.resarray[-1].obj_attributes)
####################################################
@@ -541,9 +541,9 @@ def testOwnerName(t, env):
res = self.ncl.do_ops(ops)
self.assert_OK(res)
print
- print "From Getattr / - ", res.resarray[-3].obj_attributes
+ print("From Getattr / - ", res.resarray[-3].obj_attributes)
print
- print "From Getattr /unix - ", res.resarray[-1].obj_attributes
+ print("From Getattr /unix - ", res.resarray[-1].obj_attributes)
ops = [op.putrootfh()]
attrmask = nfs4lib.list2bitmap(request)
@@ -561,6 +561,6 @@ def testOwnerName(t, env):
if not entry.nextentry:
self.fail("Could not find mountpoint /unix")
entry = entry.nextentry[0]
- print "From Readdir / - ", entry.attrs
+ print("From Readdir / - ", entry.attrs)
diff --git a/nfs4.0/servertests/st_reboot.py b/nfs4.0/servertests/st_reboot.py
index ecfc61f..33c3a4a 100644
--- a/nfs4.0/servertests/st_reboot.py
+++ b/nfs4.0/servertests/st_reboot.py
@@ -217,7 +217,7 @@ def testRootSquash(t, env):
oldname = oldowner.split('@')[0]
if oldname == 'root':
t.fail_support("No root squashing detected")
- print "Detected root squashing: root -> %s" % oldname
+ print("Detected root squashing: root -> %s" % oldname)
# Wait for grace period to have *just* expired
_waitForReboot(c, env)
diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py
index 9af7703..c049a5a 100755
--- a/nfs4.0/testserver.py
+++ b/nfs4.0/testserver.py
@@ -27,7 +27,7 @@
import sys
if sys.hexversion < 0x02050000:
- print "Requires python 2.5 or higher"
+ print("Requires python 2.5 or higher")
sys.exit(1)
import os
# Allow to be run stright from package root
@@ -217,16 +217,16 @@ def printflags(list):
command_names = [s.lower()[3:].replace('_', '') \
for s in nfs_opnum4.values()]
list.sort()
- # First print command names
+ # First print(command names)
print
for s in list:
if s in command_names:
- print s
+ print(s)
# Then everything else
print
for s in list:
if s not in command_names:
- print s
+ print(s)
def main():
nfail = -1
@@ -251,14 +251,14 @@ def main():
codes = cdict.keys()
codes.sort()
for c in codes:
- print c
+ print(c)
sys.exit(0)
if opt.showcodesflags:
codes = cdict.keys()
codes.sort()
for c in codes:
- print c, "FLAGS:", ', '.join(cdict[c].flags_list)
+ print(c, "FLAGS:", ', '.join(cdict[c].flags_list))
sys.exit(0)
# Grab server info and set defaults
@@ -285,14 +285,14 @@ def main():
for attr in dir(opt):
if attr.startswith('use') and attr != "usefh":
path = getattr(opt, attr)
- #print attr, path
+ #print(attr, path)
if path is None:
path = opt.path + ['tree', attr[3:]]
else:
# FIXME - have funct that checks path validity
if path[0] != '/':
p.error("Need to use absolute path for --%s" % attr)
- # print path
+ # print(path)
if path[-1] == '/' and attr != 'usedir':
p.error("Can't use dir for --%s" %attr)
try:
@@ -337,21 +337,21 @@ def main():
# Place tests in desired order
tests.sort() # FIXME - add options for random sort
- # Run the tests and save/print results
+ # Run the tests and save/print(results)
try:
env = environment.Environment(opt)
env.init()
except socket.gaierror, e:
if e.args[0] == -2:
- print "Unknown server '%s'" % opt.server
- print sys.exc_info()[1]
+ print("Unknown server '%s'" % opt.server)
+ print(sys.exc_info()[1])
sys.exit(1)
except Exception, e:
- print "Initialization failed, no tests run."
+ print("Initialization failed, no tests run.")
if not opt.maketree:
- print "Perhaps you need to use the --maketree option"
+ print("Perhaps you need to use the --maketree option")
raise
- print sys.exc_info()[1]
+ print(sys.exc_info()[1])
sys.exit(1)
if opt.outfile is not None:
fd = file(opt.outfile, 'w')
@@ -371,7 +371,7 @@ def main():
fail = True
nfail = testmod.printresults(tests, opt)
if fail:
- print "\nWARNING: could not clean testdir due to:\n%s\n" % str(e)
+ print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e))
if opt.xmlout is not None:
testmod.xml_printresults(tests, opt.xmlout)
diff --git a/nfs4.1/block.py b/nfs4.1/block.py
index f37bd9b..5ce5ccb 100644
--- a/nfs4.1/block.py
+++ b/nfs4.1/block.py
@@ -159,7 +159,7 @@ class Simple(Volume):
return pnfs_block_volume4(PNFS_BLOCK_VOLUME_SIMPLE, bv_simple_info=info)
def resolve(self, i):
- # print "resolve(%i) %r" % (i, self)
+ # print("resolve(%i) %r" % (i, self))
if i < 0 or i >= self._size:
raise ValueError("Asked for %i of %i" % (i, self._size))
return (self, i)
@@ -186,8 +186,8 @@ class Slice(Volume):
return pnfs_block_volume4(PNFS_BLOCK_VOLUME_SLICE, bv_slice_info=info)
def resolve(self, i):
- # print "resolve(%i) %r" % (i, self)
- # print self.start, self._size, self.length
+ # print("resolve(%i) %r" % (i, self))
+ # print(self.start, self._size, self.length)
if i < 0 or i >= self._size:
raise ValueError("Asked for %i of %i" % (i, self._size))
return self.volumes[0].resolve(self.start + i)
@@ -212,7 +212,7 @@ class Concat(Volume):
return "Concat %i of %r" % (self.id, [v.id for v in self.volumes])
def resolve(self, i):
- # print "resolve(%i) %r" % (i, self)
+ # print("resolve(%i) %r" % (i, self))
if i < 0 or i >= self._size:
raise ValueError("Asked for %i of %i" % (i, self._size))
sum = 0
diff --git a/nfs4.1/client41tests/ct_reboot.py b/nfs4.1/client41tests/ct_reboot.py
index a5d54a1..3bd241b 100644
--- a/nfs4.1/client41tests/ct_reboot.py
+++ b/nfs4.1/client41tests/ct_reboot.py
@@ -204,12 +204,12 @@ def testTwoValueSetupOrCleanup(t, env):
echo "Messagetype value value" > $CONFIG/ops/<operation>
"""
- #print 'env.opts.useparams ', env.opts.useparams
+ #print('env.opts.useparams ', env.opts.useparams)
if len(env.opts.useparams) != 4:
- print 'TWO_VALUE_SETUP_OR_CLEANUP requires '
- print 'testclient.py --useparams'
- print 'Example: --useparams=sequence:ERROR:NFS4ERR_SEQ_MISORDERED:50 '
- print 'which returns NFS4ERR_SEQ_MISORDERED every 50th sequence op'
+ print('TWO_VALUE_SETUP_OR_CLEANUP requires ')
+ print('testclient.py --useparams')
+ print('Example: --useparams=sequence:ERROR:NFS4ERR_SEQ_MISORDERED:50 ')
+ print('which returns NFS4ERR_SEQ_MISORDERED every 50th sequence op')
fail("Bad Input to test")
operation = env.opts.useparams[0]
diff --git a/nfs4.1/client41tests/environment.py b/nfs4.1/client41tests/environment.py
index 262c812..6b48d12 100644
--- a/nfs4.1/client41tests/environment.py
+++ b/nfs4.1/client41tests/environment.py
@@ -1,7 +1,7 @@
#
# environment.py
#
-# Requires python 2.3
+# Requires python 2.7
#
# Written by Fred Isaman <iisaman@citi.umich.edu>
# Copyright (C) 2004 University of Michigan, Center for
@@ -144,7 +144,7 @@ class Environment(testmod.Environment):
path = os.path.join(self.root, "config", "ops", opname)
fd = open(path, "w")
fd.write(data)
- print "wait for leasetime: ", lease[1], "seconds"
+ print("wait for leasetime: ", lease[1], "seconds")
fd.close()
time.sleep(int(lease[1]))
diff --git a/nfs4.1/config.py b/nfs4.1/config.py
index 4747f73..1dbb2ac 100644
--- a/nfs4.1/config.py
+++ b/nfs4.1/config.py
@@ -49,23 +49,23 @@ def _opline(value):
message-type of error has this form: "ERROR NFS4ERR_code ceiling"
new message types and more values can be added
"""
- print '**************** OPLINE typevalue ', type(value)
+ print('**************** OPLINE typevalue ', type(value))
if type(value) is str:
l = value.strip().split()
elif type(value) is list:
l = value
else:
- print ' OPLINE type ', type(value)
+ print(' OPLINE type ', type(value))
raise TypeError, 'Only type list or str accepted'
if l[0] == "ERROR":
if not len(l) == 3:
- print ' OPLINE length ', len
+ print(' OPLINE length ', len)
raise ValueError("ERROR messages only accepts 3 entries")
- print 'OPLINE len ', len(l)
+ print('OPLINE len ', len(l))
value = [l[0], _statcode(l[1]), int(l[2])]
else:
raise ValueError("Only message-type ERROR accepted")
- print '**************** OPLINE return ', value
+ print('**************** OPLINE return ', value)
return value
###################################################
diff --git a/nfs4.1/errorparser.py b/nfs4.1/errorparser.py
index 3de2052..328fe8d 100755
--- a/nfs4.1/errorparser.py
+++ b/nfs4.1/errorparser.py
@@ -112,7 +112,7 @@ class ErrorParser():
except IndexError: # function
functions = Errors()
func = getattr(functions, random.choice(err.function))
- print func
+ print(func)
if callable(func):
func(opname, arg, env)
diff --git a/nfs4.1/locking.py b/nfs4.1/locking.py
index 7330bbc..1dc428f 100644
--- a/nfs4.1/locking.py
+++ b/nfs4.1/locking.py
@@ -32,7 +32,7 @@ def _collect_acq_data(suffix=""):
def _deco(acquire):
def wrapper(self):
suf = ("" if not suffix else "_%s" % suffix)
- print "ACQUIRE%s tried for lock %s" % (suf.upper(), self.name)
+ print("ACQUIRE%s tried for lock %s" % (suf.upper(), self.name))
t = threading.currentThread()
try:
t.locks[self.name] = "waiting%s" % suf
@@ -40,7 +40,7 @@ def _collect_acq_data(suffix=""):
t.locks = {self.name: "waiting%s" % suf}
acquire(self)
t.locks[self.name] = "holding%s" % suf
- print "ACQUIRE%s succeeded for lock %s" % (suf.upper(), self.name)
+ print("ACQUIRE%s succeeded for lock %s" % (suf.upper(), self.name))
return wrapper
return _deco
@@ -49,7 +49,7 @@ def _collect_rel_data(suffix=""):
def _deco(release):
def wrapper(self, *args, **kwargs):
suf = ("" if not suffix else "_%s" % suffix)
- print "RELEASE%s lock %s" % (suf.upper(), self.name)
+ print("RELEASE%s lock %s" % (suf.upper(), self.name))
t = threading.currentThread()
t.locks[self.name] = "released%s" % suf
release(self, *args, **kwargs)
diff --git a/nfs4.1/nfs4lib.py b/nfs4.1/nfs4lib.py
index 02352e1..96752c2 100644
--- a/nfs4.1/nfs4lib.py
+++ b/nfs4.1/nfs4lib.py
@@ -208,7 +208,7 @@ class FancyNFS4Packer(NFS4Packer):
"""Change simple list of entry4 into strange chain structure"""
out = []
for e in data.entries[::-1]:
- # print "handle", e
+ # print("handle", e)
# This reverses the direction of the list, so start with reversed
out = [xdrdef.nfs4_type.entry4(e.cookie, e.name, e.attrs, out)]
# Must not modify original data structure
@@ -297,10 +297,10 @@ def bitmap2list(bitmap):
def printhex(str, pretty=True):
"""Print string as hex digits"""
if pretty:
- print "".join(["%02x " % ord(c) for c in str])
+ print("".join(["%02x " % ord(c) for c in str]))
else:
# Can copy/paste this string
- print "".join(["\\x%02x" % ord(c) for c in str])
+ print("".join(["\\x%02x" % ord(c) for c in str]))
def str_xor(a, b):
"""xor two string which represent binary data"""
diff --git a/nfs4.1/nfs4proxy.py b/nfs4.1/nfs4proxy.py
index 58c26cb..efb6744 100755
--- a/nfs4.1/nfs4proxy.py
+++ b/nfs4.1/nfs4proxy.py
@@ -69,7 +69,7 @@ class NFS4Proxy(rpc.Server):
while True:
try:
server_address = (self.dserver, self.dport)
- print server_address
+ print(server_address)
pipe = self.connect(server_address)
except:
traceback.print_exc(file=sys.stdout)
diff --git a/nfs4.1/nfs4server.py b/nfs4.1/nfs4server.py
index 7ca4d92..8856a82 100755
--- a/nfs4.1/nfs4server.py
+++ b/nfs4.1/nfs4server.py
@@ -521,7 +521,7 @@ class SummaryOutput:
print_summary_line = True
if summary_line != self._last or role != self._last_role:
if self._last and self._repeat_count:
- print " (repeated %u times)" % self._repeat_count
+ print(" (repeated %u times)" % self._repeat_count)
self._last = summary_line
self._repeat_count = 0
else:
@@ -530,11 +530,11 @@ class SummaryOutput:
if self._last_role != role:
print
- print role
+ print(role)
self._last_role = role
if print_summary_line:
- print summary_line
+ print(summary_line)
##################################################
@@ -613,7 +613,7 @@ class NFS4Server(rpc.Server):
Note that order matters, since the mount hides anything beneath it.
"""
- print "Mounting %r on %r" % (fs.fsid, path)
+ print("Mounting %r on %r" % (fs.fsid, path))
# Find directory object on which to mount fs
dir = self.root
principal = nfs4lib.NFS4Principal("root", system=True)
@@ -1964,14 +1964,14 @@ class NFS4Server(rpc.Server):
calls.append(call)
if arg.dir & xdrdef.sctrl_const.DIR_REPLY:
replies.append(reply)
- #print calls
- #print replies
+ #print(calls)
+ #print(replies)
grabres = xdrdef.sctrl_type.GRABres(calls, replies)
return xdrdef.sctrl_const.CTRLSTAT_OK, \
xdrdef.sctrl_type.resdata_t(arg.ctrlop, grab = grabres)
def ctrl_illegal(self, arg):
- #print "ILLEGAL"
+ #print("ILLEGAL")
return xdrdef.sctrl_const.CTRLSTAT_ILLEGAL, xdrdef.sctrl_type.resdata_t(arg.ctrlop)
def op_setclientid(self, arg, env):
diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index a910a69..1a837ee 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -1,7 +1,7 @@
#
# environment.py
#
-# Requires python 2.3
+# Requires python 2.7
#
# Written by Fred Isaman <iisaman@citi.umich.edu>
# Copyright (C) 2004 University of Michigan, Center for
@@ -225,10 +225,10 @@ class Environment(testmod.Environment):
"""Perform a special operation on the server side (such as
rebooting the server)"""
if self.opts.serverhelper is None:
- print "Manual operation required on server:"
- print args + " and hit ENTER when done"
+ print("Manual operation required on server:")
+ print(args + " and hit ENTER when done")
sys.stdin.readline()
- print "Continuing with test"
+ print("Continuing with test")
else:
cmd = self.opts.serverhelper
if self.opts.serverhelperarg:
diff --git a/nfs4.1/server41tests/st_block.py b/nfs4.1/server41tests/st_block.py
index bf968f9..2041de3 100644
--- a/nfs4.1/server41tests/st_block.py
+++ b/nfs4.1/server41tests/st_block.py
@@ -22,14 +22,14 @@ def testStateid1(t, env):
# Get layout 1
fh = res.resarray[-1].object
open_stateid = res.resarray[-2].stateid
- print open_stateid
+ print(open_stateid)
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
0, 8192, 8192, open_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid = res.resarray[-1].logr_stateid
- print lo_stateid
+ print(lo_stateid)
if lo_stateid.seqid != 1:
# From draft23 12.5.2 "The first successful LAYOUTGET processed by
# the server using a non-layout stateid as an argument MUST have the
@@ -43,7 +43,7 @@ def testStateid1(t, env):
res = sess.compound(ops)
check(res)
lo_stateid = res.resarray[-1].logr_stateid
- print lo_stateid
+ print(lo_stateid)
if lo_stateid.seqid != i + 2:
# From draft23 12.5.3 "After the layout stateid is established,
# the server increments by one the value of the "seqid" in each
@@ -63,7 +63,7 @@ def testStateid2(t, env):
# Get layout 1
fh = res.resarray[-1].object
open_stateid = res.resarray[-2].stateid
- print open_stateid
+ print(open_stateid)
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
0, 8192, 8192, open_stateid, 0xffff)]
@@ -71,7 +71,7 @@ def testStateid2(t, env):
check(res)
# Get layout 2
lo_stateid1 = res.resarray[-1].logr_stateid
- print lo_stateid1
+ print(lo_stateid1)
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
8192, 8192, 8192, lo_stateid1, 0xffff)]
@@ -79,14 +79,14 @@ def testStateid2(t, env):
check(res)
# Get layout 3 (merge of prior two)
lo_stateid2 = res.resarray[-1].logr_stateid
- print lo_stateid2
+ print(lo_stateid2)
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
0, 2*8192, 2*8192, lo_stateid2, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid3 = res.resarray[-1].logr_stateid
- print lo_stateid3
+ print(lo_stateid3)
# lo_stateid3.seqid = 3 # BUG - work around emc problem
# Parse opaque to get info for commit
# STUB not very general
@@ -122,7 +122,7 @@ def testEmptyCommit(t, env):
# Get layout 1
fh = res.resarray[-1].object
open_stateid = res.resarray[-2].stateid
- print open_stateid
+ print(open_stateid)
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
0, 8192, 8192, open_stateid, 0xffff)]
@@ -130,14 +130,14 @@ def testEmptyCommit(t, env):
check(res)
# Get layout 2
lo_stateid1 = res.resarray[-1].logr_stateid
- print lo_stateid1
+ print(lo_stateid1)
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
8192, 8192, 8192, lo_stateid1, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid2 = res.resarray[-1].logr_stateid
- print lo_stateid2
+ print(lo_stateid2)
# Parse opaque to get info for commit
# STUB not very general
layout = res.resarray[-1].logr_layout[-1]
@@ -183,7 +183,7 @@ def testSplitCommit(t, env):
# Get layout 1
fh = res.resarray[-1].object
open_stateid = res.resarray[-2].stateid
- print open_stateid
+ print(open_stateid)
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW,
0, 2*8192, 2*8192, open_stateid, 0xffff)]
@@ -191,7 +191,7 @@ def testSplitCommit(t, env):
check(res)
lo_stateid1 = res.resarray[-1].logr_stateid
- print lo_stateid1
+ print(lo_stateid1)
# Parse opaque to get info for commit
# STUB not very general
layout = res.resarray[-1].logr_layout[-1]
diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
index bf1eefc..2ab8ba0 100644
--- a/nfs4.1/server41tests/st_create_session.py
+++ b/nfs4.1/server41tests/st_create_session.py
@@ -310,7 +310,7 @@ def testRdmaArray2(t, env):
xid = c.compound_async(ops, checks=False)
try:
res = c.listen(xid)
- print res
+ print(res)
except RPCAcceptError, e:
if e.stat == GARBAGE_ARGS:
# Legitimate return
@@ -339,7 +339,7 @@ def testCallbackProgram(t, env):
cb_occurred = threading.Event()
transient = 0x40000004
def mycheck(prog):
- print "Got call using prog=0x%x" % prog
+ print("Got call using prog=0x%x" % prog)
cb_occurred.prog = prog
cb_occurred.set()
return True;
@@ -366,7 +366,7 @@ def testCallbackVersion(t, env):
cb_occurred = threading.Event()
transient = 0x40000000
def mycheck(low, hi, vers):
- print "Got call using version=%i" % vers
+ print("Got call using version=%i" % vers)
cb_occurred.low = low
cb_occurred.hi = hi
cb_occurred.vers = vers
diff --git a/nfs4.1/server41tests/st_debug.py b/nfs4.1/server41tests/st_debug.py
index 532ee7a..e34d03f 100644
--- a/nfs4.1/server41tests/st_debug.py
+++ b/nfs4.1/server41tests/st_debug.py
@@ -31,7 +31,7 @@ def testSupported2(t, env):
owner, how, claim)
res = sess2.compound(env.home + [open_op])
# STUB - since we are not handling callback, deleg_return never gets done
- print res
+ print(res)
check(res)
fh2 = res.resarray[-1].object
stateid2 = res.resarray[-2].stateid
@@ -55,16 +55,16 @@ def testReadWrite(t, env):
owner, how, claim)
fh_op = op.putrootfh()
res = sess1.compound([fh_op, open_op, op.getfh()]) # OPEN
- print res
+ print(res)
check(res)
fh = res.resarray[-1].object
stateid = res.resarray[-2].stateid
stateid.seqid = 0
res = sess1.compound([op.putfh(fh), op.write(stateid, 5, FILE_SYNC4, "write test data")])
- print res
+ print(res)
check(res)
res = sess1.compound([op.putfh(fh), op.read(stateid, 0, 1000)])
- print res
+ print(res)
check(res)
res = close_file(sess1, fh, stateid=stateid)
check(res)
@@ -95,7 +95,7 @@ def testDeadlock(t, env):
for xid in xids:
res = sess1.listen(xid)
check(res)
- print res
+ print(res)
res = close_file(sess1, fh, stateid=stateid)
check(res)
diff --git a/nfs4.1/server41tests/st_destroy_session.py b/nfs4.1/server41tests/st_destroy_session.py
index c48d144..466845d 100644
--- a/nfs4.1/server41tests/st_destroy_session.py
+++ b/nfs4.1/server41tests/st_destroy_session.py
@@ -109,7 +109,7 @@ def testDestroy3(t, env):
check(res)
fh = res.resarray[-1].object
deleg = res.resarray[-2].delegation
- print "OPEN fh =", repr(fh)
+ print("OPEN fh =", repr(fh))
if deleg.delegation_type == OPEN_DELEGATE_NONE:
fail("Could not get delegation")
recall.happened = False
diff --git a/nfs4.1/server41tests/st_exchange_id.py b/nfs4.1/server41tests/st_exchange_id.py
index b0ab99c..68f3b09 100644
--- a/nfs4.1/server41tests/st_exchange_id.py
+++ b/nfs4.1/server41tests/st_exchange_id.py
@@ -91,7 +91,7 @@ def testSSV(t, env):
# This should fail if not using GSS? What about E_ID?
res = sess.set_ssv('\x5a' * c.protect.context.ssv_len)
- print res
+ print(res)
def testNoImplId(t, env):
"""Do a simple EXCHANGE_ID w/o setting client impl_id
@@ -118,7 +118,7 @@ def testLongArray(t, env):
xid = c.compound_async(ops, checks=False)
try:
res = c.listen(xid)
- print res
+ print(res)
except RPCAcceptError, e:
if e.stat == GARBAGE_ARGS:
# Legitimate return
diff --git a/nfs4.1/server41tests/st_getdevicelist.py b/nfs4.1/server41tests/st_getdevicelist.py
index a556ce0..edf5fe4 100644
--- a/nfs4.1/server41tests/st_getdevicelist.py
+++ b/nfs4.1/server41tests/st_getdevicelist.py
@@ -28,7 +28,7 @@ def testGetDevList(t, env):
check(res)
# STUB - check block stuff
dev_list = res.resarray[-1].gdlr_deviceid_list
- print dev_list
+ print(dev_list)
def testGetDevInfo(t, env):
"""Check devlist
@@ -60,7 +60,7 @@ def testGetDevInfo(t, env):
p.reset(res.resarray[-1].da_addr_body)
decode = p.unpack_pnfs_block_deviceaddr4()
p.done()
- print decode
+ print(decode)
## def xxxtestLayout(t, env):
@@ -110,7 +110,7 @@ def testGetLayout(t, env):
p = BlockUnpacker(layout.loc_body)
opaque = p.unpack_pnfs_block_layout4()
p.done()
- print opaque
+ print(opaque)
def testEMCGetLayout(t, env):
"""Verify layout handling
@@ -142,7 +142,7 @@ def testEMCGetLayout(t, env):
p = BlockUnpacker(layout.loc_body)
opaque = p.unpack_pnfs_block_layout4()
p.done()
- print opaque
+ print(opaque)
def testLayoutReturnFile(t, env):
"""
@@ -257,9 +257,9 @@ def testLayoutCommit(t, env):
p = BlockUnpacker(layout.loc_body)
opaque = p.unpack_pnfs_block_layout4()
p.done()
- print opaque
+ print(opaque)
final_extent = opaque.blo_extents[-1]
- print final_extent
+ print(final_extent)
if final_extent.bex_state != PNFS_BLOCK_INVALID_DATA:
fail("Expected INVALID_DATA in extent")
# LAYOUTCOMMIT
@@ -276,6 +276,6 @@ def testLayoutCommit(t, env):
layoutupdate4(LAYOUT4_BLOCK_VOLUME, p.get_buffer()))]
res = sess.compound(ops)
check(res)
- print res
+ print(res)
diff --git a/nfs4.1/server41tests/st_secinfo_no_name.py b/nfs4.1/server41tests/st_secinfo_no_name.py
index 4c8cb57..9cd6bd3 100644
--- a/nfs4.1/server41tests/st_secinfo_no_name.py
+++ b/nfs4.1/server41tests/st_secinfo_no_name.py
@@ -32,7 +32,7 @@ def testSupported2(t, env):
# GETFH after do a SECINFO_NO_NAME should get error NFS4ERR_NOFILEHANDLE
res = sess.compound([op.putrootfh(), op.secinfo_no_name(0), op.getfh()])
- print res
+ print(res)
check(res, NFS4ERR_NOFILEHANDLE)
def testSupported3(t, env):
diff --git a/nfs4.1/setup.py b/nfs4.1/setup.py
index 5c3a0df..37b99a0 100644
--- a/nfs4.1/setup.py
+++ b/nfs4.1/setup.py
@@ -31,10 +31,10 @@ class build_py(_build_py):
self.build_module(module, module_file, package)
def expand_xdr(self, dir):
- print "expand = %r" % dir
+ print("expand = %r" % dir)
cwd = os.getcwd()
xdrdir = os.path.join(cwd, dir, 'xdrdef')
- print "xdrdir = %r" % xdrdir
+ print("xdrdir = %r" % xdrdir)
if os.path.exists(xdrdir):
try:
os.chdir(xdrdir)
@@ -47,7 +47,7 @@ class build_py(_build_py):
os.remove("parser.out")
os.remove("parsetab.py")
except:
- print "Remove parse* failed"
+ print("Remove parse* failed")
finally:
os.chdir(cwd)
diff --git a/nfs4.1/testclient.py b/nfs4.1/testclient.py
index 95e90e1..8a1be9f 100755
--- a/nfs4.1/testclient.py
+++ b/nfs4.1/testclient.py
@@ -24,7 +24,7 @@
import use_local # HACK so don't have to rebuild constantly
import sys
if sys.hexversion < 0x02050000:
- print "Requires python 2.5 or higher"
+ print("Requires python 2.5 or higher")
sys.exit(1)
import os
@@ -197,16 +197,16 @@ def printflags(list):
command_names = [s.lower()[3:].replace('_', '') \
for s in nfs_opnum4.values()]
list.sort()
- # First print command names
+ # First print(command names)
print
for s in list:
if s in command_names:
- print s
+ print(s)
# Then everything else
print
for s in list:
if s not in command_names:
- print s
+ print(s)
def main():
p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n"
@@ -228,16 +228,16 @@ def main():
codes = cdict.keys()
codes.sort()
for c in codes:
- print c
+ print(c)
sys.exit(0)
# Grab server info and set defaults
if not args:
p.error("Need a server")
url = args.pop(0)
- print "url", url
+ print("url", url)
opt.path = nfs4lib.path_components(url)
- print "Set opt.path", opt.path
+ print("Set opt.path", opt.path)
# Check --use* options are valid
for attr in dir(opt):
@@ -245,14 +245,14 @@ def main():
opt.useparams = parse_useparams(opt.useparams)
elif attr.startswith('use') and attr != "usefh":
path = getattr(opt, attr)
- #print attr, path
+ #print(attr, path)
if path is None:
path = opt.path + ['tree', attr[3:]]
else:
# FIXME - have funct that checks path validity
if path[0] != '/':
p.error("Need to use absolute path for --%s" % attr)
- # print path
+ # print(path)
if path[-1] == '/' and attr != 'usedir':
p.error("Can't use dir for --%s" %attr)
try:
@@ -297,20 +297,20 @@ def main():
# Place tests in desired order
tests.sort() # FIXME - add options for random sort
- # Run the tests and save/print results
+ # Run the tests and save/print(results)
try:
env = environment.Environment(opt)
env.init()
except socket.gaierror, e:
if e.args[0] == -2:
- print "Unknown server '%s'" % opt.server
+ print("Unknown server '%s'" % opt.server)
sys.exit(1)
except Exception, e:
- print "Initialization failed, no tests run."
+ print("Initialization failed, no tests run.")
if not opt.maketree:
- print "Perhaps you need to use the --maketree option"
+ print("Perhaps you need to use the --maketree option")
raise
- print sys.exc_info()[1]
+ print(sys.exc_info()[1])
sys.exit(1)
if opt.outfile is not None:
fd = file(opt.outfile, 'w')
@@ -330,7 +330,7 @@ def main():
fail = True
testmod.printresults(tests, opt)
if fail:
- print "\nWARNING: could not clean testdir due to:\n%s\n" % str(e)
+ print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e))
if __name__ == "__main__":
main()
diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
index c5ca0fe..a8b4a82 100644
--- a/nfs4.1/testmod.py
+++ b/nfs4.1/testmod.py
@@ -6,6 +6,7 @@
# Copyright (C) 2004 University of Michigan, Center for
# Information Technology Integration
#
+from __future__ import print_function
from __future__ import with_statement
import nfs4lib
import re
@@ -212,11 +213,11 @@ class Test(object):
def run(self, environment, verbose=False):
"""Run self.runtest, storing result"""
- #print "*********Running test %s (%s)" % (self.name, self.code)
+ #print("*********Running test %s (%s)" % (self.name, self.code))
self.result = self._run_result
start_time = time.time()
if verbose:
- print repr(self)
+ print(repr(self))
try:
environment.startUp()
self.runtest(self, environment)
@@ -245,7 +246,7 @@ class Test(object):
self.time_taken = stop_time - start_time
if verbose:
- print repr(self)
+ print(repr(self))
class Environment(object):
"""Base class for a test environment"""
@@ -419,8 +420,8 @@ def printresults(tests, opts, file=None):
count = [0] * 6
for t in tests:
if not hasattr(t, "result"):
- print dir(t)
- print t.__dict__
+ print(dir(t))
+ print(t.__dict__)
raise
if t.result == TEST_NOTRUN:
count[NOTRUN] += 1
@@ -434,7 +435,7 @@ def printresults(tests, opts, file=None):
count[WARN] += 1
elif t.result == TEST_PASS:
count[PASS] += 1
- print >> file, "*"*50
+ print("*"*50, file=file)
for t in tests:
if t.result == TEST_NOTRUN:
continue
@@ -448,16 +449,16 @@ def printresults(tests, opts, file=None):
continue
if (not opts.showfail) and t.result == TEST_FAIL:
continue
- print >> file, t.display(0,0)
- print >> file, "*"*50
+ print(t.display(0,0), file=file)
+ print("*"*50, file=file)
if count[NOTRUN]:
- print >> file, "Tests interrupted! Only %i tests run" % \
- sum(count[SKIP:])
+ print("Tests interrupted! Only %i tests run" % \
+ sum(count[SKIP:]), file=file)
else:
- print >> file, "Command line asked for %i of %i tests" % \
- (sum(count[SKIP:]), len(tests))
- print >> file, "Of those: %i Skipped, %i Failed, %i Warned, %i Passed" % \
- (count[SKIP], count[FAIL], count[WARN], count[PASS])
+ print("Command line asked for %i of %i tests" % \
+ (sum(count[SKIP:]), len(tests)), file=file)
+ print("Of those: %i Skipped, %i Failed, %i Warned, %i Passed" % \
+ (count[SKIP], count[FAIL], count[WARN], count[PASS]), file=file)
return count[FAIL]
def xml_printresults(tests, file_name, suite='all'):
diff --git a/nfs4.1/testserver.py b/nfs4.1/testserver.py
index 9c2133e..70b4f62 100755
--- a/nfs4.1/testserver.py
+++ b/nfs4.1/testserver.py
@@ -28,7 +28,7 @@
import use_local # HACK so don't have to rebuild constantly
import sys
if sys.hexversion < 0x02050000:
- print "Requires python 2.5 or higher"
+ print("Requires python 2.5 or higher")
sys.exit(1)
import os
@@ -196,16 +196,16 @@ def printflags(list):
command_names = [s.lower()[3:].replace('_', '') \
for s in nfs_opnum4.values()]
list.sort()
- # First print command names
+ # First print(command names)
print
for s in list:
if s in command_names:
- print s
+ print(s)
# Then everything else
print
for s in list:
if s not in command_names:
- print s
+ print(s)
def main():
p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n"
@@ -229,14 +229,14 @@ def main():
codes = cdict.keys()
codes.sort()
for c in codes:
- print c
+ print(c)
sys.exit(0)
if opt.showcodesflags:
codes = cdict.keys()
codes.sort()
for c in codes:
- print c, "FLAGS:", ', '.join(cdict[c].flags_list)
+ print(c, "FLAGS:", ', '.join(cdict[c].flags_list))
sys.exit(0)
# Grab server info and set defaults
@@ -257,14 +257,14 @@ def main():
for attr in dir(opt):
if attr.startswith('use') and attr != "usefh":
path = getattr(opt, attr)
- #print attr, path
+ #print(attr, path)
if path is None:
path = opt.path + ['tree', attr[3:]]
else:
# FIXME - have funct that checks path validity
if path[0] != '/':
p.error("Need to use absolute path for --%s" % attr)
- # print path
+ # print(path)
if path[-1] == '/' and attr != 'usedir':
p.error("Can't use dir for --%s" %attr)
try:
@@ -316,21 +316,21 @@ def main():
# Place tests in desired order
tests.sort() # FIXME - add options for random sort
- # Run the tests and save/print results
+ # Run the tests and save/print(results)
try:
env = environment.Environment(opt)
env.init()
except socket.gaierror, e:
if e.args[0] == -2:
- print "Unknown server '%s'" % opt.server
- print sys.exc_info()[1]
+ print("Unknown server '%s'" % opt.server)
+ print(sys.exc_info()[1])
sys.exit(1)
except Exception, e:
- print "Initialization failed, no tests run."
+ print("Initialization failed, no tests run.")
if not opt.maketree:
- print "Perhaps you need to use the --maketree option"
+ print("Perhaps you need to use the --maketree option")
raise
- print sys.exc_info()[1]
+ print(sys.exc_info()[1])
sys.exit(1)
if opt.outfile is not None:
fd = file(opt.outfile, 'w')
@@ -350,7 +350,7 @@ def main():
fail = True
testmod.printresults(tests, opt)
if fail:
- print "\nWARNING: could not clean testdir due to:\n%s\n" % str(e)
+ print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e))
if opt.xmlout is not None:
testmod.xml_printresults(tests, opt.xmlout)
diff --git a/rpc/rpc.py b/rpc/rpc.py
index 1a3ca38..e06dbbf 100644
--- a/rpc/rpc.py
+++ b/rpc/rpc.py
@@ -878,8 +878,8 @@ class ConnectionHandler(object):
def listen(self, pipe, xid):
# STUB - should be overwritten by subclass
header, data = pipe.listen(xid)
- print "HEADER", header
- print "DATA", repr(data)
+ print("HEADER", header)
+ print("DATA", repr(data))
#################################################
diff --git a/setup.py b/setup.py
index a032afe..ace0ab5 100755
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from __future__ import print_function
+
from distutils.core import setup
import sys
@@ -19,7 +21,7 @@ def setup(*args, **kwargs):
cwd = os.getcwd()
command = " ".join(sys.argv)
for dir in DIRS:
- print "\n\nMoving to %s" % dir
+ print("\n\nMoving to %s" % dir )
os.chdir(join(cwd, dir))
os.system("python %s" % command)
os.chdir(cwd)
diff --git a/showresults.py b/showresults.py
index b843a5f..962407d 100755
--- a/showresults.py
+++ b/showresults.py
@@ -1,13 +1,14 @@
#!/usr/bin/env python
# showresults.py - redisplay results from nfsv4 server tester output file
#
-# Requires python 2.3
+# Requires python 2.7
#
# Written by Fred Isaman <iisaman@citi.umich.edu>
# Copyright (C) 2004 University of Michigan, Center for
# Information Technology Integration
#
+from __future__ import print_function
# Allow to be run stright from package root
if __name__ == "__main__":
diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py
index 4eb5b16..6353835 100755
--- a/xdr/xdrgen.py
+++ b/xdr/xdrgen.py
@@ -300,7 +300,7 @@ def t_linecomment(t):
t.lexer.lineno += 1
def t_error(t):
- print "Illegal character %s at %d type %s" % (repr(t.value[0]), t.lexer.lineno, t.type)
+ print("Illegal character %s at %d type %s" % (repr(t.value[0]), t.lexer.lineno, t.type))
t.lexer.skip(1)
# Build the lexer
@@ -371,7 +371,7 @@ def p_optional_value(t):
if msg:
global error_occurred
error_occurred = True
- print "ERROR - %s near line %i" % (msg, t.lineno(1))
+ print("ERROR - %s near line %i" % (msg, t.lineno(1)))
def p_type_def_1(t):
'''type_def : TYPEDEF declaration SEMI'''
@@ -382,7 +382,7 @@ def p_type_def_1(t):
if d.type == 'void':
global error_occurred
error_occurred = True
- print "ERROR - can't use void in typedef at line %i" % lineno
+ print("ERROR - can't use void in typedef at line %i" % lineno)
return
d.lineno = lineno
if id_unique(d.id, d.type, lineno):
@@ -560,11 +560,11 @@ def p_enum_constant(t):
# We have a name instead of a constant, make sure it is defined
if value not in name_dict:
error_occurred = True
- print "ERROR - can't derefence %s at line %s" % (value, lineno)
+ print("ERROR - can't derefence %s at line %s" % (value, lineno))
elif not isinstance(name_dict[value], const_info):
error_occurred = True
- print "ERROR - reference to %s at line %s is not a constant" %\
- (value, lineno)
+ print("ERROR - reference to %s at line %s is not a constant" %\
+ (value, lineno))
else:
info.positive = name_dict[value].positive
t[0] = [info]
@@ -586,9 +586,9 @@ def p_error(t):
global error_occurred
error_occurred = True
if t:
- print "Syntax error at '%s' (lineno %d)" % (t.value, t.lineno)
+ print("Syntax error at '%s' (lineno %d)" % (t.value, t.lineno))
else:
- print "Syntax error: unexpectedly hit EOF"
+ print("Syntax error: unexpectedly hit EOF")
#
# RPC specific routines follow
@@ -596,7 +596,7 @@ def p_error(t):
def p_program_def(t):
'''program_def : PROGRAM ID LBRACE version_def version_def_list RBRACE EQUALS constant SEMI'''
- print "Ignoring program %s = %s" % (t[2], t[8])
+ print("Ignoring program %s = %s" % (t[2], t[8]))
global name_dict
id = t[2]
value = t[8]
@@ -666,8 +666,8 @@ def id_unique(id, name, lineno):
if id in name_dict:
global error_occurred
error_occurred = True
- print "ERROR - %s definition %s at line %s conflicts with %s" % \
- (name, id, lineno, name_dict[id])
+ print("ERROR - %s definition %s at line %s conflicts with %s" % \
+ (name, id, lineno, name_dict[id]))
return False
else:
return True
@@ -1391,7 +1391,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False):
global use_filters, allow_attr_passthrough
use_filters = filters
allow_attr_passthrough = pass_attrs
- print "Input file is", infile
+ print("Input file is", infile)
# Create output file names (without .py)
global constants_file, types_file, packer_file
@@ -1399,8 +1399,8 @@ def run(infile, filters=True, pass_attrs=True, debug=False):
constants_file = name_base + "_const"
types_file = name_base + "_type"
packer_file = name_base + "_pack"
- print "Will use output files %s.py, %s.py, and %s.py" % \
- (constants_file, types_file, packer_file)
+ print("Will use output files %s.py, %s.py, and %s.py" % \
+ (constants_file, types_file, packer_file))
# Parse the input data with yacc
global name_dict
@@ -1414,7 +1414,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False):
if error_occurred:
print
- print "Error occurred, did not write output files"
+ print("Error occurred, did not write output files")
return 1
comment_string = "# Generated by rpcgen.py from %s on %s\n" % \
@@ -1433,7 +1433,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False):
type_list = name_dict.values()
type_list.sort()
for value in type_list:
- #print value
+ #print(value)
output = value.const_output()
if output is not None:
#const_fd.write("# **** %s ****\n" % value.id)
@@ -1465,7 +1465,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False):
#
if __name__ == "__main__":
if len(sys.argv) < 2:
- print "Usage: %s <filename>" % sys.argv[0]
+ print("Usage: %s <filename>" % sys.argv[0])
sys.exit(1)
run(sys.argv[1])
--
2.17.1
^ permalink raw reply related
* [U-Boot] [linux-sunxi] Re: [PATCH v2 10/13] sunxi: add MMC support for H6
From: Icenowy Zheng @ 2018-07-24 8:39 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20180724083743.cboz25nswq6r7wry@flea>
于 2018年7月24日 GMT+08:00 下午4:37:43, Maxime Ripard <maxime.ripard@bootlin.com> 写到:
>On Sat, Jul 21, 2018 at 04:20:29PM +0800, Icenowy Zheng wrote:
>> The Allwinner H6 SoC has 3 MMC controllers like the ones in A64, with
>> the MMC2 come with the capability to do crypto by EMCE.
>>
>> Add MMC support for H6. EMCE support is not added yet.
>>
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>> arch/arm/include/asm/arch-sunxi/mmc.h | 2 +-
>> board/sunxi/board.c | 7 +++++++
>> drivers/mmc/sunxi_mmc.c | 13 ++++++++++++-
>> 3 files changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h
>b/arch/arm/include/asm/arch-sunxi/mmc.h
>> index 1574b8e8fe..d98c53faaa 100644
>> --- a/arch/arm/include/asm/arch-sunxi/mmc.h
>> +++ b/arch/arm/include/asm/arch-sunxi/mmc.h
>> @@ -45,7 +45,7 @@ struct sunxi_mmc {
>> u32 chda; /* 0x90 */
>> u32 cbda; /* 0x94 */
>> u32 res2[26];
>> -#ifdef CONFIG_SUNXI_GEN_SUN6I
>> +#if defined(CONFIG_SUNXI_GEN_SUN6I) ||
>defined(CONFIG_MACH_SUN50I_H6)
>> u32 res3[64];
>> #endif
>> u32 fifo; /* 0x100 / 0x200 FIFO access address */
>> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
>> index 5ed1b8bae1..857d5ff010 100644
>> --- a/board/sunxi/board.c
>> +++ b/board/sunxi/board.c
>> @@ -443,6 +443,13 @@ static void mmc_pinmux_setup(int sdc)
>> sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
>> sunxi_gpio_set_drv(pin, 2);
>> }
>> +#elif defined(CONFIG_MACH_SUN50I_H6)
>> + /* SDC2: PC4-PC14 */
>> + for (pin = SUNXI_GPC(4); pin <= SUNXI_GPC(14); pin++) {
>> + sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
>> + sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
>> + sunxi_gpio_set_drv(pin, 2);
>> + }
>> #elif defined(CONFIG_MACH_SUN9I)
>> /* SDC2: PC6-PC16 */
>> for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(16); pin++) {
>> diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
>> index 7fa1ae8b16..39f15eb423 100644
>> --- a/drivers/mmc/sunxi_mmc.c
>> +++ b/drivers/mmc/sunxi_mmc.c
>> @@ -70,10 +70,12 @@ static int mmc_resource_init(int sdc_no)
>> priv->reg = (struct sunxi_mmc *)SUNXI_MMC2_BASE;
>> priv->mclkreg = &ccm->sd2_clk_cfg;
>> break;
>> +#ifdef SUNXI_MMC3_BASE
>> case 3:
>> priv->reg = (struct sunxi_mmc *)SUNXI_MMC3_BASE;
>> priv->mclkreg = &ccm->sd3_clk_cfg;
>> break;
>> +#endif
>> default:
>> printf("Wrong mmc number %d\n", sdc_no);
>> return -1;
>> @@ -116,6 +118,9 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv
>*priv, unsigned int hz)
>> #ifdef CONFIG_MACH_SUN9I
>> pll = CCM_MMC_CTRL_PLL_PERIPH0;
>> pll_hz = clock_get_pll4_periph0();
>> +#elif defined(CONFIG_MACH_SUN50I_H6)
>> + pll = CCM_MMC_CTRL_PLL6X2;
>> + pll_hz = clock_get_pll6() * 2;
>> #else
>> pll = CCM_MMC_CTRL_PLL6;
>> pll_hz = clock_get_pll6();
>> @@ -494,7 +499,7 @@ struct mmc *sunxi_mmc_init(int sdc_no)
>>
>> cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
>> cfg->host_caps = MMC_MODE_4BIT;
>> -#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN8I)
>> +#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN8I) ||
>defined(CONFIG_MACH_SUN50I_H6)
>> if (sdc_no == 2)
>> cfg->host_caps = MMC_MODE_8BIT;
>> #endif
>> @@ -509,6 +514,7 @@ struct mmc *sunxi_mmc_init(int sdc_no)
>>
>> /* config ahb clock */
>> debug("init mmc %d clock and io\n", sdc_no);
>> +#if !defined(CONFIG_MACH_SUN50I_H6)
>> setbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_MMC(sdc_no));
>>
>> #ifdef CONFIG_SUNXI_GEN_SUN6I
>> @@ -519,6 +525,11 @@ struct mmc *sunxi_mmc_init(int sdc_no)
>> /* sun9i has a mmc-common module, also set the gate and reset there
>*/
>> writel(SUNXI_MMC_COMMON_CLK_GATE | SUNXI_MMC_COMMON_RESET,
>> SUNXI_MMC_COMMON_BASE + 4 * sdc_no);
>> +#endif
>> +#else /* CONFIG_MACH_SUN50I_H6 */
>> + setbits_le32(&ccm->sd_gate_reset, 1 << sdc_no);
>> + /* unassert reset */
>> + setbits_le32(&ccm->sd_gate_reset, 1 << (RESET_SHIFT + sdc_no));
>> #endif
>> ret = mmc_set_mod_clk(priv, 24000000);
>> if (ret)
>
>You should use the DM instead.
Then we still need the DM-less ver for SPL.
>
>Maxime
^ permalink raw reply
* [PATCH 02/24] pynfs: python3 support plan: exec -> exec()
From: jiyin @ 2018-07-24 7:33 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Jianhong.Yin
In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com>
From: "Jianhong.Yin" <yin-jianhong@163.com>
'/exec / {:loop /[^\\]$/! {N; b loop}; s/exec /exec(/; s/$/)/; }'
Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
---
nfs4.1/nfs4commoncode.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nfs4.1/nfs4commoncode.py b/nfs4.1/nfs4commoncode.py
index cadd237..3c9c811 100644
--- a/nfs4.1/nfs4commoncode.py
+++ b/nfs4.1/nfs4commoncode.py
@@ -190,8 +190,8 @@ class %(CompoundState)s(object):
'''
# Create normal code
-exec code_str % _d
+exec(code_str % _d)
# Create callback code
-exec code_str % _cb_d
+exec(code_str % _cb_d)
--
2.17.1
^ permalink raw reply related
* [U-Boot] [PATCH v2 12/13] sunxi: add support for Allwinner H6 SoC
From: Maxime Ripard @ 2018-07-24 8:38 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20180721082032.39980-13-icenowy@aosc.io>
On Sat, Jul 21, 2018 at 04:20:31PM +0800, Icenowy Zheng wrote:
> Allwinner H6 is a new SoC from Allwinner features USB3 and PCIe
> interfaces.
>
> This patch adds support for it.
>
> The corresponding DTSI file, from Linux next-20180720, is also
> introduced.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180724/49abc4a8/attachment.sig>
^ permalink raw reply
* Re: CCREE performance on R-Car H3 + crash
From: Gilad Ben-Yossef @ 2018-07-24 7:32 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Linux-Renesas, Linux Crypto Mailing List
In-Reply-To: <CAMuHMdWmm3_02BvQHfTSCVywQ-_W9_h62qBUr9datqycF40kUQ@mail.gmail.com>
On Mon, Jul 23, 2018 at 5:35 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Hi Gilad,
>
> On Mon, Jul 23, 2018 at 4:25 PM Gilad Ben-Yossef <gilad@benyossef.com> wrote:
>> On Mon, Jul 23, 2018 at 1:31 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote:
>> > On Mon, Jul 23, 2018 at 12:55 PM, Geert Uytterhoeven
>> > <geert@linux-m68k.org> wrote:
>> >> CC linux-crypto for the crash log.
>> >>
>> >> On Sun, Jul 22, 2018 at 7:28 AM Gilad Ben-Yossef <gilad@benyossef.com> wrote:
>> >>> On Thu, Jul 19, 2018 at 3:43 PM, Geert Uytterhoeven
>> >>> <geert@linux-m68k.org> wrote:
>> >>> > I've noticed CCREE is used with a LUKS-formatted disk, so I did some small
>> > ...
>> >>
>> >> $ cryptsetup benchmark
>> >> # Tests are approximate using memory only (no storage IO).
>> >> PBKDF2-sha1 478364 iterations per second for 256-bit key
>> >> PBKDF2-sha256 927943 iterations per second for 256-bit key
>> >> PBKDF2-sha512 360583 iterations per second for 256-bit key
>> >> PBKDF2-ripemd160 266677 iterations per second for 256-bit key
>> >> PBKDF2-whirlpool 115787 iterations per second for 256-bit key
>> >> # Algorithm | Key | Encryption | Decryption
>> >> aes-cbc 128b 46.0 MiB/s 46.7 MiB/s
>> >> serpent-cbc 128b N/A N/A
>> >> twofish-cbc 128b N/A N/A
>> >> aes-cbc 256b 46.5 MiB/s 46.4 MiB/s
>> >> serpent-cbc 256b N/A N/A
>> >> twofish-cbc 256b N/A N/A
>> >> Segmentation fault
>> >>
>> >> Oops.
>> >>
>> >> ccree e6601000.crypto: Unsupported data size 65536.
>> >> Unable to handle kernel paging request at virtual address ffffffbf5c3c3c20
>> >
>> > Oy. Thank you for reporting this. I'll take a look at what is going on ASAP.
>>
>> hmm... well, the plot thickens.
>>
>> I was able to recreate the "Unsupported data size 65536" message and
>> now trying to understand
>> why the check that causes it is there but - I wasn't able to get a
>> crash, nor do I understand why
>> this condition would result in a crash (it ends up returning -EINVAL)... :-(
>>
>> I am surely using a different tree though - I'm based on the
>> cryptodev/master tree with cherry picking of just R-Car ccree clocks
>> and enabling.
>>
>> I was thinking maybe it's a fix that is already in upstream cryptodev
>> tree but not in your tree but didn't manage to identify any obvious
>> suspects
>>
>> What tree are you based off?
>
> My tree is based on renesas-drivers-2018-07-17-v4.18-rc5 from
> https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/
>
> Do you want me to try something different?
I've tried booting your tree and see the same behavior - "Unsupported
data size" error message but no crash.
I'm running on an Savator-X R-Car H3 ES1.0 board.
Not really sure how to proceed.
Maybe you can send me your exact .config file?
Thanks,
Gilad
--
Gilad Ben-Yossef
Chief Coffee Drinker
values of β will give rise to dom!
^ permalink raw reply
* Re: [PATCH] lsof: Update SRC_URI
From: Alexander Kanavin @ 2018-07-24 8:37 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
In-Reply-To: <CAJTo0LaFai2biC-973Da-o7NMFwYkMWRTa4F5O+prseWFNwW4A@mail.gmail.com>
Also, if an upgrade is undesirable for some reason, then such changes
need UPSTREAM_CHECK_URI, or we'll be missing new upstream releases.
Alex
2018-07-24 10:07 GMT+02:00 Burton, Ross <ross.burton@intel.com>:
> Well for master if there's a new version then a better fix would be to
> upgrade, but we do need to make sure the previous releases are using
> mirrors.
>
> On 24 July 2018 at 08:48, Ovidiu Panait <ovidiu.panait@windriver.com> wrote:
>> lsof 4.89 archive has been moved to OLD directory and turned into tar.gz,
>> so update SRC_URI and checksums.
>>
>> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
>> ---
>> meta/recipes-extended/lsof/lsof_4.89.bb | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/meta/recipes-extended/lsof/lsof_4.89.bb b/meta/recipes-extended/lsof/lsof_4.89.bb
>> index 14546db23c..b58b8281f9 100644
>> --- a/meta/recipes-extended/lsof/lsof_4.89.bb
>> +++ b/meta/recipes-extended/lsof/lsof_4.89.bb
>> @@ -11,12 +11,12 @@ LIC_FILES_CHKSUM = "file://00README;beginline=645;endline=679;md5=964df275d26429
>> # https://people.freebsd.org/~abe/ ). http://www.mirrorservice.org seems to be
>> # the most commonly used alternative.
>>
>> -SRC_URI = "http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_${PV}.tar.bz2 \
>> +SRC_URI = "http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/lsof_${PV}.tar.gz \
>> file://lsof-remove-host-information.patch \
>> "
>>
>> -SRC_URI[md5sum] = "1b9cd34f3fb86856a125abbf2be3a386"
>> -SRC_URI[sha256sum] = "81ac2fc5fdc944793baf41a14002b6deb5a29096b387744e28f8c30a360a3718"
>> +SRC_URI[md5sum] = "8afbaff3ee308edc130bdc5df0801c8f"
>> +SRC_URI[sha256sum] = "5d08da7ebe049c9d9a6472d6afb81aa5af54c4733a3f8822cbc22b57867633c9"
>>
>> LOCALSRC = "file://${WORKDIR}/lsof_${PV}/lsof_${PV}_src.tar"
>>
>> --
>> 2.17.1
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply
* [U-Boot] [PATCH v2 10/13] sunxi: add MMC support for H6
From: Maxime Ripard @ 2018-07-24 8:37 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20180721082032.39980-11-icenowy@aosc.io>
On Sat, Jul 21, 2018 at 04:20:29PM +0800, Icenowy Zheng wrote:
> The Allwinner H6 SoC has 3 MMC controllers like the ones in A64, with
> the MMC2 come with the capability to do crypto by EMCE.
>
> Add MMC support for H6. EMCE support is not added yet.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> arch/arm/include/asm/arch-sunxi/mmc.h | 2 +-
> board/sunxi/board.c | 7 +++++++
> drivers/mmc/sunxi_mmc.c | 13 ++++++++++++-
> 3 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h b/arch/arm/include/asm/arch-sunxi/mmc.h
> index 1574b8e8fe..d98c53faaa 100644
> --- a/arch/arm/include/asm/arch-sunxi/mmc.h
> +++ b/arch/arm/include/asm/arch-sunxi/mmc.h
> @@ -45,7 +45,7 @@ struct sunxi_mmc {
> u32 chda; /* 0x90 */
> u32 cbda; /* 0x94 */
> u32 res2[26];
> -#ifdef CONFIG_SUNXI_GEN_SUN6I
> +#if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_MACH_SUN50I_H6)
> u32 res3[64];
> #endif
> u32 fifo; /* 0x100 / 0x200 FIFO access address */
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 5ed1b8bae1..857d5ff010 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -443,6 +443,13 @@ static void mmc_pinmux_setup(int sdc)
> sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
> sunxi_gpio_set_drv(pin, 2);
> }
> +#elif defined(CONFIG_MACH_SUN50I_H6)
> + /* SDC2: PC4-PC14 */
> + for (pin = SUNXI_GPC(4); pin <= SUNXI_GPC(14); pin++) {
> + sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
> + sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
> + sunxi_gpio_set_drv(pin, 2);
> + }
> #elif defined(CONFIG_MACH_SUN9I)
> /* SDC2: PC6-PC16 */
> for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(16); pin++) {
> diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
> index 7fa1ae8b16..39f15eb423 100644
> --- a/drivers/mmc/sunxi_mmc.c
> +++ b/drivers/mmc/sunxi_mmc.c
> @@ -70,10 +70,12 @@ static int mmc_resource_init(int sdc_no)
> priv->reg = (struct sunxi_mmc *)SUNXI_MMC2_BASE;
> priv->mclkreg = &ccm->sd2_clk_cfg;
> break;
> +#ifdef SUNXI_MMC3_BASE
> case 3:
> priv->reg = (struct sunxi_mmc *)SUNXI_MMC3_BASE;
> priv->mclkreg = &ccm->sd3_clk_cfg;
> break;
> +#endif
> default:
> printf("Wrong mmc number %d\n", sdc_no);
> return -1;
> @@ -116,6 +118,9 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
> #ifdef CONFIG_MACH_SUN9I
> pll = CCM_MMC_CTRL_PLL_PERIPH0;
> pll_hz = clock_get_pll4_periph0();
> +#elif defined(CONFIG_MACH_SUN50I_H6)
> + pll = CCM_MMC_CTRL_PLL6X2;
> + pll_hz = clock_get_pll6() * 2;
> #else
> pll = CCM_MMC_CTRL_PLL6;
> pll_hz = clock_get_pll6();
> @@ -494,7 +499,7 @@ struct mmc *sunxi_mmc_init(int sdc_no)
>
> cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
> cfg->host_caps = MMC_MODE_4BIT;
> -#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN8I)
> +#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN8I) || defined(CONFIG_MACH_SUN50I_H6)
> if (sdc_no == 2)
> cfg->host_caps = MMC_MODE_8BIT;
> #endif
> @@ -509,6 +514,7 @@ struct mmc *sunxi_mmc_init(int sdc_no)
>
> /* config ahb clock */
> debug("init mmc %d clock and io\n", sdc_no);
> +#if !defined(CONFIG_MACH_SUN50I_H6)
> setbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_MMC(sdc_no));
>
> #ifdef CONFIG_SUNXI_GEN_SUN6I
> @@ -519,6 +525,11 @@ struct mmc *sunxi_mmc_init(int sdc_no)
> /* sun9i has a mmc-common module, also set the gate and reset there */
> writel(SUNXI_MMC_COMMON_CLK_GATE | SUNXI_MMC_COMMON_RESET,
> SUNXI_MMC_COMMON_BASE + 4 * sdc_no);
> +#endif
> +#else /* CONFIG_MACH_SUN50I_H6 */
> + setbits_le32(&ccm->sd_gate_reset, 1 << sdc_no);
> + /* unassert reset */
> + setbits_le32(&ccm->sd_gate_reset, 1 << (RESET_SHIFT + sdc_no));
> #endif
> ret = mmc_set_mod_clk(priv, 24000000);
> if (ret)
You should use the DM instead.
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180724/902ee2ff/attachment.sig>
^ permalink raw reply
* Re: [PATCH 1/4] sched/topology: SD_ASYM_CPUCAPACITY flag detection
From: Morten Rasmussen @ 2018-07-24 8:37 UTC (permalink / raw)
To: Qais Yousef
Cc: vincent.guittot, peterz, linux-kernel, dietmar.eggemann, mingo,
valentin.schneider, linux-arm-kernel
In-Reply-To: <b75f665f-7d60-5d83-eaf6-88c534afe254@arm.com>
On Mon, Jul 23, 2018 at 05:07:50PM +0100, Qais Yousef wrote:
> On 23/07/18 16:27, Morten Rasmussen wrote:
> >It does increase the cost of things like hotplug slightly and
> >repartitioning of root_domains a slightly but I don't see how we can
> >avoid it if we want generic code to set this flag. If the costs are not
> >acceptable I think the only option is to make the detection architecture
> >specific.
>
> I think hotplug is already expensive and this overhead would be small in
> comparison. But this could be called when frequency changes if I understood
> correctly - this is the one I wasn't sure how 'hot' it could be. I wouldn't
> expect frequency changes at a very high rate because it's relatively
> expensive too..
A frequency change shouldn't lead to a flag change or a rebuild of the
sched_domain hierarhcy. The situations where the hierarchy should be
rebuild to update the flag is during boot as we only know the amount of
asymmetry once cpufreq has been initialized, when cpus are hotplugged
in/out, and when root_domains change due to cpuset reconfiguration. So
it should be a relatively rare event.
^ permalink raw reply
* [PATCH 1/4] sched/topology: SD_ASYM_CPUCAPACITY flag detection
From: Morten Rasmussen @ 2018-07-24 8:37 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <b75f665f-7d60-5d83-eaf6-88c534afe254@arm.com>
On Mon, Jul 23, 2018 at 05:07:50PM +0100, Qais Yousef wrote:
> On 23/07/18 16:27, Morten Rasmussen wrote:
> >It does increase the cost of things like hotplug slightly and
> >repartitioning of root_domains a slightly but I don't see how we can
> >avoid it if we want generic code to set this flag. If the costs are not
> >acceptable I think the only option is to make the detection architecture
> >specific.
>
> I think hotplug is already expensive and this overhead would be small in
> comparison. But this could be called when frequency changes if I understood
> correctly - this is the one I wasn't sure how 'hot' it could be. I wouldn't
> expect frequency changes at a very high rate because it's relatively
> expensive too..
A frequency change shouldn't lead to a flag change or a rebuild of the
sched_domain hierarhcy. The situations where the hierarchy should be
rebuild to update the flag is during boot as we only know the amount of
asymmetry once cpufreq has been initialized, when cpus are hotplugged
in/out, and when root_domains change due to cpuset reconfiguration. So
it should be a relatively rare event.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.