| View previous topic :: View next topic |
| Author |
Message |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Thu Nov 24, 2005 9:32 am Post subject: hdd partition size |
|
|
When using dread on hdd:/ I get partition sizes that are a factor of 1024 too small.
In fioGetStatFiller of hdd_fio.c the size is returned like this:
| Code: | | stat->size=clink->header->length; |
Here size should be in bytes but what is length measured in? length is part of the apa_header structure.
To fix this I will change it to:
| Code: | | stat->size=clink->header->length * 1024; |
Do people agree with this? |
|
| Back to top |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Fri Nov 25, 2005 5:57 am Post subject: |
|
|
Wouldn't that break proper support for partitions larger than 4GB? _________________ GE Dominator |
|
| Back to top |
|
 |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Fri Nov 25, 2005 9:05 am Post subject: |
|
|
| That change would. I have made a slightly more complicated change using the hisize variable as well. Using hisize in combination with size you get a 64 bit integer, big enough for much larger than 4GB. |
|
| Back to top |
|
 |
weltall
Joined: 20 Feb 2004 Posts: 310
|
Posted: Fri Nov 25, 2005 4:48 pm Post subject: |
|
|
| personally i don't see that support for >4gb partition i just get wrong size and then problem with the free space (4gb = 4gb 5gb = 1gb 10gb = 2gb and so on) at lest with ps2pfs |
|
| Back to top |
|
 |
EP
Joined: 05 Nov 2005 Posts: 39
|
Posted: Sat Dec 10, 2005 12:21 pm Post subject: |
|
|
Radad, here are some issues I came across with your latest change to hdd_fio.c.
1. It won't compile with the older iop-2.8.1 compiler.
2. It still messes up size. Here is my list of partitions and the size of the partitions in bytes:
| Code: | Name size before size now partition size
__boot 1048576 1073741824 512MB (536870912)
+MAIN 1048576 1073741824 512MB (536870912)
+MP3 1048576 1073741824 512MB (536870912)
+NEW1 1048576 1073741824 512MB (536870912)
+NEW2 8388608 0 4096MB (4294967296)
+NEW3 2097152 2147483648 1024MB (1073741824)
+NEW4 262144 268435456 128MB (134217728)
PGEN 1.1 262144 268435456 128MB (134217728)
PS2OS 262144 268435456 128MB (134217728)
|
As you can see stat.size still isn't quite right yet. The maximum working partition size is 4096MB and it now shows up as 0.
Anyway I changed this from:
| Code: | apa_header *header;
stat->mode=clink->header->type;
stat->attr=clink->header->flags;
stat->hisize=0;
u64 size = clink->header->length;
size *= 1024;
stat->size=size & 0xFFFFFFFF;
size >>= 32;
stat->hisize=size & 0xFFFFFFFF;
header=clink->header; |
To this: (Note: this is compatible with the older iop compiler just declare size variable at the beginning).
| Code: | apa_header *header;
u64 size;
stat->mode=clink->header->type;
stat->attr=clink->header->flags;
stat->hisize=0;
size = clink->header->length;
size *= 512;
stat->size=size & 0xFFFFFFFF;
size >>= 32;
stat->hisize=size & 0xFFFFFFFF;
header=clink->header; |
My noted changes above results in:
| Code: | Name size partition size
__boot 536870912 512MB (536870912)
+MAIN 536870912 512MB (536870912)
+MP3 536870912 512MB (536870912)
+NEW1 536870912 512MB (536870912)
+NEW2 0 4096MB (4294967296)
+NEW3 1073741824 1024MB (1073741824)
+NEW4 134217728 128MB (134217728)
PGEN 1.1 134217728 128MB (134217728)
PS2OS 134217728 128MB (134217728) |
OK, so hisize is what you use to get the other part of the size. So for example in another program:
| Code: | if( hisize > 0 )
totalSize = 4294967295 + hisize;
else
totalSize = size; |
If that's right, then I understand how it works now. Radad, I'll let you decide on my two slight changes. Thanks.
Last edited by EP on Sun Dec 11, 2005 5:19 pm; edited 1 time in total |
|
| Back to top |
|
 |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Sat Dec 10, 2005 5:38 pm Post subject: |
|
|
| EP wrote: | OK, so hisize is what you use to get the other part of the size. So for example in another program:
| Code: | if( hisize > 0 )
totalSize = 4294967295 + hisize;
else
totalSize = size; |
If that's right, then I understand how it works now. Radad, I'll let you decide on my two slight changes. Thanks. |
No its more like:
| Code: | | totalSize = hisize << 32 + size; |
As for the change from 1024 to 512, I will have to look into it again as 1024 works for me. |
|
| Back to top |
|
 |
EP
Joined: 05 Nov 2005 Posts: 39
|
Posted: Sun Dec 11, 2005 5:18 pm Post subject: |
|
|
| radad wrote: | No its more like:
| Code: | | totalSize = hisize << 32 + size; |
|
Yeah OK, bit shift operator making use of both size and highsize. I just wonder how to convert u64 integers to string. I saw somewhere that printf can't handle 64-bit integers. I tried it and that's most likely why I only get zero for my +NEW2 partition. It only converts the first 32 bits and thats all.
ex.
| Code: | u64 max = 0xFFFFFFFFFFFFFFFF; // as big as it gets
char buffer[21];
sprintf(buffer, "%Lu", max);
printf("Max size is %s\n", buffer); |
It results in "Max Size is 4294967295". It should be "18446744073709551615" so it only evaluates max as being 0xFFFFFFFF. Maybe it's easier than I'm making it out to be since I'm not really accustomed to C programming.
edit:
tried u64 values with an itoa function and get:
undefined reference to `__umoddi3'
undefined reference to `__udivdi3'
Can't divide or use modulo with a 64-bit integer. So is there any other way to simply take the two u32 values(hi and low side) and put them together into a string representation in base 10 format? All I need is the actual total size listed in a string format of base 10. Thanks
| radad wrote: | | As for the change from 1024 to 512, I will have to look into it again as 1024 works for me. |
Multiplying by 512 instead of 1024 looks right and appears to be more mathematically sound.
ex. using 1024
128 Megabytes != 268435456 Bytes, but 256 Megabytes ~= 268435456 Bytes
ex. using 512
128 Megabytes ~= 134217728 Bytes |
|
| Back to top |
|
 |
EP
Joined: 05 Nov 2005 Posts: 39
|
Posted: Mon Dec 19, 2005 5:30 am Post subject: |
|
|
OK, I got what I wanted working so no further assistance is needed. I did use my two noted changes to hdd_fio.c. Here are the final results:
| Code: | dr-------- 1 ps2 ps2 536870912 Feb 8 2005 __boot
dr-------- 1 ps2 ps2 536870912 Feb 8 2005 +MAIN
dr-------- 1 ps2 ps2 536870912 Feb 8 2005 +MP3
dr-------- 1 ps2 ps2 536870912 Feb 8 2005 +NEW1
dr-------- 1 ps2 ps2 4294967296 Feb 8 2005 +NEW2
dr-------- 1 ps2 ps2 1073741824 Feb 8 2005 +NEW3
dr-------- 1 ps2 ps2 134217728 Feb 8 2005 +NEW4
dr-------- 1 ps2 ps2 134217728 Oct 9 2011 PGEN 1.1
dr-------- 1 ps2 ps2 134217728 Feb 8 2005 PS2OS |
|
|
| Back to top |
|
 |
|