Fork us on GitHub Follow us on Facebook Follow us on Twitter

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#179 closed defect (fixed)

Cannot write data to FAT (ENOSPC)

Reported by: Jiri Svoboda Owned by:
Priority: major Milestone: 0.4.2
Component: helenos/unspecified Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also:

Description (last modified by Martin Decky)

As of revision mainline,236 if I create a file system with HelenOS mkfat or dosfstools mkdosfs, I cannot write data to it. Steps to reproduce with ia32 target:

With mkfat:

$ dd if=/dev/zero of=img bs=1024k count=32
$ qemu -m 32 -hda img -cdrom image.iso -boot d
# ata_bd
# mkfat bd/disk0
# mkdir /fat
# mount fat /fat bd/disk0
# mkfile --size 32k /fat/test
mkfile: Error writing file (-259).

With mkdosfs:

$ dd if=/dev/zero of=img bs=1024k count=32
$ losetup /dev/loop0 img
$ mkdosfs /dev/loop0
$ losetup -d /dev/loop0
$ qemu -m 32 -hda img -cdrom image.iso -boot d
# ata_bd
# mount fat /fat bd/disk0
# mkfile --size 32k /fat/test
mkfile: Error writing file (-259).

The situation is similar to ticket #168 but this time even fat with standard root directory size is affected.

Change History (4)

comment:1 Changed 10 years ago by Jakub Jermář

In the example above, the device will have 65536 blocks, which is too big for a FAT16 file system, which has only 16-bit field for the total number of sectors. Thus, ts will be 0 in fat_alloc_clusters() and the sanity check for the phantom clusters will make the allocation fail.

comment:2 Changed 10 years ago by Jakub Jermář

Actually there appears to be some confusion about what FAT16 is (see the Wikipedia article on initial and final version of FAT16). I seem to have implemented the initial version, while the
expected behavior is probably that of the final version.

comment:3 Changed 10 years ago by Jakub Jermář

Resolution: fixed
Status: newclosed

Fixed in changeset:head,250.

comment:4 Changed 10 years ago by Martin Decky

Description: modified (diff)
Note: See TracTickets for help on using tickets.