qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/7] vnvram: VNVRAM bdrv support


From: Corey Bryant
Subject: Re: [Qemu-devel] [PATCH 1/7] vnvram: VNVRAM bdrv support
Date: Fri, 24 May 2013 11:47:28 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6



On 05/24/2013 11:37 AM, Kevin Wolf wrote:
Am 24.05.2013 um 17:33 hat Corey Bryant geschrieben:


On 05/24/2013 09:06 AM, Kevin Wolf wrote:
Am 23.05.2013 um 19:44 hat Corey Bryant geschrieben:
Provides low-level VNVRAM functionality that reads and writes data,
such as an entry's binary blob, to a drive image using the block
driver.

Signed-off-by: Corey Bryant <address@hidden>

+/*
+ * Increase the drive size if it's too small to fit the VNVRAM data
+ */
+static int vnvram_drv_adjust_size(VNVRAM *vnvram)
+{
+    int rc = 0;
+    int64_t needed_size;
+
+    needed_size = 0;
+
+    if (bdrv_getlength(vnvram->bds) < needed_size) {
+        rc = bdrv_truncate(vnvram->bds, needed_size);
+        if (rc != 0) {
+            DPRINTF("%s: VNVRAM drive too small\n", __func__);
+        }
+    }
+
+    return rc;
+}

This function doesn't make a whole lot of sense. It truncates the file
to size 0 if and only if bdrv_getlength() returns an error.


There's a later patch that adds a "get size" function and changes
the initialization of needed_size to the actual size needed to store
VNVRAM data.  Anyway I should probably just include that change in
this patch.  I think I'll still need this function or part of it
with the new simplified approach that it looks like we're going to
take.

Okay. But even then, do you really want to truncate on errors?

Kevin




True, it'll need something to account for bdrv_getlength() failures and not truncate in that case.

--
Regards,
Corey Bryant




reply via email to

[Prev in Thread] Current Thread [Next in Thread]