Detrmining mounting status of SDBlockDevice

There is no function that can tell you the status of the SDBlockDevice. (_is_initialized) variable is private and no function return the value.
This peace of code will be executed more than one times … when the SD device fails to read/access from the SD disk.
FILE : SDBlockDevice.c – >line 386

int SDBlockDevice::init()
{
int err;

 lock();

 if (!_is_initialized) {
     _init_ref_count = 0;
 }

 _init_ref_count++;                    <<<<<<<<<<<<<<<<<<<<<<<<<This line is wrong

 if (_init_ref_count != 1) {     <<<<<<<<<<<<<<<<<<<<<<<<<This line is wrong
    goto end;
 }

The _init_ref_count variable will be continuously each time … when there is a problem. SDBLOCKDEVICE doesn’t demount when it fails to access the SD disk … but it will increment that variable contentiously.
There is no way to know if the SD disk is not reachable to re-initialize and remount since it is initialized already but fails even so to access the SD disk. By knowing what value the _init_ref_count has you can deinitialize it so many times and initialize it again and everything works again.

To regenerate this error:
Define your SDBLOCK device, access the file system (read or make DIR) … Take out the SD card physically and make another SD-Disk operation … It will fails sure …
Put back the SD-Disk … And you get the problem. . The SDBlockdevice will fail until you deinitialize so many times as _init_ref_count incremented before.
I don’t know what is the usage of _init_ref_count, but it is wrong .
Why dose SDblockdevice re-call SDBlockDevice::init() again and again while you didn’t do that?
must be a bug … or I don’t know hot to fix the fact that when the SD-Disk physically removed and accessed to re-initialize it in a proper way.
I hope it is clear what I am talking about.

I don’t call init by myself again. mbed do that for you when it fails to access the SD as I described. So it is not my fault that I call init so many times.
Mbed try to do that whenever it fails to access the SD disk.
Try it and you will discover that by yourself as I described. make a simple program that access the SD … remove it physically … try it … it will fails … at that time it will automatically call init again without your hand on that.

After changing the forum, I don’t know how to report it. So please would you do that? thanks for your help.
Please refer to this discussion if you like