public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Question on disk_bwrite and disk_bread
@ 2009-07-28  7:32 Lecordier, Guy
  2009-07-29  9:42 ` Lecordier, Guy
  0 siblings, 1 reply; 2+ messages in thread
From: Lecordier, Guy @ 2009-07-28  7:32 UTC (permalink / raw)
  To: ecos-discuss

Hello all,

I am having troubles in the disk_bwrite() and disk_bread() of disk.c (ecos3.0).

When (funs->write) or (funs->read) return an error the program goes to "done" and  disk_bwrite() or disk_bread() exit with the ctlr->busy = true;
At the next call of disk_bwrite() and disk_bread(), these functions block indefinitely at while( ctlr->busy ).
My question is how busy goes to false when the low level routine returns an error?

Thanks a lot,

Guy


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* RE: [ECOS] Question on disk_bwrite and disk_bread
  2009-07-28  7:32 [ECOS] Question on disk_bwrite and disk_bread Lecordier, Guy
@ 2009-07-29  9:42 ` Lecordier, Guy
  0 siblings, 0 replies; 2+ messages in thread
From: Lecordier, Guy @ 2009-07-29  9:42 UTC (permalink / raw)
  To: ecos-discuss


Looking the code of disk_bread() and disk_bwrite() I see one difference
in a similar test:
In disk_bread()
            if (pos > last)
            {
                res = -EIO;
                break;
            }
In disk_bwrite()
            if (pos > last)
            {
                res = -EIO;
                goto done;
            }

The break leaves the while loop and then ctlr->busy = false;
It is what I want when the (funs->read) or (funs->write) return en
error.
So in disk_bread() & disk_bwrite() I replaced all the "goto done;" by
"break;"
So now the thread is not blocked and I am able to launch again a read or
write operation.

@@ -561,12 +561,12 @@
             cyg_drv_dsr_unlock();
             
             if (ENOERR != res)
-                goto done;
+                break;
 
             if (!info->connected)
             {
                 res = -EINVAL;
-                goto done;
+                break;
             }
 
             bbuf        += tfr * info->block_size;
@@ -637,7 +637,7 @@
             if (pos > last)
             {
                 res = -EIO;
-                goto done;
+                break;
             }
 
             if( tfr > info->ident.max_transfer )
@@ -665,12 +665,12 @@
             cyg_drv_dsr_unlock();
             
             if (ENOERR != res)
-                goto done;
+                break;
  
             if (!info->connected)
             {
                 res = -EINVAL;
-                goto done;
+                break;
             }
 
             bbuf        += tfr * info->block_size;

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

end of thread, other threads:[~2009-07-29  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-28  7:32 [ECOS] Question on disk_bwrite and disk_bread Lecordier, Guy
2009-07-29  9:42 ` Lecordier, Guy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).