Question

I'm developping a "MP3 player"-like USB device. It is seen as a Mass Storage device by the USB host (Windows). I'd like to be able to keep the current song playing while the device is connected. In an ideal world, the user should be able to delete every mp3 files using his file explorer but the one currently playing, which would be seen as "in use" by Windows.

The filesystem is FAT, I use FatFS for reading files on the device.

Does FAT allow such thing (mark a file as "in use") ? Any smarter idea ?

Était-ce utile?

La solution

Like every filesystem that isn't specifically designed for this purpose, FAT isn't a cluster filesystem. As such, there are no provisions for mounting it from more than one host at a time. So it can't be mounted from the USB host's operating system and from the USB device's embedded operating system at the same time. The concept of a file being "in use" at the filesystem level is moot for a non-cluster filesystem.

For examples of cluster filesystems, look at OCFS2 or GFS2. But those require things like network lock managers and it is very unlikely that you can easily use them for an application like a USB device.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top