* [RFC] ubi: updatevol: Support volume to volume update
@ 2014-07-16 16:19 Ezequiel Garcia
2014-07-17 5:34 ` Artem Bityutskiy
0 siblings, 1 reply; 2+ messages in thread
From: Ezequiel Garcia @ 2014-07-16 16:19 UTC (permalink / raw)
To: linux-mtd
Cc: Brian Norris, Ezequiel Garcia, Guido Martínez, Artem Bityutskiy
This commit adds the support for ubiupdatevol to recieve a UBI volume
as the second parameter. This could be useful to update a UBI volume,
from another UBI volume present in the system, for instance when
a redundant scheme is used.
Not-yet-signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
Hello,
I'm submitting this patch, to discuss about its inclusion.
If the idea is acceptable we should fix the parameter documentation,
and maybe cleanup the implementation a bit.
One thing to consider, is that this volume to volume update feature
could be moved to the kernel (through yet another ioctl). However,
I think there's no advantage over this simpler approach.
ubi-utils/ubiupdatevol.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/ubi-utils/ubiupdatevol.c b/ubi-utils/ubiupdatevol.c
index 5096791..6b30210 100644
--- a/ubi-utils/ubiupdatevol.c
+++ b/ubi-utils/ubiupdatevol.c
@@ -212,7 +212,24 @@ static int update_volume(libubi_t libubi, struct ubi_vol_info *vol_info)
goto out_free;
}
- bytes = st.st_size - args.skip;
+ /* If the argument is a character device and a UBI volume
+ * we update from it. In this case, skip and size parameters
+ * are not used.
+ */
+ if (S_ISCHR(st.st_mode) &&
+ ubi_probe_node(libubi, args.img) == 2) {
+
+ struct ubi_vol_info src_vol_info;
+
+ err = ubi_get_vol_info(libubi, args.img, &src_vol_info);
+ if (!err)
+ bytes = src_vol_info.data_bytes;
+ else
+ bytes = 0;
+ } else {
+
+ bytes = st.st_size - args.skip;
+ }
} else
bytes = args.size;
--
2.0.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC] ubi: updatevol: Support volume to volume update
2014-07-16 16:19 [RFC] ubi: updatevol: Support volume to volume update Ezequiel Garcia
@ 2014-07-17 5:34 ` Artem Bityutskiy
0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2014-07-17 5:34 UTC (permalink / raw)
To: Ezequiel Garcia; +Cc: Brian Norris, linux-mtd, Guido Martínez
On Wed, 2014-07-16 at 13:19 -0300, Ezequiel Garcia wrote:
> This commit adds the support for ubiupdatevol to recieve a UBI volume
> as the second parameter. This could be useful to update a UBI volume,
> from another UBI volume present in the system, for instance when
> a redundant scheme is used.
No objections to adding such functionality.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-17 5:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-16 16:19 [RFC] ubi: updatevol: Support volume to volume update Ezequiel Garcia
2014-07-17 5:34 ` Artem Bityutskiy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.