• udev and friends not able to mount Atari GEMDOS partition

    From Emmanuel Kasper@21:1/5 to All on Tue Sep 8 11:20:01 2020
    Dear Debian m68k-list

    I've tinkering a lot with Atari computers lately but I was mostly active
    on the FreeMint side of things [0]. Now I am considering the Linux side
    of things since I got a TT with 32MB of RAM in March.

    Going back to $subject:
    I have a sd card partitioned with an AHDI partition table (that I use
    with https://lotharek.pl/productdetail.php?id=48)
    and I noticed that the partition layout is correctly detected by the
    kernel and udev when I insert the SD card on Linux:

    dmesg| grep AHDI
    [1040750.399373] mmcblk0: AHDI p1 p2

    udevadm info /dev/mmcblk0 | grep ID_PART_TABLE
    E: ID_PART_TABLE_TYPE=atari

    Now the thing is that altough the partitions are formatted with Atari
    GEMDOS fat, udev does not recognize the FS, which prevents mounting the partition as a non root user via nautilus / udisksctl tools.

    # notice the missing ID_FS_ keys
    udevadm info /dev/mmcblk0p1
    E: DEVNAME=/dev/mmcblk0p1
    E: DEVTYPE=partition
    E: PARTN=1
    E: MAJOR=179
    E: MINOR=1
    E: SUBSYSTEM=block
    E: USEC_INITIALIZED=1040760689634
    E: ID_NAME=SU01G
    E: ID_SERIAL=0xb023b954
    E: ID_PATH=pci-0000:00:1a.0-usb-0:1.3:1.0-platform-rtsx_usb_sdmmc.2.auto
    E: ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_3_1_0-platform-rtsx_usb_sdmmc_2_auto
    E: ID_PART_TABLE_TYPE=atari
    E: ID_DRIVE_FLASH_SD=1
    E: ID_DRIVE_MEDIA_FLASH_SD=1
    E: ID_PART_ENTRY_SCHEME=atari
    E: ID_PART_ENTRY_TYPE=BGM
    E: ID_PART_ENTRY_NUMBER=1
    E: ID_PART_ENTRY_OFFSET=2
    E: ID_PART_ENTRY_SIZE=131072
    E: ID_PART_ENTRY_DISK=179:0
    E: DEVLINKS=/dev/disk/by-id/mmc-SU01G_0xb023b954-part1 /dev/disk/by-path/pci-0000:00:1a.0-usb-0:1.3:1.0-platform-rtsx_usb_sdmmc.2.auto-part1
    E: TAGS=:systemd:


    Considering it is possible to mount such a partition as root with
    sudo mount /dev/mmcblk0p1 /mnt

    what would need be in udev to recognize the filesystem ?

    Best Regards
    Emmanuel


    [0] https://subsole.org/st_mint

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dirk Heinrichs@21:1/5 to All on Tue Sep 8 17:40:02 2020
    Am 08.09.20 um 11:02 schrieb Emmanuel Kasper:

    Considering it is possible to mount such a partition as root with sudo
    mount /dev/mmcblk0p1 /mnt what would need be in udev to recognize the filesystem ?

    udev is about devices, not filesystems. Just use above mount command to
    mount it (given the kernel has support for it, either built in or as a
    module). If you want udev to create a more convenient name for
    /dev/mmcblk0, you need to write a rule for it.

    HTH...

        Dirk

    --
    Dirk Heinrichs <dirk.heinrichs@altum.de>
    Matrix-Adresse: @heini:altum.de
    GPG Public Key: 80F1540E03A3968F3D79C382853C32C427B48049
    Privacy Handbuch: https://www.privacy-handbuch.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Brad Boyer@21:1/5 to Dirk Heinrichs on Tue Sep 8 23:50:01 2020
    On Tue, Sep 08, 2020 at 05:07:50PM +0200, Dirk Heinrichs wrote:
    Am 08.09.20 um 11:02 schrieb Emmanuel Kasper:

    Considering it is possible to mount such a partition as root with sudo mount /dev/mmcblk0p1 /mnt what would need be in udev to recognize the filesystem ?

    udev is about devices, not filesystems. Just use above mount command to
    mount it (given the kernel has support for it, either built in or as a module). If you want udev to create a more convenient name for
    /dev/mmcblk0, you need to write a rule for it.

    That almost sounds like libblkid isn't recognizing the FS. Can you try
    running blkid on the device? If it can't detect the FS type, that might
    be a place where there is an issue. The libblkid code is not based on
    the drivers in the kernel, but is still essential for a portion of the auto-detection of file systems in user-space.

    Brad Boyer
    flar@allandria.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John Paul Adrian Glaubitz@21:1/5 to Emmanuel Kasper on Wed Sep 9 10:10:01 2020
    Hi Emmanuel!

    On 9/9/20 9:25 AM, Emmanuel Kasper wrote:
    Now I had a quicklook at libblkid, and it should be able at first view
    to cope with sector size up to 4096 bytes, so I am a bit puzzled here. https://github.com/karelzak/util-linux/blob/master/libblkid/src/superblocks/vfat.c#L218

    It might be worth asking on the util-linux upstream mailing list as the maintainers
    are usually very responsive and helpful.

    Adrian

    --
    .''`. John Paul Adrian Glaubitz
    : :' : Debian Developer - glaubitz@debian.org
    `. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
    `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emmanuel Kasper@21:1/5 to All on Wed Sep 9 09:50:02 2020
    Le 08/09/2020 à 23:25, Brad Boyer a écrit :
    On Tue, Sep 08, 2020 at 05:07:50PM +0200, Dirk Heinrichs wrote:
    Am 08.09.20 um 11:02 schrieb Emmanuel Kasper:

    Considering it is possible to mount such a partition as root with sudo
    mount /dev/mmcblk0p1 /mnt what would need be in udev to recognize the
    filesystem ?

    udev is about devices, not filesystems. Just use above mount command to
    mount it (given the kernel has support for it, either built in or as a
    module). If you want udev to create a more convenient name for
    /dev/mmcblk0, you need to write a rule for it.

    That almost sounds like libblkid isn't recognizing the FS. Can you try running blkid on the device? If it can't detect the FS type, that might
    be a place where there is an issue. The libblkid code is not based on
    the drivers in the kernel, but is still essential for a portion of the auto-detection of file systems in user-space.


    Hi Brad
    Indeed blkid does not recognize the FS type, thanks for the hint !

    sudo blkid -p /dev/mmcblk0p1
    /dev/mmcblk0p1: PART_ENTRY_SCHEME="atari" PART_ENTRY_TYPE="BGM" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2" PART_ENTRY_SIZE="131072" PART_ENTRY_DISK="179:256"

    I suppose this is because the Atari GEMDOS FAT16 partitions have a
    variable sector size wich is larger that 512 bytes for partitions >
    16MB, whereas MSDOS FAT16 always uses a 512 bytes sectorsize .

    The disktype tool, provided in the archive, gave me the hint about the
    sector size difference:
    http://disktype.sourceforge.net/doc/ch03s03.html
    and this technical guide, which has all the FAT subtilities explained: http://info-coach.fr/atari/documents/_mydoc/Atari_HD_File_Sytem_Reference_Guide.pdf


    sudo disktype /dev/mmcblk0p1
    --- /dev/mmcblk0p1
    Block device, size 64 MiB (67108864 bytes)
    FAT16 file system (hints score 3 of 5, ATARI ST bootable)
    Unusual sector size 4096 bytes
    Volume size 63.95 MiB (67051520 bytes, 8185 clusters of 8 KiB)


    Now I had a quicklook at libblkid, and it should be able at first view
    to cope with sector size up to 4096 bytes, so I am a bit puzzled here. https://github.com/karelzak/util-linux/blob/master/libblkid/src/superblocks/vfat.c#L218

    Something to dig in.

    Emmanuel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emmanuel Kasper@21:1/5 to All on Wed Sep 9 10:50:01 2020
    Le 09/09/2020 à 09:53, John Paul Adrian Glaubitz a écrit :
    Hi Emmanuel!

    On 9/9/20 9:25 AM, Emmanuel Kasper wrote:
    Now I had a quicklook at libblkid, and it should be able at first view
    to cope with sector size up to 4096 bytes, so I am a bit puzzled here.
    https://github.com/karelzak/util-linux/blob/master/libblkid/src/superblocks/vfat.c#L218

    It might be worth asking on the util-linux upstream mailing list as the maintainers
    are usually very responsive and helpful.

    Thanks Adrian for the hint, I will write them. The words responsive and
    helpful took my attention.
    BTW I still have this quote of you in my email signature :)


    --
    You know an upstream is nice when they even accept m68k patches.
    - John Paul Adrian Glaubitz, Debian OpenJDK maintainer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Geert Uytterhoeven@21:1/5 to manu@debian.org on Wed Sep 9 10:20:01 2020
    Hi Emmanuel,

    On Wed, Sep 9, 2020 at 9:42 AM Emmanuel Kasper <manu@debian.org> wrote:
    Le 08/09/2020 à 23:25, Brad Boyer a écrit :
    On Tue, Sep 08, 2020 at 05:07:50PM +0200, Dirk Heinrichs wrote:
    Am 08.09.20 um 11:02 schrieb Emmanuel Kasper:

    Considering it is possible to mount such a partition as root with sudo >>> mount /dev/mmcblk0p1 /mnt what would need be in udev to recognize the
    filesystem ?

    udev is about devices, not filesystems. Just use above mount command to
    mount it (given the kernel has support for it, either built in or as a
    module). If you want udev to create a more convenient name for
    /dev/mmcblk0, you need to write a rule for it.

    That almost sounds like libblkid isn't recognizing the FS. Can you try running blkid on the device? If it can't detect the FS type, that might
    be a place where there is an issue. The libblkid code is not based on
    the drivers in the kernel, but is still essential for a portion of the auto-detection of file systems in user-space.

    Indeed blkid does not recognize the FS type, thanks for the hint !

    sudo blkid -p /dev/mmcblk0p1
    /dev/mmcblk0p1: PART_ENTRY_SCHEME="atari" PART_ENTRY_TYPE="BGM" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2" PART_ENTRY_SIZE="131072" PART_ENTRY_DISK="179:256"

    I suppose this is because the Atari GEMDOS FAT16 partitions have a
    variable sector size wich is larger that 512 bytes for partitions >
    16MB, whereas MSDOS FAT16 always uses a 512 bytes sectorsize .

    Note that we still have a few out-of-tree kernel patches for Atari FAT
    support as well, cfr. the top 3 commits of https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/log/?h=m68k-queue

    Needs some love from a knowledgeable person to send this upstream...

    Gr{oetje,eeting}s,

    Geert

    --
    Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

    In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
    -- Linus Torvalds

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Schmitz@21:1/5 to Emmanuel Kasper on Mon Sep 14 02:10:02 2020
    Hi Emmanuel,

    On 9/09/20 7:25 PM, Emmanuel Kasper wrote:

    That almost sounds like libblkid isn't recognizing the FS. Can you try
    running blkid on the device? If it can't detect the FS type, that might
    be a place where there is an issue. The libblkid code is not based on
    the drivers in the kernel, but is still essential for a portion of the
    auto-detection of file systems in user-space.

    Hi Brad
    Indeed blkid does not recognize the FS type, thanks for the hint !

    sudo blkid -p /dev/mmcblk0p1
    /dev/mmcblk0p1: PART_ENTRY_SCHEME="atari" PART_ENTRY_TYPE="BGM" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2" PART_ENTRY_SIZE="131072" PART_ENTRY_DISK="179:256"

    I suppose this is because the Atari GEMDOS FAT16 partitions have a
    variable sector size wich is larger that 512 bytes for partitions >
    16MB, whereas MSDOS FAT16 always uses a 512 bytes sectorsize .
    This variable sector size may be what causes the trouble here - see the
    commit log of the commit at the head of Geert's m68k-queue.

    The disktype tool, provided in the archive, gave me the hint about the
    sector size difference:
    http://disktype.sourceforge.net/doc/ch03s03.html
    and this technical guide, which has all the FAT subtilities explained: http://info-coach.fr/atari/documents/_mydoc/Atari_HD_File_Sytem_Reference_Guide.pdf


    sudo disktype /dev/mmcblk0p1
    --- /dev/mmcblk0p1
    Block device, size 64 MiB (67108864 bytes)
    FAT16 file system (hints score 3 of 5, ATARI ST bootable)
    Unusual sector size 4096 bytes
    Volume size 63.95 MiB (67051520 bytes, 8185 clusters of 8 KiB)

    According to my recollection, the FAT logical sector size is limited to
    4k by the physical page size (m68k MMU limitation), resulting in a
    partition size limit of 256 MB (>128 MB must use 4k logical sectors).
    Your partition shows this sector size already below that limit, which is
    odd. 8k cluster size with 2 logical sectors of 4k per cluster does
    correspond to a TOS partition, though.

    Have you tried to manually mount the partition?

    Cheers,

        Michael

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emmanuel Kasper@21:1/5 to All on Mon Sep 14 09:10:02 2020
    Le 14/09/2020 à 01:46, Michael Schmitz a écrit :
    Hi Emmanuel,

    On 9/09/20 7:25 PM, Emmanuel Kasper wrote:

    That almost sounds like libblkid isn't recognizing the FS. Can you try
    running blkid on the device? If it can't detect the FS type, that might
    be a place where there is an issue. The libblkid code is not based on
    the drivers in the kernel, but is still essential for a portion of the
    auto-detection of file systems in user-space.

    Hi Brad
    Indeed blkid does not recognize the FS type, thanks for the hint !

    sudo blkid -p /dev/mmcblk0p1
    /dev/mmcblk0p1: PART_ENTRY_SCHEME="atari" PART_ENTRY_TYPE="BGM"
    PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2" PART_ENTRY_SIZE="131072"
    PART_ENTRY_DISK="179:256"

    I suppose this is because the Atari GEMDOS FAT16 partitions have a
    variable sector size wich is larger that 512 bytes for partitions >
    16MB, whereas MSDOS FAT16 always uses a 512 bytes sectorsize .
    This variable sector size may be what causes the trouble here - see the commit log of the commit at the head of Geert's m68k-queue.

    The disktype tool, provided in the archive, gave me the hint about the
    sector size difference:
    http://disktype.sourceforge.net/doc/ch03s03.html
    and this technical guide, which has all the FAT subtilities explained:
    http://info-coach.fr/atari/documents/_mydoc/Atari_HD_File_Sytem_Reference_Guide.pdf



    sudo disktype /dev/mmcblk0p1
    --- /dev/mmcblk0p1
    Block device, size 64 MiB (67108864 bytes)
    FAT16 file system (hints score 3 of 5, ATARI ST bootable)
       Unusual sector size 4096 bytes
       Volume size 63.95 MiB (67051520 bytes, 8185 clusters of 8 KiB)

    According to my recollection, the FAT logical sector size is limited to
    4k by the physical page size (m68k MMU limitation), resulting in a
    partition size limit of 256 MB (>128 MB must use 4k logical sectors).
    Your partition shows this sector size already below that limit, which is
    odd. 8k cluster size with 2 logical sectors of 4k per cluster does
    correspond to a TOS partition, though.

    Have you tried to manually mount the partition?

    Hi Michael
    Thanks for the hint about the logical sector size ! I always wondered
    where this 4k logical sector limit came from on the Linux side.

    Mounting the partitions with /sbin/mount works well without specifying
    the FS type, so there is no problem here.
    However the missing support in libblkid prevents me from using udisks2 / udisksctl to mount the partition as non-root user AFAIK.
    I wrote to the util-linux mailing as suggested by Adrian as it is the
    home of libblkid:
    https://www.spinics.net/lists/util-linux-ng/msg16472.html

    I have seen they added no sot long ago AHDI partition support, so I have
    hope they have interest for GEMDOS FAT16 detection too.

    Emmanuel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Geert Uytterhoeven@21:1/5 to manu@debian.org on Mon Oct 26 12:10:03 2020
    Hi Emmanuel,

    CC Michael

    On Mon, Oct 26, 2020 at 11:28 AM Emmanuel Kasper <manu@debian.org> wrote:
    Note that we still have a few out-of-tree kernel patches for Atari FAT support as well, cfr. the top 3 commits of https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/log/?h=m68k-queue

    Needs some love from a knowledgeable person to send this upstream...

    Gr{oetje,eeting}s,


    Hi Geert !
    I had a look at the patches as I was dabbling in GEMDOS FAT handling
    these days, and I have to say I don't understand the purpose of the
    commit you mentioned:

    fat: Atari FAT updates
    Add support for the Atari-variant of the FAT filesystem https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/commit/?h=m68k-queue&id=501bd95410f8347ed80bff873498db7a1b044457

    to the best of my knowledge, Linux was always able to mount Atari FAT partitions, as long as the logical sector size of the FAT was up to 4096 bytes, this limit itself coming from https://github.com/gregkh/linux/blame/071a0578b0ce0b0e543d1e38ee6926b9cc21c198/fs/fat/inode.c#L1508

    what problem is being fixed, or new feature added with the patch ?
    or am I missing something ?

    TBH, I don't know. This patch came from the old Linux/m68k CVS.
    If anyone feels it can be dropped, I can do so.
    If anyone feels it is needed, please submit it upstream.

    Gr{oetje,eeting}s,

    Geert

    --
    Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

    In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
    -- Linus Torvalds

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emmanuel Kasper@21:1/5 to All on Mon Oct 26 12:10:03 2020
    Note that we still have a few out-of-tree kernel patches for Atari FAT support as well, cfr. the top 3 commits of https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/log/?h=m68k-queue

    Needs some love from a knowledgeable person to send this upstream...

    Gr{oetje,eeting}s,


    Hi Geert !
    I had a look at the patches as I was dabbling in GEMDOS FAT handling
    these days, and I have to say I don't understand the purpose of the
    commit you mentioned:

    fat: Atari FAT updates
    Add support for the Atari-variant of the FAT filesystem https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/commit/?h=m68k-queue&id=501bd95410f8347ed80bff873498db7a1b044457

    to the best of my knowledge, Linux was always able to mount Atari FAT partitions, as long as the logical sector size of the FAT was up to 4096
    bytes, this limit itself coming from https://github.com/gregkh/linux/blame/071a0578b0ce0b0e543d1e38ee6926b9cc21c198/fs/fat/inode.c#L1508

    what problem is being fixed, or new feature added with the patch ?
    or am I missing something ?

    Emmanuel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emmanuel Kasper@21:1/5 to All on Mon Oct 26 18:40:02 2020
    Le 26/10/2020 à 11:44, Geert Uytterhoeven a écrit :
    Hi Emmanuel,

    CC Michael

    On Mon, Oct 26, 2020 at 11:28 AM Emmanuel Kasper <manu@debian.org> wrote:
    Note that we still have a few out-of-tree kernel patches for Atari FAT
    support as well, cfr. the top 3 commits of
    https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/log/?h=m68k-queue

    Needs some love from a knowledgeable person to send this upstream...

    Gr{oetje,eeting}s,


    Hi Geert !
    I had a look at the patches as I was dabbling in GEMDOS FAT handling
    these days, and I have to say I don't understand the purpose of the
    commit you mentioned:

    fat: Atari FAT updates
    Add support for the Atari-variant of the FAT filesystem
    https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/commit/?h=m68k-queue&id=501bd95410f8347ed80bff873498db7a1b044457

    to the best of my knowledge, Linux was always able to mount Atari FAT
    partitions, as long as the logical sector size of the FAT was up to 4096
    bytes, this limit itself coming from
    https://github.com/gregkh/linux/blame/071a0578b0ce0b0e543d1e38ee6926b9cc21c198/fs/fat/inode.c#L1508

    what problem is being fixed, or new feature added with the patch ?
    or am I missing something ?

    TBH, I don't know. This patch came from the old Linux/m68k CVS.
    If anyone feels it can be dropped, I can do so.
    If anyone feels it is needed, please submit it upstream.

    I had a second look at the code and the patch seems to try to improve
    the detection of FAT12 filesystems.

    However those are properly detected by the kernel anyway, (5.8.0 here)
    sudo mkfs.fat -F 12 /dev/mmcblk0p4

    sudo disktype /dev/mmcblk0p4
    --- /dev/mmcblk0p4
    Block device, size 12 MiB (12582912 bytes)
    FAT12 file system (hints score 4 of 5)
    Volume size 11.96 MiB (12546048 bytes, 3063 clusters of 4 KiB)

    sudo mount /dev/mmcblk0p4 /mnt
    works

    The same partition formatted with GEMDOS is also properly correctly
    detected by the kernel and mounted.

    A FAT 12 MS DOS floppy is also correctly mounted via mount without
    specifying the fat type.

    IMHO the patch is not needed anymore, or is covering a use case I don't see.

    Emmanuel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Schmitz@21:1/5 to Emmanuel Kasper on Mon Oct 26 22:40:01 2020
    Hi Emmanuel,

    On 27/10/20 6:13 AM, Emmanuel Kasper wrote:
    Le 26/10/2020 à 11:44, Geert Uytterhoeven a écrit :
    Hi Emmanuel,

    CC Michael

    On Mon, Oct 26, 2020 at 11:28 AM Emmanuel Kasper <manu@debian.org> wrote: >>>> Note that we still have a few out-of-tree kernel patches for Atari FAT >>>> support as well, cfr. the top 3 commits of
    https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/log/?h=m68k-queue

    Needs some love from a knowledgeable person to send this upstream...

    Gr{oetje,eeting}s,

    Hi Geert !
    I had a look at the patches as I was dabbling in GEMDOS FAT handling
    these days, and I have to say I don't understand the purpose of the
    commit you mentioned:

    fat: Atari FAT updates
    Add support for the Atari-variant of the FAT filesystem
    https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/commit/?h=m68k-queue&id=501bd95410f8347ed80bff873498db7a1b044457

    to the best of my knowledge, Linux was always able to mount Atari FAT
    partitions, as long as the logical sector size of the FAT was up to 4096 >>> bytes, this limit itself coming from
    https://github.com/gregkh/linux/blame/071a0578b0ce0b0e543d1e38ee6926b9cc21c198/fs/fat/inode.c#L1508

    what problem is being fixed, or new feature added with the patch ?
    or am I missing something ?
    TBH, I don't know. This patch came from the old Linux/m68k CVS.

    I can't recall why I had decided to port it from 2.4 either, but there
    would have been a real problem to fix at that time (such as failing to
    mount the TOS boot partition from Linux). I would probably had noticed
    about the time compressed kernels got too big to be copied to the Falcon
    using floppies...

    That problem now appears to have gone away. I had to replace the IDE
    disk in my Falcon a few times, and I might have finally managed to set compatible or sane FAT options on the last attempt ...

    Looking at the patch, the only reason I can see is that AFAIK(?), GEMDOS
    always uses a 16 bit FAT, even though the partition size may be small
    enough to use a 12 bit FAT. The biggest such partition that would have
    been possible to mount for Linux would be about 32 MB (entirely
    reasonable size, many years ago).

    If anyone feels it can be dropped, I can do so.
    If anyone feels it is needed, please submit it upstream.
    I had a second look at the code and the patch seems to try to improve
    the detection of FAT12 filesystems.

    However those are properly detected by the kernel anyway, (5.8.0 here)
    sudo mkfs.fat -F 12 /dev/mmcblk0p4

    sudo disktype /dev/mmcblk0p4
    --- /dev/mmcblk0p4
    Block device, size 12 MiB (12582912 bytes)
    FAT12 file system (hints score 4 of 5)
    Volume size 11.96 MiB (12546048 bytes, 3063 clusters of 4 KiB)

    sudo mount /dev/mmcblk0p4 /mnt
    works

    The same partition formatted with GEMDOS is also properly correctly
    detected by the kernel and mounted.

    For the current GEMDOS partition on my system (128 MB), the 'atari'
    option indeed makes no difference. I suspect that a FAT16 file system
    small enough to be detected as FAT12 would cause problems though.

    Your 12 MB GEMDOS partition does work OK in TOS? That would suggest my assumption about 16 bit FAT is wrong, and the patches are indeed no
    longer required.
    A FAT 12 MS DOS floppy is also correctly mounted via mount without
    specifying the fat type.

    IMHO the patch is not needed anymore, or is covering a use case I don't see.

    With what you've reported, I can't see what use case this patch would
    have enabled either. For all I care, we should drop the three FAT
    related commits at the head of m68k-queue.

    Cheers,

        Michael



    Emmanuel





    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emmanuel Kasper@21:1/5 to All on Tue Oct 27 11:40:02 2020
    Le 26/10/2020 à 22:19, Michael Schmitz a écrit :
    Hi Emmanuel,

    On 27/10/20 6:13 AM, Emmanuel Kasper wrote:
    Le 26/10/2020 à 11:44, Geert Uytterhoeven a écrit :
    Hi Emmanuel,

    CC Michael

    On Mon, Oct 26, 2020 at 11:28 AM Emmanuel Kasper <manu@debian.org>
    wrote:
    Note that we still have a few out-of-tree kernel patches for Atari FAT >>>>> support as well, cfr. the top 3 commits of
    https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/log/?h=m68k-queue


    Needs some love from a knowledgeable person to send this upstream... >>>>>
    Gr{oetje,eeting}s,

    Hi Geert !
    I had a look at the patches as I was dabbling in GEMDOS FAT handling
    these days, and I have to say I don't understand the purpose of the
    commit you mentioned:

    fat: Atari FAT updates
    Add support for the Atari-variant of the FAT filesystem
    https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git/commit/?h=m68k-queue&id=501bd95410f8347ed80bff873498db7a1b044457


    to the best of my knowledge, Linux was always able to mount Atari FAT
    partitions, as long as the logical sector size of the FAT was up to
    4096
    bytes, this limit itself coming from
    https://github.com/gregkh/linux/blame/071a0578b0ce0b0e543d1e38ee6926b9cc21c198/fs/fat/inode.c#L1508


    what problem is being fixed, or new feature added with the patch ?
    or am I missing something ?
    TBH, I don't know.  This patch came from the old Linux/m68k CVS.

    I can't recall why I had decided to port it from 2.4 either, but there
    would have been a real problem to fix at that time (such as failing to
    mount the TOS boot partition from Linux). I would probably had noticed
    about the time compressed kernels got too big to be copied to the Falcon using floppies...

    That problem now appears to have gone away. I had to replace the IDE
    disk in my Falcon a few times, and I might have finally managed to set compatible or sane FAT options on the last attempt ...

    Looking at the patch, the only reason I can see is that AFAIK(?), GEMDOS always uses a 16 bit FAT, even though the partition size may be small
    enough to use a 12 bit FAT. The biggest such partition that would have
    been possible to mount for Linux would be about 32 MB (entirely
    reasonable size, many years ago).

    If anyone feels it can be dropped, I can do so.
    If anyone feels it is needed, please submit it upstream.
    I had a second look at the code and the patch seems to try to improve
    the detection of FAT12 filesystems.

    However those are properly detected by the kernel anyway, (5.8.0 here)
    sudo mkfs.fat -F 12 /dev/mmcblk0p4

    sudo disktype /dev/mmcblk0p4
    --- /dev/mmcblk0p4
    Block device, size 12 MiB (12582912 bytes)
    FAT12 file system (hints score 4 of 5)
       Volume size 11.96 MiB (12546048 bytes, 3063 clusters of 4 KiB)

    sudo mount /dev/mmcblk0p4 /mnt
    works

    The same partition formatted with GEMDOS is also properly correctly
    detected by the kernel and mounted.

    For the current GEMDOS partition on my system (128 MB), the 'atari'
    option indeed makes no difference. I suspect that a FAT16 file system
    small enough to be detected as FAT12 would cause problems though.

    Your 12 MB GEMDOS partition does work OK in TOS? That would suggest my assumption about 16 bit FAT is wrong, and the patches are indeed no
    longer required.

    Partitions smaller than 32M, are indeed formatted as FAT16 by GEMDOS.

    disktype /dev/mmcblk0p4
    Partition 4: 12.04 MiB (12619776 bytes, 24648 sectors from 139490)
    Type "GEM" (Standard GEMDOS)
    FAT16 file system (hints score 3 of 5)
    Volume size 11.98 MiB (12558336 bytes, 12264 clusters of 1 KiB)

    This is not a problem whatsoever for Linux: those small FAT16 partitions
    are handled correctly by fsck and mount, without forcing a fat type or
    option, and are working correcting in TOS too.


    A FAT 12 MS DOS floppy is also correctly mounted via mount without
    specifying the fat type.

    IMHO the patch is not needed anymore, or is covering a use case I
    don't see.

    With what you've reported, I can't see what use case this patch would
    have enabled either. For all I care, we should drop the three FAT
    related commits at the head of m68k-queue.
    Cheers,

    Thanks for the feedback !


        Michael



    Emmanuel






    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eero Tamminen@21:1/5 to Emmanuel Kasper on Tue Oct 27 15:20:01 2020
    Hi,

    On 10/27/20 12:19 PM, Emmanuel Kasper wrote:
    Partitions smaller than 32M, are indeed formatted as FAT16 by GEMDOS.

    Formatted by GEMDOS?

    Hard disk support in Atari TOS requires separate
    hard disk drivers. Those have utilities for
    hard disk formatting, TOS supports only formatting
    of floppies.


    disktype /dev/mmcblk0p4
    Partition 4: 12.04 MiB (12619776 bytes, 24648 sectors from 139490)
    Type "GEM" (Standard GEMDOS)
    FAT16 file system (hints score 3 of 5)
    Volume size 11.98 MiB (12558336 bytes, 12264 clusters of 1 KiB)

    This is not a problem whatsoever for Linux: those small FAT16 partitions
    are handled correctly by fsck and mount, without forcing a fat type or option, and are working correcting in TOS too.

    There are many historical hard disk drivers and
    formatting utilities for Atari. I think the only
    still maintained (commercial) one is HD Driver
    (hddrutil.app):
    https://www.hddriver.net/en/

    But in theory users might still have hard disks
    formatted by the older hard disk programs like
    Cécile (cc_tools.app), ICDPro (icdfmt.prg), CBHD
    (cbhdconf.app) or Atari's AHDI (hdx.prg).

    (Older versions of them may also have formatted
    hard disk slightly differently.)

    Which of the Atari hard disk formatting utilities
    you tried?

    Do we still care about hard disks that have been formatted with native
    Atari SW, when user can
    mount them in a PC emulator like Hatari, copy
    files to safety and re-format the disk?


    - Eero

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emmanuel Kasper@21:1/5 to All on Tue Oct 27 17:20:02 2020
    Hi Eero
    Le 27/10/2020 à 14:54, Eero Tamminen a écrit :
    Hi,

    On 10/27/20 12:19 PM, Emmanuel Kasper wrote:
    Partitions smaller than 32M, are indeed formatted as FAT16 by GEMDOS.

    Formatted by GEMDOS?

    Hard disk support in Atari TOS requires separate
    hard disk drivers.  Those have utilities for
    hard disk formatting, TOS supports only formatting
    of floppies.


    disktype /dev/mmcblk0p4
    Partition 4: 12.04 MiB (12619776 bytes, 24648 sectors from 139490)
       Type "GEM" (Standard GEMDOS)
       FAT16 file system (hints score 3 of 5)
         Volume size 11.98 MiB (12558336 bytes, 12264 clusters of 1 KiB)

    This is not a problem whatsoever for Linux: those small FAT16 partitions
    are handled correctly by fsck and mount, without forcing a fat type or
    option, and are working correcting in TOS too.

    There are many historical hard disk drivers and
    formatting utilities for Atari.  I think the only
    still maintained (commercial) one is HD Driver
    (hddrutil.app):
        https://www.hddriver.net/en/

    But in theory users might still have hard disks
    formatted by the older hard disk programs like
    Cécile (cc_tools.app), ICDPro (icdfmt.prg), CBHD
    (cbhdconf.app) or Atari's AHDI (hdx.prg).

    (Older versions of them may also have formatted
    hard disk slightly differently.)

    Which of the Atari hard disk formatting utilities
    you tried?


    Ha, I did not know that the FAT16 support was coming from the hard disk
    driver ! I used AHDI 5.0 in my test.

    According to the Table in 4.9.1, in http://info-coach.fr/atari/documents/_mydoc/Atari_HD_File_Sytem_Reference_Guide_v1.1b.pdf
    all other hard disk drivers can also access FAT16 partitions < 32 MB.
    I don't know if the other drivers would *create* FAT12 partitions in any
    case, but since the above guide never talks about FAT12, I would be
    suprised if they did.

    Do we still care about hard disks that have been formatted with native
    Atari SW, when user can
    mount them in a PC emulator like Hatari, copy
    files to safety and re-format the disk?

    Personally I don't mind that much about which tool formatted the hard
    disk, I was only pondering if we need code in the kernel to treat
    smaller partitions as FAT12, when these partitions are created as FAT16
    on the Atari side.

    Emmanuel


    --
    You know an upstream is nice when they even accept m68k patches.
    - John Paul Adrian Glaubitz, Debian OpenJDK maintainer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eero Tamminen@21:1/5 to Emmanuel Kasper on Tue Oct 27 19:40:01 2020
    Hi,

    On 10/27/20 5:59 PM, Emmanuel Kasper wrote:
    Ha, I did not know that the FAT16 support was coming from the hard disk driver ! I used AHDI 5.0 in my test.

    According to the Table in 4.9.1, in http://info-coach.fr/atari/documents/_mydoc/Atari_HD_File_Sytem_Reference_Guide_v1.1b.pdf
    all other hard disk drivers can also access FAT16 partitions < 32 MB.
    I don't know if the other drivers would *create* FAT12 partitions in any case, but since the above guide never talks about FAT12, I would be
    suprised if they did.

    Do we still care about hard disks that have been formatted with native
    Atari SW, when user can
    mount them in a PC emulator like Hatari, copy
    files to safety and re-format the disk?

    Personally I don't mind that much about which tool formatted the hard
    disk, I was only pondering if we need code in the kernel to treat
    smaller partitions as FAT12, when these partitions are created as FAT16
    on the Atari side.

    One can use even Linux tools to create them.
    See "man mkdosfs" -A & -F options.


    - Eero

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Geert Uytterhoeven@21:1/5 to schmitzmic@gmail.com on Mon Nov 2 13:30:02 2020
    Hi Michael,

    On Mon, Oct 26, 2020 at 10:19 PM Michael Schmitz <schmitzmic@gmail.com> wrote:
    On 27/10/20 6:13 AM, Emmanuel Kasper wrote:
    A FAT 12 MS DOS floppy is also correctly mounted via mount without specifying the fat type.

    IMHO the patch is not needed anymore, or is covering a use case I don't see.

    With what you've reported, I can't see what use case this patch would
    have enabled either. For all I care, we should drop the three FAT
    related commits at the head of m68k-queue.


    Thanks. Dropped.

    Gr{oetje,eeting}s,

    Geert

    --
    Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

    In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
    -- Linus Torvalds

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)