<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div style="RIGHT: auto"><SPAN style="RIGHT: auto">Hi,</SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN> </div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto">By only calling the unmount and the rmdir, the SD card does not get mount successfully the next time i.e. if i insert another SD card, after unmounting the previous one, then the scond SD card mount fails in the rtems_disk_create_phys. It returns RTEMS_RESOURCE_IN_USE (12). I remember we had this problem with the 4.10 also. In 4.10, we had to call the below sequence to have a clean unmount</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN> </div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto">unmount(mount_path)</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto">rmdir(mount_path</SPAN><SPAN style="RIGHT: auto">)</SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto">sync_dev(dev)<SPAN style="RIGHT: auto" class=tab> //dev = /dev/sdc01</SPAN></SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab>purge_dev(dev)</SPAN></SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab>disk_delete(dev)</SPAN></SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"> </div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto">sync_dev(dev)<SPAN style="RIGHT: auto" class=tab> //dev = /dev/sdc0</SPAN></SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab>purge_dev(dev)</SPAN></SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab>disk_delete(dev)</SPAN></SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab></SPAN></SPAN> </div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab>io_unregister_driver(major)</SPAN></SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab></SPAN></SPAN> </div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab>with the RTEMS 4.11, the sync_dev and purge_dev needs a pointer of type rtems_disk_device. </SPAN></SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab>I get this pointer with a call to the rtems_disk_obtain(dev). I get the dev from a call to rtems_media_get_device_identifier("/dev/sdc01", &dev);<BR>But when i pass the dev returned from rtems_media_get_device_identifier to the rtems_disk_obtain, i get a NULL pointer.</SPAN></SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab></SPAN></SPAN> </div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab>Regards,</SPAN></SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><SPAN style="RIGHT: auto" class=tab>Ali</SPAN></SPAN></div>
<DIV style="FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; FONT-SIZE: 12pt">
<DIV style="RIGHT: auto" dir=ltr>
<DIV style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 0; MARGIN: 5px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; HEIGHT: 0px; FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; BORDER-RIGHT: #ccc 1px solid; PADDING-TOP: 0px" class=hr contentEditable=false readonly="true"></DIV><FONT size=2 face=Arial><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Sebastian Huber <sebastian.huber@embedded-brains.de><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> rtems-users@rtems.org <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, April 7, 2014 2:56 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: Problem with SD card unmount with rtems 4.10.99<BR></FONT></DIV>
<DIV class=y_msg_container><BR>Hello Ali,<BR clear=none>
<DIV id=yqtfd85661 class=yqt9892298758><BR clear=none>On 2014-04-07 05:15, ali nasir wrote:<BR clear=none>> Hi,<BR clear=none>><BR clear=none>> I am facing a problem during the SDcard unmount with the rtems 4.10.99 (GIT<BR clear=none>> HEAD). Following sequence is performed during the mount:<BR clear=none>> 1. rtems_io_register_driver .This returns the major number of the device<BR clear=none>> 2. Then create a device (dev) using the call to rtems_filesystem_make_dev_t<BR clear=none>> 3. rtems_disk_io_initialize<BR clear=none>> 4. rtems_disk_create_phys is then called with the device (dev) returned from<BR clear=none>> above call to rtems_filesystem_make_dev_t and the name as /dev/sdc0<BR clear=none>> 5. rtems_bdpart_register_from_disk("/dev/sdc0")<BR clear=none>> 6. rtems_fsmount. The rtems_fstab_entry has two entries. one for the partition<BR clear=none>> (/dev/sdc01) and the other as /dev/sdc0<BR clear=none>> The
above sequence is succesfull.<BR clear=none>> The unmount sequence is as follows:<BR clear=none>> 1. unmount("/mnt/sdcard")<BR clear=none>> 2. rmdir("/mnt/sdcard")<BR clear=none>> 3. Call the rtems_media_get_device_identifier("/dev/sdc01", &dev) to get the<BR clear=none>> dev. Note that here we start with the first partition<BR clear=none>> 4. Call rtems_disk_obtain(dev) to get the disk_device pointer.<BR clear=none>> 5. rtems_bdbuf_syncdev is then called. The pointer returned by disk_obtain is<BR clear=none>> passed here.<BR clear=none>> But at this point, i notice that the rtems_disk_obtain returns a NULL pointer<BR clear=none>> and the syncdev crashes. I also see that the dev returned from the call to<BR clear=none>> rtems_media_get_device_identifier does not seem to be correct. It does not give<BR clear=none>> me the correct major number.<BR clear=none>> This sequence used to work with the rtems4.10.2. The
only difference was that<BR clear=none>> in 4.10.2, the syncdev used to take the 'dev' itself as the argument. In<BR clear=none>> 4.10.2, if this partition was not correctly removed, then all further SD card<BR clear=none>> mount failed and needed a system reset for further mounts.<BR clear=none>><BR clear=none>> What is the correct sequence to unmount an existing single partition SDcard<BR clear=none>> with the latest RTEMS?Note that it used to work correct with the 4.10.2<BR clear=none>> I see that there is a media manager also in place? Any example on how to use<BR clear=none>> the media manager?</DIV><BR clear=none><BR clear=none>on RTEMS 4.11 it is enough to call unmount(mount_path) and optionally the <BR clear=none>rmdir(mount_path).<BR clear=none><BR clear=none>-- <BR clear=none>Sebastian Huber, embedded brains GmbH<BR clear=none><BR clear=none>Address : Dornierstr. 4, D-82178 Puchheim, Germany<BR clear=none>Phone :
+49 89 189 47 41-16<BR clear=none>Fax : +49 89 189 47 41-09<BR clear=none>E-Mail : <A href="mailto:sebastian.huber@embedded-brains.de" shape=rect ymailto="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</A><BR clear=none>PGP : Public key available on request.<BR clear=none><BR clear=none>Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<BR clear=none>_______________________________________________<BR clear=none>rtems-users mailing list<BR clear=none><A href="mailto:rtems-users@rtems.org" shape=rect ymailto="mailto:rtems-users@rtems.org">rtems-users@rtems.org</A><BR clear=none><A href="http://www.rtems.org/mailman/listinfo/rtems-users" shape=rect target=_blank>http://www.rtems.org/mailman/listinfo/rtems-users</A><BR><BR></DIV></DIV></DIV></div></body></html>