summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-sysroot-private.h
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2018-03-12 13:55:51 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-15 17:43:19 +0000
commit5b3f79d4bb7dc80f4bc750a9e8911709646a5523 (patch)
tree363c8ea98cd9ac7fecc1996d4de59f8103200dd4 /src/libostree/ostree-sysroot-private.h
parentbb9cc8912a0208a1b383ddbd24ecde6c7453e730 (diff)
downloadostree-5b3f79d4bb7dc80f4bc750a9e8911709646a5523.tar.gz
sysroot: Rework how we find booted deployment
I was looking at this code in prep for "staging" deployments, and there are several cleanups to be made here. The first thing I noticed is that we look for the `ostree=` kernel argument, but the presence of that should be exactly equivalent to having `/run/ostree-booted` exist. We just added a member variable for that, so let's make use of it. Related to this, we were erroring out if we had the karg but didn't find a deployment. But this can happen if e.g. one is using `ostree admin --sysroot` from an ostree-booted system! It's actually a bit surprising no one has reported this so far; I guess in the end people are either using non-ostree systems or running from containers. Let's add a member variable `root_is_sysroot` that we can use to determine if we're looking at `/`. Then, our more precise "should find a booted deployment" state is when both `ostree_booted` and `root_is_sysroot` are TRUE. Next, rather than walking all of the deployments after parsing, we can inline the `fstatat()` while parsing. The mild ugly thing about this is assigning to the sysroot member variable while parsing, but I will likely clean that up later, just wanted to avoid rewriting everything in one go. Closes: #1497 Approved by: jlebon
Diffstat (limited to 'src/libostree/ostree-sysroot-private.h')
-rw-r--r--src/libostree/ostree-sysroot-private.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libostree/ostree-sysroot-private.h b/src/libostree/ostree-sysroot-private.h
index cb4aac9d..b2776e8d 100644
--- a/src/libostree/ostree-sysroot-private.h
+++ b/src/libostree/ostree-sysroot-private.h
@@ -51,6 +51,10 @@ struct OstreeSysroot {
gboolean loaded;
gboolean ostree_booted;
+ gboolean root_is_sysroot; /* TRUE if sysroot_fd is pointed to rootfs "/" */
+ /* The device/inode for /, used to detect booted deployment */
+ dev_t root_device;
+ ino_t root_inode;
gboolean is_physical; /* TRUE if we're pointed at physical storage root and not a deployment */
GPtrArray *deployments;