summaryrefslogtreecommitdiffstats
path: root/fs/squashfs/file_cache.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-03-11 10:49:50 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-03-11 10:49:50 +0100
commita0fa6e1d2b6ac59ecb0cf531fb3b37fab636e336 (patch)
tree3c26e206ccf918207fac4c683bbc56f65b2a6431 /fs/squashfs/file_cache.c
parent251ae23e9fa0a5ab88823e63bb18b89706b7ea87 (diff)
parent9eeaa7cce84b9fb4674d5e99fbc0c68cdff8c25a (diff)
downloadbarebox-a0fa6e1d2b6ac59ecb0cf531fb3b37fab636e336.tar.gz
barebox-a0fa6e1d2b6ac59ecb0cf531fb3b37fab636e336.tar.xz
Merge branch 'for-next/squashfs'
Diffstat (limited to 'fs/squashfs/file_cache.c')
-rw-r--r--fs/squashfs/file_cache.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/squashfs/file_cache.c b/fs/squashfs/file_cache.c
new file mode 100644
index 0000000000..9443e4558d
--- /dev/null
+++ b/fs/squashfs/file_cache.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2013
+ * Phillip Lougher <phillip@squashfs.org.uk>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/pagemap.h>
+
+#include "squashfs_fs.h"
+#include "squashfs_fs_sb.h"
+#include "squashfs_fs_i.h"
+#include "squashfs.h"
+
+/* Read separately compressed datablock and memcopy into page cache */
+int squashfs_readpage_block(struct page *page, u64 block, int bsize)
+{
+ struct inode *i = page->inode;
+ struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb,
+ block, bsize);
+ int res = buffer->error;
+
+ if (res)
+ ERROR("Unable to read page, block %llx, size %x\n", block,
+ bsize);
+ else
+ squashfs_copy_cache(page, buffer, buffer->length, 0);
+
+ squashfs_cache_put(buffer);
+ return res;
+}