xen-store: support XenStore access through /dev/xen/xenbus - #20
Open
lkpdn wants to merge 3 commits into
Open
Conversation
lkpdn
force-pushed
the
pr-xenstore-device-transport
branch
from
August 27, 2026 14:49
2d77dae to
1622572
Compare
xs_transaction() writes the request header with write_all(), then sends the payload with one writev(). A short write leaves XenStore waiting for the rest while the client waits for a reply. EINTR leaves the header stranded on the stream. Build each payload as one byte buffer and use write_all() for both parts. This retries short writes and EINTR, and removes the raw iovec handling and nix dependency. Add deterministic coverage for both cases. Fixes: 43a2751 ("Add support for Xen store API") Signed-off-by: Koichiro Den <den@valinux.co.jp>
The XenStore client stores and operates directly on UnixStream objects. This ties protocol handling to the XenStore Unix domain socket transport. Introduce XenStoreTransport and route cloning, reads, writes, and shutdown through it. Keep UnixStream as the only transport in this patch. Add a socket-pair test covering the refactored protocol path and idle reader shutdown. No functional change intended. Signed-off-by: Koichiro Den <den@valinux.co.jp>
XenStoreHandle::new() connects only through a Unix domain socket, which is normally unavailable in a driver domain. On Linux, /dev/xen/xenbus exposes the kernel's XenStore connection to user space as a character device. Follow xs_open() in libxenstore by trying this interface when the socket connection fails. Unlike a socket, this character device cannot use shutdown(2) to wake a blocked reader, and std::thread has no equivalent to libxenstore's use of pthread_cancel(). Do a simple cooperative shutdown instead: open the device with O_NONBLOCK and poll it together with a shutdown eventfd before each read. This keeps partial reads interruptible without relying on Linux to make complete XenStore messages available before waking readers. Add tests for fallback and shutdown of the character device reader, including shutdown after partial data and while input is ready. Signed-off-by: Koichiro Den <den@valinux.co.jp>
lkpdn
force-pushed
the
pr-xenstore-device-transport
branch
from
August 27, 2026 14:59
1622572 to
21d85ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the PR
XenStoreHandle::new() currently connects only through the Unix domain socket, which is normally unavailable in a driver domain. Linux exposes XenStore through /dev/xen/xenbus.
First abstract the transport I/O without changing the socket path, then add the device fallback. Open the device with O_NONBLOCK and poll it with a shutdown eventfd so partial reads remain interruptible.
Dependency
Depends-on: #18
(This branch is stacked on #18. The last two commits are new here.)
Requirements
git commit -s), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafecode is properly documented.