[PATCH v6 3/5] vvfat: Fix wrong checks for cluster mappings invariant

2024-07-20 Thread Amjad Alsharafi
_index` for the first mapping, but since `first_mapping_index` is only used here, another approach is to just check manually for the `mapping->first_mapping_index != -1` since we know that this is the value for the only entry where `offset == 0` (i.e. first mapping). Signed-off-by: Amjad Alsharafi

[PATCH v6 4/5] vvfat: Fix reading files with non-continuous clusters

2024-07-20 Thread Amjad Alsharafi
dn't open anything) we will get the offset into the file with `s->cluster_size*(cluster_num-s->current_mapping->begin)`, which will give us `0x2000 * (504-500)`, which is out of bound for this mapping and will produce some issues. Signed-off-by: Amjad Alsharafi --- block/vvfat.c | 10

[PATCH v6 5/5] iotests: Add `vvfat` tests

2024-07-20 Thread Amjad Alsharafi
Added several tests to verify the implementation of the vvfat driver. We needed a way to interact with it, so created a basic `fat16.py` driver that handled writing correct sectors for us. Added `vvfat` to the non-generic formats, as its not a normal image format. Signed-off-by: Amjad Alsharafi

[PATCH v6 1/5] vvfat: Fix bug in writing to middle of file

2024-07-20 Thread Amjad Alsharafi
!< offset=0x2000`, thus not fetching the next cluster. Signed-off-by: Amjad Alsharafi Reviewed-by: Kevin Wolf Tested-by: Kevin Wolf --- block/vvfat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 9d050ba3ae..19da009a5b 100

[PATCH v6 0/5] vvfat: Fix write bugs for large files and add iotests

2024-07-20 Thread Amjad Alsharafi
in vvfat Amjad Alsharafi (5): vvfat: Fix bug in writing to middle of file vvfat: Fix usage of `info.file.offset` vvfat: Fix wrong checks for cluster mappings invariant vvfat: Fix reading files with non-continuous clusters iotests: Add `vvfat` tests block/vvfat.c | 34

[PATCH v6 2/5] vvfat: Fix usage of `info.file.offset`

2024-07-20 Thread Amjad Alsharafi
The field is marked as "the offset in the file (in clusters)", but it was being used like this `cluster_size*(nums)+mapping->info.file.offset`, which is incorrect. Signed-off-by: Amjad Alsharafi Reviewed-by: Kevin Wolf --- block/vvfat.c | 11 +++ 1 file changed, 7 ins

Re: [PATCH v5 4/5] vvfat: Fix reading files with non-continuous clusters

2024-07-18 Thread Amjad Alsharafi
On Jul 19 2024, at 8:20 am, Amjad Alsharafi wrote: > On Thu, Jul 18, 2024 at 05:20:36PM +0200, Kevin Wolf wrote: >> Am 12.06.2024 um 14:43 hat Amjad Alsharafi geschrieben: >> > When reading with `read_cluster` we get the `mapping` with >> > `find_mapping_fo

Re: [PATCH v5 4/5] vvfat: Fix reading files with non-continuous clusters

2024-07-18 Thread Amjad Alsharafi
On Thu, Jul 18, 2024 at 05:20:36PM +0200, Kevin Wolf wrote: > Am 12.06.2024 um 14:43 hat Amjad Alsharafi geschrieben: > > When reading with `read_cluster` we get the `mapping` with > > `find_mapping_for_cluster` and then we call `open_file` for this > > mapping. > >

Re: [PATCH v5 0/5] vvfat: Fix write bugs for large files and add iotests

2024-07-01 Thread Amjad Alsharafi
Can I get review for this patch? Thanks, Best regards, Amjad On Wed, Jun 12, 2024 at 08:43:21PM +0800, Amjad Alsharafi wrote: > These patches fix some bugs found when modifying files in vvfat. > First, there was a bug when writing to the cluster 2 or above of a file, it > will copy th

Re: [PATCH v5 5/5] iotests: Add `vvfat` tests

2024-06-13 Thread Amjad Alsharafi
On Wed, Jun 12, 2024 at 08:43:26PM +0800, Amjad Alsharafi wrote: > Added several tests to verify the implementation of the vvfat driver. > > We needed a way to interact with it, so created a basic `fat16.py` driver > that handled writing correct sectors for us. > > Added

[PATCH v5 4/5] vvfat: Fix reading files with non-continuous clusters

2024-06-12 Thread Amjad Alsharafi
dn't open anything) we will get the offset into the file with `s->cluster_size*(cluster_num-s->current_mapping->begin)`, which will give us `0x2000 * (504-500)`, which is out of bound for this mapping and will produce some issues. Signed-off-by: Amjad Alsharafi ---

[PATCH v5 5/5] iotests: Add `vvfat` tests

2024-06-12 Thread Amjad Alsharafi
Added several tests to verify the implementation of the vvfat driver. We needed a way to interact with it, so created a basic `fat16.py` driver that handled writing correct sectors for us. Added `vvfat` to the non-generic formats, as its not a normal image format. Signed-off-by: Amjad Alsharafi

[PATCH v5 3/5] vvfat: Fix wrong checks for cluster mappings invariant

2024-06-12 Thread Amjad Alsharafi
_index` for the first mapping, but since `first_mapping_index` is only used here, another approach is to just check manually for the `mapping->first_mapping_index != -1` since we know that this is the value for the only entry where `offset == 0` (i.e. first mapping). Signed-off-by: Amjad

