search for: file_config_complete

Displaying 20 results from an estimated 37 matches for "file_config_complete".

2017 Nov 21
1
[nbdkit PATCH] file: Diagnose a missing file earlier
...@ -117,6 +117,7 @@ file_config (const char *key, const char *value) { if (strcmp (key, "file") == 0) { /* See FILENAMES AND PATHS in nbdkit-plugin(3). */ + free (filename); filename = nbdkit_absolute_path (value); if (!filename) return -1; @@ -147,6 +148,10 @@ file_config_complete (void) nbdkit_error ("you must supply the file=<FILENAME> parameter after the plugin name on the command line"); return -1; } + if (access (filename, F_OK) < 0) { + nbdkit_error ("access '%s': %m", filename); + return -1; + } return 0;...
2018 Aug 02
2
Re: [PATCH 1/3] file: Avoid unsupported fallocate() calls
...If we can punch hole and may trim, try PUNCH_HOLE > 2. If we can zero range, try ZERO_RANGE > 3. Fall back to manual writing > > - trim changed to: > 1. If we can punch hole, try PUNCH_HOLE > 2. Succeed Seems reasonable from the description. > @@ -118,6 +119,8 @@ file_config_complete (void) > /* The per-connection handle. */ > struct handle { > int fd; > + bool can_punch_hole; > + bool can_zero_range; Would it be better to make these tri-state rather than merely bool? (Indeterminate, supported, known to fail) > }; > > /* Create the pe...
2018 Aug 02
10
[PATCH 0/3] file: Zero for block devices and older file systems
This is the second version to support efficient zero for block devices on older kernels (e.g. RHEL 7.5), and file systems that do not support yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2). Changes since v1: - Split to smaller patches - Skip linux only includes on other systems - Skip code using BLKZEROOUT if the macro is not defined - Try BLKZEROOUT only if the offset and count are aligned to device
2018 Aug 19
9
[PATCH v3 0/4] file: Zero for block devices and older file systems
This version addresses comments on v3. Changes since v3: - Finally got spacing right (Eric) - Reorder includes (Richard) - Return 0 or -1 instead of r (Richard) - Add common/include/isaligned.h to Makefile.am (Richard) v3 was here: https://www.redhat.com/archives/libguestfs/2018-August/msg00177.html Nir Soffer (4): file: Avoid unsupported fallocate() calls file: Support zero without
2020 Aug 25
0
[RFC nbdkit PATCH 4/5] file: Utilize nbdkit_string_intern
...} @@ -812,7 +805,6 @@ static struct nbdkit_plugin plugin = { .name = "file", .longname = "nbdkit file plugin", .version = PACKAGE_VERSION, - .unload = file_unload, .config = file_config, .config_complete = file_config_complete, .config_help = file_config_help, -- 2.28.0
2018 Aug 03
0
[PATCH v2 1/4] file: Avoid unsupported fallocate() calls
...lugins/file/file.c b/plugins/file/file.c index 3bb4d17..5daab63 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -33,6 +33,7 @@ #include <config.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -118,6 +119,8 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool can_punch_hole; + bool can_zero_range; }; /* Create the per-connection handle. */ @@ -146,6 +149,18 @@ file_open (int readonly) return NULL; } +#ifdef FALLOC_FL_PUNCH_HOLE + h->can_punch_hole = true; +#e...
2018 Aug 18
0
[PATCH v3 1/4] file: Avoid unsupported fallocate() calls
...lugins/file/file.c b/plugins/file/file.c index 3bb4d17..5daab63 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -33,6 +33,7 @@ #include <config.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -118,6 +119,8 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool can_punch_hole; + bool can_zero_range; }; /* Create the per-connection handle. */ @@ -146,6 +149,18 @@ file_open (int readonly) return NULL; } +#ifdef FALLOC_FL_PUNCH_HOLE + h->can_punch_hole = true; +#e...
2018 Aug 19
0
[PATCH v4 1/4] file: Avoid unsupported fallocate() calls
...gins/file/file.c index 3bb4d17..72f51a4 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -35,6 +35,7 @@ #include <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <string.h> #include <fcntl.h> #include <unistd.h> @@ -118,6 +119,8 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool can_punch_hole; + bool can_zero_range; }; /* Create the per-connection handle. */ @@ -146,6 +149,18 @@ file_open (int readonly) return NULL; } +#ifdef FALLOC_FL_PUNCH_HOLE + h->can_punch_hole = true; +#e...
2020 Aug 07
0
[nbdkit PATCH 2/4] file: Add .list_exports support
...= 0) { nbdkit_error ("add --filter=delay on the command line"); @@ -111,13 +124,19 @@ file_config (const char *key, const char *value) return 0; } -/* Check the user did pass a file=<FILENAME> parameter. */ +/* Check the user did pass exactly one parameter. */ static int file_config_complete (void) { - if (filename == NULL) { - nbdkit_error ("you must supply the file=<FILENAME> parameter " - "after the plugin name on the command line"); + if (!filename == !directory) { + nbdkit_error ("you must supply exactly one file=<FILENAM...
2018 Aug 02
0
[PATCH 3/3] file: Zero for block devices on old kernels
...ugins/file/file.c @@ -45,6 +45,7 @@ #if defined(__linux__) && !defined(FALLOC_FL_PUNCH_HOLE) #include <linux/falloc.h> /* For FALLOC_FL_*, glibc < 2.18 */ +#include <linux/fs.h> /* For BLKZEROOUT */ #endif #include <nbdkit-plugin.h> @@ -119,16 +120,25 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool is_block_device; + int sector_size; bool can_punch_hole; bool can_zero_range; bool can_fallocate; }; +static bool +is_aligned(struct handle *h, uint64_t n) +{ + return n % h->sector_size == 0; +} + /* Cre...
2018 Aug 02
0
[PATCH 1/3] file: Avoid unsupported fallocate() calls
...lugins/file/file.c b/plugins/file/file.c index 3bb4d17..8bb9a2d 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -33,6 +33,7 @@ #include <config.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -118,6 +119,8 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool can_punch_hole; + bool can_zero_range; }; /* Create the per-connection handle. */ @@ -146,6 +149,18 @@ file_open (int readonly) return NULL; } +#ifdef FALLOC_FL_PUNCH_HOLE + h->can_punch_hole = true; +#e...
2018 Aug 19
0
[PATCH v4 4/4] file: Zero for block devices on old kernels
...inux/falloc.h> /* For FALLOC_FL_*, glibc < 2.18 */ #endif +#if defined(__linux__) +#include <linux/fs.h> /* For BLKZEROOUT */ +#endif + #include <nbdkit-plugin.h> +#include "isaligned.h" + #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif @@ -119,9 +126,12 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool is_block_device; + int sector_size; bool can_punch_hole; bool can_zero_range; bool can_fallocate; + bool can_zeroout; }; /* Create the per-connection handle. */ @@ -129,6 +139,7 @@ static void * file_open (...
2018 Aug 03
0
[PATCH v2 4/4] file: Zero for block devices on old kernels
...inux/falloc.h> /* For FALLOC_FL_*, glibc < 2.18 */ #endif +#if defined(__linux__) +#include <linux/fs.h> /* For BLKZEROOUT */ +#endif + #include <nbdkit-plugin.h> +#include "isaligned.h" + #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif @@ -119,9 +126,12 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool is_block_device; + int sector_size; bool can_punch_hole; bool can_zero_range; bool can_fallocate; + bool can_zeroout; }; /* Create the per-connection handle. */ @@ -129,6 +139,7 @@ static void * file_open (...
2018 Aug 02
0
Re: [PATCH 1/3] file: Avoid unsupported fallocate() calls
...LE > > 2. If we can zero range, try ZERO_RANGE > > 3. Fall back to manual writing > > > > - trim changed to: > > 1. If we can punch hole, try PUNCH_HOLE > > 2. Succeed > > Seems reasonable from the description. > > > @@ -118,6 +119,8 @@ file_config_complete (void) > > /* The per-connection handle. */ > > struct handle { > > int fd; > > + bool can_punch_hole; > > + bool can_zero_range; > > Would it be better to make these tri-state rather than merely bool? > (Indeterminate, supported, known to fail) >...
2018 Aug 02
0
[PATCH] file: Zero support for block devices and NFS 4.2
...#include <string.h> @@ -42,6 +43,8 @@ #include <sys/stat.h> #include <errno.h> #include <linux/falloc.h> /* For FALLOC_FL_* on RHEL, glibc < 2.18 */ +#include <sys/ioctl.h> +#include <linux/fs.h> #include <nbdkit-plugin.h> @@ -116,6 +119,10 @@ file_config_complete (void) /* The per-connection handle. */ struct handle { int fd; + bool is_block_device; + bool can_punch_hole; + bool can_zero_range; + bool can_fallocate; }; /* Create the per-connection handle. */ @@ -123,6 +130,7 @@ static void * file_open (int readonly) { struct handle *h; +...
2018 Aug 18
7
[PATCH v3 0/4] file: Zero for block devices and older file systems
This version addresses some of the comments on v2. Changes since v2: - file_zero: Add missing space in function call - is_aligned: Assert that align is indeed a power of 2 - Spelling in commit message Not changed: - Eric commented that spacing was off: https://www.redhat.com/archives/libguestfs/2018-August/msg00113.html but I could not find anything wrong. - Eric asked if ioctl.h will cause
2018 Apr 12
4
[nbdkit PATCH v3 0/2] Add nbdkit_realpath
Hi, this is the v3 of my series for nbdkit_realpath; this series adds an extra documentation update to nbdkit_absolute_path, documenting when it can only be used, and then adds nbdkit_realpath. Thanks, Pino Toscano (2): docs: improve documentation of nbdkit_absolute_path plugin: add and use nbdkit_realpath docs/nbdkit-plugin.pod | 24 +++++++++++++++++++++++- include/nbdkit-common.h
2018 Feb 14
2
[nbdkit PATCH v2] plugin: add and use nbdkit_realpath
...r *key, const char *value) if (strcmp (key, "file") == 0) { /* See FILENAMES AND PATHS in nbdkit-plugin(3). */ free (filename); - filename = nbdkit_absolute_path (value); + filename = nbdkit_realpath (value); if (!filename) return -1; } @@ -90,10 +90,6 @@ file_config_complete (void) nbdkit_error ("you must supply the file=<FILENAME> parameter after the plugin name on the command line"); return -1; } - if (access (filename, F_OK) < 0) { - nbdkit_error ("access '%s': %m", filename); - return -1; - } return 0;...
2018 Feb 13
3
[nbdkit PATCH] plugin: add and use nbdkit_realpath
...r *key, const char *value) if (strcmp (key, "file") == 0) { /* See FILENAMES AND PATHS in nbdkit-plugin(3). */ free (filename); - filename = nbdkit_absolute_path (value); + filename = nbdkit_realpath (value); if (!filename) return -1; } @@ -90,10 +90,6 @@ file_config_complete (void) nbdkit_error ("you must supply the file=<FILENAME> parameter after the plugin name on the command line"); return -1; } - if (access (filename, F_OK) < 0) { - nbdkit_error ("access '%s': %m", filename); - return -1; - } return 0;...
2018 Aug 03
10
[PATCH v2 0/4] file: Zero for block devices and older file systems
This is the third version to support efficient zero for block devices on older kernels (e.g. RHEL 7.5), and file systems that do not support yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2). Changes since v2: - Revert file_can_trim change, since it is too late to change the value after negotiation. Changing the capability dinamically may be useful internally, but it should be done via other means. -