[PATCH v1 1/7] libvirt-stream: Don't require RPC module

Michal Privoznik mprivozn at redhat.com
Wed Dec 8 15:29:03 UTC 2021


When implementing sparse streams, one of improvements I did was
to increase client buffer size for sending/receiving stream data
(commit v1.3.5-rc1~502). Previously, we were using 64KiB buffer
while packets on RPC are 256KiB (usable data is slightly less
because of the header). This meant that it took multiple calls of
virStreamRecv()/virStreamSend() to serve a single packet of data.
In my fix, I've included the virnetprotocol.h file which provides
VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX macro which is the exact size
of data in a single packet. However, including the file from
libvirt-stream.c which implements public APIs is not right. If
RPC module is not built then the file doesn't exists.

Redefine the macro and drop the include. The size can never
change anyways.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/libvirt-stream.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/libvirt-stream.c b/src/libvirt-stream.c
index 873d7b1d4e..86b13f39de 100644
--- a/src/libvirt-stream.c
+++ b/src/libvirt-stream.c
@@ -23,12 +23,16 @@
 #include "datatypes.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "rpc/virnetprotocol.h"
 
 VIR_LOG_INIT("libvirt.stream");
 
 #define VIR_FROM_THIS VIR_FROM_STREAMS
 
+/* To avoid dragging in RPC code (which may be not compiled in),
+ * redefine this constant. Its value can't ever change, so we're
+ * safe to do so. */
+#define VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX 262120
+
 
 /**
  * virStreamNew:
-- 
2.32.0




More information about the libvir-list mailing list