[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 6/7] qmp: add pmemload command
From: |
Simon Ruderich |
Subject: |
Re: [Qemu-devel] [PATCH v4 6/7] qmp: add pmemload command |
Date: |
Fri, 17 Aug 2018 09:50:29 +0200 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Thu, Aug 16, 2018 at 03:01:31PM -0500, Eric Blake wrote:
>> + }
>> + if (!has_size) {
>> + struct stat s;
>> + if (fstat(fd, &s)) {
>> + error_setg_errno(errp, errno, "could not fstat fd to get size");
>> + goto exit;
>> + }
>> + size = s.st_size;
>> + }
>
> This works for regular files, but not for block devices.
>
> Do we have a helper function for easily determining the size of an arbitrary
> fd (whether file or block device)? If not, should we? As there are
> multiple spots in the code that grab this sort of information.
I found raw_getlength() in block/file-posix.c, but its static and
it takes a BlockDriverState* as argument. For most systems it
could be extracted without too much trouble, but some (e.g
__sun__ and BSD) are quite entangled with BlockDriverState code.
> Otherwise looks okay to me.
Should I check for S_ISCHR() and S_ISBLK() and abort with an
error? I don't think it's a common use case for pmemload anyway.
Regards
Simon
--
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
signature.asc
Description: PGP signature
- [Qemu-devel] [PATCH v4 5/7] hmp: use F for filename arguments in memsave/pmemsave, (continued)
- [Qemu-devel] [PATCH v4 5/7] hmp: use F for filename arguments in memsave/pmemsave, Simon Ruderich, 2018/08/16
- [Qemu-devel] [PATCH v4 4/7] hmp: use l for size argument in memsave/pmemsave, Simon Ruderich, 2018/08/16
- [Qemu-devel] [PATCH v4 2/7] cpus: convert qmp_memsave/qmp_pmemsave to use qemu_open, Simon Ruderich, 2018/08/16
- [Qemu-devel] [PATCH v4 7/7] hmp: add pmemload command, Simon Ruderich, 2018/08/16
- [Qemu-devel] [PATCH v4 6/7] qmp: add pmemload command, Simon Ruderich, 2018/08/16
- [Qemu-devel] [PATCH v4 3/7] cpus: use size_t in qmp_memsave/qmp_pmemsave, Simon Ruderich, 2018/08/16
- [Qemu-devel] [PATCH v4 1/7] cpus: correct coding style in qmp_memsave/qmp_pmemsave, Simon Ruderich, 2018/08/16