blob: 71d62a8956b28290c54489d067585bd024fb59ba [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/*
2 * Copyright (C) 2009-2013 Felix Fietkau <nbd@nbd.name>
3 * Copyright (C) 2009-2013 Gabor Juhos <juhosg@openwrt.org>
4 * Copyright (C) 2012 Jonas Gorski <jogo@openwrt.org>
5 * Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 *
11 */
12
13#ifndef _MTDSPLIT_H
14#define _MTDSPLIT_H
15
16#define KERNEL_PART_NAME "kernel"
17#define ROOTFS_PART_NAME "rootfs"
18#define UBI_PART_NAME "ubi"
19
20#define ROOTFS_SPLIT_NAME "rootfs_data"
21
22enum mtdsplit_part_type {
23 MTDSPLIT_PART_TYPE_UNK = 0,
24 MTDSPLIT_PART_TYPE_SQUASHFS,
25 MTDSPLIT_PART_TYPE_JFFS2,
26 MTDSPLIT_PART_TYPE_UBI,
27};
28
29#ifdef CONFIG_MTD_SPLIT
30int mtd_get_squashfs_len(struct mtd_info *master,
31 size_t offset,
32 size_t *squashfs_len);
33
34int mtd_check_rootfs_magic(struct mtd_info *mtd, size_t offset,
35 enum mtdsplit_part_type *type);
36
37int mtd_find_rootfs_from(struct mtd_info *mtd,
38 size_t from,
39 size_t limit,
40 size_t *ret_offset,
41 enum mtdsplit_part_type *type);
42
43#else
44static inline int mtd_get_squashfs_len(struct mtd_info *master,
45 size_t offset,
46 size_t *squashfs_len)
47{
48 return -ENODEV;
49}
50
51static inline int mtd_check_rootfs_magic(struct mtd_info *mtd, size_t offset,
52 enum mtdsplit_part_type *type)
53{
54 return -EINVAL;
55}
56
57static inline int mtd_find_rootfs_from(struct mtd_info *mtd,
58 size_t from,
59 size_t limit,
60 size_t *ret_offset,
61 enum mtdsplit_part_type *type)
62{
63 return -ENODEV;
64}
65#endif /* CONFIG_MTD_SPLIT */
66
67#endif /* _MTDSPLIT_H */