[PATCH v5 2/5] vvfat: Fix usage of `info.file.offset`

2024-06-12 Thread Amjad Alsharafi
The field is marked as "the offset in the file (in clusters)", but it was being used like this `cluster_size*(nums)+mapping->info.file.offset`, which is incorrect. Signed-off-by: Amjad Alsharafi --- block/vvfat.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-

[PATCH v5 0/5] vvfat: Fix write bugs for large files and add iotests

2024-06-12 Thread Amjad Alsharafi
: https://patchew.org/QEMU/20240327201231.31046-1-amjadsharaf...@gmail.com/ Fix the issue of writing to the middle of the file in vvfat Amjad Alsharafi (5): vvfat: Fix bug in writing to middle of file vvfat: Fix usage of `info.file.offset` vvfat: Fix wrong checks for cluster mappings

[PATCH v5 1/5] vvfat: Fix bug in writing to middle of file

2024-06-12 Thread Amjad Alsharafi
!< offset=0x2000`, thus not fetching the next cluster. Signed-off-by: Amjad Alsharafi Reviewed-by: Kevin Wolf Tested-by: Kevin Wolf --- block/vvfat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 9d050ba3ae..19da009a5b 100

Re: [PATCH v4 2/4] vvfat: Fix usage of `info.file.offset`

2024-06-11 Thread Amjad Alsharafi
On Tue, Jun 11, 2024 at 04:30:53PM +0200, Kevin Wolf wrote: > Am 11.06.2024 um 14:31 hat Amjad Alsharafi geschrieben: > > On Mon, Jun 10, 2024 at 06:49:43PM +0200, Kevin Wolf wrote: > > > Am 05.06.2024 um 02:58 hat Amjad Alsharafi geschrieben: > > > > The field is mar

Re: [PATCH v4 2/4] vvfat: Fix usage of `info.file.offset`

2024-06-11 Thread Amjad Alsharafi
On Mon, Jun 10, 2024 at 06:49:43PM +0200, Kevin Wolf wrote: > Am 05.06.2024 um 02:58 hat Amjad Alsharafi geschrieben: > > The field is marked as "the offset in the file (in clusters)", but it > > was being used like this > > `cluster_size*(nums)+mapping->inf

Re: [PATCH v4 4/4] iotests: Add `vvfat` tests

2024-06-10 Thread Amjad Alsharafi
On Mon, Jun 10, 2024 at 02:01:24PM +0200, Kevin Wolf wrote: > Am 05.06.2024 um 02:58 hat Amjad Alsharafi geschrieben: > > Added several tests to verify the implementation of the vvfat driver. > > > > We needed a way to interact with it, so created a basic `fat16.py` dri

[PATCH v4 4/4] iotests: Add `vvfat` tests

2024-06-04 Thread Amjad Alsharafi
sts/fat16.py new file mode 100644 index 00..baf801b4d5 --- /dev/null +++ b/tests/qemu-iotests/fat16.py @@ -0,0 +1,635 @@ +# A simple FAT16 driver that is used to test the `vvfat` driver in QEMU. +# +# Copyright (C) 2024 Amjad Alsharafi +# +# This program is free software; you can redistrib

[PATCH v4 2/4] vvfat: Fix usage of `info.file.offset`

2024-06-04 Thread Amjad Alsharafi
new clusters for files, and its inevitable that we reach this condition when doing that if the clusters are not after one another, so there is no reason to `abort` here, execution continues and the new clusters are written to disk correctly. Signed-off-by: Amjad Alsharafi --- block/vvfat.c | 12 +++

[PATCH v4 3/4] vvfat: Fix reading files with non-continuous clusters

2024-06-04 Thread Amjad Alsharafi
dn't open anything) we will get the offset into the file with `s->cluster_size*(cluster_num-s->current_mapping->begin)`, which will give us `0x2000 * (504-500)`, which is out of bound for this mapping and will produce some issues. Signed-off-by: Amjad Alsharafi ---

