@@ -93,6 +93,8 @@
* removable Default false, boolean for removable media
* luns=N Default N = number of filenames, number of
* LUNs to support
+ * fua=b[,b...] Default false, booleans for ignore FUA
flag
+ * in SCSI WRITE(6,10,12) commands
I wonder if it makes sense to make it per-LUN. I would imagine
that it's great to ignore FUA if the device has its own power supply
in which case after disconnect the data won't be lost. This is a
per-device property not really per-LUN. As such I'd make this option
global for the gadget.
Make sense only for removable media with one partition.
Otherwise. why we have sync option per partition f.e., not per device?
+ ssize_t rc = count;
Not really needed here.
See below
+ if (sscanf(buf, "%d", &i) != 1)
+ return -EINVAL;
Why not simple_strtol() directly?
I did it in the same way like fsg_store_ro() does.
I have no objections to back to previous solution.
+
+ if (curlun->fua)
+ fsg_lun_fsync_sub(curlun);
Shouldn't that read something like:
+ if (!curlun->fua && i)
+ fsg_lun_fsync_sub(curlun);
ie. there is no sense in syncing if FUA was active (in which case all
writes were synced already, right?) or if the new value is false (since
then user does not won't syncing).
The idea is to sync data before switching from async mode.
Actually fua = 1 means ignorance of that flag.