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

Reinstall libtcmu API and header files #444

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

baihuahua
Copy link

@baihuahua baihuahua commented Jul 14, 2018

The separation work of libtcmu and tcmu-runner seems harder than we thought and is going to take a bit more time to achieve. Let's reinstall libtcmu header files and API first for now as the future sepatation work can still base on this to move on and qemu-tcmu can also make a little forward with this change. @mikechristie @amarts @lxbsz

Both tcmu-runner and qemu-tcmu can build successfully with this patchset. Please review.

Yaowei Bai added 5 commits July 15, 2018 01:08
Separate tcmu-runner.h from libtcmu_priv.h and include it explicitly
where it's necessary. We will export libtcmu_priv.h as part of libtcmu
in the next patch.

Signed-off-by: Yaowei Bai <[email protected]>
@baihuahua
Copy link
Author

Hi Mike, could you please take a look at this patchset at your convenience? Thanks. @mikechristie

@mikechristie
Copy link
Collaborator

Sorry. I misread it the first time. I thought it depended on your discussion with Xiubo on the PR. Will get to it today.

@lxbsz
Copy link
Collaborator

lxbsz commented Jul 24, 2018

@mikechristie If we change the whole code one time in a PR it will be very hard to review, it should be okay for me to split this in different small PRs to make it easier.

And IMO, the goal is to make the libtcmu.so include and provide the following features and APIs:
1, the basic helpers of the kernel uio device and target/module configfs.
2, some basic scsi handling helpers, such as the INQUIRY...
3, dbus related code.

@baihuahua
Copy link
Author

Yes, small PRs should be more easier to review. We could start from this PR and implement other features one by one. This should make sense. @mikechristie

@@ -272,7 +272,7 @@ configure_file (
)
install(SCRIPT tcmu.conf_install.cmake)

install(FILES libtcmu.h libtcmu_common.h tcmu-runner.h
install(FILES libtcmu.h libtcmu_common.h libtcmu_priv.h darray.h
Copy link
Collaborator

Choose a reason for hiding this comment

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

For the final lib we are not going to have users use/include the private definitions. The lib user should also not need the darray.h header unless we expose an api that uses a darrary.

Copy link
Author

Choose a reason for hiding this comment

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

While the tcmulib_context and tcmu_device structs in libtcmu_priv.h are needed by users and tcmulib_context depends on darray.h currently. Maybe we should rename libtcmu_priv.h as it will not 'private'.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The lib users should not need to ever directly interact with tcmu_device. It is internal to the lib. The only interact with it via libtcmu helpers.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Check out how consumer.c or tcmu-synthesizer worked with libtcmu originally for an example. They never directly interacted with tcmu_device so we could make internal changes and not have to update every libtcmu user.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh yeah for libtcmu_context and darray that should not be an issue. The users of libtcmu only pass around a tcmulib_context struct pointer. They never access it, so the forward declaration in the libtcmu.h should be enough.

Copy link
Author

Choose a reason for hiding this comment

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

I see. I'll tune this as your suggestion. Thansk.

#include "darray.h"
#include "ccan/list/list.h"
#include "tcmur_aio.h"

Copy link
Collaborator

Choose a reason for hiding this comment

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

This patch is fine.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks.

@@ -23,6 +23,7 @@
#include "libtcmu_log.h"
#include "libtcmu_common.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This patch seems ok.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks.

CMakeLists.txt Outdated
@@ -272,6 +272,8 @@ configure_file (
)
install(SCRIPT tcmu.conf_install.cmake)

install(FILES libtcmu.h libtcmu_common.h tcmu-runner.h
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't the final new lib have a new header name so it does not conflict with users of the old libtcmu?

Also wether the final lib needs something like tcmu-runner.h is still up in the air.

@mikechristie
Copy link
Collaborator

I agree small patchsets are best.

The include related cleanup patches in this patches are nice on their own. So these patches:

[PATCH 3/5] libtcmu: explicitly include tcmu-runner.h where necessary
[PATCH 4/5] libtcmu_priv.h: drop unnecessary header files

I will merge now.

The final piece would be to install the new libtcmuXYZ and the headers again. I do not think we can install them now because they are going to change in the end, and also the libtcmu that would be installed now will not be supported in the end, so we do not want releases installing libs that are not supported. So these patches like these should be sent at the end when you have a lib to support:

[PATCH 1/5] Revert "build: drop versionless libtcmu.so symlink"
[PATCH 2/5] Revert "libtcmu: do not install headers and drop libtcmu stable API"
[PATCH 5/5] CMakeList.txt: install more header files for dependence of libtcmu

you would do at the end.

@lxbsz lxbsz changed the base branch from master to main August 10, 2022 00:24
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