Le 28/09/2012 12:39, Carsten Haitzler (The Rasterman) a écrit :
> you're waiting for vincent to commit patches? what patches? where? by who?
> doing what? you planned to do something ... but never mention you did it.
> planning and doing are very different things. you didn't say that the patches
> you sent fix this. sorry but your mails are incredibly far from being clear on
> the topic. your first reply to me definitely is not. and then its "revert
> changes" which of course i refused as it'd make the code worse.
>
> could you please actually be clear before resorting to swearing and asking for
> reverts?
You're not doing (overwrite_count) passes,
but (overwrite_count*NB_PASS). You cannot
cancel operation and see progression.
Here is a patch.
$ svn update -r77020 e_fm_op.c
And then patch.
So we are doing the same thing (I mean, in
a loop), but correctly. (and ...random_buf()
never returns -1, so -> void).
Discomfitor asked me to improve e_fm_op.c,
and I started by adding this little feature.
It's just that it make me angry when I'm in
charge of something which is modified by others
without asking anything. Then I loose my time to
write mails, as if I had only that to do.
--- e_fm_op.c 2012-09-28 17:01:30.375484254 +0200
+++ e_fm_op.c 2012-09-28 17:14:05.047492064 +0200
@@ -105,7 +105,7 @@
static int _e_fm_op_remove_atom(E_Fm_Op_Task *task);
static int _e_fm_op_rename_atom(E_Fm_Op_Task *task);
static int _e_fm_op_destroy_atom(E_Fm_Op_Task *task);
-static int _e_fm_op_random_buf(char *buf, ssize_t len);
+static void _e_fm_op_random_buf(char *buf, ssize_t len);
static char _e_fm_op_random_char();
Ecore_Fd_Handler *_e_fm_op_stdin_handler = NULL;
@@ -1679,6 +1679,9 @@
if (_e_fm_op_abort) goto finish;
static int fd = -1;
static char *buf = NULL;
+ static int passes = 0;
+ static off_t pos = 0;
+ off_t sz;
if (fd == -1)
{
@@ -1702,27 +1705,39 @@
!S_ISREG(st2.st_mode))
goto finish;
- if ((buf = malloc(st2.st_size)) == NULL)
+ if ((buf = malloc(READBUFSIZE)) == NULL)
goto finish;
task->src.st.st_size = st2.st_size;
}
- if (lseek(fd, SEEK_SET, 0) == -1)
- goto finish;
+ if (pos + READBUFSIZE > task->src.st.st_size) sz = task->src.st.st_size - pos;
+ else sz = READBUFSIZE;
- if (_e_fm_op_random_buf(buf, task->src.st.st_size) == -1)
- memset(buf, 0xFF, task->src.st.st_size);
- if (write(fd, buf, task->src.st.st_size) != task->src.st.st_size)
+ _e_fm_op_random_buf(buf, sz);
+ if (write(fd, buf, sz) != sz)
goto finish;
if (fsync(fd) == -1)
goto finish;
- task->dst.done++;
- _e_fm_op_update_progress_report_simple((double)task->dst.done/NB_PASS*100, "/dev/urandom", task->src.name);
+ pos += sz;
- if (task->dst.done == NB_PASS)
- goto finish;
+ _e_fm_op_update_progress_report_simple((double) (pos + (passes * task->src.st.st_size)) /
+ (task->src.st.st_size * NB_PASS) * 100,
+ "/dev/urandom", task->src.name);
+
+ if (pos >= task->src.st.st_size)
+ {
+ passes++;
+
+ if (passes == NB_PASS)
+ goto finish;
+ if (lseek(fd, SEEK_SET, 0) == -1)
+ goto finish;
+
+ pos = 0;
+ return 1;
+ }
return 1;
@@ -1730,11 +1745,13 @@
close(fd);
fd = -1;
E_FREE(buf);
+ passes = 0;
+ pos = 0;
task->finished = 1;
return 1;
}
-static int
+static void
_e_fm_op_random_buf(char *buf, ssize_t len)
{
int f = -1;
@@ -1746,7 +1763,7 @@
{
buf[i] = _e_fm_op_random_char();
}
- return 0;
+ return;
}
if (read(f, buf, len) != len)
@@ -1758,7 +1775,7 @@
}
close(f);
- return 0;
+ return;
}
static char
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel