blob: 7a0c6a1ad1d4786c70980a2c1a558c4b1d491339 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MCONSOLE_KERN_H__
7#define __MCONSOLE_KERN_H__
8
Al Viro37185b32012-10-08 03:27:32 +01009#include <linux/list.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include "mconsole.h"
11
12struct mconsole_entry {
13 struct list_head list;
14 struct mc_request request;
15};
16
Paolo 'Blaisorblade' Giarrussod8d7c282006-10-30 22:07:12 -080017/* All these methods are called in process context. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070018struct mc_device {
19 struct list_head list;
20 char *name;
Jeff Dikef28169d2007-02-10 01:43:53 -080021 int (*config)(char *, char **);
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 int (*get_config)(char *, char *, int, char **);
Jeff Dike894be2a2007-02-10 01:43:54 -080023 int (*id)(char **, int *, int *);
Jeff Dikef28169d2007-02-10 01:43:53 -080024 int (*remove)(int, char **);
Linus Torvalds1da177e2005-04-16 15:20:36 -070025};
26
27#define CONFIG_CHUNK(str, size, current, chunk, end) \
28do { \
29 current += strlen(chunk); \
30 if(current >= size) \
31 str = NULL; \
32 if(str != NULL){ \
33 strcpy(str, chunk); \
34 str += strlen(chunk); \
35 } \
36 if(end) \
37 current++; \
38} while(0)
39
40#ifdef CONFIG_MCONSOLE
41
42extern void mconsole_register_dev(struct mc_device *new);
43
44#else
45
46static inline void mconsole_register_dev(struct mc_device *new)
47{
48}
49
50#endif
51
52#endif