Previous patch switched from accepting align and sector flags to values.
Exposing internal sanlock flags doesn't make sense now. Tuples with
supported sector size and alignment values should be exposed instead.
---
python/sanlock.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/python/sanlock.c b/python/sanlock.c
index 323f1bd..f367fbd 100644
--- a/python/sanlock.c
+++ b/python/sanlock.c
@@ -1739,13 +1739,21 @@ initsanlock(void)
PYSNLK_INIT_ADD_CONSTANT(SANLK_SETEV_REPLACE_EVENT,
"SETEV_REPLACE_EVENT");
PYSNLK_INIT_ADD_CONSTANT(SANLK_SETEV_ALL_HOSTS, "SETEV_ALL_HOSTS");
- /* Sector and align size flags */
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_SECTOR512, "SECTOR512");
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_SECTOR4K, "SECTOR4K");
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN1M, "ALIGN1M");
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN2M, "ALIGN2M");
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN4M, "ALIGN4M");
- PYSNLK_INIT_ADD_CONSTANT(SANLK_RES_ALIGN8M, "ALIGN8M");
-
#undef PYSNLK_INIT_ADD_CONSTANT
+
+ /* Tuples with supported sector size and alignment values */
+ PyObject *sector = PyTuple_New(2);
+ PyTuple_SetItem(sector, 0, PyInt_FromLong(SECTOR512));
+ PyTuple_SetItem(sector, 1, PyInt_FromLong(SECTOR4K));
+ if (PyModule_AddObject(py_module, "SECTOR", sector))
+ Py_DECREF("SECTOR");
+
+ PyObject *align = PyTuple_New(4);
+ PyTuple_SetItem(align, 0, PyInt_FromLong(ALIGN1M));
+ PyTuple_SetItem(align, 1, PyInt_FromLong(ALIGN2M));
+ PyTuple_SetItem(align, 2, PyInt_FromLong(ALIGN4M));
+ PyTuple_SetItem(align, 3, PyInt_FromLong(ALIGN8M));
+ if (PyModule_AddObject(py_module, "ALIGN", align))
+ Py_DECREF("ALIGN");
+
}
--
2.20.1