Some code for Swap Compression

rmoser (mlmoser@comcast.net)
Sat, 26 Apr 2003 19:41:03 -0400


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-7266-1051400825-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

Alright, I'm done with everything except fdecomp_push() and
fcomp_push(). For the decompression function fdecomp_push(),
it fully supports the fcomp-standard streams (the ones I outlined
originally), so the fcomp-extended stuff has to be supported
(simple enough modification. I'm lazy). A very large portion (most
of it) of fcomp_push() needs to be coded; the entire compression
phase is uncoded. The logic is in that function, in comments.
Someone has to read it, look at the format, and write it. After
those two things, this can finally be shoved into a userspace
program and rewritten for the kernel, and also can be preoptimized
(i.e. don't resize the stream so many times in decompression when
it's just copying data).

tar.bz2 attatched. Please please PLEASE make a userspace
program for this as well so that we can get a general idea about
compression ratio. No better way than using it on files.

--Bluefox Icy

--=_courier-7266-1051400825-0001-2
Content-Type: application/octet-stream; name="fcomp.tar.bz2"
Content-Transfer-Encoding: 7bit
Content-disposition: attachment; filename=fcomp.tar.bz2
X-Mime-Autoconverted: from x-uuencode to 7bit by courier 0.39

begin 755 fcomp.tar.bz2
M0EIH.3%!62936=QEER@`':G_A/ZX(B!________>^O____\`!``(8"&/)I(U
M]OF+KHL>]ZO<WM5$]5I*#HT1Q+L[N[J]SWMVZZ>O>JTK/=V[3D;M2"ZO:.SC
MW=RUUI&V7KUQY9V;<SE-G;&[%VS6H/(U+*V.A+(7PDB!"9-,FC00F(T-",D>
MIZ,@3]03$-/4,U-,FC-0T-!D"`(FA!I/29,J>I[4AZFAIA!H```,(``#'#$:
M::#0!H````:#(--`T`&C0!B&@$FDDB--!-!3TTC---3]1J#TC)F2>HTT--`&
M@````(DIHF4R>DD>U1IYJIZ;*>F4T]$GJ-D,1/4'J:'J?JGDFRAY1Y1ZCU/2
M9!$D(1H!1@F@C:FB>30IZGZ*>H\GJ9)H::#0`T:``'K#\[/M]/U]'2N]2H*G
M:M`+KE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