xref: /rk3399_rockchip-uboot/fs/ext4/ext4_common.h (revision a1596438a68921d2c9b1fdec70a720d38c85ca7d)
1 /*
2  * (C) Copyright 2011 - 2012 Samsung Electronics
3  * EXT4 filesystem implementation in Uboot by
4  * Uma Shankar <uma.shankar@samsung.com>
5  * Manjunatha C Achar <a.manjunatha@samsung.com>
6  *
7  * ext4ls and ext4load :  based on ext2 ls load support in Uboot.
8  *
9  * (C) Copyright 2004
10  * esd gmbh <www.esd-electronics.com>
11  * Reinhard Arlt <reinhard.arlt@esd-electronics.com>
12  *
13  * based on code from grub2 fs/ext2.c and fs/fshelp.c by
14  * GRUB  --  GRand Unified Bootloader
15  * Copyright (C) 2003, 2004  Free Software Foundation, Inc.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 2 of the License, or
20  * (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30  */
31 
32 #ifndef __EXT4_COMMON__
33 #define __EXT4_COMMON__
34 #include <ext_common.h>
35 #include <ext4fs.h>
36 #include <malloc.h>
37 #include <asm/errno.h>
38 
39 #define YES		1
40 #define NO		0
41 #define TRUE		1
42 #define FALSE		0
43 #define RECOVER	1
44 #define SCAN		0
45 
46 #define S_IFLNK		0120000		/* symbolic link */
47 #define BLOCK_NO_ONE		1
48 #define SUPERBLOCK_SECTOR	2
49 #define SUPERBLOCK_SIZE	1024
50 #define F_FILE			1
51 
52 #define zalloc(size) calloc(1, size)
53 
54 extern unsigned long part_offset;
55 int ext4fs_read_inode(struct ext2_data *data, int ino,
56 		      struct ext2_inode *inode);
57 int ext4fs_read_file(struct ext2fs_node *node, int pos,
58 		unsigned int len, char *buf);
59 int ext4fs_find_file(const char *path, struct ext2fs_node *rootnode,
60 			struct ext2fs_node **foundnode, int expecttype);
61 int ext4fs_iterate_dir(struct ext2fs_node *dir, char *name,
62 			struct ext2fs_node **fnode, int *ftype);
63 #endif
64