Closed
Description
Currently license is accepted as a byte string in the macro, but since the linux kernel only allows certain licenses, this could just be an enum.
Code:
/include/linux/module.h
180 │ /*
181 │ * The following license idents are currently accepted as indicating free
182 │ * software modules
183 │ *
184 │ * "GPL" [GNU Public License v2]
185 │ * "GPL v2" [GNU Public License v2]
186 │ * "GPL and additional rights" [GNU Public License v2 rights and more]
187 │ * "Dual BSD/GPL" [GNU Public License v2
188 │ * or BSD license choice]
189 │ * "Dual MIT/GPL" [GNU Public License v2
190 │ * or MIT license choice]
191 │ * "Dual MPL/GPL" [GNU Public License v2
192 │ * or Mozilla license choice]
193 │ *
194 │ * The following other idents are available
195 │ *
196 │ * "Proprietary" [Non free products]
197 │ *
198 │ * Both "GPL v2" and "GPL" (the latter also in dual licensed strings) are
199 │ * merely stating that the module is licensed under the GPL v2, but are not
200 │ * telling whether "GPL v2 only" or "GPL v2 or later". The reason why there
201 │ * are two variants is a historic and failed attempt to convey more
202 │ * information in the MODULE_LICENSE string. For module loading the
203 │ * "only/or later" distinction is completely irrelevant and does neither
204 │ * replace the proper license identifiers in the corresponding source file
205 │ * nor amends them in any way. The sole purpose is to make the
206 │ * 'Proprietary' flagging work and to refuse to bind symbols which are
207 │ * exported with EXPORT_SYMBOL_GPL when a non free module is loaded.
208 │ *
209 │ * In the same way "BSD" is not a clear license information. It merely
210 │ * states, that the module is licensed under one of the compatible BSD
211 │ * license variants. The detailed and correct license information is again
212 │ * to be found in the corresponding source files.
213 │ *
214 │ * There are dual licensed components, but when running with Linux it is the
215 │ * GPL that is relevant so this is a non issue. Similarly LGPL linked with GPL
216 │ * is a GPL combined work.
217 │ *
218 │ * This exists for several reasons
219 │ * 1. So modinfo can show license info for users wanting to vet their setup
220 │ * is free
221 │ * 2. So the community can ignore bug reports including proprietary modules
222 │ * 3. So vendors can do likewise based on their own policies
223 │ */
224 │ #define MODULE_LICENSE(_license) MODULE_FILE MODULE_INFO(license, _license)
Resulting in something like this:
module! {
type: RustMinimal,
name: b"rust_minimal",
author: "Rust for Linux Contributors",
description: b"Rust minimal sample",
license: License::GPLv2,
}