[PATCH v4 1/4] vvfat: Fix bug in writing to middle of file

2024-06-04 Thread Amjad Alsharafi
!< offset=0x2000`, thus not fetching the next cluster. Signed-off-by: Amjad Alsharafi Reviewed-by: Kevin Wolf Tested-by: Kevin Wolf --- block/vvfat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 9d050ba3ae..19da009a5b 100

[PATCH v4 0/4] vvfat: Fix write bugs for large files and add iotests

2024-06-04 Thread Amjad Alsharafi
/ Fix the issue of writing to the middle of the file in vvfat Amjad Alsharafi (4): vvfat: Fix bug in writing to middle of file vvfat: Fix usage of `info.file.offset` vvfat: Fix reading files with non-continuous clusters iotests: Add `vvfat` tests block/vvfat.c | 38

Re: [PATCH v3 0/6] vvfat: Fix write bugs for large files and add iotests

2024-06-04 Thread Amjad Alsharafi
On Fri, May 31, 2024 at 07:22:49PM +0200, Kevin Wolf wrote: > Am 26.05.2024 um 11:56 hat Amjad Alsharafi geschrieben: > > These patches fix some bugs found when modifying files in vvfat. > > First, there was a bug when writing to the cluster 2 or above of a file, it > >

[PATCH v3 1/6] vvfat: Fix bug in writing to middle of file

2024-05-26 Thread Amjad Alsharafi
!< offset=0x2000`, thus not fetching the next cluster. Signed-off-by: Amjad Alsharafi --- block/vvfat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 9d050ba3ae..ab342f0743 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2525,7 +252

[PATCH v3 6/6] iotests: Add `create_file` test for `vvfat` driver

2024-05-26 Thread Amjad Alsharafi
We test the ability to create new files in the filesystem, this is done by adding an entry in the desired directory list. The file will also be created in the host filesystem with matching filename. Signed-off-by: Amjad Alsharafi --- tests/qemu-iotests/fat16.py| 124

[PATCH v3 0/6] vvfat: Fix write bugs for large files and add iotests

2024-05-26 Thread Amjad Alsharafi
Amjad Alsharafi (6): vvfat: Fix bug in writing to middle of file vvfat: Fix usage of `info.file.offset` vvfat: Fix reading files with non-continuous clusters iotests: Add `vvfat` tests iotests: Filter out `vvfat` fmt from failing tests iotests: Add `create_file` test for `vvfat` driver

[PATCH v3 2/6] vvfat: Fix usage of `info.file.offset`

2024-05-26 Thread Amjad Alsharafi
new clusters for files, and its inevitable that we reach this condition when doing that if the clusters are not after one another, so there is no reason to `abort` here, execution continues and the new clusters are written to disk correctly. Signed-off-by: Amjad Alsharafi --- block/vvfat.c | 9

[PATCH v3 5/6] iotests: Filter out `vvfat` fmt from failing tests

2024-05-26 Thread Amjad Alsharafi
`vvfat` is a special format and not all tests (even generic) can run without crashing. So, added `unsupported_fmt: vvfat` to all failling tests. Also added `vvfat` format into `meson.build`, vvfaat tests can be run on the `block-thorough` suite. Signed-off-by: Amjad Alsharafi --- .gitlab

[PATCH v3 4/6] iotests: Add `vvfat` tests

2024-05-26 Thread Amjad Alsharafi
Added several tests to verify the implementation of the vvfat driver. We needed a way to interact with it, so created a basic `fat16.py` driver that handled writing correct sectors for us. Signed-off-by: Amjad Alsharafi --- tests/qemu-iotests/check | 2 +- tests/qemu-iotests/fat16

[PATCH v3 3/6] vvfat: Fix reading files with non-continuous clusters

2024-05-26 Thread Amjad Alsharafi
dn't open anything) we will get the offset into the file with `s->cluster_size*(cluster_num-s->current_mapping->begin)`, which will give us `0x2000 * (504-500)`, which is out of bound for this mapping and will produce some issues. Signed-off-by: Amjad Alsharafi ---

Re: [PATCH v2 0/5] vvfat: Fix write bugs for large files and add iotests

2024-05-04 Thread Amjad Alsharafi
, Amjad Alsharafi wrote: > v2: > Added iotests for `vvfat` driver along with a simple `fat16` module to run > the tests. > > v1: > https://patchew.org/QEMU/20240327201231.31046-1-amjadsharaf...@gmail.com/ > Fix the issue of writing to the middle of the file in vvfat &

[PATCH v2 4/5] iotests: Add `vvfat` tests

