1 /*
2 * JFFS2 -- Journalling Flash File System, Version 2.
3 *
4 * Copyright © 2001-2007 Red Hat, Inc.
5 * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
6 *
7 * Created by David Woodhouse <dwmw2@infradead.org>
8 *
9 * For licensing information, see the file 'LICENCE' in this directory.
10 *
11 */
12 #include "los_vm_common.h"
13
14 #include "nodelist.h"
15 #include "vfs_jffs2.h"
16
17
18 static unsigned char gc_buffer[PAGE_SIZE]; //avoids malloc when user may be under memory pressure
19
20
jffs2_gc_fetch_page(struct jffs2_sb_info * c,struct jffs2_inode_info * f,unsigned long offset,unsigned long * priv)21 unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
22 struct jffs2_inode_info *f,
23 unsigned long offset,
24 unsigned long *priv)
25 {
26 /* FIXME: This works only with one file system mounted at a time */
27 int ret;
28
29 ret = jffs2_read_inode_range(c, f, gc_buffer,
30 offset & ~(PAGE_SIZE-1), PAGE_SIZE);
31 if (ret)
32 return ERR_PTR(ret);
33
34 return gc_buffer;
35 }
jffs2_gc_release_page(struct jffs2_sb_info * c,unsigned char * ptr,unsigned long * priv)36 void jffs2_gc_release_page(struct jffs2_sb_info *c,
37 unsigned char *ptr,
38 unsigned long *priv)
39 {
40 /* Do nothing */
41 }
42
43