Displaying 6 results from an estimated 6 matches for "parse_mapfile".
2020 May 22
3
[PATCH nbdkit] ddrescue: Miscellaneous fixes.
A few fixes and a possible enhancement to the ddrescue filter.  If you
think these are all OK, I will squash it into your patch and push it.
Rich.
2020 May 22
0
[PATCH nbdkit] DDRESCUE: MISC FIXES
...1,14 @@ struct range {
   int64_t size;
   char status;
 };
+DEFINE_VECTOR_TYPE(ranges, struct range);
 
 struct mapfile {
   int ranges_count;
-  struct range *ranges;
+  ranges ranges;
 };
 
-static struct mapfile map = { 0, NULL };
+static struct mapfile map = { 0, empty_vector };
 
 static int
 parse_mapfile (const char *filename)
@@ -75,8 +77,6 @@ parse_mapfile (const char *filename)
   }
 
   while ((len = getline (&line, &linelen, fp)) != -1) {
-    const char *delim = " \t";
-    char *sp, *p;
     int64_t offset, length;
     char status;
 
@@ -95,7 +95,8 @@ parse_mapfile (const...
2020 May 22
1
Re: [PATCH nbdkit] DDRESCUE: MISC FIXES
On 5/22/20 2:53 PM, Richard W.M. Jones wrote:
> Use vector type to store map ranges.
> 
> Test filenames unique.
> 
> Remove some unused variables.
> 
> Break up long lines.
> ---
> @@ -95,7 +95,8 @@ parse_mapfile (const char *filename)
>         continue;
>       }
>   
> -    if (sscanf (line, "%" SCNi64 "\t%" SCNi64 "\t%c", &offset, &length, &status) == 3) {
> +    if (sscanf (line, "%" SCNi64 "\t%" SCNi64 "\t%c",
>...
2020 May 01
1
[PATCH] WIP: ddrescue mapfile filter
...hread.h>
+
+#include <nbdkit-filter.h>
+
+#include "cleanup.h"
+
+struct range {
+  int64_t start;
+  int64_t end;
+  int64_t size;
+  char status;
+};
+
+struct mapfile {
+  int ranges_count;
+  struct range *ranges;
+};
+
+static struct mapfile map = { 0, NULL };
+
+static int
+parse_mapfile (const char *filename)
+{
+  FILE *fp = NULL;
+  CLEANUP_FREE char *line = NULL;
+  size_t linelen = 0;
+  ssize_t len;
+  int ret = -1;
+  int status_seen = 0;
+
+  fp = fopen (filename, "r");
+  if (!fp) {
+    nbdkit_error ("%s: ddrescue: fopen: %m", filename);
+    goto out;...
2020 May 22
0
[PATCH] [v3] ddrescue mapfile filter
...hread.h>
+
+#include <nbdkit-filter.h>
+
+#include "cleanup.h"
+
+struct range {
+  int64_t start;
+  int64_t end;
+  int64_t size;
+  char status;
+};
+
+struct mapfile {
+  int ranges_count;
+  struct range *ranges;
+};
+
+static struct mapfile map = { 0, NULL };
+
+static int
+parse_mapfile (const char *filename)
+{
+  FILE *fp = NULL;
+  CLEANUP_FREE char *line = NULL;
+  size_t linelen = 0;
+  ssize_t len;
+  int ret = -1;
+  int status_seen = 0;
+
+  fp = fopen (filename, "r");
+  if (!fp) {
+    nbdkit_error ("%s: ddrescue: fopen: %m", filename);
+    goto out;...
2020 May 01
4
[PATCH] [v2] WIP: ddrescue mapfile filter
...hread.h>
+
+#include <nbdkit-filter.h>
+
+#include "cleanup.h"
+
+struct range {
+  int64_t start;
+  int64_t end;
+  int64_t size;
+  char status;
+};
+
+struct mapfile {
+  int ranges_count;
+  struct range *ranges;
+};
+
+static struct mapfile map = { 0, NULL };
+
+static int
+parse_mapfile (const char *filename)
+{
+  FILE *fp = NULL;
+  CLEANUP_FREE char *line = NULL;
+  size_t linelen = 0;
+  ssize_t len;
+  int ret = -1;
+  int status_seen = 0;
+
+  fp = fopen (filename, "r");
+  if (!fp) {
+    nbdkit_error ("%s: ddrescue: fopen: %m", filename);
+    goto out;...