{"action":"created","comment":{"url":"https://api.github.com/repos/systemd/systemd/pulls/comments/169050354","pull_request_review_id":97512487,"id":169050354,"diff_hunk":"@@ -541,6 +645,90 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) {\n #endif\n }\n \n+int compress_stream_zstd(int fdf, int fdt, uint64_t max_bytes) {\n+#if HAVE_ZSTD\n+        _cleanup_(ZSTD_freeCCtxp) ZSTD_CCtx *s = ZSTD_createCStream();\n+        size_t out_size = ZSTD_CStreamOutSize();\n+        uint8_t out[out_size];\n+        char *src = NULL;\n+        struct stat st;\n+        ZSTD_inBuffer ZSTD_in = {src, 0, 0};\n+        ZSTD_outBuffer ZSTD_out = {&out, sizeof(out), 0};\n+        size_t ret;\n+        uint64_t left = max_bytes;\n+        int r;\n+\n+        assert(fdf >= 0);\n+        assert(fdt >= 0);\n+\n+        if (!s)\n+                return -ENOMEM;\n+\n+        ret = ZSTD_initCStream(s, ZSTD_COMPRESSION_LEVEL);\n+        if (ZSTD_isError(ret)) {\n+                log_error(\"Failed to initialize ZSTD encoder: %s\", ZSTD_getErrorName(ret));\n+                return zstd_ret_to_errnoh(ret);\n+        }\n+\n+        if (fstat(fdf, &st) < 0)\n+                return log_debug_errno(errno, \"fstat() failed: %m\");\n+        ZSTD_in.size = st.st_size;\n+\n+        src = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fdf, 0);\n+        if (src == MAP_FAILED)\n+                return -errno;\n+        ZSTD_in.src = src;\n+\n+        for (;;) {\n+                while (ZSTD_out.pos < ZSTD_out.size) {\n+                        ret = ZSTD_compressStream(s, &ZSTD_out, &ZSTD_in);\n+                        if (ZSTD_isError(ret)) {\n+                                log_error(\"ZSTD encoder failed: %s\", ZSTD_getErrorName(ret));","path":"src/journal/compress.c","position":190,"original_position":190,"commit_id":"99c84350ec28894ffced910e513673d26a8226dc","original_commit_id":"99c84350ec28894ffced910e513673d26a8226dc","user":{"login":"poettering","id":2130732,"avatar_url":"https://avatars1.githubusercontent.com/u/2130732?v=4","gravatar_id":"","url":"https://api.github.com/users/poettering","html_url":"https://github.com/poettering","followers_url":"https://api.github.com/users/poettering/followers","following_url":"https://api.github.com/users/poettering/following{/other_user}","gists_url":"https://api.github.com/users/poettering/gists{/gist_id}","starred_url":"https://api.github.com/users/poettering/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poettering/subscriptions","organizations_url":"https://api.github.com/users/poettering/orgs","repos_url":"https://api.github.com/users/poettering/repos","events_url":"https://api.github.com/users/poettering/events{/privacy}","received_events_url":"https://api.github.com/users/poettering/received_events","type":"User","site_admin":false},"body":"in systemd, we try to avoid logging above LOG_DEBUG level in \"library code\", and this pretty much is \"library code\" (as opposed to \"main program code\"). See CODING_STYLE about this. Hence, please downgrade this to log_debug.","created_at":"2018-02-19T11:33:53Z","updated_at":"2018-02-19T11:36:16Z","html_url":"https://github.com/systemd/systemd/pull/8207#discussion_r169050354","pull_request_url":"https://api.github.com/repos/systemd/systemd/pulls/8207","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/systemd/systemd/pulls/comments/169050354"},"html":{"href":"https://github.com/systemd/systemd/pull/8207#discussion_r169050354"},"pull_request":{"href":"https://api.github.com/repos/systemd/systemd/pulls/8207"}}},"pull_request":{"url":"https://api.github.com/repos/systemd/systemd/pulls/8207","id":169767558,"html_url":"https://github.com/systemd/systemd/pull/8207","diff_url":"https://github.com/systemd/systemd/pull/8207.diff","patch_url":"https://github.com/systemd/systemd/pull/8207.patch","issue_url":"https://api.github.com/repos/systemd/systemd/issues/8207","number":8207,"state":"open","locked":false,"title":"coredump,journal: add ZSTD compression support","user":{"login":"shawnl","id":510834,"avatar_url":"https://avatars1.githubusercontent.com/u/510834?v=4","gravatar_id":"","url":"https://api.github.com/users/shawnl","html_url":"https://github.com/shawnl","followers_url":"https://api.github.com/users/shawnl/followers","following_url":"https://api.github.com/users/shawnl/following{/other_user}","gists_url":"https://api.github.com/users/shawnl/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnl/subscriptions","organizations_url":"https://api.github.com/users/shawnl/orgs","repos_url":"https://api.github.com/users/shawnl/repos","events_url":"https://api.github.com/users/shawnl/events{/privacy}","received_events_url":"https://api.github.com/users/shawnl/received_events","type":"User","site_admin":false},"body":"Preliminary support for ZSTD\r\n\r\nIs there a desire to use ZSTD for the journal too? (because there isn't enough functionality here for that yet)\r\n\r\nCloses: #8097","created_at":"2018-02-17T04:17:02Z","updated_at":"2018-02-19T11:36:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18960b69b5a9b071f1df52c6e9c00b950a70f708","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":232590939,"url":"https://api.github.com/repos/systemd/systemd/labels/coredump","name":"coredump","color":"f7c6c7","default":false},{"id":567025275,"url":"https://api.github.com/repos/systemd/systemd/labels/fix-commit-message-on-merge","name":"fix-commit-message-on-merge","color":"006b75","default":false},{"id":219549857,"url":"https://api.github.com/repos/systemd/systemd/labels/journal","name":"journal","color":"d4c5f9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/systemd/systemd/pulls/8207/commits","review_comments_url":"https://api.github.com/repos/systemd/systemd/pulls/8207/comments","review_comment_url":"https://api.github.com/repos/systemd/systemd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/systemd/systemd/issues/8207/comments","statuses_url":"https://api.github.com/repos/systemd/systemd/statuses/99c84350ec28894ffced910e513673d26a8226dc","head":{"label":"shawnl:zstd","ref":"zstd","sha":"99c84350ec28894ffced910e513673d26a8226dc","user":{"login":"shawnl","id":510834,"avatar_url":"https://avatars1.githubusercontent.com/u/510834?v=4","gravatar_id":"","url":"https://api.github.com/users/shawnl","html_url":"https://github.com/shawnl","followers_url":"https://api.github.com/users/shawnl/followers","following_url":"https://api.github.com/users/shawnl/following{/other_user}","gists_url":"https://api.github.com/users/shawnl/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnl/subscriptions","organizations_url":"https://api.github.com/users/shawnl/orgs","repos_url":"https://api.github.com/users/shawnl/repos","events_url":"https://api.github.com/users/shawnl/events{/privacy}","received_events_url":"https://api.github.com/users/shawnl/received_events","type":"User","site_admin":false},"repo":{"id":45327383,"name":"systemd","full_name":"shawnl/systemd","owner":{"login":"shawnl","id":510834,"avatar_url":"https://avatars1.githubusercontent.com/u/510834?v=4","gravatar_id":"","url":"https://api.github.com/users/shawnl","html_url":"https://github.com/shawnl","followers_url":"https://api.github.com/users/shawnl/followers","following_url":"https://api.github.com/users/shawnl/following{/other_user}","gists_url":"https://api.github.com/users/shawnl/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnl/subscriptions","organizations_url":"https://api.github.com/users/shawnl/orgs","repos_url":"https://api.github.com/users/shawnl/repos","events_url":"https://api.github.com/users/shawnl/events{/privacy}","received_events_url":"https://api.github.com/users/shawnl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shawnl/systemd","description":"systemd upstream","fork":true,"url":"https://api.github.com/repos/shawnl/systemd","forks_url":"https://api.github.com/repos/shawnl/systemd/forks","keys_url":"https://api.github.com/repos/shawnl/systemd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shawnl/systemd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shawnl/systemd/teams","hooks_url":"https://api.github.com/repos/shawnl/systemd/hooks","issue_events_url":"https://api.github.com/repos/shawnl/systemd/issues/events{/number}","events_url":"https://api.github.com/repos/shawnl/systemd/events","assignees_url":"https://api.github.com/repos/shawnl/systemd/assignees{/user}","branches_url":"https://api.github.com/repos/shawnl/systemd/branches{/branch}","tags_url":"https://api.github.com/repos/shawnl/systemd/tags","blobs_url":"https://api.github.com/repos/shawnl/systemd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shawnl/systemd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shawnl/systemd/git/refs{/sha}","trees_url":"https://api.github.com/repos/shawnl/systemd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shawnl/systemd/statuses/{sha}","languages_url":"https://api.github.com/repos/shawnl/systemd/languages","stargazers_url":"https://api.github.com/repos/shawnl/systemd/stargazers","contributors_url":"https://api.github.com/repos/shawnl/systemd/contributors","subscribers_url":"https://api.github.com/repos/shawnl/systemd/subscribers","subscription_url":"https://api.github.com/repos/shawnl/systemd/subscription","commits_url":"https://api.github.com/repos/shawnl/systemd/commits{/sha}","git_commits_url":"https://api.github.com/repos/shawnl/systemd/git/commits{/sha}","comments_url":"https://api.github.com/repos/shawnl/systemd/comments{/number}","issue_comment_url":"https://api.github.com/repos/shawnl/systemd/issues/comments{/number}","contents_url":"https://api.github.com/repos/shawnl/systemd/contents/{+path}","compare_url":"https://api.github.com/repos/shawnl/systemd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shawnl/systemd/merges","archive_url":"https://api.github.com/repos/shawnl/systemd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shawnl/systemd/downloads","issues_url":"https://api.github.com/repos/shawnl/systemd/issues{/number}","pulls_url":"https://api.github.com/repos/shawnl/systemd/pulls{/number}","milestones_url":"https://api.github.com/repos/shawnl/systemd/milestones{/number}","notifications_url":"https://api.github.com/repos/shawnl/systemd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shawnl/systemd/labels{/name}","releases_url":"https://api.github.com/repos/shawnl/systemd/releases{/id}","deployments_url":"https://api.github.com/repos/shawnl/systemd/deployments","created_at":"2015-11-01T03:47:46Z","updated_at":"2017-10-29T04:37:03Z","pushed_at":"2018-02-18T08:04:20Z","git_url":"git://github.com/shawnl/systemd.git","ssh_url":"git@github.com:shawnl/systemd.git","clone_url":"https://github.com/shawnl/systemd.git","svn_url":"https://github.com/shawnl/systemd","homepage":"http://www.freedesktop.org/wiki/Software/systemd/","size":85310,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"systemd:master","ref":"master","sha":"31ce89e7d9272d01a749737c9622e8eff2d8a112","user":{"login":"systemd","id":1918868,"avatar_url":"https://avatars0.githubusercontent.com/u/1918868?v=4","gravatar_id":"","url":"https://api.github.com/users/systemd","html_url":"https://github.com/systemd","followers_url":"https://api.github.com/users/systemd/followers","following_url":"https://api.github.com/users/systemd/following{/other_user}","gists_url":"https://api.github.com/users/systemd/gists{/gist_id}","starred_url":"https://api.github.com/users/systemd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemd/subscriptions","organizations_url":"https://api.github.com/users/systemd/orgs","repos_url":"https://api.github.com/users/systemd/repos","events_url":"https://api.github.com/users/systemd/events{/privacy}","received_events_url":"https://api.github.com/users/systemd/received_events","type":"Organization","site_admin":false},"repo":{"id":32873313,"name":"systemd","full_name":"systemd/systemd","owner":{"login":"systemd","id":1918868,"avatar_url":"https://avatars0.githubusercontent.com/u/1918868?v=4","gravatar_id":"","url":"https://api.github.com/users/systemd","html_url":"https://github.com/systemd","followers_url":"https://api.github.com/users/systemd/followers","following_url":"https://api.github.com/users/systemd/following{/other_user}","gists_url":"https://api.github.com/users/systemd/gists{/gist_id}","starred_url":"https://api.github.com/users/systemd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemd/subscriptions","organizations_url":"https://api.github.com/users/systemd/orgs","repos_url":"https://api.github.com/users/systemd/repos","events_url":"https://api.github.com/users/systemd/events{/privacy}","received_events_url":"https://api.github.com/users/systemd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/systemd/systemd","description":"🐧 ⚙️ – systemd System and Service Manager ","fork":false,"url":"https://api.github.com/repos/systemd/systemd","forks_url":"https://api.github.com/repos/systemd/systemd/forks","keys_url":"https://api.github.com/repos/systemd/systemd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/systemd/systemd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/systemd/systemd/teams","hooks_url":"https://api.github.com/repos/systemd/systemd/hooks","issue_events_url":"https://api.github.com/repos/systemd/systemd/issues/events{/number}","events_url":"https://api.github.com/repos/systemd/systemd/events","assignees_url":"https://api.github.com/repos/systemd/systemd/assignees{/user}","branches_url":"https://api.github.com/repos/systemd/systemd/branches{/branch}","tags_url":"https://api.github.com/repos/systemd/systemd/tags","blobs_url":"https://api.github.com/repos/systemd/systemd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/systemd/systemd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/systemd/systemd/git/refs{/sha}","trees_url":"https://api.github.com/repos/systemd/systemd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/systemd/systemd/statuses/{sha}","languages_url":"https://api.github.com/repos/systemd/systemd/languages","stargazers_url":"https://api.github.com/repos/systemd/systemd/stargazers","contributors_url":"https://api.github.com/repos/systemd/systemd/contributors","subscribers_url":"https://api.github.com/repos/systemd/systemd/subscribers","subscription_url":"https://api.github.com/repos/systemd/systemd/subscription","commits_url":"https://api.github.com/repos/systemd/systemd/commits{/sha}","git_commits_url":"https://api.github.com/repos/systemd/systemd/git/commits{/sha}","comments_url":"https://api.github.com/repos/systemd/systemd/comments{/number}","issue_comment_url":"https://api.github.com/repos/systemd/systemd/issues/comments{/number}","contents_url":"https://api.github.com/repos/systemd/systemd/contents/{+path}","compare_url":"https://api.github.com/repos/systemd/systemd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/systemd/systemd/merges","archive_url":"https://api.github.com/repos/systemd/systemd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/systemd/systemd/downloads","issues_url":"https://api.github.com/repos/systemd/systemd/issues{/number}","pulls_url":"https://api.github.com/repos/systemd/systemd/pulls{/number}","milestones_url":"https://api.github.com/repos/systemd/systemd/milestones{/number}","notifications_url":"https://api.github.com/repos/systemd/systemd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/systemd/systemd/labels{/name}","releases_url":"https://api.github.com/repos/systemd/systemd/releases{/id}","deployments_url":"https://api.github.com/repos/systemd/systemd/deployments","created_at":"2015-03-25T15:27:27Z","updated_at":"2018-02-19T10:01:21Z","pushed_at":"2018-02-19T11:06:54Z","git_url":"git://github.com/systemd/systemd.git","ssh_url":"git@github.com:systemd/systemd.git","clone_url":"https://github.com/systemd/systemd.git","svn_url":"https://github.com/systemd/systemd","homepage":"https://www.freedesktop.org/wiki/Software/systemd/","size":85778,"stargazers_count":2825,"watchers_count":2825,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1137,"mirror_url":null,"archived":false,"open_issues_count":874,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":1137,"open_issues":874,"watchers":2825,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/systemd/systemd/pulls/8207"},"html":{"href":"https://github.com/systemd/systemd/pull/8207"},"issue":{"href":"https://api.github.com/repos/systemd/systemd/issues/8207"},"comments":{"href":"https://api.github.com/repos/systemd/systemd/issues/8207/comments"},"review_comments":{"href":"https://api.github.com/repos/systemd/systemd/pulls/8207/comments"},"review_comment":{"href":"https://api.github.com/repos/systemd/systemd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/systemd/systemd/pulls/8207/commits"},"statuses":{"href":"https://api.github.com/repos/systemd/systemd/statuses/99c84350ec28894ffced910e513673d26a8226dc"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"poettering"}}