Re: Gadget mass storage file change detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please instruct your email client to break lines after about 72 
columns.

On Mon, 21 Mar 2011, Barnes, Clifton A. wrote:

> I'm currently trying to use the gadget mass storage function to present a FAT32 partition on an SD card as a mass storage device to Windows.  I have been successful in setting up the mass storage module in this way by using the block device.  I can copy files to and from Windows and see them on the device where I have mounted the block device also.  However, the file system statistics (accessed by using statvfs) do not seem to update.  I can remove files from windows and the f_bfree number does not change.  I've also used 'df' and have seen the same result.  I believe this is because the VFS does not know that the mass storage gadget has changed the file system since the mass storage gadget is only using it as a block device.  

Correct.  What you are doing is bound to cause filesystem corruption.

> Is there a way to notify the VFS that the file system has changed?  

Not while the host is using it.  You must unmount the filesystem on the
gadget before exporting it to the host, and don't mount it again until 
the gadget has been disconnected from the host.

> Is there a better way to share a file system between Windows and the device?  

Yes.  Don't use a mass-storage gadget.  Instead use a networking gadget 
like g_ether, and start up a filesharing server like Samba.  After all, 
that's what you want -- you want to share the files.

> Is there another way to know the amount of free space on the file system?

df works just fine.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux