Skip to content
Snippets Groups Projects
  1. Sep 07, 2017
    • Colin Walters's avatar
      fdio: Add glnx_fstatat_allow_noent() · 627d4e2f
      Colin Walters authored
      This is a very common pattern in both ostree/rpm-ostree. Make a better API for
      this. I thought a lot about simply zeroing out `struct stat` but that feels
      dangerous; none of the values have seem obviously `cannot be zero`.
      627d4e2f
  2. Aug 25, 2017
  3. Aug 18, 2017
    • Colin Walters's avatar
      dirfd: New tmpdir API · 7100ebbc
      Colin Walters authored
      Basically all of the ostree/rpm-ostree callers want to both create and open, so
      let's merge `glnx_mkdtempat()` and `glnx_mkdtempat_open()`.
      
      Second, all of them want to do `glnx_shutil_rm_rf_at()` on cleanup, so we do the
      same thing we did with `GLnxTmpfile` and create `GLnxTmpDir` that has a cleanup
      attribute.
      
      The cleanup this results in for rpm-ostree is pretty substantial.
      7100ebbc
  4. Aug 15, 2017
  5. Aug 09, 2017
    • Colin Walters's avatar
      fdio: Merge systemd code to use copy_file_range(), use FICLONE · d18f026e
      Colin Walters authored
      FICLONE is the new alias for the formerly btrfs-specific ioctl; XFS
      has experimental patches to support it.
      
      Further, we should use copy_file_range() for the case where we're only doing a
      limited copy. Both NFS and XFS (with reflink enabled) understand it.
      
      Part of the reason I'm doing this is so that ostree's `/etc` merge will start
      using XFS reflinks. But another major reason is to take the next step after and
      copy this code into GLib as well, so that all of the general GLib users will
      benefit; e.g. Nautilus will transparently do server copy offloads with NFS home
      directories.
      
      See also this coreutils thread about `copy_file_range()`:
      <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24399>. I don't care about file
      holes for our use cases, so it's fine.
      
      Other changes while I'm here:
       - Tweak the sendfile() case to match the newly inlined logic for cfr
       - Add a TEMP_FAILURE_RETRY() around the read()
      d18f026e
  6. Aug 02, 2017
  7. Jul 31, 2017
  8. Jul 26, 2017
  9. Jul 24, 2017
  10. Jul 21, 2017
    • Jonathan Lebon's avatar
      errors: check for an error before prefixing · c820571b
      Jonathan Lebon authored
      Minor tweak to the new `GLNX_AUTO_PREFIX_ERROR`. Since the common case
      is that there's no errors, let's bring down the same check that
      `g_prefix_error` does to avoid a function call most of the time.
      c820571b
  11. Jul 20, 2017
  12. Jul 19, 2017
  13. Jul 17, 2017
    • Colin Walters's avatar
      errors: Add GLNX_AUTO_PREFIX_ERROR · 607f1775
      Colin Walters authored
      In a lot of places in ostree, we end up prefixing errors in the *caller*.
      Often we only have 1-2 callers, and doing the error prefixing isn't
      too duplicative.  But there are definitely cases where it's cleaner
      to do the prefixing in the callee.  We have functions that aren't
      ported to new style for this reason (they still do the prefixing
      in `out:`).
      
      Introduce a cleanup-oriented version of error prefixing so we can port those
      functions too.
      607f1775
    • Colin Walters's avatar
      fdio: Add string prefix for glnx_fstat() · 61ef326a
      Colin Walters authored
      For consistency.
      61ef326a
    • Colin Walters's avatar
      fdio: Add a fchmod wrapper · 547bcea2
      Colin Walters authored
      There are a number of versions of this in ostree at least, might as well wrap
      it.
      547bcea2
    • Colin Walters's avatar
      Remove glnx_stream_fstat() · 8b75c8e3
      Colin Walters authored
      There are only two users of this in ostree, and one of them is
      fairly bogus; we can just use `fstat()`.
      8b75c8e3
    • Colin Walters's avatar
      fdio: Add cleanup+flush API for FILE* · e30a773f
      Colin Walters authored
      Mostly in ostree/rpm-ostree, we work in either raw `int fd`, or
      `G{Input,Output}Stream`.  One exception is the rpm-ostree `/etc/passwd`
      handling, which uses `FILE*` since that's what glibc exposes.
      
      And in general, there are use cases for `FILE*`; the raw `GUnixOutputStream` for
      example isn't buffered, and doing so via e.g. `GBufferedOutputStream` means
      allocating *two* GObjects and even worse going through multiple vfuncs for every
      write.
      
      `FILE*` is used heavily in systemd, and provides buffering. It is a bit cheaper
      than gobjects, but has its own trap; by default every operation locks a mutex.
      For more information on that, see `unlocked_stdio(3)`. However, callers can
      avoid that by using e.g. `fwrite_unlocked`, which I plan to do for most users of
      `FILE*` that aren't writing to one of the standard streams like `stdout` etc.
      e30a773f
  14. Jul 13, 2017
  15. Jul 10, 2017
  16. Jun 30, 2017
  17. Jun 28, 2017
  18. Jun 26, 2017
  19. Jun 17, 2017
  20. Jun 14, 2017
    • Colin Walters's avatar
      Add G_IN_SET, patch our internal users via spatch · 9a1b77ef
      Colin Walters authored
      I originally tried to get this into GLib:
      https://bugzilla.gnome.org/show_bug.cgi?id=783751
      
      But that looks like it's going to fail due to MSVC. Let's add it here at least
      so I can start using it tomorrow and not wait for the MSVC team to catch up.
      
      I renamed `glnx-alloca.h` to `glnx-macros.h` as a more natural collective
      home for things from systemd's `macro.h`.
      
      Finally, I used a Coccinelle spatch similar to the one referenced
      in the above BZ to patch our uses.
      9a1b77ef
  21. Jun 13, 2017
  22. May 31, 2017
    • Colin Walters's avatar
      dirfd: Have dfd iter _take_fd() take a pointer and do a steal · f5ba01cf
      Colin Walters authored
      This avoids callers having to use `glnx_steal_fd()` on their own; in general, I
      think we should implement move semantics like this at the callee level.
      
      Another reason to do this is there's a subtle problem with doing:
      
      ```
      somefunction (steal_value (&v), ..., error);
      ```
      
      in that if `somefunction` throws, it may not have taken ownership of the value.
      At least `glnx_dirfd_iterator_init_take_fd()` didn't.
      f5ba01cf
  23. May 30, 2017
  24. May 19, 2017
  25. May 17, 2017
Loading