blob: 163a9bbc0e0421a03f0a5dc2c4074c0886a19dae [file] [log] [blame]
stroesebcd0be52004-12-16 17:33:10 +00001/*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4 *
5 * (C) Copyright 2003 Sysgo Real-Time Solutions, AG <www.elinos.com>
6 * Pavel Bartusek <pba@sysgo.de>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23/* An implementation for the Ext2FS filesystem ported from GRUB.
24 * Some parts of this code (mainly the structures and defines) are
25 * from the original ext2 fs code, as found in the linux kernel.
26 */
27
28
29#define SECTOR_SIZE 0x200
30#define SECTOR_BITS 9
31
32/* Error codes */
33typedef enum
34{
35 ERR_NONE = 0,
36 ERR_BAD_FILENAME,
37 ERR_BAD_FILETYPE,
38 ERR_BAD_GZIP_DATA,
39 ERR_BAD_GZIP_HEADER,
40 ERR_BAD_PART_TABLE,
41 ERR_BAD_VERSION,
42 ERR_BELOW_1MB,
43 ERR_BOOT_COMMAND,
44 ERR_BOOT_FAILURE,
45 ERR_BOOT_FEATURES,
46 ERR_DEV_FORMAT,
47 ERR_DEV_VALUES,
48 ERR_EXEC_FORMAT,
49 ERR_FILELENGTH,
50 ERR_FILE_NOT_FOUND,
51 ERR_FSYS_CORRUPT,
52 ERR_FSYS_MOUNT,
53 ERR_GEOM,
54 ERR_NEED_LX_KERNEL,
55 ERR_NEED_MB_KERNEL,
56 ERR_NO_DISK,
57 ERR_NO_PART,
58 ERR_NUMBER_PARSING,
59 ERR_OUTSIDE_PART,
60 ERR_READ,
61 ERR_SYMLINK_LOOP,
62 ERR_UNRECOGNIZED,
63 ERR_WONT_FIT,
64 ERR_WRITE,
65 ERR_BAD_ARGUMENT,
66 ERR_UNALIGNED,
67 ERR_PRIVILEGED,
68 ERR_DEV_NEED_INIT,
69 ERR_NO_DISK_SPACE,
70 ERR_NUMBER_OVERFLOW,
71
72 MAX_ERR_NUM
73} ext2fs_error_t;
74
75
76extern int ext2fs_set_blk_dev(block_dev_desc_t *rbdd, int part);
Mike Frysingerc87f6452010-10-20 07:18:09 -040077extern int ext2fs_ls (const char *dirname);
78extern int ext2fs_open (const char *filename);
stroesebcd0be52004-12-16 17:33:10 +000079extern int ext2fs_read (char *buf, unsigned len);
80extern int ext2fs_mount (unsigned part_length);
81extern int ext2fs_close(void);