Fix build failures.
cover Fix build failures.
Hi,
This patch series fixes a bunch of build failures.
please apply,
Gerd
Gerd Hoffmann (3):
Don't use g_thread_get_initialized.
Use hex instead of binary.
vns/tls: don't use depricated gnutls functions
hw/9pfs/virtio-9p-coth.c | 4 --- target-unicore32/translate.c | 16 +++++----- ui/vnc-tls.c | 62 +++++++++++++++++++++++++++++------------- vl.c | 1 + 4 files changed, 52 insertions(+), 31 deletions(-)
PATCH 1/3 Don't use g_thread_get_initialized.
Initialize glib threads unconditionally in main() instead of using g_thread_get_initialized in the 9p code.
Fixes a build failure on RHEL-5, which ships glib 2.12. g_thread_get_initialized was added in 2.20.
--- hw/9pfs/virtio-9p-coth.c | 4 ---- vl.c | 1 + 2 files changed, 1 insertions(+), 4 deletions(-)
hw/9pfs/virtio-9p-coth.c +0 -4
@@ -67,10 +67,6 @@ int v9fs_init_worker_threads(void)/* Leave signal handling to the iothread. */ pthread_sigmask (SIG_SETMASK , &set, &oldset); -/* init thread system if not already initialized */ -if (!g_thread_get_initialized ()) { -g_thread_init (NULL ); - }if (qemu_pipe (notifier_fds) ==-1 ) { ret =-1 ; goto err_out;
vl.c +1 -0
@@ -2200,6 +2200,7 @@ int main(int argc, char **argv, char **envp)error_set_progname (argv[0 ]);g_mem_set_vtable (&mem_trace); +g_thread_init (NULL );init_clocks ();
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 1/3] Don't use g_thread_get_initialized.
Quoted 32 lines · Gerd Hoffmann
Initialize glib threads unconditionally in
main()instead of usingg_thread_get_initializedin the 9p code.Fixes a build failure on RHEL-5, which ships glib 2.12.
g_thread_get_initializedwas added in 2.20.Signed-off-by Gerd Hoffmann <[email protected]>---
hw/9pfs/virtio-9p-coth.c | 4 ----
vl.c | 1 +2 files changed, 1 insertions(+), 4 deletions(-)hw/9pfs/virtio-9p-coth.c +0
-4@@ -67,10 +67,6 @@ int v9fs_init_worker_threads(void) /* Leave signal handling to the iothread. */ pthread_sigmask(SIG_SETMASK, &set, &oldset); - /* init thread system if not already initialized */ - if (!g_thread_get_initialized()) { - g_thread_init(NULL); - } if (qemu_pipe(notifier_fds) == -1) { ret = -1; goto err_out;vl.c +0
-0
vl.c int main(int argc, char **argv, char **envp) · line 2203
Quoted 4 lines
vl.c +1
-0@@ -2200,6 +2200,7 @@ int main(int argc, char **argv, char **envp) error_set_progname(argv[0]); g_mem_set_vtable(&mem_trace); + g_thread_init(NULL);
It breaks slirp on Win32. Who knows this reason?
Quoted 7 lines
vl.c +0
-1init_clocks(); --1.7.1
PATCH 2/3 Use hex instead of binary.
In reply to Gerd HoffmannOlder gcc versions don't understand 0b<bits>,
use hex representation instead.
Fixes build failure on RHEL-5.
--- target-unicore32/translate.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
target-unicore32/translate.c +8 -8
@@ -1788,7 +1788,7 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)* E : 5 */ switch (insn >>29 ) { -case 0b000 : +case 0x0 :if (UCOP_SET (5 ) &&UCOP_SET (8 ) && !UCOP_SET (28 )) {do_mult (env, s, insn);break ;
@@ -1798,7 +1798,7 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)do_misc (env, s, insn);break ; } -case 0b001 : +case 0x1 :if (((UCOP_OPCODES >>2 ) ==2 ) && !UCOP_SET_S ) {do_misc (env, s, insn);break ;
@@ -1806,7 +1806,7 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)do_datap (env, s, insn);break ; -case 0b010 : +case 0x2 :if (UCOP_SET (8 ) &&UCOP_SET (5 )) {do_ldst_hwsb (env, s, insn);break ;
@@ -1814,24 +1814,24 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)if (UCOP_SET (8 ) ||UCOP_SET (5 )) {ILLEGAL ; } -case 0b011 : +case 0x3 :do_ldst_ir (env, s, insn);break ; -case 0b100 : +case 0x4 :if (UCOP_SET (8 )) {ILLEGAL ;/* extended instructions */ }do_ldst_m (env, s, insn);break ; -case 0b101 : +case 0x5 :do_branch (env, s, insn);break ; -case 0b110 : +case 0x6 :/* Coprocessor. */ disas_coproc_insn (env, s, insn);break ; -case 0b111 : +case 0x7 :if (!UCOP_SET (28 )) {disas_coproc_insn (env, s, insn);break ;
Signature · 1 line
1.7.1
PATCH 3/3 vns/tls: don't use depricated gnutls functions
In reply to Gerd HoffmannAvoid using depricated gnutls functions with recent gnutls versions. Fixes build failure on Fedora 16. Keep the old way for compatibility with old installations such as RHEL-5 (gnutls 1.4.x).
Based on a patch from Raghavendra D Prabhu <[email protected]>
--- ui/vnc-tls.c | 62 ++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 43 insertions(+), 19 deletions(-)
ui/vnc-tls.c +43 -19
@@ -283,13 +283,51 @@ int vnc_tls_validate_certificate(struct VncState *vs)return 0 ; } +#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x020200 /* 2.2.0 */ + +static int vnc_set_gnutls_priority (struct VncState *vs,int needX509Creds) +{ +const char *priority = needX509Creds ?"NORMAL" :"NORMAL:+ANON-DH" ; + +if (gnutls_priority_set_direct (vs->tls.session, priority,NULL ) <0 ) { +return -1 ; + } +return 0 ; +} + +#else + +static int vnc_set_gnutls_priority (struct VncState *vs,int x509) +{ +static const int cert_types[] = {GNUTLS_CRT_X509 ,0 }; +static const int protocols[] = { +GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 + }; +static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; +static const int kx_x509[] = { +GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA , +GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 + }; + +if (gnutls_kx_set_priority (vs->tls.session, x509 ? kx_x509 : kx_anon) <0 ) { +return -1 ; + } + +if (gnutls_certificate_type_set_priority (vs->tls.session, cert_types) <0 ) { +return -1 ; + } + +if (gnutls_protocol_set_priority (vs->tls.session, protocols) <0 ) { +return -1 ; + } +return 0 ; +} + +#endif int vnc_tls_client_setup (struct VncState *vs,int needX509Creds) { -static const int cert_type_priority[] = {GNUTLS_CRT_X509 ,0 }; -static const int protocol_priority[]= {GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 }; -static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; -static const int kx_x509[] = {GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA ,GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 };VNC_DEBUG ("Do TLS setup\n" );if (vnc_tls_initialize () <0 ) {
@@ -310,21 +348,7 @@ int vnc_tls_client_setup(struct VncState *vs,return -1 ; } -if (gnutls_kx_set_priority (vs->tls.session, needX509Creds ? kx_x509 : kx_anon) <0 ) { -gnutls_deinit (vs->tls.session); - vs->tls.session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_certificate_type_set_priority (vs->tls.session, cert_type_priority) <0 ) { -gnutls_deinit (vs->tls.session); - vs->tls.session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_protocol_set_priority (vs->tls.session, protocol_priority) <0 ) { +if (vnc_set_gnutls_priority (vs, needX509Creds) <0 ) {gnutls_deinit (vs->tls.session); vs->tls.session =NULL ;vnc_client_error (vs);
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 3/3] vns/tls: don't use depricated gnutls functions
See inline comments below.
Am 07.09.2011 15:02, schrieb Gerd Hoffmann:
Quoted 1 line
Avoid using depricated gnutls functions with recent gnutls versions.
deprecated?
Quoted 16 lines
Fixes build failure on Fedora 16. Keep the old way for compatibility with old installations such as RHEL-5 (gnutls 1.4.x).
Based on a patch from Raghavendra D Prabhu <[email protected]>
Signed-off-by Gerd Hoffmann <[email protected]>---
ui/vnc-tls.c| 62
++++++++++++++++++++++++++++++++++++++++-----------------1 files changed, 43 insertions(+), 19 deletions(-)ui/vnc-tls.c +0
-0
ui/vnc-tls.c int vnc_tls_validate_certificate(struct VncState · line 291
Quoted 9 lines
ui/vnc-tls.c +4
-0@@ -283,13 +283,51 @@ int vnc_tls_validate_certificate(struct VncState *vs)return 0 ; } +#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x020200 /* 2.2.0 */ + +static int vnc_set_gnutls_priority (struct VncState *vs,int needX509Creds)
Replace the first argument by gnutls_session_t /session/. This simplifies the code.
ui/vnc-tls.c int vnc_tls_validate_certificate(struct VncState *vs) · line 293
Quoted 4 lines
ui/vnc-tls.c +4
-0+{ +const char *priority = needX509Creds ?"NORMAL" :"NORMAL:+ANON-DH" ; + +if (gnutls_priority_set_direct (vs->tls.session, priority,NULL ) <0 ) {
Even if this works, testing for != GNUTLS_E_SUCCESS would be better because GNUTLS_E_SUCCESS is the return value for success according to the manual.
The same applies to the other function calls below as well.
ui/vnc-tls.c int vnc_tls_validate_certificate(struct VncState *vs) · line 301
Quoted 8 lines
ui/vnc-tls.c +8
-0+ return -1; + } +return 0 ; +} + +#else + +static int vnc_set_gnutls_priority (struct VncState *vs,int x509)
Replace the first argument by gnutls_session_t /session/.
Quoted 53 lines
ui/vnc-tls.c +26
-0+{ +static const int cert_types[] = {GNUTLS_CRT_X509 ,0 }; +static const int protocols[] = { +GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 + }; +static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; +static const int kx_x509[] = { +GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA , +GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 + }; + +if (gnutls_kx_set_priority (vs->tls.session, x509 ? kx_x509 : kx_anon) <0 ) { +return -1 ; + } + +if (gnutls_certificate_type_set_priority (vs->tls.session, cert_types) <0 ) { +return -1 ; + } + +if (gnutls_protocol_set_priority (vs->tls.session, protocols) <0 ) { +return -1 ; + } +return 0 ; +} + +#endif int vnc_tls_client_setup(struct VncState *vs,int needX509Creds) {
- static const int cert_type_priority[] = {GNUTLS_CRT_X509, 0 };
- static const int protocol_priority[]= {GNUTLS_TLS1_1,GNUTLS_TLS1_0,GNUTLS_SSL3, 0 };
- static const int kx_anon[] = {GNUTLS_KX_ANON_DH, 0};
- static const int kx_x509[] = {GNUTLS_KX_DHE_DSS,GNUTLS_KX_RSA,GNUTLS_KX_DHE_RSA,GNUTLS_KX_SRP, 0};
VNC_DEBUG("Do TLS setup\n");
if (vnc_tls_initialize()< 0) {ui/vnc-tls.c +0
-8@@ -310,21 +348,7 @@ int vnc_tls_client_setup(struct VncState *vs,return -1 ; } -if (gnutls_kx_set_priority (vs->tls.session, needX509Creds ? kx_x509 : kx_anon) < 0) { -gnutls_deinit (vs->tls.session); - vs->tls.session =NULL ; -vnc_client_error (vs); -return -1 ; - } - - if (gnutls_certificate_type_set_priority(vs->tls.session,
ui/vnc-tls.c int vnc_tls_client_setup(struct VncState *vs, · line 354
Quoted 10 lines
ui/vnc-tls.c +1
-7cert_type_priority) < 0) { -gnutls_deinit (vs->tls.session); - vs->tls.session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_protocol_set_priority (vs->tls.session, protocol_priority) < 0) { +if (vnc_set_gnutls_priority (vs, needX509Creds) <0 ) {
Use vs->tls.session as first argument.
Quoted 3 lines
gnutls_deinit(vs->tls.session);vs->tls.session= NULL;vnc_client_error(vs);
PATCH v2 1/1 vns/tls: don't use depricated gnutls functions
Avoid using deprecated gnutls functions with recent gnutls versions. Fixes build failure on Fedora 16. Keep the old way for compatibility with old installations such as RHEL-5 (gnutls 1.4.x).
Based on a patch from Raghavendra D Prabhu <[email protected]>
--- ui/vnc-tls.c | 68 +++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 49 insertions(+), 19 deletions(-)
ui/vnc-tls.c +49 -19
@@ -283,13 +283,57 @@ int vnc_tls_validate_certificate(struct VncState *vs)return 0 ; } +#if defined(GNUTLS_VERSION_NUMBER ) && \ +GNUTLS_VERSION_NUMBER >=0x020200 /* 2.2.0 */ + +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +const char *priority = x509 ?"NORMAL" :"NORMAL:+ANON-DH" ; +int rc; + + rc =gnutls_priority_set_direct (s, priority,NULL ); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} + +#else + +static int vnc_set_gnutls_priority (gnutls_session_t s,int x509) +{ +static const int cert_types[] = {GNUTLS_CRT_X509 ,0 }; +static const int protocols[] = { +GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 + }; +static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; +static const int kx_x509[] = { +GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA , +GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 + }; +int rc; + + rc =gnutls_kx_set_priority (s, x509 ? kx_x509 : kx_anon); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + + rc =gnutls_certificate_type_set_priority (s, cert_types); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } + + rc =gnutls_protocol_set_priority (s, protocols); +if (rc !=GNUTLS_E_SUCCESS ) { +return -1 ; + } +return 0 ; +} + +#endif int vnc_tls_client_setup (struct VncState *vs,int needX509Creds) { -static const int cert_type_priority[] = {GNUTLS_CRT_X509 ,0 }; -static const int protocol_priority[]= {GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 }; -static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; -static const int kx_x509[] = {GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA ,GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 };VNC_DEBUG ("Do TLS setup\n" );if (vnc_tls_initialize () <0 ) {
@@ -310,21 +354,7 @@ int vnc_tls_client_setup(struct VncState *vs,return -1 ; } -if (gnutls_kx_set_priority (vs->tls.session, needX509Creds ? kx_x509 : kx_anon) <0 ) { -gnutls_deinit (vs->tls.session); - vs->tls.session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_certificate_type_set_priority (vs->tls.session, cert_type_priority) <0 ) { -gnutls_deinit (vs->tls.session); - vs->tls.session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_protocol_set_priority (vs->tls.session, protocol_priority) <0 ) { +if (vnc_set_gnutls_priority (vs->tls.session, needX509Creds) <0 ) {gnutls_deinit (vs->tls.session); vs->tls.session =NULL ;vnc_client_error (vs);
Signature · 1 line
1.7.1
Anthony Liguori
AppliedQuoted 6 lines · Gerd Hoffmann
Hi,This patch series fixes a bunch of build failures.
please apply,
Gerd
Applied all. Thanks.
Regards,
Anthony Liguori
Quoted 14 lines
Gerd Hoffmann (3):
Don't useg_thread_get_initialized.
Use hex instead of binary.
vns/tls: don't use depricated gnutls functionshw/9pfs/virtio-9p-coth.c | 4 --- target-unicore32/translate.c | 16 +++++----- ui/vnc-tls.c | 62 +++++++++++++++++++++++++++++------------- vl.c | 1 + 4 files changed, 52 insertions(+), 31 deletions(-)