2013-09-21 17:55:44 +00:00
|
|
|
/*
|
2016-06-07 06:58:31 +00:00
|
|
|
* Copyright (C) 2009-2013 Felix Fietkau <nbd@nbd.name>
|
2013-09-21 17:55:44 +00:00
|
|
|
* Copyright (C) 2009-2013 Gabor Juhos <juhosg@openwrt.org>
|
|
|
|
* Copyright (C) 2012 Jonas Gorski <jogo@openwrt.org>
|
|
|
|
* Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published
|
|
|
|
* by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MTDSPLIT_H
|
|
|
|
#define _MTDSPLIT_H
|
|
|
|
|
2013-09-21 17:56:01 +00:00
|
|
|
#define KERNEL_PART_NAME "kernel"
|
|
|
|
#define ROOTFS_PART_NAME "rootfs"
|
2016-02-01 12:41:53 +00:00
|
|
|
#define UBI_PART_NAME "ubi"
|
2013-09-21 17:56:01 +00:00
|
|
|
|
2013-09-21 17:55:44 +00:00
|
|
|
#define ROOTFS_SPLIT_NAME "rootfs_data"
|
|
|
|
|
2016-02-01 12:41:41 +00:00
|
|
|
enum mtdsplit_part_type {
|
|
|
|
MTDSPLIT_PART_TYPE_UNK = 0,
|
|
|
|
MTDSPLIT_PART_TYPE_SQUASHFS,
|
|
|
|
MTDSPLIT_PART_TYPE_JFFS2,
|
2016-02-01 12:41:47 +00:00
|
|
|
MTDSPLIT_PART_TYPE_UBI,
|
2016-02-01 12:41:41 +00:00
|
|
|
};
|
|
|
|
|
2013-09-21 17:55:44 +00:00
|
|
|
#ifdef CONFIG_MTD_SPLIT
|
|
|
|
int mtd_get_squashfs_len(struct mtd_info *master,
|
|
|
|
size_t offset,
|
|
|
|
size_t *squashfs_len);
|
2013-09-21 17:55:54 +00:00
|
|
|
|
2016-02-01 12:41:41 +00:00
|
|
|
int mtd_check_rootfs_magic(struct mtd_info *mtd, size_t offset,
|
|
|
|
enum mtdsplit_part_type *type);
|
2013-09-21 17:55:54 +00:00
|
|
|
|
|
|
|
int mtd_find_rootfs_from(struct mtd_info *mtd,
|
|
|
|
size_t from,
|
|
|
|
size_t limit,
|
2016-02-01 12:41:41 +00:00
|
|
|
size_t *ret_offset,
|
|
|
|
enum mtdsplit_part_type *type);
|
2013-09-21 17:55:54 +00:00
|
|
|
|
2013-09-21 17:55:44 +00:00
|
|
|
#else
|
|
|
|
static inline int mtd_get_squashfs_len(struct mtd_info *master,
|
|
|
|
size_t offset,
|
|
|
|
size_t *squashfs_len)
|
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
2013-09-21 17:55:54 +00:00
|
|
|
|
2016-02-01 12:41:41 +00:00
|
|
|
static inline int mtd_check_rootfs_magic(struct mtd_info *mtd, size_t offset,
|
|
|
|
enum mtdsplit_part_type *type)
|
2013-09-21 17:55:54 +00:00
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mtd_find_rootfs_from(struct mtd_info *mtd,
|
|
|
|
size_t from,
|
|
|
|
size_t limit,
|
2016-02-01 12:41:41 +00:00
|
|
|
size_t *ret_offset,
|
|
|
|
enum mtdsplit_part_type *type)
|
2013-09-21 17:55:54 +00:00
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_MTD_SPLIT */
|
2013-09-21 17:55:44 +00:00
|
|
|
|
|
|
|
#endif /* _MTDSPLIT_H */
|