Hello community,
here is the log from the commit of package snapper for openSUSE:12.3 checked in at 2013-02-22 17:02:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:12.3/snapper (Old)
and /work/SRC/openSUSE:12.3/.snapper.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "snapper", Maintainer is "ASchnell@suse.com"
Changes:
--------
--- /work/SRC/openSUSE:12.3/snapper/snapper.changes 2013-02-21 15:37:31.000000000 +0100
+++ /work/SRC/openSUSE:12.3/.snapper.new/snapper.changes 2013-02-22 17:02:12.000000000 +0100
@@ -1,0 +2,5 @@
+Fri Feb 22 11:49:23 CET 2013 - aschnell@suse.de
+
+- use sendfile system-call instead of read/write loop
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ snapper-0.1.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/snapper-0.1.2/snapper/AppUtil.cc new/snapper-0.1.2/snapper/AppUtil.cc
--- old/snapper-0.1.2/snapper/AppUtil.cc 2013-02-08 10:51:31.000000000 +0100
+++ new/snapper-0.1.2/snapper/AppUtil.cc 2013-02-22 14:31:31.000000000 +0100
@@ -30,6 +30,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -90,45 +91,19 @@
bool
copyfile(int src_fd, int dest_fd)
{
- struct stat src_stat;
- int r1 = fstat(src_fd, &src_stat);
- if (r1 != 0)
- {
- y2err("fstat failed errno:" << errno << " (" << stringerror(errno) << ")");
- return false;
- }
-
- posix_fadvise(src_fd, 0, src_stat.st_size, POSIX_FADV_SEQUENTIAL);
-
- static_assert(sizeof(off_t) >= 8, "off_t is too small");
-
- const off_t block_size = 4096;
-
- char block[block_size];
-
- off_t length = src_stat.st_size;
- while (length > 0)
+ while (true)
{
- off_t t = min(block_size, length);
+ // use small value for count to make function better interruptible
+ ssize_t r1 = sendfile(dest_fd, src_fd, NULL, 0xffff);
+ if (r1 == 0)
+ return true;
- int r2 = read(src_fd, block, t);
- if (r2 != t)
+ if (r1 < 0)
{
- y2err("read failed errno:" << errno << " (" << stringerror(errno) << ")");
+ y2err("sendfile failed errno:" << errno << " (" << stringerror(errno) << ")");
return false;
}
-
- int r3 = write(dest_fd, block, t);
- if (r3 != t)
- {
- y2err("write failed errno:" << errno << " (" << stringerror(errno) << ")");
- return false;
- }
-
- length -= t;
}
-
- return true;
}
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org