]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
affs: generate OFS sequence numbers starting at 1
authorSimon Tatham <anakin@pobox.com>
Thu, 20 Feb 2025 08:14:43 +0000 (08:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:33:38 +0000 (14:33 +0200)
commit395041688ba13e5a2b3049915abfde3bbc519c73
treef46d545246bf77d819535c8eab82dae773ba9614
parent499d26188afc8fbb420afcd95527bc9efd518e17
affs: generate OFS sequence numbers starting at 1

[ Upstream commit e4cf8ec4de4e13f156c1d61977d282d90c221085 ]

If I write a file to an OFS floppy image, and try to read it back on
an emulated Amiga running Workbench 1.3, the Amiga reports a disk
error trying to read the file. (That is, it's unable to read it _at
all_, even to copy it to the NIL: device. It isn't a matter of getting
the wrong data and being unable to parse the file format.)

This is because the 'sequence number' field in the OFS data block
header is supposed to be based at 1, but affs writes it based at 0.
All three locations changed by this patch were setting the sequence
number to a variable 'bidx' which was previously obtained by dividing
a file position by bsize, so bidx will naturally use 0 for the first
block. Therefore all three should add 1 to that value before writing
it into the sequence number field.

With this change, the Amiga successfully reads the file.

For data block reference: https://wiki.osdev.org/FFS_(Amiga)

Signed-off-by: Simon Tatham <anakin@pobox.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/affs/file.c