// SPDX-License-Identifier: GPL-2.0-or-later /* -*- linux-c -*- ------------------------------------------------------- * * * Copyright 2001 H. Peter Anvin - All Rights Reserved * * ----------------------------------------------------------------------- */ /* * linux/fs/isofs/compress.c * * Transparent decompression of files on an iso9660 filesystem */ #include <linux/module.h> #include <linux/init.h> #include <linux/bio.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/zlib.h> #include "isofs.h" #include "zisofs.h" /* This should probably be global. */ static char zisofs_sink_page[PAGE_SIZE]; /* * This contains the zlib memory allocation and the mutex for the * allocation; this avoids failures at block-decompression time. */ static void *zisofs_zlib_workspace; static DEFINE_MUTEX(zisofs_zlib_lock); /* * Read data of @inode from @block_start to @block_end and uncompress * to one zisofs block. Store the data in the @pages array with @pcount * entries. Start storing at offset @poffset of the first page. */ static loff_t zisofs_uncompress_block(struct inode *inode, loff_t block_start, loff_t block_end, int pcount, struct page **pages, unsigned poffset, int *errp) { … } /* * Uncompress data so that pages[full_page] is fully uptodate and possibly * fills in other pages if we have data for them. */ static int zisofs_fill_pages(struct inode *inode, int full_page, int pcount, struct page **pages) { … } /* * When decompressing, we typically obtain more than one page * per reference. We inject the additional pages into the page * cache as a form of readahead. */ static int zisofs_read_folio(struct file *file, struct folio *folio) { … } const struct address_space_operations zisofs_aops = …; int __init zisofs_init(void) { … } void zisofs_cleanup(void) { … }