For a drive that has been FAT formated to have a non-default cluster size, I found that when doing two or more cycles of mounting and unmounting, the first would succeed and the second would fail with EINVAL. It didn't matter whether the mount/unmount was being done from the shell command line or from a program. The problem turned out to be due to the block size not having been updated before the first call to rtems_bdbuf_read() specifying a non-zero block number. Moving the call to rtems_bdbuf_set_block_size() before that call solves the problem.
One of the frustrations in solving this problem is that there are many sources of EINVAL, and all you get to see on the console is "Invalid argument". I considered leaving a bunch of prints in the code to clarify what argument is invalid, but ultimately took them out in order to change as little as possible. Would it worthwhile to put them back at each abnormal return point that sets errno? This issue exists in the HEAD of the RTEMS git. Ric _______________________________________________ rtems-devel mailing list rtems-devel@rtems.org http://www.rtems.org/mailman/listinfo/rtems-devel