Custom Search

SUBSCRIBE

SUBSCRIBE : 300 + Free Video Tutorials Programming (Python, golang, Julia), DevOps

Tuesday, December 8, 2015

python ctypes example load librbd

# python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>>
>>>
>>> from ctypes.util import find_library
>>> librbd_path = find_library('rbd')
>>> librbd_path
'librbd.so.1'
>>>
>>>
>>> from ctypes import CDLL
>>>
>>> rbdd = CDLL(librbd_path)
>>>
>>>
>>> rbdd

>>>
>>>
>>> dir(rbdd)
['_FuncPtr', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattr__', '__getattribute__', '__getitem__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_func_flags_', '_func_restype_', '_handle', '_name']
>>> 

>>>
>>> rbdd.rbd_write
<_funcptr 0x7f1475cff460="" at="" object="">
>>> 
>>>
>>> help(rbdd.rbd_write)
>>>
>>>



1 comment:

  1. https://github.com/ceph/ceph/blob/master/src/pybind/rbd.py

    ReplyDelete