Merge branch 'wip/stacked-overlay' into preview
authorRalph Ronnquist <rrq@rrq.au>
Sat, 12 Aug 2023 03:44:10 +0000 (13:44 +1000)
committerRalph Ronnquist <rrq@rrq.au>
Sat, 12 Aug 2023 03:44:10 +0000 (13:44 +1000)
debian/changelog [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/fusefile.links [new file with mode: 0644]
debian/gbp.conf [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/source/format [new file with mode: 0644]
debian/watch [new file with mode: 0644]
fusefile.8
fusefile.c

diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..f1aaad3
--- /dev/null
@@ -0,0 +1,84 @@
+fusefile (1.1-1) unstable; urgency=medium
+
+  * Corrected fragment ranges to be 64-bit (long int)
+  * Allow for fragment pathnames including "/" without range appendix
+  * Fix index oob in -dump function.
+
+ -- Ralph Ronnquist <rrq@rrq.au>  Thu, 03 Aug 2023 21:02:13 +1000
+
+fusefile (1.0-1) unstable; urgency=medium
+
+  * Version change for submission to debian
+
+ -- Ralph Ronnquist <rrq@rrq.au>  Sun, 25 Jun 2023 17:39:21 +1000
+
+fusefile (0.5.7) unstable; urgency=medium
+
+  * Updated man page.
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Sun, 25 Jun 2023 13:37:38 +1000
+
+fusefile (0.5.6) unstable; urgency=medium
+
+  * Added -dump function for dumping fragments including overlay table.
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Wed, 21 Jun 2023 00:09:34 +1000
+
+fusefile (0.5.5) unstable; urgency=medium
+
+  * Updated man page.
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Thu, 25 May 2023 16:01:40 +1000
+
+fusefile (0.5.4) unstable; urgency=medium
+
+  * Include fusedisk helper script for block mount
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Wed, 24 May 2023 19:48:53 +1000
+fusefile (0.5.3) unstable; urgency=medium
+
+  * Updated package description.
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Mon, 03 Oct 2022 13:01:26 +1100
+
+fusefile (0.5.2) unstable; urgency=medium
+
+  * Reworked overlay with new region representaiton.
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Fri, 12 Aug 2022 08:57:37 +1000
+
+fusefile (0.5.1) unstable; urgency=medium
+
+  * Fixes to overlay function.
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Thu, 11 Aug 2022 01:40:48 +1000
+
+fusefile (0.5) unstable; urgency=medium
+
+  * Added overlay file option.
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Tue, 09 Aug 2022 21:22:35 +1000
+
+fusefile (0.4) unstable; urgency=medium
+
+  * Revised into overwriting in sources without size change.
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Fri, 15 Jul 2022 12:17:30 +1000
+
+fusefile (0.3) unstable; urgency=medium
+
+  * Added writeability variation
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Thu, 26 May 2022 19:53:05 +1000
+
+fusefile (0.2) unstable; urgency=medium
+
+  * Code refresh for chimaera (bullseye).
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Tue, 05 Apr 2022 19:43:49 +1000
+
+fusefile (0.1) unstable; urgency=medium
+
+  * Initial Release.
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com>  Mon, 11 Mar 2018 10:00:00 +1100
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..397a837
--- /dev/null
@@ -0,0 +1,22 @@
+Source: fusefile
+Section: admin
+Priority: optional
+Maintainer: Ralph Ronnquist <rrq@rrq.au>
+Build-Depends: debhelper-compat (= 13), libfuse-dev
+Standards-Version: 4.6.2
+Homepage: https://git.devuan.org/rrq/fusefile.git
+Vcs-Browser: https://git.devuan.org/rrq/fusefile/src/branch/debian
+Vcs-Git: https://git.devuan.org/rrq/fusefile.git -b debian
+Rules-Requires-Root: no
+
+Package: fusefile
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, fuse
+Description: Using FUSE to combine file fragments into a single file.
+ fusefile is a FUSE "file mount" that presents a series of fragments
+ of other files as a contiguous concatenation. Technically it bind
+ mounts a driver on top of the filename mountpoint to provide access
+ to the given file fragments as if in a single, contiguous file. The
+ fusefile mount driver offers read/write access to the fused file,
+ distributing written data across the given fragments or to an overlay
+ file.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..011d4e9
--- /dev/null
@@ -0,0 +1,25 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: fusefile
+Upstream-Contact: Ralph Ronnquist <rrq@rrq.au>
+Source: https://git.devuan.org/rrq/fusefile.git
+
+Files: *
+Copyright: 2018 Ralph Ronnquist <rrq@rrq.au>
+License: GPL-3.0+
+
+License: GPL-3.0+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
diff --git a/debian/fusefile.links b/debian/fusefile.links
new file mode 100644 (file)
index 0000000..ed132f0
--- /dev/null
@@ -0,0 +1 @@
+usr/share/man/man8/fusefile.8 usr/share/man/man8/fusedisk.8
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644 (file)
index 0000000..f5e3ac2
--- /dev/null
@@ -0,0 +1,5 @@
+[DEFAULT]
+debian-branch=debian
+upstream-branch=master
+upstream-tag=%(version)s
+compression-level=9
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..2d33f6a
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+%:
+       dh $@
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch b/debian/watch
new file mode 100644 (file)
index 0000000..cfb3210
--- /dev/null
@@ -0,0 +1,4 @@
+version=4
+opts="mode=git, pgpmode=none" \
+https://git.devuan.org/rrq/fusefile \
+refs/tags/([\d\.]+) master uupdate
index da2b645b7825d2b7cad2a9999682ff37331708a4..b952f5574075e2ae9b0df699ead855873618a772 100644 (file)
@@ -8,6 +8,8 @@ fusefile, fusedisk \- FUSE file mount for combining file fragments
 .br
 .B fusefile \fB-dump\fR \fR[\fIfuse-opts\fR] \fBmountpoint\fR \fR[\fIoverlay\fR] \fIfilename/from-to\fR ...
 .br
+.B fusefile \fB-push\fR \fR[\fIfuse-opts\fR] \fBmountpoint\fR \fR[\fIoverlay\fR] \fIfilename/from-to\fR ...
+.br
 .B fusedisk \fR[\fIfuse-opts\fR] \fBmountpoint\fR \fR[\fIoverlay\fR] \fIfilename/from-to\fR ...
 
 .SH DESCRIPTION
@@ -38,12 +40,18 @@ of each other.
 
 The option \fB-dump\fR as first argument together with a fusefile
 setup will print the setup to standard output rather than establishing
-a fusefile mount. This is of most use with a prior overlay setup,
-where then the printout includes the portions of updates that have
-been captured in the overlay. The printout is the series of fusefile
+a fusefile mount. This is of most use with a prior overlay setup where
+then the printout includes the portions of updates that have been
+captured in the overlay. The printout is the series of fusefile
 fragment argments to give in order to intersperse the captured overlay
 portions according to the overlay table.
 
+The option \fB-push\fR as first argument together with a fusefile
+setup will push the overlay into the sources (except for
+write-protected fragments). This is only of use with a prior overlay
+setup where then the updates that have been captured in the overlay
+get pushed into the fragments.
+
 \fBfusedisk\fR is a helper script to set up a \fBfusefile\fR as a
 block device (via \fIfuseblk\fR) by using the device mapper
 (\fBdmsetup\fR) to manage an empty block device mapping where content
index e05b90ebdf4c8a3de0c45d56a562dc71f4031fc4..62431d28a6894ba2973388ee7999971bb0bb2e2e 100644 (file)
@@ -837,6 +837,40 @@ static int fusefile_write(const char *path, const char *buf, size_t size,
     return size;
 }
 
+#define PUSHBUF 104857600
+/**
+ * Write data from overlay to source.
+ */
+static void push_oly(off_t beg, off_t end) {
+    static char * buffer = 0;
+    // Pretend that there isn't an overlay
+    char *filename = overlay.source.filename;
+    if ( buffer == 0 ) {
+       buffer = malloc( PUSHBUF );
+       if ( buffer == 0 ) {
+           fprintf( stderr, "** OOM!!\n" );
+           exit( 1 );
+       }
+    }
+    overlay.source.filename = 0;
+    while ( beg < end ) {
+       off_t size = end - beg;
+       if ( size > PUSHBUF ) {
+           size = PUSHBUF;
+       }
+       if ( lseek( overlay.source.fd, beg, SEEK_SET ) < 0 ) {
+           fprintf( stderr, "** Cannot seek overlay at %ld\n", beg );
+           break;
+       }
+       size = read( overlay.source.fd, buffer, size );
+       if ( write_block( beg, buffer, size ) < 0 ) {
+           fprintf( stderr, "** Cannot push %ld bytes at %ld\n", size, beg );
+       }
+       beg += size;
+    }
+    overlay.source.filename = filename;
+}
+
 static void fusefile_destroy(void *data) {
     char *mnt = (char*) data; // As passed to fuse_main
 #if DEBUG
@@ -922,7 +956,7 @@ void *fusefile_init(struct fuse_conn_info *fci) {
 /**
  * Dump the current fragmentation to stdout.
  */
-static int dump_fragments() {
+static int dump_fragments(int push) {
     int oly = 0;
     int src = 0;
     size_t pos = 0;
@@ -932,25 +966,33 @@ static int dump_fragments() {
        for ( ; src < sources.count && 
                  ENDSOURCE( sources.array[ src ] ) <= x; src++ ) {
            // Dump sources.array[src] in full
-           fprintf( stdout, "%s/%ld:%ld\n",
-                    sources.array[ src ].filename,
-                    pos - sources.array[ src ].start,
-                    sources.array[ src ].to );
+           if ( !push ) {
+               fprintf( stdout, "%s/%ld:%ld\n",
+                        sources.array[ src ].filename,
+                        pos - sources.array[ src ].start,
+                        sources.array[ src ].to );
+           }
            pos = ENDSOURCE( sources.array[ src ] );
        }
        if ( ( src < sources.count ) && ( sources.array[ src ].start < x ) ) {
            // Dump sources.array[src] up to x;
-           fprintf( stdout, "%s/%ld:%ld\n",
-                    sources.array[ src ].filename,
-                    pos - sources.array[ src ].start,
-                    x - sources.array[ src ].start );
+           if ( !push ) {
+               fprintf( stdout, "%s/%ld:%ld\n",
+                        sources.array[ src ].filename,
+                        pos - sources.array[ src ].start,
+                        x - sources.array[ src ].start );
+           }
            pos = ENDSOURCE( sources.array[ src ] );
        }
        if ( oly < overlay.count ) {
-           fprintf( stdout, "%s/%ld:%ld\n",
-                    overlay.source.filename,
-                    overlay.table[ oly ].beg,
-                    overlay.table[ oly ].end );
+           if ( !push ) {
+               fprintf( stdout, "%s/%ld:%ld\n",
+                        overlay.source.filename,
+                        overlay.table[ oly ].beg,
+                        overlay.table[ oly ].end );
+           } else {
+               push_oly( overlay.table[ oly ].beg, overlay.table[ oly ].end );
+           }
            pos = overlay.table[ oly++ ].end;
        }
        for ( ; src < sources.count &&
@@ -1092,7 +1134,10 @@ int main(int argc, char *argv[])
     }
     fuseargc = setup_argv( fuseargc, &argv );
     if ( strcmp( "-dump", argv[ 1 ] ) == 0 ) {
-       return dump_fragments();
+       return dump_fragments( 0 );
+    }
+    if ( strcmp( "-push", argv[ 1 ] ) == 0 ) {
+       return dump_fragments( 1 );
     }
     struct fuse_args args = FUSE_ARGS_INIT( fuseargc, argv );
     if ( fuse_parse_cmdline( &args, &mnt, &mt, &fg ) ) {