Skip to contentSkip to conversation

multipath: libdmmp json fix

PATCH In review Benjamin Marzinski 4 participants 7 messages May 29, 2020 – May 30, 2020 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

cover multipath: libdmmp json fix

This is a patch I got to keep libdmmp working with the latest json-c release.

Björn Esser (1):
libdmmp: Add support for upcoming json-c 0.14.0.

 libdmmp/libdmmp_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
author maintainer
#1 lore raw

PATCH 1/1 libdmmp: Add support for upcoming json-c 0.14.0.

From: Björn Esser <[email protected]>

TRUE/FALSE are not defined anymore. 1 and 0 are used instead. This is backwards compatible, as earlier versions of json-c are using the same integer values in their present definitions.

---
 libdmmp/libdmmp_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdmmp/libdmmp_private.h +1 -1
index ac85b63f..4378962b 100644
@@ -82,7 +82,7 @@ static out_type func_name(struct dmmp_context *ctx, const char *var_name) { \
 do { \
 	json_type j_type = json_type_null; \
 	json_object *j_obj_tmp = NULL; \
-	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != TRUE) { \
+	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != 1) { \
 		_error(ctx, "Invalid JSON output from multipathd IPC: " \
 		       "key '%s' not found", key); \
 		rc = DMMP_ERR_IPC_ERROR; \
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
#2 lore raw

Re: [PATCH 1/1] libdmmp: Add support for upcoming json-c 0.14.0.

Hi Ben,

Quoted 25 lines · Benjamin Marzinski

From: Björn Esser <[email protected]>

TRUE/FALSE are not defined anymore. 1 and 0 are used instead. This is backwards compatible, as earlier versions of json-c are using the same integer values in their present definitions.

---
 libdmmp/libdmmp_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdmmp/libdmmp_private.h +1 -1
index ac85b63f..4378962b 100644
@@ -82,7 +82,7 @@ static out_type func_name(struct dmmp_context *ctx,
 const char *var_name) { \
 do { \
 	json_type j_type = json_type_null; \
 	json_object *j_obj_tmp = NULL; \
-	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != TRUE)
 { \
+	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != 1) { \
 		_error(ctx, "Invalid JSON output from multipathd IPC: "

\

libdmmp/libdmmp_private.h static out_type func_name(struct dmmp_context *ctx, const char *var_name) { \ · line 88

Quoted 2 lines
libdmmp/libdmmp_private.h +0 -0
 		       "key '%s' not found", key); \
 		rc = DMMP_ERR_IPC_ERROR; \

Did you see
https://www.redhat.com/archives/dm-devel/2020-May/msg00261.html ?

This has first been reported to the list by Christian (
https://www.redhat.com/archives/dm-devel/2020-April/msg00261.html), and brought to my attention later by Xose. I personally thought the change from boolean to int is a step in the wrong direction, therefore I submitted my modified version using stdboolh. If everyone else is fine with the int, it's not worth arguing about it.

Regards,
Martin

PS: Can anyone explain why json-c did this? Looks like a "cause hassle for downstream devs and users for no good reason" kind of thing to me...

Signature · 4 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107
SUSE  Software Solutions Germany GmbH
HRB 36809, AG Nürnberg GF: Felix
Imendörffer
#3 lore raw

Re: [PATCH 1/1] libdmmp: Add support for upcoming json-c 0.14.0.

Quoted 39 lines · Martin Wilck
Quoted 24 lines · Benjamin Marzinski

From: Björn Esser <[email protected]>

TRUE/FALSE are not defined anymore. 1 and 0 are used instead. This is backwards compatible, as earlier versions of json-c are using the same integer values in their present definitions.

---
  libdmmp/libdmmp_private.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
libdmmp/libdmmp_private.h +1 -1
index ac85b63f..4378962b 100644
@@ -82,7 +82,7 @@ static out_type func_name(struct dmmp_context *ctx,
 const char *var_name) { \
  do { \
  	json_type j_type = json_type_null; \
  	json_object *j_obj_tmp = NULL; \
-	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != TRUE)
 { \
+	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != 1) { \
  		_error(ctx, "Invalid JSON output from multipathd IPC: "
Quoted 3 lines

\
"key '%s' not found", key); \
rc = DMMP_ERR_IPC_ERROR; \

Did you see
https://www.redhat.com/archives/dm-devel/2020-May/msg00261.html ?

This has first been reported to the list by Christian (
https://www.redhat.com/archives/dm-devel/2020-April/msg00261.html), and brought to my attention later by Xose. I personally thought the change from boolean to int is a step in the wrong direction, therefore I submitted my modified version using stdboolh. If everyone else is fine with the int, it's not worth arguing about it.

Quoted 7 lines

Regards,
Martin

PS: Can anyone explain why json-c did this? Looks like a "cause hassle for downstream devs and users for no good reason" kind of thing to me...

Add Eric Haszlakiewicz to CC.

Done at: https://github.com/json-c/json-c/commit/0992aac61f8b087efd7094e9ac2b84fa9c040fcd

#4 lore raw

Re: [PATCH 1/1] libdmmp: Add support for upcoming json-c 0.14.0.

Quoted 15 lines · Xose Vazquez Perez
Quoted 13 lines · Martin Wilck

Did you see
https://www.redhat.com/archives/dm-devel/2020-May/msg00261.html ?

This has first been reported to the list by Christian (
https://www.redhat.com/archives/dm-devel/2020-April/msg00261.html), and brought to my attention later by Xose. I personally thought the change from boolean to int is a step in the wrong direction, therefore I submitted my modified version using stdboolh. If everyone else is fine with the int, it's not worth arguing about it.

Regards,
Martin

Quoted 8 lines
Quoted 4 lines

PS: Can anyone explain why json-c did this? Looks like a "cause hassle for downstream devs and users for no good reason" kind of thing to me...

Add Eric Haszlakiewicz to CC.

Done at: https://github.com/json-c/json-c/commit/0992aac61f8b087efd7094e9ac2b84fa9c040fcd

TRUE and FALSE are rather generic defines that json-c had no business ever setting, especially to json-c specific values, and the fact that we were doing so was conflicting with other cases that already defined it.  Sorry about the hassle, but I consider that a very good reason to remove them.

Eric

author maintainer
#5 lore raw

Re: [PATCH 1/1] libdmmp: Add support for upcoming json-c 0.14.0.

In reply to Martin Wilck
Quoted 25 lines · Martin Wilck

Hi Ben,

Quoted 22 lines · Benjamin Marzinski

From: Björn Esser <[email protected]>

TRUE/FALSE are not defined anymore. 1 and 0 are used instead. This is backwards compatible, as earlier versions of json-c are using the same integer values in their present definitions.

---
 libdmmp/libdmmp_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdmmp/libdmmp_private.h +0 -1
index ac85b63f..4378962b 100644
@@ -82,7 +82,7 @@ static out_type func_name(struct dmmp_context *ctx,
 const char *var_name) { \
 do { \
 	json_type j_type = json_type_null; \
 	json_object *j_obj_tmp = NULL; \
-	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != TRUE)
 { \
Quoted 8 lines

libdmmp/libdmmp_private.h static out_type func_name(struct dmmp_context *ctx, const char *var_name) { \ · line 88

Quoted 5 lines
libdmmp/libdmmp_private.h +1 -0
+	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != 1) { \
 		_error(ctx, "Invalid JSON output from multipathd IPC: "

\

libdmmp/libdmmp_private.h +0 -0
 		       "key '%s' not found", key); \
 		rc = DMMP_ERR_IPC_ERROR; \

Did you see
https://www.redhat.com/archives/dm-devel/2020-May/msg00261.html ?

Nope. Overlooked it. My bad. I'm fine with any version that compiles. Either stdbool or int is fine.

-Ben

Quoted 21 lines

This has first been reported to the list by Christian (
https://www.redhat.com/archives/dm-devel/2020-April/msg00261.html), and brought to my attention later by Xose. I personally thought the change from boolean to int is a step in the wrong direction, therefore I submitted my modified version using stdboolh. If everyone else is fine with the int, it's not worth arguing about it.

Regards,
Martin

PS: Can anyone explain why json-c did this? Looks like a "cause hassle for downstream devs and users for no good reason" kind of thing to me...

Signature · 4 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107
SUSE  Software Solutions Germany GmbH
HRB 36809, AG Nürnberg GF: Felix
Imendörffer
#6 lore raw

Re: [PATCH 1/1] libdmmp: Add support for upcoming json-c 0.14.0.

Quoted 7 lines · Benjamin Marzinski
Quoted 3 lines · Martin Wilck

Did you see
https://www.redhat.com/archives/dm-devel/2020-May/msg00261.html ?

Nope. Overlooked it. My bad. I'm fine with any version that compiles. Either stdbool or int is fine.

Ok. I'll take the liberty to apply mine on my upstream-queue branch, then. Let Christophe have the final say when he merges next time.

Martin

Signature · 4 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107
SUSE  Software Solutions Germany GmbH
HRB 36809, AG Nürnberg GF: Felix
Imendörffer