Change in vdsm[master]: infra: Introduce EventFD support

fromani at redhat.com fromani at redhat.com
Wed Mar 4 15:01:55 UTC 2015


Francesco Romani has posted comments on this change.

Change subject: infra: Introduce EventFD support
......................................................................


Patch Set 7:

(3 comments)

I'm ok with the answers to my previous comments.

I'm not so happy with code in __init__.py, but I guess I can live with that.

Added comments about possible improvements, they can be implemented or discussed in later patches.

https://gerrit.ovirt.org/#/c/37051/7/lib/vdsm/infra/eventfd/__init__.py
File lib/vdsm/infra/eventfd/__init__.py:

Line 85:           which time, the read() proceeds as described above) or fails with
Line 86:           the error EAGAIN if the file descriptor has been made nonblocking.
Line 87:         """
Line 88:         n = ctypes.c_uint64()
Line 89:         rv = libc.read(self._fd, ctypes.pointer(n), 8)
we know the sky will not fall and that sizeof(uint64) == 8 is and will be True, nevertheless it will be a little nicer to use sizeof().
Line 90:         if rv < 0:
Line 91:             err = ctypes.get_errno()
Line 92:             if err != 0:
Line 93:                 msg = os.strerror(err)


Line 104:         blocks until a read() is performed on the file descriptor, or fails
Line 105:         with the error EAGAIN if the file descriptor has been made nonblocking.
Line 106:         """
Line 107:         n = ctypes.c_uint64(value)
Line 108:         rv = libc.write(self._fd, ctypes.pointer(n), 8)
same
Line 109:         if rv < 0:
Line 110:             err = ctypes.get_errno()
Line 111:             if err != 0:
Line 112:                 msg = os.strerror(err)


Line 109:         if rv < 0:
Line 110:             err = ctypes.get_errno()
Line 111:             if err != 0:
Line 112:                 msg = os.strerror(err)
Line 113:                 raise OSError(err, msg)
these five lines above looks exactly the same as in read(), can they be factored out somehow?
Line 114: 
Line 115:     def close(self):
Line 116:         "Closes the fd and clears the internal counter"
Line 117:         if self._fd != -1:


-- 
To view, visit https://gerrit.ovirt.org/37051
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6035d4a8dc13ce11cf0425e4945bbf0c19bd92a7
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list