From c1befbcd3eb4a51831260c7c7b743a673512e6a5 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 24 Mar 2026 18:46:36 +0000 Subject: util/nvmutil: never do cross-filesystem moves make a local TMPDIR instead, where gbe.bin is. this avoids the EXDEV errno, so we don't have to handle it, and it's just better performant for everyone. Signed-off-by: Leah Rowe --- util/libreboot-utils/lib/io.c | 64 ------------------------------------------- 1 file changed, 64 deletions(-) (limited to 'util/libreboot-utils/lib/io.c') diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c index de5f8c76..ef87d521 100644 --- a/util/libreboot-utils/lib/io.c +++ b/util/libreboot-utils/lib/io.c @@ -458,70 +458,6 @@ gbe_mv(void) err(errno, "TODO: cross-filesystem atomic writes currently broken"); - /* - * cross-filesystem: copy into target dir tmp - */ - - if (fs_dirname_basename(f->fname, - &dir, &base, 0) < 0) - goto ret_gbe_mv; - - dirfd = fs_open(dir, - O_RDONLY | O_DIRECTORY); - - if (dirfd < 0) - goto ret_gbe_mv; - - if (fstat(dirfd, &st_dir) < 0) - goto ret_gbe_mv; - - if (new_tmpfile_at(dirfd, &st_dir, - &dest_fd, &dest_name) < 0) - goto ret_gbe_mv; - - /* copy: tmp to local tmp */ - - rval = rw_file_exact(f->tmp_fd, f->bufcmp, - f->gbe_file_size, 0, IO_PREAD, - NO_LOOP_EAGAIN, LOOP_EINTR, - MAX_ZERO_RW_RETRY, OFF_ERR); - - if (rval < 0) - goto ret_gbe_mv; - - rval = rw_file_exact(dest_fd, f->bufcmp, - f->gbe_file_size, 0, IO_PWRITE, - NO_LOOP_EAGAIN, LOOP_EINTR, - MAX_ZERO_RW_RETRY, OFF_ERR); - - if (rval < 0) - goto ret_gbe_mv; - - if (fsync_on_eintr(dest_fd) == -1) - goto ret_gbe_mv; - - if (close_on_eintr(dest_fd) == -1) { - dest_fd = -1; - goto ret_gbe_mv; - } - dest_fd = -1; - - /* atomic replace */ - - if (fs_rename_at(dirfd, dest_name, - dirfd, base) == -1) - goto ret_gbe_mv; - - if (fsync_dir(f->fname) < 0) { - f->io_err_gbe_bin = 1; - goto ret_gbe_mv; - } - - free_if_null(&dest_name); - free_if_null(&dir); - - tmp_gbe_bin_exists = 0; - ret_gbe_mv: /* TODO: this whole section is bloat. -- cgit v1.2.1