summaryrefslogtreecommitdiffstats
path: root/gluster
diff options
context:
space:
mode:
authorThiago da Silva <thiago@redhat.com>2015-09-02 07:08:17 -0700
committerGerrit Code Review <review@dev.gluster.org>2015-09-02 07:08:18 -0700
commitf3acbc844a105d342a3133789f01eaf713a981d1 (patch)
treec36e9bcb31f36232b453131f7494dbb7d19b76d8 /gluster
parentc9fedc64081e1504a1bbf88be5a5dcfb9fff3652 (diff)
parentca456a770e835f829281dac85bd8c4f00b8624ff (diff)
Merge "Fix open/fopen in thread other than main"
Diffstat (limited to 'gluster')
-rwxr-xr-xgluster/api.py20
-rwxr-xr-xgluster/gfapi.py11
2 files changed, 16 insertions, 15 deletions
diff --git a/gluster/api.py b/gluster/api.py
index d2a0840..0ec5413 100755
--- a/gluster/api.py
+++ b/gluster/api.py
@@ -284,6 +284,18 @@ glfs_set_logging = ctypes.CFUNCTYPE(ctypes.c_int,
glfs_fini = ctypes.CFUNCTYPE(
ctypes.c_int, ctypes.c_void_p)(('glfs_fini', client))
+glfs_creat = ctypes.CFUNCTYPE(ctypes.c_void_p,
+ ctypes.c_void_p,
+ ctypes.c_char_p,
+ ctypes.c_int,
+ ctypes.c_uint,
+ use_errno=True)(('glfs_creat', client))
+
+glfs_open = ctypes.CFUNCTYPE(ctypes.c_void_p,
+ ctypes.c_void_p,
+ ctypes.c_char_p,
+ ctypes.c_int,
+ use_errno=True)(('glfs_open', client))
glfs_close = ctypes.CFUNCTYPE(
ctypes.c_int, ctypes.c_void_p)(('glfs_close', client))
@@ -457,12 +469,6 @@ glfs_getcwd = ctypes.CFUNCTYPE(ctypes.c_char_p,
ctypes.c_size_t)(('glfs_getcwd', client))
-# TODO: creat and open fails on test_create_file_already_exists & test_open_file_not_exist functional testing, # noqa
-# when defined via function prototype.. Need to find RCA. For time being, using it from 'api.glfs_' # noqa
-#_glfs_creat = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_uint) # noqa
- # (('glfs_creat', client)) # noqa
-#_glfs_open = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int) # noqa
-# (('glfs_open', client)) # noqa
# TODO: # discard and fallocate fails with "AttributeError: /lib64/libgfapi.so.0: undefined symbol: glfs_discard", # noqa
# for time being, using it from api.* # noqa
# glfs_discard = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_ulong, ctypes.c_size_t)(('glfs_discard', client)) # noqa
@@ -470,8 +476,6 @@ glfs_getcwd = ctypes.CFUNCTYPE(ctypes.c_char_p,
# (('glfs_fallocate', client)) # noqa
-#glfs_creat = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_uint)(('glfs_creat', client)) # noqa
-#glfs_open = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int)(('glfs_open', client)) # noqa
#glfs_discard = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_ulong, ctypes.c_size_t)(('glfs_discard', client)) # noqa
#glfs_fallocate = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_ulong, ctypes.c_size_t)(('glfs_fallocate', client)) # noqa
diff --git a/gluster/gfapi.py b/gluster/gfapi.py
index 9b0d9a8..7fee1bb 100755
--- a/gluster/gfapi.py
+++ b/gluster/gfapi.py
@@ -777,9 +777,9 @@ class Volume(object):
raise ValueError("Invalid mode")
else:
if (os.O_CREAT & flags) == os.O_CREAT:
- fd = api.client.glfs_creat(self.fs, path, flags, 0666)
+ fd = api.glfs_creat(self.fs, path, flags, 0666)
else:
- fd = api.client.glfs_open(self.fs, path, flags)
+ fd = api.glfs_open(self.fs, path, flags)
if not fd:
err = ctypes.get_errno()
raise OSError(err, os.strerror(err))
@@ -803,12 +803,9 @@ class Volume(object):
raise TypeError("flags must evaluate to an integer")
if (os.O_CREAT & flags) == os.O_CREAT:
- # FIXME:
- # Without direct call to _api the functest fails on creat and open.
-
- fd = api.client.glfs_creat(self.fs, path, flags, mode)
+ fd = api.glfs_creat(self.fs, path, flags, mode)
else:
- fd = api.client.glfs_open(self.fs, path, flags)
+ fd = api.glfs_open(self.fs, path, flags)
if not fd:
err = ctypes.get_errno()
raise OSError(err, os.strerror(err))