I have a software that will unmount a partition programatically (if it's not busy) and mount it again after all of the work is done.
If I run this in the terminal:
sudo mount /dev/sdb1 /mnt/fat32 -o sync,dirsync,rw,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro -t vfat
I get this in
100 24 8:17 / /mnt/fat32 rw,relatime shared:61 - vfat /dev/sdb1 rw,sync,dirsync,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro
So I made a mountinfo parser andto get the data to restore the mount, but I'm having with converting mount options (
rw,relatime) and super options (the last part in
int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data);
My approach was to convert the mount options into the appropriate
mountflags and to give special options straight to
data, but then I get this error:
[62857.390803] FAT-fs (sdb1): Unrecognized mount option "rw" or missing value
So I made a function to copy the attributes in the super options thet just matches the filesystem specific data, and now it works. But I still have a problem: how can I set, for instance,
dirsync if they are not in the mount options flags and if they aren't for vfat specific attributes?
If it can be made through the command line mount it can also be made in the command line version, right?