summaryrefslogtreecommitdiffstats
path: root/fs/squashfs/file_cache.c
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2014-01-23 15:52:06 -0500
committerPaul Moore <pmoore@redhat.com>2014-01-23 15:52:06 -0500
commit41be702a542a0d14bb0b1c16e824fa9ed27616ec (patch)
treee48942a05882da47544e179c6a0c920e00137a6a /fs/squashfs/file_cache.c
parent8ed814602876bec9bad2649ca17f34b499357a1c (diff)
parentd8ec26d7f8287f5788a494f56e8814210f0e64be (diff)
downloadop-kernel-dev-41be702a542a0d14bb0b1c16e824fa9ed27616ec.zip
op-kernel-dev-41be702a542a0d14bb0b1c16e824fa9ed27616ec.tar.gz
Merge tag 'v3.13' into next
Linux 3.13 Minor fixup needed in selinux_inet_conn_request() Conflicts: security/selinux/hooks.c
Diffstat (limited to 'fs/squashfs/file_cache.c')
-rw-r--r--fs/squashfs/file_cache.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/fs/squashfs/file_cache.c b/fs/squashfs/file_cache.c
new file mode 100644
index 0000000..f2310d2
--- /dev/null
+++ b/fs/squashfs/file_cache.c
@@ -0,0 +1,38 @@
+/*
+ * 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/vfs.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/pagemap.h>
+#include <linux/mutex.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->mapping->host;
+ 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;
+}
OpenPOWER on IntegriCloud