1
2
3
4
5
6
7
8
9#ifndef MTD_PARTITIONS_H
10#define MTD_PARTITIONS_H
11
12#include <linux/types.h>
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37struct mtd_partition {
38 char *name;
39 uint64_t size;
40 uint64_t offset;
41 uint32_t mask_flags;
42 struct nand_ecclayout *ecclayout;
43};
44
45#define MTDPART_OFS_NXTBLK (-2)
46#define MTDPART_OFS_APPEND (-1)
47#define MTDPART_SIZ_FULL (0)
48
49
50struct mtd_info;
51
52int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
53int del_mtd_partitions(struct mtd_info *);
54
55
56
57
58
59struct mtd_part_parser {
60 struct list_head list;
61 struct module *owner;
62 const char *name;
63 int (*parse_fn)(struct mtd_info *, struct mtd_partition **, unsigned long);
64};
65
66extern int register_mtd_parser(struct mtd_part_parser *parser);
67extern int deregister_mtd_parser(struct mtd_part_parser *parser);
68extern int parse_mtd_partitions(struct mtd_info *master, const char **types,
69 struct mtd_partition **pparts, unsigned long origin);
70
71#define put_partition_parser(p) do { module_put((p)->owner); } while(0)
72
73struct device;
74struct device_node;
75
76int __devinit of_mtd_parse_partitions(struct device *dev,
77 struct device_node *node,
78 struct mtd_partition **pparts);
79
80#ifdef CONFIG_MTD_PARTITIONS
81static inline int mtd_has_partitions(void) { return 1; }
82#else
83static inline int mtd_has_partitions(void) { return 0; }
84#endif
85
86#ifdef CONFIG_MTD_CMDLINE_PARTS
87static inline int mtd_has_cmdlinepart(void) { return 1; }
88#else
89static inline int mtd_has_cmdlinepart(void) { return 0; }
90#endif
91
92int mtd_is_partition(struct mtd_info *mtd);
93int mtd_add_partition(struct mtd_info *master, char *name,
94 long long offset, long long length);
95int mtd_del_partition(struct mtd_info *master, int partno);
96
97#endif
98