Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Janssson API instead of YAJL #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lsm5
Copy link
Member

@lsm5 lsm5 commented Jul 23, 2018

YAJL upstream has been pretty much dead for a while now.
I used commit bd1c5c9 in libguestfs source for reference.

Signed-off-by: Lokesh Mandvekar [email protected]

modified: Makefile.am
modified: configure.ac
modified: src/oci-umount.c

@rhvgoyal @rhatdan docker [run,exec,commit,push] work fine with this. PTAL.

src/oci-umount.c Outdated
@@ -905,7 +896,7 @@ char *getJSONstring(FILE *from, size_t chunksize, char *msg)
{
struct stat stat_buf;
char *err = NULL, *JSONstring = NULL;
size_t nbytes, bufsize;
size_t nbytes, bufsize;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix tabs to match current behaviour

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, will push new commit with tabbing fixed. Thanks

@rhatdan
Copy link
Member

rhatdan commented Jul 23, 2018

We will need to test this manually, but once the indenting is fixed this LGTM
@rhvgoyal PTAL

src/oci-umount.c Outdated
char *configData;
_cleanup_(yajl_tree_freep) yajl_val config_node = NULL;
_cleanup_(json_decrefp) json_t *config_node = NULL;
_cleanup_config_mounts_ struct config_mount_info *config_mounts = NULL;
unsigned config_mounts_len = 0;
_cleanup_fclose_ FILE *fp = NULL;

/* 'bundle' must be specified for the OCI hooks, and from there we read the configuration file */
const char *bundle_path[] = { "bundle", (const char *)0 };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using bundle_path anymore?

src/oci-umount.c Outdated
_cleanup_config_mounts_ struct config_mount_info *config_mounts = NULL;
unsigned config_mounts_len = 0;
_cleanup_fclose_ FILE *fp = NULL;

/* 'bundle' must be specified for the OCI hooks, and from there we read the configuration file */
const char *bundle_path[] = { "bundle", (const char *)0 };
yajl_val v_bundle_path = yajl_tree_get(node, bundle_path, yajl_t_string);
json_t *v_bundle_path = json_object_get(node, "bundle");
if (!v_bundle_path) {
const char *bundle_path[] = { "bundlePath", (const char *)0 };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. Is this bundle_path variable being used?

src/oci-umount.c Outdated
snprintf(errbuf, BUFLEN, "failed to read config data from %s", config_file_name);
configData = getJSONstring(fp, (size_t)CHUNKSIZE, errbuf);
snprintf(err.text, sizeof(err.text), "failed to read config data from %s", config_file_name);
configData = getJSONstring(fp, (size_t)CHUNKSIZE, err.text);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this is part of generic cleanup and has nothing to do with json conversion? Can we break the patch down in to a patch series and all the changes which are cleanup and not related to json converstion, move them into a separate patch. That way reviewing becomes easier.

@lsm5
Copy link
Member Author

lsm5 commented Jul 23, 2018

@rhatdan I pushed a new branch to address indentation issues.

@rhvgoyal TBH, my approach so far was switching yajl with jansson api without making any additional changes, and getting docker to work with the new executable, but let me dig into this further and try to address your comments. Thanks

src/oci-umount.c Outdated
@@ -1065,13 +1056,16 @@ static int parseBundle(const char *id, yajl_val *node_ptr, char **rootfs, struct

/* Extract values from the config json */
const char *mount_points_path[] = {"mounts", (const char *)0 };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mount_point_paths not being used anymore?

@rhvgoyal
Copy link
Collaborator

@lsm5, once you push your new changes I will review again.

YAJL upstream has been pretty much dead for a while now.
I used commit bd1c5c9 in libguestfs source for reference.

Signed-off-by: Lokesh Mandvekar <[email protected]>

modified:   Makefile.am
modified:   configure.ac
modified:   src/oci-umount.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants