Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * MTD device concatenation layer definitions
4 *
5 * Copyright © 2002 Robert Kaiser <rkaiser@sysgo.de>
6 */
7
8#ifndef MTD_CONCAT_H
9#define MTD_CONCAT_H
10
11
12/*
13 * Our storage structure:
14 * Subdev points to an array of pointers to struct mtd_info objects
15 * which is allocated along with this structure
16 *
17 */
18struct mtd_concat {
19 struct mtd_info mtd;
20 int num_subdev;
21 struct mtd_info *subdev[];
22};
23
24struct mtd_info *mtd_concat_create(
25 struct mtd_info *subdev[], /* subdevices to concatenate */
26 int num_devs, /* number of subdevices */
27 const char *name); /* name for the new device */
28
29void mtd_concat_destroy(struct mtd_info *mtd);
30
31/**
32 * mtd_virt_concat_node_create - Create a component for concatenation
33 *
34 * Returns a positive number representing the no. of devices found for
35 * concatenation, or a negative error code.
36 *
37 * List all the devices for concatenations found in DT and create a
38 * component for concatenation.
39 */
40int mtd_virt_concat_node_create(void);
41
42/**
43 * mtd_virt_concat_add - add mtd_info object to the list of subdevices for concatenation
44 * @mtd: pointer to new MTD device info structure
45 *
46 * Returns true if the mtd_info object is added successfully else returns false.
47 *
48 * The mtd_info object is added to the list of subdevices for concatenation.
49 * It returns true if a match is found, and false if all subdevices have
50 * already been added or if the mtd_info object does not match any of the
51 * intended MTD devices.
52 */
53bool mtd_virt_concat_add(struct mtd_info *mtd);
54
55/**
56 * mtd_virt_concat_create_join - Create and register the concatenated MTD device
57 *
58 * Returns 0 on succes, or a negative error code.
59 *
60 * Creates and registers the concatenated MTD device
61 */
62int mtd_virt_concat_create_join(void);
63
64/**
65 * mtd_virt_concat_destroy - Remove the concat that includes a specific mtd device
66 * as one of its components.
67 * @mtd: pointer to MTD device info structure.
68 *
69 * Returns 0 on succes, or a negative error code.
70 *
71 * If the mtd_info object is part of a concatenated device, all other MTD devices
72 * within that concat are registered individually. The concatenated device is then
73 * removed, along with its concatenation component.
74 *
75 */
76int mtd_virt_concat_destroy(struct mtd_info *mtd);
77
78void mtd_virt_concat_destroy_joins(void);
79void mtd_virt_concat_destroy_items(void);
80
81#endif