Thread (1 message) flat view 1 message, 1 author, 2021-03-23

Re: [virtio-comment] Re: [RFC PATCH v1] virtio-vsock: use C style defines for constants

From: Stefan Hajnoczi <stefanha@redhat.com>
Date: 2021-03-23 08:34:35
Also in: virtio-comment

On Tue, Mar 23, 2021 at 09:18:34AM +0300, Arseny Krasnov wrote:
On 22.03.2021 17:30, Stefan Hajnoczi wrote:
quoted
On Mon, Mar 22, 2021 at 09:34:58AM -0400, Michael S. Tsirkin wrote:
quoted
On Mon, Mar 22, 2021 at 11:52:22AM +0000, Stefan Hajnoczi wrote:
quoted
On Mon, Mar 22, 2021 at 09:37:59AM +0300, Arseny Krasnov wrote:
quoted
@@ -227,6 +226,11 @@ \subsubsection{Stream Sockets}\label{sec:Device Types / Socket Device / Device O
 hints are permanent once sent and successive packets with bits clear do not
 reset them.
 
+\begin{lstlisting}
+#define VIRTIO_VSOCK_SHUTDOWN_RECEIVE_BIT 0
+#define VIRTIO_VSOCK_SHUTDOWN_SEND_BIT    1
+\end{lstlisting}
The spec has no other _BIT constants.
True. Sometimes there's an _F_ somewhere there instead.
You're right, I missed the virtio-net bit constants:

  #define VIRTIO_NET_F_GUEST_TSO4 7

Compared to:

  #define VIRTQ_DESC_F_AVAIL     (1 << 7)

or

  #define VIRTQ_DESC_F_WRITE     2

It's an inconsistent mix :). Hard to tell them apart when they aren't
bitmask constants with '<<'.

Can we use '<<' for clarity on new constants?
So for bit constants, i can use:

#define VIRTIO_VSOCK_SHUTDOWN_RECEIVE (1 << 0)
#define VIRTIO_VSOCK_SHUTDOWN_SEND    (1 << 1)

for this case and all other next cases, when i'll add SEQPACKET
description in spec?
Personally I think that's clearest. Michael pointed out that the spec is
not consistent though, so I won't complain if you prefer to keep the
_BIT numbering.

Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help