X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=common%2Ftransformation_null.c;fp=common%2Ftransformation_null.c;h=6f257526f5c58bae66a2e6a001d6b73ede3905ef;hp=0000000000000000000000000000000000000000;hb=e3956dfb7715a21919aa66dd4209a2dc1c3c82da;hpb=acf85e7a305b04b699e17104be519912a7ae90f0 diff --git a/common/transformation_null.c b/common/transformation_null.c new file mode 100644 index 0000000..6f25752 --- /dev/null +++ b/common/transformation_null.c @@ -0,0 +1,94 @@ +#include +#include + +#include "transformation.h" + +/* + * Initialize + */ +static int +null_initialize(Transformation *xform, int enc) +{ + return 0; +} + +/* + * Shut down. + */ +static int +null_shutdown(Transformation *xform) +{ + return 0; +} + +/* + * Handle fork. + */ +static int +null_startNewTape(Transformation *xform, struct tapebuf *tpbin, + unsigned long *destlen) +{ + return 0; +} + +/* + * Start slave process. + */ +static int +null_startDiskIOProcess(Transformation *xform) +{ + return 0; +} + +/* + * End slave process. + */ +static int +null_endDiskIOProcess(Transformation *xform) +{ + return 0; +} + +/* + * Compress a buffer. + */ +static int +null_compress(Transformation *xform, struct tapebuf *tpbin, unsigned long *destlen, + const char *src, int srclen) +{ + memcpy(tpbin->buf, src, srclen); + *destlen = srclen; + + return 1; +} + +/* + * Decompress a buffer. + */ +static int +null_decompress(Transformation *xform, struct tapebuf *tpbin, unsigned long *destlen, + const char *src, int srclen, char **reason) +{ + memcpy(tpbin->buf, src, srclen); + *destlen = srclen; + + return 1; +} + +/* + * + */ +Transformation transformation_null = +{ + 0, + NULL, + "null", + 0, + &null_initialize, + &null_shutdown, + &null_startNewTape, + &null_startDiskIOProcess, + &null_endDiskIOProcess, + &null_compress, + &null_decompress +};