[libvirt] [PATCH RESEND] Added support for portable-rpcgen from portablexdr library

This patch allows to build libvirt natively under MinGW/MSYS using portablexdr library. An updated version of portablexdr with fixed bugs is available as part of MSYS2 project. Signed-off-by: Pavel Fedin <p.fedin@samsung.com> --- configure.ac | 2 +- src/lxc/lxc_monitor_protocol.x | 2 +- src/rpc/genprotocol.pl | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index aed0934..547a405 100644 --- a/configure.ac +++ b/configure.ac @@ -397,7 +397,7 @@ AM_CONDITIONAL([HAVE_LIBTASN1], [test "x$ac_cv_header_libtasn1_h" = "xyes"]) AC_CHECK_LIB([intl],[gettext],[]) dnl Do we have rpcgen? -AC_PATH_PROG([RPCGEN], [rpcgen], [no]) +AC_PATH_PROGS([RPCGEN], [rpcgen portable-rpcgen], [no]) AM_CONDITIONAL([HAVE_RPCGEN], [test "x$ac_cv_path_RPCGEN" != "xno"]) dnl Is this GLIBC's buggy rpcgen? AM_CONDITIONAL([HAVE_GLIBC_RPCGEN], diff --git a/src/lxc/lxc_monitor_protocol.x b/src/lxc/lxc_monitor_protocol.x index 3b66af5..205d7c2 100644 --- a/src/lxc/lxc_monitor_protocol.x +++ b/src/lxc/lxc_monitor_protocol.x @@ -30,7 +30,7 @@ enum virLXCMonitorExitStatus { }; struct virLXCMonitorExitEventMsg { - enum virLXCMonitorExitStatus status; + virLXCMonitorExitStatus status; }; struct virLXCMonitorInitEventMsg { diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index 6e6d6d4..1ac2507 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -38,7 +38,10 @@ my $target = shift; unlink $target; -open RPCGEN, "-|", $rpcgen, $mode, $xdrdef +if ($rpcgen =~ /portable-rpcgen/) { + $rpcgen = "$rpcgen -o -"; +} +open RPCGEN, "-|", "$rpcgen $mode $xdrdef" or die "cannot run $rpcgen $mode $xdrdef: $!"; open TARGET, ">$target" or die "cannot create $target: $!"; -- 1.9.5.msysgit.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Mon, Jul 06, 2015 at 10:40:28AM +0300, Pavel Fedin wrote:
This patch allows to build libvirt natively under MinGW/MSYS using portablexdr library. An updated version of portablexdr with fixed bugs is available as part of MSYS2 project.
Signed-off-by: Pavel Fedin <p.fedin@samsung.com> --- configure.ac | 2 +- src/lxc/lxc_monitor_protocol.x | 2 +- src/rpc/genprotocol.pl | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac index aed0934..547a405 100644 --- a/configure.ac +++ b/configure.ac @@ -397,7 +397,7 @@ AM_CONDITIONAL([HAVE_LIBTASN1], [test "x$ac_cv_header_libtasn1_h" = "xyes"]) AC_CHECK_LIB([intl],[gettext],[])
dnl Do we have rpcgen? -AC_PATH_PROG([RPCGEN], [rpcgen], [no]) +AC_PATH_PROGS([RPCGEN], [rpcgen portable-rpcgen], [no]) AM_CONDITIONAL([HAVE_RPCGEN], [test "x$ac_cv_path_RPCGEN" != "xno"]) dnl Is this GLIBC's buggy rpcgen? AM_CONDITIONAL([HAVE_GLIBC_RPCGEN], diff --git a/src/lxc/lxc_monitor_protocol.x b/src/lxc/lxc_monitor_protocol.x index 3b66af5..205d7c2 100644 --- a/src/lxc/lxc_monitor_protocol.x +++ b/src/lxc/lxc_monitor_protocol.x @@ -30,7 +30,7 @@ enum virLXCMonitorExitStatus { };
struct virLXCMonitorExitEventMsg { - enum virLXCMonitorExitStatus status; + virLXCMonitorExitStatus status;
I don't think we should use enums at all in the protocol specification. It should be unsigned int and the change should be made separately. Is this hunk here because portable-rpcgen has problems with enum being declared there? If we leave it here and just remove the 'enum' keyword, then we need to also adjust I see you Cc'd Eric, so I'd leave him some space to object, but unless that happens, the patch looks fine to me without this particular hunk. Martin
};
struct virLXCMonitorInitEventMsg { diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl index 6e6d6d4..1ac2507 100755 --- a/src/rpc/genprotocol.pl +++ b/src/rpc/genprotocol.pl @@ -38,7 +38,10 @@ my $target = shift;
unlink $target;
-open RPCGEN, "-|", $rpcgen, $mode, $xdrdef +if ($rpcgen =~ /portable-rpcgen/) { + $rpcgen = "$rpcgen -o -"; +} +open RPCGEN, "-|", "$rpcgen $mode $xdrdef" or die "cannot run $rpcgen $mode $xdrdef: $!"; open TARGET, ">$target" or die "cannot create $target: $!"; -- 1.9.5.msysgit.0
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Hello!
I don't think we should use enums at all in the protocol specification. It should be unsigned int and the change should be made separately. Is this hunk here because portable-rpcgen has problems with enum being declared there?
Yes, its parser fails. I have checked throughout the code, there are some other enums in .x files too, but when they are put in structs, they are specified without 'enum' keyword and everything is fine. For example, virnetprotocol.x: --- cut --- struct virNetMessageHeader { unsigned prog; /* Unique ID for the program */ unsigned vers; /* Program version number */ int proc; /* Unique ID for the procedure within the program */ virNetMessageType type; /* Type of message */ unsigned serial; /* Serial number of message. */ virNetMessageStatus status; }; --- cut --- Here virNetMessageType and virNetMessageStatus are enums. Actually i borrowed fix method from here. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia

On Tue, Jul 07, 2015 at 03:04:51PM +0300, Pavel Fedin wrote:
Hello!
I don't think we should use enums at all in the protocol specification. It should be unsigned int and the change should be made separately. Is this hunk here because portable-rpcgen has problems with enum being declared there?
Yes, its parser fails. I have checked throughout the code, there are some other enums in .x files too, but when they are put in structs, they are specified without 'enum' keyword and everything is fine. For example, virnetprotocol.x: --- cut --- struct virNetMessageHeader { unsigned prog; /* Unique ID for the program */ unsigned vers; /* Program version number */ int proc; /* Unique ID for the procedure within the program */ virNetMessageType type; /* Type of message */ unsigned serial; /* Serial number of message. */ virNetMessageStatus status; }; --- cut --- Here virNetMessageType and virNetMessageStatus are enums. Actually i borrowed fix method from here.
I see. I'm still a little bit hesitant about that, but that's pre-existing to your patch, so that shouldn't keep us away from that. Could you split that hunk into another patch and also fix it in lxc_monitor_protocol-structs so that make syntax-check doesn't bother us? Thanks, Martin
Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia

Hello!
Could you split that hunk into another patch and also fix it in lxc_monitor_protocol-structs so that make syntax-check doesn't bother us?
No problem, i will do it. If i have further questions, i'll ask them tomorrow because i'm in 40 minutes apart from leaving the office today. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
participants (2)
-
Martin Kletzander
-
Pavel Fedin