@@ -61,45 +61,45 @@ CEPH_NOSNAP = -2
6161
6262# errno definitions
6363cdef enum :
64- CEPHFS_EBLOCKLISTED = 108
65- CEPHFS_EPERM = 1
66- CEPHFS_ESTALE = 116
67- CEPHFS_ENOSPC = 28
68- CEPHFS_ETIMEDOUT = 110
69- CEPHFS_EIO = 5
70- CEPHFS_ENOTCONN = 107
71- CEPHFS_EEXIST = 17
72- CEPHFS_EINTR = 4
73- CEPHFS_EINVAL = 22
74- CEPHFS_EBADF = 9
75- CEPHFS_EROFS = 30
76- CEPHFS_EAGAIN = 11
77- CEPHFS_EACCES = 13
78- CEPHFS_ELOOP = 40
79- CEPHFS_EISDIR = 21
80- CEPHFS_ENOENT = 2
81- CEPHFS_ENOTDIR = 20
82- CEPHFS_ENAMETOOLONG = 36
83- CEPHFS_EBUSY = 16
84- CEPHFS_EDQUOT = 122
85- CEPHFS_EFBIG = 27
86- CEPHFS_ERANGE = 34
87- CEPHFS_ENXIO = 6
88- CEPHFS_ECANCELED = 125
89- CEPHFS_ENODATA = 61
90- CEPHFS_EOPNOTSUPP = 95
91- CEPHFS_EXDEV = 18
92- CEPHFS_ENOMEM = 12
93- CEPHFS_ENOTRECOVERABLE = 131
94- CEPHFS_ENOSYS = 38
95- CEPHFS_EWOULDBLOCK = CEPHFS_EAGAIN
96- CEPHFS_ENOTEMPTY = 39
97- CEPHFS_EDEADLK = 35
98- CEPHFS_EDEADLOCK = CEPHFS_EDEADLK
99- CEPHFS_EDOM = 33
100- CEPHFS_EMLINK = 31
101- CEPHFS_ETIME = 62
102- CEPHFS_EOLDSNAPC = 85
64+ EBLOCKLISTED = 108
65+ EPERM = 1
66+ ESTALE = 116
67+ ENOSPC = 28
68+ ETIMEDOUT = 110
69+ EIO = 5
70+ ENOTCONN = 107
71+ EEXIST = 17
72+ EINTR = 4
73+ EINVAL = 22
74+ EBADF = 9
75+ EROFS = 30
76+ EAGAIN = 11
77+ EACCES = 13
78+ ELOOP = 40
79+ EISDIR = 21
80+ ENOENT = 2
81+ ENOTDIR = 20
82+ ENAMETOOLONG = 36
83+ EBUSY = 16
84+ EDQUOT = 122
85+ EFBIG = 27
86+ ERANGE = 34
87+ ENXIO = 6
88+ ECANCELED = 125
89+ ENODATA = 61
90+ EOPNOTSUPP = 95
91+ EXDEV = 18
92+ ENOMEM = 12
93+ ENOTRECOVERABLE = 131
94+ ENOSYS = 38
95+ EWOULDBLOCK = EAGAIN
96+ ENOTEMPTY = 39
97+ EDEADLK = 35
98+ EDEADLOCK = EDEADLK
99+ EDOM = 33
100+ EMLINK = 31
101+ ETIME = 62
102+ EOLDSNAPC = 85
103103
104104cdef extern from " Python.h" :
105105 # These are in cpython/string.pxd, but use "object" types instead of
@@ -186,20 +186,20 @@ class PermissionDenied(OSError):
186186 pass
187187
188188cdef errno_to_exception = {
189- CEPHFS_EPERM : PermissionError,
190- CEPHFS_ENOENT : ObjectNotFound,
191- CEPHFS_EIO : IOError ,
192- CEPHFS_ENOSPC : NoSpace,
193- CEPHFS_EEXIST : ObjectExists,
194- CEPHFS_ENODATA : NoData,
195- CEPHFS_EINVAL : InvalidValue,
196- CEPHFS_EOPNOTSUPP : OperationNotSupported,
197- CEPHFS_ERANGE : OutOfRange,
198- CEPHFS_EWOULDBLOCK : WouldBlock,
199- CEPHFS_ENOTEMPTY : ObjectNotEmpty,
200- CEPHFS_ENOTDIR : NotDirectory,
201- CEPHFS_EDQUOT : DiskQuotaExceeded,
202- CEPHFS_EACCES : PermissionDenied,
189+ EPERM : PermissionError,
190+ ENOENT : ObjectNotFound,
191+ EIO : IOError ,
192+ ENOSPC : NoSpace,
193+ EEXIST : ObjectExists,
194+ ENODATA : NoData,
195+ EINVAL : InvalidValue,
196+ EOPNOTSUPP : OperationNotSupported,
197+ ERANGE : OutOfRange,
198+ EWOULDBLOCK : WouldBlock,
199+ ENOTEMPTY : ObjectNotEmpty,
200+ ENOTDIR : NotDirectory,
201+ EDQUOT : DiskQuotaExceeded,
202+ EACCES : PermissionDenied,
203203}
204204
205205
@@ -256,7 +256,7 @@ cdef class DirResult(object):
256256
257257 def __enter__ (self ):
258258 if not self .handle:
259- raise make_ex(CEPHFS_EBADF , " dir is not open" )
259+ raise make_ex(EBADF , " dir is not open" )
260260 self .lib.require_state(" mounted" )
261261 with nogil:
262262 ceph_rewinddir(self .lib.cluster, self .handle)
@@ -300,14 +300,14 @@ cdef class DirResult(object):
300300
301301 def rewinddir (self ):
302302 if not self .handle:
303- raise make_ex(CEPHFS_EBADF , " dir is not open" )
303+ raise make_ex(EBADF , " dir is not open" )
304304 self .lib.require_state(" mounted" )
305305 with nogil:
306306 ceph_rewinddir(self .lib.cluster, self .handle)
307307
308308 def telldir (self ):
309309 if not self .handle:
310- raise make_ex(CEPHFS_EBADF , " dir is not open" )
310+ raise make_ex(EBADF , " dir is not open" )
311311 self .lib.require_state(" mounted" )
312312 with nogil:
313313 ret = ceph_telldir(self .lib.cluster, self .handle)
@@ -317,7 +317,7 @@ cdef class DirResult(object):
317317
318318 def seekdir (self , offset ):
319319 if not self .handle:
320- raise make_ex(CEPHFS_EBADF , " dir is not open" )
320+ raise make_ex(EBADF , " dir is not open" )
321321 if not isinstance (offset, int ):
322322 raise TypeError (' offset must be an int' )
323323 self .lib.require_state(" mounted" )
@@ -486,7 +486,7 @@ cdef class LibCephFS(object):
486486 self .state = " uninitialized"
487487 if rados_inst is not None :
488488 if auth_id is not None or conffile is not None or conf is not None :
489- raise make_ex(CEPHFS_EINVAL ,
489+ raise make_ex(EINVAL ,
490490 " May not pass RADOS instance as well as other configuration" )
491491
492492 self .create_with_rados(rados_inst)
@@ -663,9 +663,9 @@ cdef class LibCephFS(object):
663663 ret = ceph_conf_get(self .cluster, _option, ret_buf, length)
664664 if ret == 0 :
665665 return decode_cstr(ret_buf)
666- elif ret == - CEPHFS_ENAMETOOLONG :
666+ elif ret == - ENAMETOOLONG :
667667 length = length * 2
668- elif ret == - CEPHFS_ENOENT :
668+ elif ret == - ENOENT :
669669 return None
670670 else :
671671 raise make_ex(ret, " error calling conf_get" )
@@ -702,7 +702,7 @@ cdef class LibCephFS(object):
702702 if not isinstance (timeout, int ):
703703 raise TypeError (' timeout must be an integer' )
704704 if timeout < 0 :
705- raise make_ex(CEPHFS_EINVAL , ' timeout must be greater than or equal to 0' )
705+ raise make_ex(EINVAL , ' timeout must be greater than or equal to 0' )
706706 cdef:
707707 uint32_t _timeout = timeout
708708 with nogil:
@@ -1390,7 +1390,7 @@ cdef class LibCephFS(object):
13901390 elif access_flags > 0 and c == ' +' :
13911391 access_flags = 3 ;
13921392 else :
1393- raise make_ex(CEPHFS_EOPNOTSUPP ,
1393+ raise make_ex(EOPNOTSUPP ,
13941394 " open flags doesn't support %s " % c)
13951395
13961396 if access_flags == 1 :
@@ -2735,7 +2735,7 @@ cdef class LibCephFS(object):
27352735 if ret > 0 :
27362736 dict_result[" pool_name" ] = decode_cstr(buf)
27372737 return dict_result
2738- elif ret == - CEPHFS_ERANGE :
2738+ elif ret == - ERANGE :
27392739 buflen = buflen * 2
27402740 else :
27412741 raise make_ex(ret, " error in get_file_pool_name" )
@@ -2761,7 +2761,7 @@ cdef class LibCephFS(object):
27612761 if ret > 0 :
27622762 dict_result[" pool_name" ] = decode_cstr(buf)
27632763 break
2764- elif ret == - CEPHFS_ERANGE :
2764+ elif ret == - ERANGE :
27652765 buflen = buflen * 2
27662766 else :
27672767 raise make_ex(ret, " error in get_default_data_pool_name" )
0 commit comments