reading file hangs rtems

Eugeny S. Mints emints at
Tue Aug 2 09:17:43 UTC 2005

Philippe Simons wrote:
> Ok, iv found the problem with my mmc block driver.
> well for now, the driver is read-only (didnt implemented the write fct
> yet)
> so here is my smc_ioctl...
> static int
> smc_ioctl(dev_t dev, uint32_t req, void *argp)
> {
>     switch (req)
>     {
>         case BLKIO_REQUEST:
>         {
>             blkdev_request *r = argp;
>             switch (r->req)
>             {
>                 case BLKDEV_REQ_READ:
>                     return smc_read(r);
>                 case BLKDEV_REQ_WRITE:
> 		/* return smc_write(r);*/
> 		    printk("BLKDEV_REQ_WRITE\n");
> 		    return -1;
>                 default:
>                     errno = EBADRQC;
>                     return -1;
>             }
>             break;
>         }
>         default:
>             errno = EBADRQC;
>             return -1;
>     }
> }
> well the output of this shows me that after a "read file" the fat layer
> seems to try to write something and hangs in a endless loop...
> (the output is full of BLKDEV_REQ_WRITE).
> So my question is, how to tell the fat layer not to try to write on the
> device?
Unfortunately fat layer does not contain any "read-only fs" hooks for 
now. As to these write attempts my suggestion is that they come from 
msdos_file_close(), 'if (!FAT_FILE_IS_REMOVED(fat_fd))' branch. As a 
temporary workaround you may try to comment out this branch.

Best wishes,
> maybe i should change my return value for BLKDEV_REQ_WRITE?
> Philippe
> On Thu, 14 Jul 2005 16:15:09 +0200, "Philippe Simons"
> <loki_666 at> said:
>>Hi ,i've been working now on a MMC block driver for the bp32 bsp, with
>>some partial results.
>>The driver install correctly (the /dev/smc file appears), and the fat
>>initialisation find the FAT12 partition.
>>Using the fileio sample, I can browse the MMC tree whithout any
>>but if i try to output a file with cat or try to read a file with the
>>fileio menu...
>>the file seems to be read correctly, but just after rtems hangs.
>>I've added a simple task which output some dots in a endless loop, and
>>after the file is read, this task stop.
>>I used the ramdisk block driver as template to build the mmc block
>>ne1 has a clue on this issue?
>> - Or how I learned to stop worrying and
>>                          love email again

More information about the users mailing list