| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
| |
Prep for dropping `GLNX_DEFINE_CLEANUP_FUNCTION` from libglnx
in favor of using GLib's `G_DEFINE_AUTO_CLEANUP_FREE_FUNC()`.
Closes: #1042
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
| |
It's more natural for a few calling places. Prep for patches to go the other
way, which in turn are prep for adding a commit filter v2 that takes `struct
stat`.
`ot_gfile_type_for_mode()` was only used in this function, so inline it here.
Closes: #974
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I added `glnx_open_anonymous_tmpfile()`, but then later noticed
that the usage of this was really to be combined with `mmap()`,
and we had two versions of that in the delta code. Add a helper.
(Bigger picture...how is this different from glibc's "mmap() of /dev/zero"
approach for large chunks? One advantage is the storage can be "swapped" to
`/var/tmp`, but still deleted automatically, rather than requiring swap space)
Closes: #973
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's lots of mechanically replacing `OtTmpFile` with `GLnxTmpfile`;
the biggest changes are in the commit path. Symlink commits are now
very clearly separated from regular files. Symlinks are `OtCleanupUnlinkat`,
and regular files are `GLnxTmpfile`.
The commit codepath separates those as `_ostree_repo_commit_path_final()` and
`_ostree_repo_commit_tmpf_final()`. A nice aspect of all of this is that they
both *consume* the temporary on success. This avoids an extra spurious
`unlink()` call.
One of the biggest bits of code motion is in `commit_loose_regfile_object()`,
which no longer needs to care about symlinks. For the most parth though it's
just removing conditionals.
Update submodule: libglnx
Closes: #958
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The pull code also could make use of this in both the metadata and content
paths. I changed it to own the tempfile malloc (just like `GLnxTmpFile`), since
there's no reason to have different lifetimes for the filename and the file, and
that way we only have one variable rather than two.
The content path turns out to be a special case though, where
at least for mirroring archives, we directly pass the file *path*
down into `_ostree_repo_commit_loose_final()`.
This is prep for `GLnxTmpFile` porting.
Closes: #957
Approved by: jlebon
|
|
|
|
|
|
|
|
| |
I saw a few instances of `glnx_set_error_from_errno() + return FALSE`,
and fixed them and did a bit of style conversion.
Closes: #895
Approved by: jlebon
|
|
|
|
|
|
|
| |
I had to run a sed job to add whitespace after, but otherwise this was easy.
Closes: #890
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's hard right now to do a full port to the new libglnx tmpfile
API since there are complex cases in the commit path which deal
with symlinks as well.
Let's make things more gradual by introducing the important part (struct with
autocleanup) here in libotutil, port what we can. This will make a future
complete port easier.
Closes: #871
Approved by: jlebon
|
|
|
|
|
|
|
|
|
| |
Follow up to a previous patch that addressed a double-close; I
realized we already had a helper for doing "open dfd iter, do nothing
if we get ENOENT". Raise it to libotuil, and port all consumers.
Closes: #863
Approved by: jlebon
|
|
|
|
|
|
|
| |
Just happened to be reading this code, it's an easy port.
Closes: #842
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
| |
The keyring isn't large, so let's just fall back to copying it
rather than requiring `renameat()`.
Prep for `ostree_repo_open_at()`.
Closes: #821
Approved by: jlebon
|
|
|
|
|
|
|
| |
These were migrated into libglnx; port the few callers to use that.
Closes: #808
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`perf record ostree checkout ...` for a bare-user repo was telling
me we were spending a good 13% of our time in the depchain of `ot_lgexattrat()`.
The problem here is that traversing the `/proc` path turns out to be
somewhat expensive - there are LSM (SELinux) checks, etc.
For regular files, opening and just getting the xattr, then closing is still
quite cheap. For symlinks, we'll always need to open anyways.
This appears to shave about ~0.1 seconds off of a checkout of
`fedora-atomic/25/x86_64/docker-host` on my workstation.
Oh, and this was the last user of `ot_lgexattrat()` so we can kill it, which is
nice - the xattr code should really live in libglnx.
Closes: #796
Approved by: jlebon
|
|
|
|
|
|
|
| |
The first one is better as `err`, the second might as well just call `err` too.
Closes: #767
Approved by: jlebon
|
|
|
|
|
|
|
|
| |
This code was last used in 9618232f4da325692dcf98fd6ff5b8abd9fce66c
which is sooo old and outdated. Delete.
Closes: #767
Approved by: jlebon
|
|
|
|
|
|
|
| |
These are dead due to fd-relative porting probably.
Closes: #767
Approved by: jlebon
|
|
|
|
|
|
|
|
| |
This is dead code since 9cc98041953090160dde48afa69b97c936541cdb where
pull-local became just a wrapper for pull, which has its own threading.
Closes: #767
Approved by: jlebon
|
|
|
|
|
|
|
| |
This is all unused since the fd-relative/no-GFile porting. Delete delete delete!
Closes: #767
Approved by: jlebon
|
|
|
|
|
|
|
|
|
| |
I happened to read this file and realized there's a lot of cruft left over from
the time when I liked `GFile` and `malloc()`ing like 50 times just to make a
pathname string. Delete it.
Closes: #767
Approved by: jlebon
|
|
|
|
|
|
|
|
| |
And fd-relative. I also introduced some helpers here which I'll use later in
more invasive patches.
Closes: #742
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add an OpenSSL backend to the checksum input stream, which is where we do a lot
of checksumming (object commit, static deltas).
The raw OpenSSL performance is
[approximately double](https://gist.github.com/cgwalters/169349fd1c06fd4fb4d3a7ce33303222) on
my laptop; not only does OpenSSL have e.g. hand-tuned x86_64 assembly, the
current implementation uses the
[Intel SHA extensions](https://en.wikipedia.org/wiki/Intel_SHA_extensions).
Another reason to do this is I was idly thinking about adding
[Curve25519](https://en.wikipedia.org/wiki/Curve25519) signatures (like e.g.
Alpine does) instead of/in addition to GPG. The rationale for that is
that GPG is pretty heavyweight, both in code footprint and the simple
fact that EC keys are way smaller.
I didn't benchmark ostree with this; we have bigger performance problems
really like the fact we just malloc way too much. But, it's a step
in the right direction I think in combination with the libcurl work
where we're linking to openssl anyways.
Closes: #738
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current `OstreeChecksumInputStream` is public due to a historical
mistake. I'd like to add an OpenSSL checksum backend, but that's
harder without breaking this API.
Let's ignore it and create a new private version, so it's easier to do the
GLib/OpenSSL abstraction in one place.
Closes: #738
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We hit this with:
```
27411 unlink("/boot/efi/EFI/fedora/grub.cfg.new") = -1 EROFS (Read-only file system)
```
from the grub2 code.
https://github.com/projectatomic/rpm-ostree/issues/633
Closes: #694
Approved by: giuseppe
|
|
|
|
|
|
|
| |
In prep for future work.
Closes: #575
Approved by: giuseppe
|
|
|
|
|
|
|
| |
Just a cleanup in preparation for future work.
Closes: #575
Approved by: giuseppe
|
|
|
|
|
|
|
|
| |
So we build warning-free on GLib (< 2.50, >= 2.50). This
is a band aid until we hard-require >= 2.50.
Closes: #547
Approved by: jlebon
|
|
|
|
|
|
|
| |
This notably fixes compilation with CLang.
Closes: #548
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
| |
CLang finds these, whereas GCC treats having
`__attribute__((cleanup))` as a use.
This obsoletes https://github.com/ostreedev/ostree/pull/411
Closes: #548
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While looking at a slow update issue (which I'm guessing is
unpredictable I/O latency in an OpenStack instance), I noticed
in one of the traces we were inside a fsync here.
Dropping the fsync here is just another of a long series of unwinding
them - we `syncfs()` the sysroot fd and `/boot` and we have a big
`sync()` anyways.
Closes: #508
Approved by: jlebon
|
|
|
|
|
|
|
|
| |
Just preparatory cleanup for a next patch which makes
the fsyncing configurable.
Closes: #509
Approved by: giuseppe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Lots and lots of preparation led to this moment - when nothing
apparent changes for users! Woo!
But seriously, having the extra dependency is a minor annoyance, and
in the big picture I think the libgsystem idea was wrong - we need to
land things in GLib, and use git submodules for API-unstable or
Linux-specific sharing. For a lot of OSTree, the libgsystem `GFile*`
orientation was also wrong, we really want fd-relative.
Closes: #444
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
| |
We have a better API now, drop use of the internal helper, which also
depended on libgsystem.
This required bumping libglnx to pull in a fix.
Closes: #429
Approved by: giuseppe
|
|
|
|
|
|
|
|
|
|
|
|
| |
Import `gs_file_enumerator_iterate()` for the next six months or
so...after RHEL 7.3 is released I'm strongly considering hard
requiring 2.46 or so.
Likely at some point we should figure out how to share more "glib
backport" code with NetworkManager at least.
Closes: #341
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was the last caller of libgsystem that isn't
`gs_file_get_path_cached()`. I think the use case ostree has where
the same code can be called via command line and via a shared library
*and* via a daemon is rather unusual, so let's just copy the code for
logging from libgsystem into here.
For example rpm-ostree hard depends on a daemon mode, so it'll just
use `sd_journal` directly.
Closes: #341
Approved by: jlebon
|
|
|
|
|
|
|
|
|
| |
Just noticed this while reading some code, we didn't have many manual
`out: close()` bits left, this pushes us over the edge to autocleanup
almost everywhere.
Closes: #332
Approved by: jlebon
|
|
|
|
|
| |
Closes: #333
Approved by: giuseppe
|
|
|
|
|
|
|
|
|
| |
This kills another GSystem consumer...I think down the line I'd like
to do something like "detect whether file is > 1k if so, mmap,
otherwise just readall()" so we can use this helper in more places.
Closes: #319
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a lot of "allow_noent" type wrapper functions since
a common pattern is to allow files to not exist, but still
throw cleanly on other issues.
This is another instance of that, and cleans up duplicated error
handling code.
Part of this is prep for moving away from `GFile` consumers.
Closes: #319
Approved by: jlebon
|
|
|
|
|
|
|
| |
I apparently missed a few uses in the previous porting.
Closes: #319
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In addition to generic fd relative porting,
this is a necessary preparatory step for libglnx porting, because
when I tried to use `g_mapped_file_new` I hit an issue with
it using a different error domain from GIO.
Thankfully libglnx consistently uses the GIO error domain, and here
we're now using it for the `open()` call.
Closes: #317
Approved by: jlebon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is similar to changes Krzesimir has been doing recently - we
really don't need the ergonomics of floating refs since we have
autocleanups.
We should continue to change most of our code to sink refs.
Specifically here it was pretty broken that the `_map()` API was
sinking but the other two weren't, and this broke some refactoring I
was trying to do later.
Closes: #317
Approved by: jlebon
|
|
|
|
|
|
|
| |
In the second case it's actually less code too.
Closes: #312
Approved by: giuseppe
|
|
|
|
|
| |
Closes: #312
Approved by: giuseppe
|
|
|
|
|
|
|
|
| |
There's no need to allocate the variant builder on a heap, so allocate
it on the stack and avoid a memory leak at the same time.
Closes: #307
Approved by: cgwalters
|
|
|
|
|
|
|
|
|
| |
- Revert 'cannot' --> 'can not' (it's the exception!)
- Remove duplicate function
- Squelch compiler warnings
Closes: #248
Approved by: cgwalters
|
|
|
|
|
|
|
|
|
|
| |
This can be used as a fingerprint to determine whether two
OstreeSePolicy objects are equivalent.
Also add documentation for ostree_sepolicy_get_name().
Closes: #219
Approved by: cgwalters
|
|
|
|
|
| |
This unfortunately adds *more* `gs_file_get_path_cached()`, but we'll
fix that all in one go.
|
|
|
|
|
|
|
|
|
| |
:warning: There is a notable spiked pit trap here around
`posix_fallocate()` and `errno`. This has bit other projects,
see e.g.
https://github.com/systemd/systemd/commit/7bb87460e691d30c1a7fd23a1a8240776957e05f
Otherwise the port was straightforward.
|
|
|
|
|
|
| |
Refactor some common code
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
|
|
|
|
| |
These APIs are rather painful...this is why GError exists.
|