Hi,
Hi Vojtech
Please see some questions in-lined below.
Thanks
Amit
On Thu, Apr 25, 2019 at 2:57 PM Vojtech Juranek <vjuranek(a)redhat.com> wrote:
> 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");
*shouldn't this be Py_DECREF(sector) ? AFAIK Py_DECREF should get a pointer
to PyObject *
ops, sure, thanks for spotting it, same for align
> +
> + 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");
*shouldn't this be Py_DECREF(align) ? AFAIK Py_DECREF should get a pointer
to PyObject *
> +
>
> }
>
> --
> 2.20.1
*In What repo/branch are those patches available ? *
official repo is [1], I pushed my changes into my fork on github [2], however,
patches are handled over email on sanlock-devel ML [3], so you should CC also
sanlock-devel(a)lists.fedorahosted.org (you have to subscribe to this ML first
to be able to post there)
[1]
https://pagure.io/sanlock
[2]
https://github.com/vjuranek/sanlock/tree/4k_api_update
[3]
https://lists.fedorahosted.org/admin/lists/sanlock-devel.lists.fedorahost...