Unlike the rest of libcgroup, the current implementation of cgget
uses arrays of strings to represent cgroups, controllers, and
settings.  The rest of the library utilizes the cgroup struct to
represent the hierarchy.

In preparation for the development of a cgroup v1/v2 abstraction
layer, this patchset refactors cgget to utilize struct cgroup and
better match the rest of the code base.  Note that patch #5 is a
complete re-write; it will likely be easier to review it as if it
were a new file rather than trying to decipher the git diff.

This patchset is largely intended to be nonfunctional and utilizes
the extensive cgget tests patchset sent out earlier [1].  During the
development of this code and the corresponding tests, I noticed in
a few error cases that the previous cgget would return 0 but still
populate stderr.  The newly refactored cgget does not behave this
way and this is reflected in this automated test [2].  Major
behavior should remain unchanged.

The changes to libcgroup are available here:
https://github.com/drakenclimber/libcgroup/tree/issues/cgget-refactor

The extensive cgget tests are available here:
https://github.com/drakenclimber/libcgroup-tests/tree/issues/cgget-tests

Automated tests results are available here:
https://github.com/drakenclimber/libcgroup/runs/1912708516

Code coverage increased from 45% to 46.2%.  Code coverage in the
newly refactored cgget.c is now at 86.3%:
https://coveralls.io/builds/37176420

[1] https://sourceforge.net/p/libcg/mailman/message/37218156/
[2] 
https://github.com/drakenclimber/libcgroup-tests/blob/issues/cgget-tests/ftests/016-cgget-invalid_options.py#L100

Tom Hromatka (5):
  api: Expose cg_build_path_locked() to users of libcgroup.la
  api.c: Expose cgroup_fill_cgc() to users of libcgroup.la
  api.c: Expose cgroup_test_subsys_mounted() to users of libcgroup.la
  wrapper.c: Add support for empty values in cgroup_add_value_string()
  cgget: Major refactor

 src/api.c                |  36 +-
 src/libcgroup-internal.h |  40 ++
 src/libcgroup.map        |   5 +
 src/tools/Makefile.am    |   2 +-
 src/tools/cgget.c        | 897 +++++++++++++++++++++++++--------------
 src/wrapper.c            |  30 +-
 6 files changed, 685 insertions(+), 325 deletions(-)

-- 
2.26.2



_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to