search for: tmpdisk_close

Displaying 6 results from an estimated 6 matches for "tmpdisk_close".

2020 Apr 09
0
[PATCH nbdkit v2 3/3] tmpdisk: Implement this plugin using fileops.
.... */ - return h; + return fops; - error: - if (h) { - if (h->fd >= 0) { - close (h->fd); - unlink (disk); - } - free (h); - } + error3: + close (fd); + error2: + unlink (disk); + error1: + rmdir (dir); + error0: + free (fops); return NULL; } static void tmpdisk_close (void *handle) { - struct handle *h = handle; + struct fileops *fops = handle; - close (h->fd); - free (h); -} - -/* Read data from the file. */ -static int -tmpdisk_pread (void *handle, void *buf, - uint32_t count, uint64_t offset, - uint32_t flags) -{ - stru...
2020 Mar 16
1
[PATCH nbdkit] New tmpdisk plugin.
Unfinished (needs tests). This is my attempt to make a "remote tmpfs" plugin as outlined in this prior email: https://www.redhat.com/archives/libguestfs/2020-March/msg00134.html Although it would be possible to construct something a bit like this using existing plugins and filters (perhaps with some new features in those filters) I think it may be nicer to have a dedicated plugin for
2020 Mar 17
2
[PATCH nbdkit v2] New tmpdisk plugin.
..., so unlink the disk. + * This also ensures it is always cleaned up. + */ + unlink (disk); + + /* Return the handle. */ + return h; + + error: + if (h) { + if (h->fd >= 0) { + close (h->fd); + unlink (disk); + } + free (h); + } + return NULL; +} + +static void +tmpdisk_close (void *handle) +{ + struct handle *h = handle; + + close (h->fd); + free (h); +} + +/* Read data from the file. */ +static int +tmpdisk_pread (void *handle, void *buf, + uint32_t count, uint64_t offset, + uint32_t flags) +{ + struct handle *h = handle; + + while...
2020 Mar 17
0
Re: [PATCH nbdkit v2] New tmpdisk plugin.
...ack as zeroes. Is it worth also implementing .zero for this plugin, to take advantage of fallocate when flags permits zeroing by trimming, rather than having to always rely on nbdkit's emulation through .pwrite? > + > + .open = tmpdisk_open, > + .close = tmpdisk_close, > + .pread = tmpdisk_pread, > + .pwrite = tmpdisk_pwrite, > + .flush = tmpdisk_flush, > + .trim = tmpdisk_trim, > + > + .errno_is_preserved = 1, > +}; > + -- Eric Blake, Principal Software Engineer Red Hat, Inc....
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
2020 Apr 09
6
[PATCH nbdkit v2 0/3] Implement fileops.
Needs some work still, see in particular the commit message for patch 3. Rich.