Skip to content

Commit

Permalink
libbdm: update to new fragment list
Browse files Browse the repository at this point in the history
  • Loading branch information
rickgaiser committed Jun 15, 2022
1 parent 81d4d26 commit 39c6788
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion iop/fs/libbdm/include/bd_defrag.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <usbhdfsd-common.h>


int bd_defrag(struct block_device* bd, struct bd_fraglist* fl, u32 sector, void* buffer, u16 count);
int bd_defrag(struct block_device* bd, u32 fragcount, struct bd_fragment* fraglist, u32 sector, void* buffer, u16 count);



Expand Down
8 changes: 4 additions & 4 deletions iop/fs/libbdm/src/bd_defrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "module_debug.h"


int bd_defrag(struct block_device* bd, struct bd_fraglist* fl, u32 sector, void* buffer, u16 count)
int bd_defrag(struct block_device* bd, u32 fragcount, struct bd_fragment* fraglist, u32 sector, void* buffer, u16 count)
{
u32 sector_start = sector;
u16 count_left = count;
Expand All @@ -16,16 +16,16 @@ int bd_defrag(struct block_device* bd, struct bd_fraglist* fl, u32 sector, void*
int i;

// Locate fragment containing start sector
for (i=0; i<fl->count; i++) {
f = &fl->list[i];
for (i=0; i<fragcount; i++) {
f = &fraglist[i];
if (offset <= sector_start && (offset + f->count) > sector_start) {
// Fragment found
break;
}
offset += f->count;
}

if (i == fl->count) {
if (i == fragcount) {
M_PRINTF("%s: ERROR: fragment not found!\n", __FUNCTION__);
return -1;
}
Expand Down

0 comments on commit 39c6788

Please sign in to comment.