Skip to content

Commit bca266b

Browse files
CaiZhiyongaxboe
CaiZhiyong
authored andcommitted
block: remove unrelated header files and export symbol
Fix up the following items: - remove unrelated header files. - export interface function. - modify function cmdline_parts_parse return value, this will make it more friendly for the caller. Signed-off-by: CaiZhiyong <[email protected]> Cc: Ezequiel Garcia <[email protected]> CC: Brian Norris <[email protected]> Cc: "Wanglin (Albert)" <[email protected]> Cc: Artem Bityutskiy <[email protected]> Cc: Karel Zak <[email protected]> Cc: Shmulik Ladkani <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Jens Axboe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 6753471 commit bca266b

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

block/cmdline-parser.c

+11-7
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
* Written by Cai Zhiyong <[email protected]>
55
*
66
*/
7-
#include <linux/buffer_head.h>
8-
#include <linux/module.h>
7+
#include <linux/export.h>
98
#include <linux/cmdline-parser.h>
109

1110
static int parse_subpart(struct cmdline_subpart **subpart, char *partdef)
@@ -159,6 +158,7 @@ void cmdline_parts_free(struct cmdline_parts **parts)
159158
*parts = next_parts;
160159
}
161160
}
161+
EXPORT_SYMBOL(cmdline_parts_free);
162162

163163
int cmdline_parts_parse(struct cmdline_parts **parts, const char *cmdline)
164164
{
@@ -206,6 +206,7 @@ int cmdline_parts_parse(struct cmdline_parts **parts, const char *cmdline)
206206
cmdline_parts_free(parts);
207207
goto done;
208208
}
209+
EXPORT_SYMBOL(cmdline_parts_parse);
209210

210211
struct cmdline_parts *cmdline_parts_find(struct cmdline_parts *parts,
211212
const char *bdev)
@@ -214,17 +215,17 @@ struct cmdline_parts *cmdline_parts_find(struct cmdline_parts *parts,
214215
parts = parts->next_parts;
215216
return parts;
216217
}
218+
EXPORT_SYMBOL(cmdline_parts_find);
217219

218220
/*
219221
* add_part()
220222
* 0 success.
221223
* 1 can not add so many partitions.
222224
*/
223-
void cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
224-
int slot,
225-
int (*add_part)(int, struct cmdline_subpart *, void *),
226-
void *param)
227-
225+
int cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
226+
int slot,
227+
int (*add_part)(int, struct cmdline_subpart *, void *),
228+
void *param)
228229
{
229230
sector_t from = 0;
230231
struct cmdline_subpart *subpart;
@@ -247,4 +248,7 @@ void cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
247248
if (add_part(slot, subpart, param))
248249
break;
249250
}
251+
252+
return slot;
250253
}
254+
EXPORT_SYMBOL(cmdline_parts_set);

include/linux/cmdline-parser.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ int cmdline_parts_parse(struct cmdline_parts **parts, const char *cmdline);
3737
struct cmdline_parts *cmdline_parts_find(struct cmdline_parts *parts,
3838
const char *bdev);
3939

40-
void cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
41-
int slot,
42-
int (*add_part)(int, struct cmdline_subpart *, void *),
43-
void *param);
40+
int cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
41+
int slot,
42+
int (*add_part)(int, struct cmdline_subpart *, void *),
43+
void *param);
4444

4545
#endif /* CMDLINEPARSEH */

0 commit comments

Comments
 (0)