2010-03-05 09:11:12     Mounting all the Partion of a USB HDD

Document created by Aaronwu Employee on Aug 20, 2013
Version 1Show Document
  • View in full screen mode

2010-03-05 09:11:12     Mounting all the Partion of a USB HDD

John Peter (INDIA)

Message: 86867   

 

Hi,

 

I have been going through the hotplug & mdev related threads hosted in the forum. I understand that the requirement of the developer have been mostly mounting 1 device or at the most 1 partition of the device at a time.

 

Our requirement is if the USB HDD device supports example 5 partition each either with NTFS or VFAT filesystem support then I need to mount all the 5 partition corresponding to their filesystem too. How can this be achieved.

 

1.Can this be done in the Hotplug script that we usaually write for attach & detach of USB devices.

 

2.Is there any sample code available to achieve this.

 

3. If we need to display the actual names of the partitions mounted(eg: Partitions names shown in Linux PC or Windows PC). How can this be done.

 

Please suggest me on how to proceed in this work.

 

Awating for your responses.

 

Thanks in advance.

 

Peter.

QuoteReplyEditDelete

 

 

2010-03-05 09:36:54     Re: Mounting all the Partion of a USB HDD

Mike Frysinger (UNITED STATES)

Message: 86869   

 

there is no limitation any where in the number of devices that get handled

 

please read the documentation:

  docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:mdev

 

all mounted partitions can be found in /proc/mounts

QuoteReplyEditDelete

 

 

2010-03-05 10:27:22     Re: Mounting all the Partion of a USB HDD

Karthikeyan Jeevanandam (INDIA)

Message: 86874   

 

Hi ,

 

Use hotplug scripts to detect USB insert. See or parse  /proc/partitions for the available mountable partitions. Mount the partitions trying with desired file system.

 

Regards,

 

Karthik

QuoteReplyEditDelete

 

 

2010-03-18 04:01:03     Re: Mounting all the Partion of a USB HDD

John Peter (INDIA)

Message: 87398   

 

Hi all,

 

When I use mdev with Hotplug & insert a USB HDD which has say 5 Partitions then I am able to see that the hotplug is called for 7 times (eg: --> sda,sda1,sda5,sda6,sda7,sda8,sda9).

 

If we need to send a signal to the User Application only once on insertion of the device then how can it be achieved?

 

What blocking code could be prepared in the hotplug script wherein even though hotplug is called multiple times we need to send a signal only once to the USer application in case of USB insertion & 1 signal for USB Removal. If anyone has experimented it before then please share us the sample code to do the above.

 

Similarly we observed in a sample code on hotplug script where signal USR1 or 2 was used to send signal to the User Application.

 

Can we poll the signal instead of waiting/pending for the signal arrival. If we can poll then can anybody share a sample piece of code on polling?

 

Please send us your suggestions.

 

Thanks in advance.

 

With Regards,

 

Peter.

QuoteReplyEditDelete

 

 

2010-03-18 11:43:51     Re: Mounting all the Partion of a USB HDD

Mike Frysinger (UNITED STATES)

Message: 87409   

 

your hotplug script should never block, but even if it did, it likely wouldnt matter.  you cannot "poll for signals" as that makes no sense.

 

you already have all the info you need when the device is insert (sda).  read the partition table yourself to figure out how many partitions there are.  or fix your software to properly handle an arbitrary number of partitions detected at anytime.

QuoteReplyEditDelete

 

 

2010-03-19 02:34:17     Re: Mounting all the Partion of a USB HDD

John Peter (INDIA)

Message: 87441   

 

Hi Mike

 

Thanks for the suggestion.

 

Here I am referring to blocking of Hotplug itself. I want the User Application to be reported of USB insertion/removal only once. As I stated earlier I just need to send a signal to the User Application stating the USB insertion/removal only once even though the Hotplug will be called multiple time for a single USB device insertion. Hope you understand my query clearly now.

 

And regarding the polling, I am not going to poll for the signal in the Hotplug script, instead I want to  poll the signal  in the  USER  Application.  For eg: If  I send the  SIGUSR1 or SIGUSR2 for USB insertion/removal from Hotplug script to the User Application, then I want to poll the SIGUSR1 signal every 1 seconds & by that way I can confirm the USB insertion/ Removal in the application. I need this because I may be using different modules & devices like HDD where I need to poll for each device status.

 

 

 

With Regards,

 

Santhosh.R

QuoteReplyEditDelete

 

 

2010-03-19 02:36:57     Re: Mounting all the Partion of a USB HDD

John Peter (INDIA)

Message: 87442   

 

Hi Mike

 

Thanks for the suggestion.

 

Here I am not referring to blocking of Hotplug itself. I want the User Application to be reported of USB insertion/removal only once. As I stated earlier I just need to send a signal to the User Application stating the USB insertion/removal only once even though the Hotplug will be called multiple time for a single USB device insertion. Hope you understand my query clearly now.

 

And regarding the polling, I am not going to poll for the signal in the Hotplug script, instead I want to  poll the signal  in the  USER  Application.  For eg: If  I send the  SIGUSR1 or SIGUSR2 for USB insertion/removal from Hotplug script to the User Application, then I want to poll the SIGUSR1 signal every 1 seconds & by that way I can confirm the USB insertion/ Removal in the application. I need this because I may be using different modules & devices like HDD where I need to poll for each device status.

 

 

 

With Regards,

 

Peter

Attachments

    Outcomes