[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH] dd: support skip and seek values greater than 2G on android
From: Tanguy Pruvot <tanguy.pruvot () gmail ! com>
Date: 2012-07-30 18:53:23
Message-ID: 357381493.20120730205323 () gmail ! com
[Download RAW message or body]
http://review.cyanogenmod.com/20215
it could be useful to keep a bs=1 to get exact positions.
bionic fail to use the CONFIG_LFS flag to support large offsets,
this workaround fix the function on /dev/mem or /dev/kmem inputs
required to dump part of kernel code or memory like :
busybox dd bs=1 count=156 skip=$((0xC0035EF0)) if=/dev/kmem of=/tmp/func.dump
Post-Joint : 0001-dd-support-skip-and-seek-values-greater-than-2G-on-a.patch.
["0001-dd-support-skip-and-seek-values-greater-than-2G-on-a.patch" (application/octet-stream)]
From 6a025ba7107abe0c46a29c023ea54262c0dda26a Mon Sep 17 00:00:00 2001
From: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Date: Fri, 27 Jul 2012 02:01:00 +0200
Subject: [PATCH] dd: support skip and seek values greater than 2G on android
it could be useful to keep a bs=1 to get exact positions.
bionic fail to use the CONFIG_LFS flag to support large offsets,
this workaround fix the function on /dev/mem or /dev/kmem inputs
Change-Id: I7fc951b001f065e02254037da2a1e61520e20282
---
coreutils/dd.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 96602eb..bce98c4 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -208,7 +208,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
int flags;
size_t oc;
off_t count;
- off_t seek, skip;
+ uoff_t seek, skip;
const char *infile, *outfile;
} Z;
#define flags (Z.flags )
@@ -344,6 +344,20 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
} else {
outfile = bb_msg_standard_output;
}
+#if (!ENABLE_LFS) && defined(ANDROID)
+ if (skip) {
+ if (lseek64(ifd, skip * ibs, SEEK_SET) == (off64_t) -1)
+ fprintf(stderr, "warning: skip lseek64 failed\n");
+ else
+ skip = 0;
+ }
+ if (seek) {
+ if (lseek64(ifd, seek * obs, SEEK_SET) == (off64_t) -1)
+ fprintf(stderr, "warning: seek lseek64 failed\n");
+ else
+ seek = 0;
+ }
+#endif
if (skip) {
if (lseek(ifd, skip * ibs, SEEK_CUR) < 0) {
while (skip-- > 0) {
--
1.7.10
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic