search for: tmpdisk_load

Displaying 8 results from an estimated 8 matches for "tmpdisk_load".

2020 Apr 04
4
[PATCH nbdkit 0/2] Generalize the tmpdisk plugin.
Patch 1/2 is uncontroversial. Patch 2/2 is an interesting idea I had to generalize this plugin. It already uses a complete embedded shell script to do most of the work. What if, instead of making special cases for "type" and "label" params, we simply turn any other plugin parameters into script variables? This part of it works fine. However there is another problem which is
2020 Apr 04
0
[PATCH nbdkit 2/2] tmpdisk: Pass any parameters as shell variables to the command.
...-1; -static const char *label = NULL; -static const char *type = "ext4"; + +/* Shell variables. */ +static struct var { + struct var *next; + const char *key, *value; +} *vars; /* This comes from default-command.c which is generated from * default-command.sh.in. @@ -70,29 +74,49 @@ tmpdisk_load (void) tmpdir = s; } +static void +tmpdisk_unload (void) +{ + struct var *v, *v_next; + + for (v = vars; v != NULL; v = v_next) { + v_next = v->next; + free (v); + } +} + static int tmpdisk_config (const char *key, const char *value) { if (strcmp (key, "command")...
2020 Apr 07
0
[PATCH nbdkit v2] tmpdisk: Pass any parameters as shell variables to the command.
...ot;; +static int64_t requested_size = -1; /* size parameter on the command line */ + +/* Shell variables. */ +static struct var { + struct var *next; + const char *key, *value; +} *vars; /* This comes from default-command.c which is generated from * default-command.sh.in. @@ -70,29 +75,49 @@ tmpdisk_load (void) tmpdir = s; } +static void +tmpdisk_unload (void) +{ + struct var *v, *v_next; + + for (v = vars; v != NULL; v = v_next) { + v_next = v->next; + free (v); + } +} + static int tmpdisk_config (const char *key, const char *value) { if (strcmp (key, "command")...
2020 Apr 04
0
[PATCH nbdkit 1/2] tmpdisk: Generate the default command from a shell script fragment.
...t;\n" - "else\n" - " mkfs -t \"$type\" $extra $labelopt \"$label\" \"$disk\"\n" - "fi\n"; +/* This comes from default-command.c which is generated from + * default-command.sh.in. + */ +extern const char *command; static void tmpdisk_load (void) diff --git a/plugins/tmpdisk/default-command.sh.in b/plugins/tmpdisk/default-command.sh.in new file mode 100644 index 00000000..251e0b7b --- /dev/null +++ b/plugins/tmpdisk/default-command.sh.in @@ -0,0 +1,51 @@ +# nbdkit +# -*- mode: shell-script -*- +# Copyright (C) 2017-2020 Red Hat Inc....
2020 Apr 08
0
[PATCH nbdkit v3] tmpdisk: Pass any parameters as shell variables to the command.
...c int64_t requested_size = -1; /* size parameter on the command line */ + +/* Shell variables. */ +static struct var { + struct var *next; + const char *key, *value; +} *vars, *last_var; /* This comes from default-command.c which is generated from * default-command.sh.in. @@ -70,29 +76,61 @@ tmpdisk_load (void) tmpdir = s; } +static void +tmpdisk_unload (void) +{ + struct var *v, *v_next; + + for (v = vars; v != NULL; v = v_next) { + v_next = v->next; + free (v); + } +} + static int tmpdisk_config (const char *key, const char *value) { if (strcmp (key, "command")...
2020 Apr 08
2
[PATCH nbdkit v3] tmpdisk: Generalize the tmpdisk plugin.
v2 was here: https://www.redhat.com/archives/libguestfs/2020-April/msg00075.html In v3: - Add [VAR=VALUE ...] to manual. - Various minor improvements to the manual. - Work (at least, in theory - not tested) with block devices or symlinks. I didn't document this because it's hard to ensure these files or block devices would be cleaned up, so here be dragons. - Remove O_NOCTTY. -
2020 Apr 07
2
[PATCH nbdkit v2] tmpdisk: Generalize the tmpdisk plugin
An evolution of v1 here: https://www.redhat.com/archives/libguestfs/2020-April/msg00035.html I want to generalize the tmpdisk plugin, particularly so you can use commands like ‘qemu-img create’ or even ‘virt-builder’. (Actually virt-builder really works - I tested it - but of course it causes a 30+ second delay when connecting to the server.) You can now use commands such as: nbdkit tmpdisk
2020 Mar 17
2
[PATCH nbdkit v3] New tmpdisk plugin.
v2 was here: https://www.redhat.com/archives/libguestfs/2020-March/msg00154.html v3: - Micro-optimize tmpdir. - Quote $disk in default command shell fragment. - Don't redirect mkfs output to /dev/null. Instead use exec </dev/null >/dev/null before the shell fragment. We may want to do this in other places where we run external shell scripts, or more generally for all