package resize_fat::info_sector; use diagnostics; use strict; use common; use resize_fat::io; #- Oops, this will be unresizable on big-endian machine. trapped by signature. my $format = "a484 I I I a16"; my @fields = ( 'unused', 'signature', #- should be 0x61417272 'free_clusters', #- -1 for unknown 'next_cluster', #- most recently allocated cluster 'unused2', ); 1; sub read($) { my ($fs) = @_; my $info = resize_fat::io::read($fs, $fs->{info_offset}, psizeof($format)); @{$fs->{info_sector}}{@fields} = unpack $format, $info; $fs->{info_sector}{signature} == 0x61417272 or die "Invalid information sector signature\n"; } sub write($) { my ($fs) = @_; $fs->{info_sector}{free_clusters} = $fs->{clusters}{count}{free}; $fs->{info_sector}{next_cluster} = 2; my $info = pack $format, @{$fs->{info_sector}}{@fields}; resize_fat::io::write($fs, $fs->{info_offset}, psizeof($format), $info); } B͕"IlprA+ Y,&H=>v0y_Jc8!`uЇ M !TZ bFʺV5H^;F|Sm8Xe!s"^J nr'MIЏ>q{0]Nn!^87O7aШt[8ZlTBa ny< ѱ;y`¤PO?.jAF |7z~WtMQzE.EHD1+5IڦA}8#,nNݚWYmUpM3o!Sa ՅeW5~ayV8-?H~blVB)6|L [,:)M|LgSYUS> 0e_[ub\5apMĨ}6l }=tzG5XϯvڠWIYa%a;,[~j\y8_x=4:Y 0f>6nbI/%u%&V\Vm=` \.rY;OsMsW/#E>`ۘ\r