Linux Audio

Check our new training course

Loading...
v4.6
 
 1/*
 2 * Copyright (c) 2013
 3 * Phillip Lougher <phillip@squashfs.org.uk>
 4 *
 5 * This work is licensed under the terms of the GNU GPL, version 2. See
 6 * the COPYING file in the top-level directory.
 7 */
 8
 9#include <linux/fs.h>
10#include <linux/vfs.h>
11#include <linux/kernel.h>
12#include <linux/slab.h>
13#include <linux/string.h>
14#include <linux/pagemap.h>
15#include <linux/mutex.h>
16
17#include "squashfs_fs.h"
18#include "squashfs_fs_sb.h"
19#include "squashfs_fs_i.h"
20#include "squashfs.h"
21
22/* Read separately compressed datablock and memcopy into page cache */
23int squashfs_readpage_block(struct page *page, u64 block, int bsize)
24{
25	struct inode *i = page->mapping->host;
26	struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb,
27		block, bsize);
28	int res = buffer->error;
29
30	if (res)
31		ERROR("Unable to read page, block %llx, size %x\n", block,
32			bsize);
33	else
34		squashfs_copy_cache(page, buffer, buffer->length, 0);
35
36	squashfs_cache_put(buffer);
37	return res;
38}
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * Copyright (c) 2013
 4 * Phillip Lougher <phillip@squashfs.org.uk>
 
 
 
 5 */
 6
 7#include <linux/fs.h>
 8#include <linux/vfs.h>
 9#include <linux/kernel.h>
10#include <linux/slab.h>
11#include <linux/string.h>
12#include <linux/pagemap.h>
13#include <linux/mutex.h>
14
15#include "squashfs_fs.h"
16#include "squashfs_fs_sb.h"
17#include "squashfs_fs_i.h"
18#include "squashfs.h"
19
20/* Read separately compressed datablock and memcopy into page cache */
21int squashfs_readpage_block(struct page *page, u64 block, int bsize, int expected)
22{
23	struct inode *i = page->mapping->host;
24	struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb,
25		block, bsize);
26	int res = buffer->error;
27
28	if (res)
29		ERROR("Unable to read page, block %llx, size %x\n", block,
30			bsize);
31	else
32		squashfs_copy_cache(page, buffer, expected, 0);
33
34	squashfs_cache_put(buffer);
35	return res;
36}