From: Martin Belanger Date: Wed, 15 Mar 2023 19:56:55 +0000 (-0400) Subject: Python: Add hostnqn_from_file() and hostid_from_file() X-Git-Tag: v1.4~22 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0a0bfc9120f612ee69320fb18ceee28b4ff8cc02;p=users%2Fsagi%2Flibnvme.git Python: Add hostnqn_from_file() and hostid_from_file() Signed-off-by: Martin Belanger --- diff --git a/libnvme/nvme.i b/libnvme/nvme.i index 1f2f6639..0409afc0 100644 --- a/libnvme/nvme.i +++ b/libnvme/nvme.i @@ -40,7 +40,21 @@ PyDict_SetItemString(p, key, val); /* Does NOT steal reference to val .. */ Py_XDECREF(val); /* .. therefore decrement ref. count. */ } + PyObject *hostnqn_from_file() { + char * val = nvmf_hostnqn_from_file(); + PyObject * obj = PyUnicode_FromString(val); + free(val); + return obj; + } + PyObject *hostid_from_file() { + char * val = nvmf_hostid_from_file(); + PyObject * obj = PyUnicode_FromString(val); + free(val); + return obj; + } %} +PyObject *hostnqn_from_file(); +PyObject *hostid_from_file(); %inline %{ struct host_iter {