All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] flash_erase: use pwrite() rather than lseek() && write()
@ 2013-05-02 16:33 Mike Frysinger
  2013-05-29 12:36 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2013-05-02 16:33 UTC (permalink / raw)
  To: linux-mtd

Saves a syscall.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 flash_erase.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/flash_erase.c b/flash_erase.c
index 326a299..1421cf9 100644
--- a/flash_erase.c
+++ b/flash_erase.c
@@ -277,11 +277,7 @@ int main(int argc, char *argv[])
 				continue;
 			}
 		} else {
-			if (lseek(fd, offset, SEEK_SET) < 0) {
-				sys_errmsg("%s: MTD lseek failure", mtd_device);
-				continue;
-			}
-			if (write(fd, &cleanmarker, sizeof(cleanmarker)) != sizeof(cleanmarker)) {
+			if (pwrite(fd, &cleanmarker, sizeof(cleanmarker), (loff_t)offset) != sizeof(cleanmarker)) {
 				sys_errmsg("%s: MTD write failure", mtd_device);
 				continue;
 			}
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] flash_erase: use pwrite() rather than lseek() && write()
  2013-05-02 16:33 [PATCH] flash_erase: use pwrite() rather than lseek() && write() Mike Frysinger
@ 2013-05-29 12:36 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2013-05-29 12:36 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd

On Thu, 2013-05-02 at 12:33 -0400, Mike Frysinger wrote:
> Saves a syscall.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Pushed to mtd-utils.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-29 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-02 16:33 [PATCH] flash_erase: use pwrite() rather than lseek() && write() Mike Frysinger
2013-05-29 12:36 ` 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.