changeset 1861:9e96c8c52574 draft

some fix in fileread
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Mon, 23 Dec 2013 16:54:13 +0900
parents d250caefe0ff
children 64c571a30bdb
files example/fileread/main.cc example/fileread/ppe/Read.cc
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/example/fileread/main.cc	Mon Dec 23 15:29:11 2013 +0900
+++ b/example/fileread/main.cc	Mon Dec 23 16:54:13 2013 +0900
@@ -20,7 +20,7 @@
                             -cpu    Number of SPE (default 1) \n\
                             -file   Opne file\n";
 typedef struct fileread {
-   struct filesize *self;
+   struct fileread *self;
    long fd;
    long division_size;
    long task_number;
@@ -121,6 +121,7 @@
 
     FilereadPtr fr = (FilereadPtr)manager->allocate(sizeof(Fileread));
 
+    fr->self = fr;
     fr->fd = fd;
     fr->cpu = spe_cpu;
     fr->task_blocks = 16;
--- a/example/fileread/ppe/Read.cc	Mon Dec 23 15:29:11 2013 +0900
+++ b/example/fileread/ppe/Read.cc	Mon Dec 23 16:54:13 2013 +0900
@@ -22,12 +22,10 @@
     long fd = (long)s->get_param(3);
 
     char text[(long)read_size];
-    text[(long)read_size + 1] = '\0';
-
-    //lseek(*fd, division_size* task_number,SEEK_SET);   //lseekでどこから読み込むのか指定
-    //read(*fd,text,(long)read_size);
+    text[(long)read_size] = '\0';
 
     pread(fd, text, (long)read_size , division_size*task_number);
+
     s->printf("[start task No. %d]\n",task_number);
     s->printf("%s\n",text);