Question

My application needs a guaranteed time to complete some IO on an SDcard before the SDcard is unmounted. My solution is to write a linux kernel module that inserts a wrapper around the umount system call that will delay the actual umount and call me back to complete my work.

My code may have root privileged components.

Any less obstructive solutions?

Was it helpful?

Solution

Though I can't guarantee it, I believe that umount will automatically wait for that. That's one of the reasons to use umount (instead of directly removing the sdcard).

Also, you can't «write a linux kernel module» and "install" it into an android device. What you would have to do would involve recompiling android, making a custom ROM and install that to the desired device. Each device would need a different ROM, etc. I don't think this conceivable for you.

Anyway, umount should wait for any IO operation to finish (maybe with a timeout). I don't see a solution in case you have several files to send and what to ensure that all of them will be written.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top