1c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse/*
2c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse * JFFS2 -- Journalling Flash File System, Version 2.
3c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse *
4c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse * Copyright © 2001-2007 Red Hat, Inc.
56088c0587706b2cf21ce50c11576718bff5fae0cDavid Woodhouse * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
6c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse *
7c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse * Created by David Woodhouse <dwmw2@infradead.org>
8c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse *
9c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse * For licensing information, see the file 'LICENCE' in this directory.
10c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse *
11c00c310eac04a28d2143368ae988716792ed53ceDavid Woodhouse */
121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _JFFS2_FS_I
141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _JFFS2_FS_I
151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/rbtree.h>
17aa98d7cf59b5b0764d3502662053489585faf2feKaiGai Kohei#include <linux/posix_acl.h>
18cf9d1e428cc28ef5798aeda0822a6ce64849a439David Woodhouse#include <linux/mutex.h>
191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct jffs2_inode_info {
211b1dcc1b57a49136f118a0f16367256ff9994a69Jes Sorensen	/* We need an internal mutex similar to inode->i_mutex.
221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	   Unfortunately, we can't used the existing one, because
231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	   either the GC would deadlock, or we'd have to release it
241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	   before letting GC proceed. Or we'd have to put ugliness
251b1dcc1b57a49136f118a0f16367256ff9994a69Jes Sorensen	   into the GC code so it didn't attempt to obtain the i_mutex
261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	   for the inode(s) which are already locked */
27ced22070363ef50e4a47aadd003a81ebeaa3f917David Woodhouse	struct mutex sem;
281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* The highest (datanode) version number used for this ino */
301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	uint32_t highest_version;
311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* List of data fragments which make up the file */
331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	struct rb_root fragtree;
341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* There may be one datanode which isn't referenced by any of the
361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	   above fragments, if it contains a metadata update but no actual
371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	   data - or if this is a directory inode */
38182ec4eee397543101a6db8906ed88727d3f7e53Thomas Gleixner	/* This also holds the _only_ dnode for symlinks/device nodes,
391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	   etc. */
401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	struct jffs2_full_dnode *metadata;
411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* Directory entries */
431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	struct jffs2_full_dirent *dents;
441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
452b79adcca147c9f8fd1094ab4cb342d7e1790d70Artem B. Bityutskiy	/* The target path if this is the inode of a symlink */
462b79adcca147c9f8fd1094ab4cb342d7e1790d70Artem B. Bityutskiy	unsigned char *target;
472b79adcca147c9f8fd1094ab4cb342d7e1790d70Artem B. Bityutskiy
481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* Some stuff we just have to keep in-core at all times, for each inode. */
491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	struct jffs2_inode_cache *inocache;
501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	uint16_t flags;
521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	uint8_t usercompr;
531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	struct inode vfs_inode;
541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _JFFS2_FS_I */
57