2024-05-04 Thread Amjad Alsharafi
Added several tests to verify the implementation of the vvfat driver. We needed a way to interact with it, so created a basic `fat16.py` driver that handled writing correct sectors for us. Signed-off-by: Amjad Alsharafi --- tests/qemu-iotests/check | 2 +- tests/qemu-iotests/fat16

[PATCH v2 5/5] iotests: Filter out `vvfat` fmt from failing tests

2024-05-04 Thread Amjad Alsharafi
`vvfat` is a special format and not all tests (even generic) can run without crashing. So, added `unsupported_fmt: vvfat` to all failling tests. Also added `vvfat` format into `meson.build`, vvfaat tests can be run on the `block-thorough` suite. Signed-off-by: Amjad Alsharafi --- .gitlab

[PATCH v2 2/5] vvfat: Fix usage of `info.file.offset`

2024-05-04 Thread Amjad Alsharafi
new clusters for files, and its inevitable that we reach this condition when doing that if the clusters are not after one another, so there is no reason to `abort` here, execution continues and the new clusters are written to disk correctly. Signed-off-by: Amjad Alsharafi --- block/vvfat.c | 9

[PATCH v2 3/5] vvfat: Fix reading files with non-continuous clusters

2024-05-04 Thread Amjad Alsharafi
dn't open anything) we will get the offset into the file with `s->cluster_size*(cluster_num-s->current_mapping->begin)`, which will give us `0x2000 * (504-500)`, which is out of bound for this mapping and will produce some issues. Signed-off-by: Amjad Alsharafi ---

[PATCH v2 0/5] vvfat: Fix write bugs for large files and add iotests

2024-05-04 Thread Amjad Alsharafi
v2: Added iotests for `vvfat` driver along with a simple `fat16` module to run the tests. v1: https://patchew.org/QEMU/20240327201231.31046-1-amjadsharaf...@gmail.com/ Fix the issue of writing to the middle of the file in vvfat Amjad Alsharafi (5): vvfat: Fix bug in writing to middle

[PATCH v2 1/5] vvfat: Fix bug in writing to middle of file

2024-05-04 Thread Amjad Alsharafi
!< offset=0x2000`, thus not fetching the next cluster. Signed-off-by: Amjad Alsharafi --- block/vvfat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 9d050ba3ae..ab342f0743 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2525,7 +252

Re: [PATCH 0/3] vvfat: Fix bugs in writing and reading files -- PING

2024-04-30 Thread Amjad Alsharafi
Ping again On Apr 13 2024, at 5:51 pm, Amjad Alsharafi wrote: > Ping to the vvfat maintainers. >

Re: [PATCH 0/3] vvfat: Fix bugs in writing and reading files -- PING

2024-04-13 Thread Amjad Alsharafi
Ping to the vvfat maintainers.

Re: [PATCH 3/3] ffvat: Fix reading files with non-continuous clusters

2024-03-29 Thread Amjad Alsharafi
I noticed the issue in the commit message 'ffvat' should be 'vvfat', I'll fix it in the next version. On Thu, Mar 28, 2024 at 04:11:27AM +0800, Amjad Alsharafi wrote: > When reading with `read_cluster` we get the `mapping` with > `find_mapping_for_cluster` and then we call `ope

[PATCH 1/3] vvfat: Fix bug in writing to middle of file

2024-03-27 Thread Amjad Alsharafi
!< offset=0x2000`, thus not fetching the next cluster. Signed-off-by: Amjad Alsharafi --- block/vvfat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 9d050ba3ae..ab342f0743 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2525,7 +252

[PATCH 3/3] ffvat: Fix reading files with non-continuous clusters

2024-03-27 Thread Amjad Alsharafi
dn't open anything) we will get the offset into the file with `s->cluster_size*(cluster_num-s->current_mapping->begin)`, which will give us `0x2000 * (504-500)`, which is out of bound for this mapping and will produce some issues. Signed-off-by: Amjad Alsharafi ---

[PATCH 0/3] vvfat: Fix bugs in writing and reading files

2024-03-27 Thread Amjad Alsharafi
These patches fix some bugs found when modifying files in vvfat. First, there was a bug when writing to the second+ cluster of a file, it will copy the cluster before it instead. Another issue was modifying the clusters of a file and adding new clusters, this showed 2 issues: - If the new

[PATCH 2/3] vvfat: Fix usage of `info.file.offset`

2024-03-27 Thread Amjad Alsharafi
new clusters for files, and its inevitable that we reach this condition when doing that if the clusters are not after one another, so there is no reason to `abort` here, execution continues and the new clusters are written to disk correctly. Signed-off-by: Amjad Alsharafi --- block/vvfat.c | 9