Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a different approach to add an "offset" option for loop device mounts…
… to the mount applet advantages/differences (in my opinion): - less changes to the original code at all - less hunks to maintain, if the original code will be changed in the future - a more neutral implementation, because a present "offset" option isn't "eaten up" any longer, if the device to be mounted isn't a file (loop mounts are auto-detected anyway, the "loop" option is silently ignored by the original code) and so this option is still usable for other (future) purposes, if it's passed along the path up to the filesystem driver - tested with the following cases: - as the only option specified => only one entry in filteropts ---------------------------------------------------------------------- root@FB7490:/var/media/ftp $ mount -o offset=256 /var/media/ftp/filesystem.image /var/test;grep /var/test /proc/mounts;losetup -a | grep filesystem\.image;umount /var/test /dev/loop2 /var/test ext2 rw,relatime 0 0 /dev/loop2: 256 /var/media/ftp/filesystem.image ---------------------------------------------------------------------- - preceded with an option for the mount applet => even the first and last entry in filteropts root@FB7490:/var/media/ftp $ mount -o ro,offset=256 /var/media/ftp/filesystem.image /var/test;grep /var/test /proc/mounts;losetup -a | grep filesystem\.image;umount /var/test /dev/loop2 /var/test ext2 ro,relatime 0 0 /dev/loop2: 256 /var/media/ftp/filesystem.image ---------------------------------------------------------------------- - preceded with an option for the filesystem_driver => the 2nd and last entry in filteropts root@FB7490:/var/media/ftp $ mount -o user_xattr,offset=256 /var/media/ftp/filesystem.image /var/test;grep /var/test /proc/mounts;losetup -a | grep filesystem\.image;umount /var/test /dev/loop2 /var/test ext2 rw,relatime,user_xattr 0 0 /dev/loop2: 256 /var/media/ftp/filesystem.image ---------------------------------------------------------------------- - preceded with options for the filesystem_driver and a followed by another one for the applet => 2nd and last root@FB7490:/var/media/ftp $ mount -o user_xattr,offset=256,ro /var/media/ftp/filesystem.image /var/test;grep /var/test /proc/mounts;losetup -a | grep filesystem\.image;umount /var/test /dev/loop2 /var/test ext2 ro,relatime,user_xattr 0 0 /dev/loop2: 256 /var/media/ftp/filesystem.image ---------------------------------------------------------------------- - preceded with options for the filesystem_driver and a followed by another one => 2nd and not the last root@FB7490:/var/media/ftp $ mount -o user_xattr,offset=256,acl /var/media/ftp/filesystem.image /var/test;grep /var/test /proc/mounts;losetup -a | grep filesystem\.image;umount /var/test /dev/loop2 /var/test ext2 rw,relatime,user_xattr,acl 0 0 /dev/loop2: 256 /var/media/ftp/filesystem.image ---------------------------------------------------------------------- - followed by an option for the filesystem driver => first and not the last option in filteropts root@FB7490:/var/media/ftp $ mount -o offset=256,acl /var/media/ftp/filesystem.image /var/test;grep /var/test /proc/mounts;losetup -a | grep filesystem\.image;umount /var/test /dev/loop2 /var/test ext2 rw,relatime,acl 0 0 /dev/loop2: 256 /var/media/ftp/filesystem.image - as far as I oversee the test results, every possible combination works as expected
- Loading branch information