le_kernelModule_interface.h

1 
2 
3 /*
4  * ====================== WARNING ======================
5  *
6  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
7  * DO NOT MODIFY IN ANY WAY.
8  *
9  * ====================== WARNING ======================
10  */
11 
12 /**
13  * @page c_kernelModule Linux Kernel Module API
14  *
15  * @ref le_kernelModule_interface.h "API Reference"
16  *
17  * This API provides a way for applications to manually load and unload modules that were bundled
18  * with their system.
19  *
20  * Module dependencies and running module load scripts are handled automatically. Only the name of
21  * the module in question is required.
22  *
23  * To load a module, call @c le_kernelModule_Load. Unloading is similarly handled by
24  * @c le_kernelModule_Unload
25  *
26  * An example for loading a module:
27  *
28  * @code
29  * le_result_t result = le_kernelModule_Load(moduleName);
30  *
31  * LE_FATAL_IF(result != LE_OK, "Could not load the required module, %s.", moduleName);
32  *
33  * LE_INFO("Module, %s has been loaded.", moduleName);
34  * @endcode
35  *
36  * Copyright (C) Sierra Wireless Inc.
37  */
38 
39 #ifndef LE_KERNELMODULE_INTERFACE_H_INCLUDE_GUARD
40 #define LE_KERNELMODULE_INTERFACE_H_INCLUDE_GUARD
41 
42 
43 #include "legato.h"
44 
45 // Internal includes for this interface
46 #include "le_kernelModule_common.h"
47 //--------------------------------------------------------------------------------------------------
48 /**
49  * Type for handler called when a server disconnects.
50  */
51 //--------------------------------------------------------------------------------------------------
52 typedef void (*le_kernelModule_DisconnectHandler_t)(void *);
53 
54 //--------------------------------------------------------------------------------------------------
55 /**
56  *
57  * Connect the current client thread to the service providing this API. Block until the service is
58  * available.
59  *
60  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
61  * called before any other functions in this API. Normally, ConnectService is automatically called
62  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
63  *
64  * This function is created automatically.
65  */
66 //--------------------------------------------------------------------------------------------------
67 void le_kernelModule_ConnectService
68 (
69  void
70 );
71 
72 //--------------------------------------------------------------------------------------------------
73 /**
74  *
75  * Try to connect the current client thread to the service providing this API. Return with an error
76  * if the service is not available.
77  *
78  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
79  * called before any other functions in this API. Normally, ConnectService is automatically called
80  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
81  *
82  * This function is created automatically.
83  *
84  * @return
85  * - LE_OK if the client connected successfully to the service.
86  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
87  * bound.
88  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
89  * - LE_COMM_ERROR if the Service Directory cannot be reached.
90  */
91 //--------------------------------------------------------------------------------------------------
92 le_result_t le_kernelModule_TryConnectService
93 (
94  void
95 );
96 
97 //--------------------------------------------------------------------------------------------------
98 /**
99  * Set handler called when server disconnection is detected.
100  *
101  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
102  * to continue without exiting, it should call longjmp() from inside the handler.
103  */
104 //--------------------------------------------------------------------------------------------------
105 LE_FULL_API void le_kernelModule_SetServerDisconnectHandler
106 (
107  le_kernelModule_DisconnectHandler_t disconnectHandler,
108  void *contextPtr
109 );
110 
111 //--------------------------------------------------------------------------------------------------
112 /**
113  *
114  * Disconnect the current client thread from the service providing this API.
115  *
116  * Normally, this function doesn't need to be called. After this function is called, there's no
117  * longer a connection to the service, and the functions in this API can't be used. For details, see
118  * @ref apiFilesC_client.
119  *
120  * This function is created automatically.
121  */
122 //--------------------------------------------------------------------------------------------------
123 void le_kernelModule_DisconnectService
124 (
125  void
126 );
127 
128 
129 //--------------------------------------------------------------------------------------------------
130 /**
131  * Load the specified kernel module that was bundled with a Legato system.
132  *
133  * @return
134  * - LE_OK if the module has been successfully loaded into the kernel.
135  * - LE_NOT_FOUND if the named module was not found in the system.
136  * - LE_FAULT if errors were encountered when loading the module, or one of the module's
137  * dependencies.
138  * - LE_DUPLICATE if the module has been already loaded into the kernel.
139  */
140 //--------------------------------------------------------------------------------------------------
141 le_result_t le_kernelModule_Load
142 (
143  const char* LE_NONNULL moduleName
144  ///< [IN] Name of the module to load.
145 );
146 
147 //--------------------------------------------------------------------------------------------------
148 /**
149  * Unload the specified module. The module to be unloaded must be one that was bundled with the
150  * system.
151  *
152  * @return
153  * - LE_OK if the module has been successfully unloaded from the kernel.
154  * - LE_NOT_FOUND if the named module was not found in the system.
155  * - LE_FAULT if errors were encountered during the module, or one of the module's dependencies
156  * unloading.
157  * - LE_DUPLICATE if the module has been already unloaded from the kernel.
158  */
159 //--------------------------------------------------------------------------------------------------
160 le_result_t le_kernelModule_Unload
161 (
162  const char* LE_NONNULL moduleName
163  ///< [IN] Name of the module to unload.
164 );
165 
166 #endif // LE_KERNELMODULE_INTERFACE_H_INCLUDE_GUARD
le_result_t
Definition: le_basics.h:35
#define LE_FULL_API
Definition: le_apiFeatures.h:40