Problem with mounting a device second time.
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Apr 19 07:37:19 UTC 2012
On 04/19/2012 09:15 AM, ali nasir wrote:
> 1. Before calling the ioctl, we ensure that all the files are closed using the fclose.
Ok.
> 2. If we do the ioctl, the unmount() is still succesfull.
Good.
> 3. How do i find the remaining user of the disk? Is there a struct where i can see something?
Please have a look at the following code:
#include <rtems.h>
#include <rtems/diskdevs.h>
#include <rtems/shell.h>
static int do_bdls(int argc, char **argv)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
dev_t dev = (dev_t) -1;
rtems_disk_device *dd = NULL;
while (sc == RTEMS_SUCCESSFUL && (dd = rtems_disk_next(dev)) != NULL) {
printf(
"%08" PRIx32 ":%08" PRIx32 " %c %s UC=%u BB=%" PRIu32 " BC=%" PRIu32 " BS=%"
PRIu32 " MBS=%" PRIu32 "\n",
rtems_filesystem_dev_major_t(dev),
rtems_filesystem_dev_minor_t(dev),
dd->phys_dev == dd ? 'P' : 'L',
dd->name,
dd->uses,
dd->start,
dd->size,
dd->block_size,
dd->media_block_size
);
dev = rtems_disk_get_device_identifier(dd);
sc = rtems_disk_release(dd);
}
return 0;
}
static rtems_shell_cmd_t bdls_command = {
"bdls",
"bdls",
"bsp",
do_bdls,
NULL,
NULL
};
You can call do_bdls() before and after the ioctl and watch the usage count
'UC=???'.
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the users
mailing list