* 'linux-4.14.y' of github.com:openela/kernel-lts:
LTS: Update to 4.14.350
SUNRPC: Fix RPC client cleaned up the freed pipefs dentries
arm64: dts: rockchip: Add sound-dai-cells for RK3368
tcp: Fix data races around icsk->icsk_af_ops.
ipv6: Fix data races around sk->sk_prot.
ipv6: annotate some data-races around sk->sk_prot
pwm: stm32: Refuse too small period requests
ftruncate: pass a signed offset
batman-adv: Don't accept TT entries for out-of-spec VIDs
batman-adv: include gfp.h for GFP_* defines
drm/nouveau/dispnv04: fix null pointer dereference in nv17_tv_get_hd_modes
drm/nouveau/dispnv04: fix null pointer dereference in nv17_tv_get_ld_modes
hexagon: fix fadvise64_64 calling conventions
tty: mcf: MCF54418 has 10 UARTS
usb: atm: cxacru: fix endpoint checking in cxacru_bind()
usb: musb: da8xx: fix a resource leak in probe()
usb: gadget: printer: SS+ support
net: usb: ax88179_178a: improve link status logs
iio: adc: ad7266: Fix variable checking bug
mmc: sdhci-pci: Convert PCIBIOS_* return codes to errnos
x86: stop playing stack games in profile_pc()
i2c: ocores: set IACK bit after core is enabled
i2c: ocores: stop transfer on timeout
nvme: fixup comment for nvme RDMA Provider Type
soc: ti: wkup_m3_ipc: Send NULL dummy message instead of pointer message
media: dvbdev: Initialize sbuf
ALSA: emux: improve patch ioctl data validation
net/iucv: Avoid explicit cpumask var allocation on stack
netfilter: nf_tables: fully validate NFT_DATA_VALUE on store to data registers
ASoC: fsl-asoc-card: set priv->pdev before using it
drm/amdgpu: fix UBSAN warning in kv_dpm.c
pinctrl: rockchip: fix pinmux reset in rockchip_pmx_set
pinctrl: rockchip: fix pinmux bits for RK3328 GPIO3-B pins
pinctrl: rockchip: fix pinmux bits for RK3328 GPIO2-B pins
pinctrl: fix deadlock in create_pinctrl() when handling -EPROBE_DEFER
usb: xhci: do not perform Soft Retry for some xHCI hosts
xhci: Set correct transferred length for cancelled bulk transfers
xhci: Use soft retry to recover faster from transaction errors
usb: xhci: Remove ep_trb from xhci_cleanup_halted_endpoint()
scsi: mpt3sas: Avoid test/set_bit() operating in non-allocated memory
scsi: mpt3sas: Gracefully handle online firmware update
scsi: mpt3sas: Add ioc_<level> logging macros
iio: dac: ad5592r: fix temperature channel scaling value
iio: dac: ad5592r: un-indent code-block for scale read
iio: dac: ad5592r-base: Replace indio_dev->mlock with own device lock
x86/amd_nb: Check for invalid SMN reads
PCI: Add PCI_ERROR_RESPONSE and related definitions
ARM: dts: samsung: smdk4412: fix keypad no-autorepeat
ARM: dts: samsung: exynos4412-origen: fix keypad no-autorepeat
ARM: dts: samsung: smdkv310: fix keypad no-autorepeat
gcov: add support for GCC 14
drm/radeon: fix UBSAN warning in kv_dpm.c
ACPICA: Revert "ACPICA: avoid Info: mapping multiple BARs. Your kernel is fine."
dmaengine: ioatdma: Fix missing kmem_cache_destroy()
regulator: core: Fix modpost error "regulator_get_regmap" undefined
net: usb: rtl8150 fix unintiatilzed variables in rtl8150_get_link_ksettings
virtio_net: checksum offloading handling fix
xfrm6: check ip6_dst_idev() return value in xfrm6_get_saddr()
netrom: Fix a memory leak in nr_heartbeat_expiry()
cipso: fix total option length computation
MIPS: Routerboard 532: Fix vendor retry check code
MIPS: Octeon: Add PCIe link status check
udf: udftime: prevent overflow in udf_disk_stamp_to_time()
udf: Simplify calls to udf_disk_stamp_to_time
udf: Sanitize nanoseconds for time stamps
usb: misc: uss720: check for incompatible versions of the Belkin F5U002
powerpc/io: Avoid clang null pointer arithmetic warnings
powerpc/pseries: Enforce hcall result buffer validity and size
scsi: qedi: Fix crash while reading debugfs attribute
batman-adv: bypass empty buckets in batadv_purge_orig_ref()
rcutorture: Fix rcu_torture_one_read() pipe_count overflow comment
usb-storage: alauda: Check whether the media is initialized
hugetlb_encode.h: fix undefined behaviour (34 << 26)
mm/hugetlb: add mmap() encodings for 32MB and 512MB page sizes
hv_utils: drain the timesync packets on onchannelcallback
nilfs2: fix potential kernel bug due to lack of writeback flag waiting
intel_th: pci: Add Lunar Lake support
intel_th: pci: Add Meteor Lake-S support
intel_th: pci: Add Sapphire Rapids SOC support
intel_th: pci: Add Granite Rapids SOC support
intel_th: pci: Add Granite Rapids support
dmaengine: axi-dmac: fix possible race in remove()
ocfs2: fix races between hole punching and AIO+DIO
ocfs2: use coarse time for new created files
fs/proc: fix softlockup in __read_vmcore
vmci: prevent speculation leaks by sanitizing event in event_deliver()
drm/exynos/vidi: fix memory leak in .get_modes()
drivers: core: synchronize really_probe() and dev_uevent()
net/ipv6: Fix the RT cache flush via sysctl using a previous delay
ipv6/route: Add a missing check on proc_dointvec
Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
tcp: fix race in tcp_v6_syn_recv_sock()
drm/bridge/panel: Fix runtime warning on panel bridge release
iommu/amd: Fix sysfs leak in iommu init
HID: core: remove unnecessary WARN_ON() in implement()
Input: try trimming too long modalias strings
xhci: Apply broken streams quirk to Etron EJ188 xHCI host
xhci: Apply reset resume quirk to Etron EJ188 xHCI host
jfs: xattr: fix buffer overflow for invalid xattr
mei: me: release irq in mei_me_pci_resume error path
USB: class: cdc-wdm: Fix CPU lockup caused by excessive log messages
nilfs2: fix nilfs_empty_dir() misjudgment and long loop on I/O errors
nilfs2: return the mapped address from nilfs_get_page()
nilfs2: Remove check for PageError
selftests/mm: compaction_test: fix bogus test success on Aarch64
selftests/mm: conform test to TAP format output
selftests/mm: compaction_test: fix incorrect write of zero to nr_hugepages
media: mc: mark the media devnode as registered from the, start
serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler
serial: sc16is7xx: replace hardcoded divisor value with BIT() macro
usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete
af_unix: Annotate data-race of sk->sk_shutdown in sk_diag_fill().
af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen().
af_unix: Use unix_recvq_full_lockless() in unix_stream_connect().
af_unix: Annotate data-race of net->unx.sysctl_max_dgram_qlen.
af_unix: Annotate data-races around sk->sk_state in UNIX_DIAG.
af_unix: Annotate data-races around sk->sk_state in sendmsg() and recvmsg().
af_unix: Annotate data-races around sk->sk_state in unix_write_space() and poll().
af_unix: Fix data races around sk->sk_shutdown.
af_unix: Annotate data-race of sk->sk_state in unix_inq_len().
af_unix: Fix a data-race in unix_dgram_peer_wake_me().
af_unix: ensure POLLOUT on remote close() for connected dgram socket
ptp: Fix error message on failed pin verification
tcp: count CLOSE-WAIT sockets for TCP_MIB_CURRESTAB
vxlan: Fix regression when dropping packets due to invalid src addresses
ipv6: sr: block BH in seg6_output_core() and seg6_input_core()
wifi: iwlwifi: mvm: don't read past the mfuart notifcation
wifi: mac80211: Fix deadlock in ieee80211_sta_ps_deliver_wakeup()
wifi: mac80211: mesh: Fix leak of mesh_preq_queue objects
tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets
Revert "tcp: remove redundant check on tskb"
Revert "tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets"
Revert "scsi: target: Fix SELinux error when systemd-modules loads the target module"
LTS: Update to 4.14.349
x86/kvm: Disable all PV features on crash
x86/kvm: Disable kvmclock on all CPUs on shutdown
x86/kvm: Teardown PV features on boot CPU as well
crypto: algif_aead - fix uninitialized ctx->init
nfs: fix undefined behavior in nfs_block_bits()
ext4: fix mb_cache_entry's e_refcnt leak in ext4_xattr_block_cache_find()
sparc: move struct termio to asm/termios.h
kdb: Use format-specifiers rather than memset() for padding in kdb_read()
kdb: Merge identical case statements in kdb_read()
kdb: Fix console handling when editing and tab-completing commands
kdb: Use format-strings rather than '\0' injection in kdb_read()
kdb: Fix buffer overflow during tab-complete
sparc64: Fix number of online CPUs
intel_th: pci: Add Meteor Lake-S CPU support
net/9p: fix uninit-value in p9_client_rpc()
crypto: qat - Fix ADF_DEV_RESET_SYNC memory leak
KVM: arm64: Allow AArch32 PSTATE.M to be restored as System mode
netfilter: nft_dynset: relax superfluous check on set updates
netfilter: nft_dynset: report EOPNOTSUPP on missing set feature
netfilter: nf_tables: don't skip expired elements during walk
netfilter: nf_tables: drop map element references from preparation phase
netfilter: nf_tables: pass ctx to nf_tables_expr_destroy()
netfilter: nftables: rename set element data activation/deactivation functions
netfilter: nf_tables: pass context to nft_set_destroy()
netfilter: nf_tables: fix set double-free in abort path
netfilter: nf_tables: add nft_set_is_anonymous() helper
fbdev: savage: Handle err return when savagefb_check_var failed
media: v4l2-core: hold videodev_lock until dev reg, finishes
media: mxl5xx: Move xpt structures off stack
arm64: dts: hi3798cv200: fix the size of GICR
md/raid5: fix deadlock that raid5d() wait for itself to clear MD_SB_CHANGE_PENDING
arm64: tegra: Correct Tegra132 I2C alias
ata: pata_legacy: make legacy_exit() work again
neighbour: fix unaligned access to pneigh_entry
vxlan: Fix regression when dropping packets due to invalid src addresses
nilfs2: fix use-after-free of timer for log writer thread
fs/nilfs2: convert timers to use timer_setup()
mmc: core: Do not force a retune before RPMB switch
binder: fix max_thread type inconsistency
ALSA: timer: Set lower bound of start tick time
ALSA: timer: Simplify timer hw resolution calls
ipvlan: Dont Use skb->sk in ipvlan_process_v{4,6}_outbound
ipvlan: add ipvlan_route_v6_outbound() helper
ipvlan: properly track tx_errors
net: add DEV_STATS_READ() helper
kconfig: fix comparison to constant symbols, 'm', 'n'
net:fec: Add fec_enet_deinit()
net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM
smsc95xx: use usbnet->driver_priv
smsc95xx: remove redundant function arguments
enic: Validate length of nl attributes in enic_set_vf_port
dma-buf/sw-sync: don't enable IRQ from sync_print_obj()
net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion
nvmet: fix ns enable/disable possible hang
spi: Don't mark message DMA mapped when no transfer in it is
netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu()
nfc: nci: Fix handling of zero-length payload packets in nci_rx_work()
nfc: nci: Fix kcov check in nci_rx_work()
net: fec: avoid lock evasion when reading pps_enable
net: fec: remove redundant variable 'inc'
virtio: delete vq in vp_find_vqs_msix() when request_irq() fails
arm64: asm-bug: Add .align 2 to the end of __BUG_ENTRY
openvswitch: Set the skbuff pkt_type for proper pmtud support.
tcp: Fix shift-out-of-bounds in dctcp_update_alpha().
params: lift param_set_uint_minmax to common code
ipv6: sr: fix memleak in seg6_hmac_init_algo
nfc: nci: Fix uninit-value in nci_rx_work
x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y
null_blk: Fix the WARNING: modpost: missing MODULE_DESCRIPTION()
media: cec: cec-api: add locking in cec_release()
um: Fix the -Wmissing-prototypes warning for __switch_mm
powerpc/pseries: Add failure related checks for h_get_mpp and h_get_ppp
media: stk1160: fix bounds checking in stk1160_copy_video()
um: Add winch to winch_handlers before registering winch IRQ
um: Fix return value in ubd_init()
Input: pm8xxx-vibrator - correct VIB_MAX_LEVELS calculation
Input: ims-pcu - fix printf string overflow
libsubcmd: Fix parse-options memory leak
f2fs: add error prints for debugging mount failure
extcon: max8997: select IRQ_DOMAIN instead of depending on it
ppdev: Add an error check in register_device
stm class: Fix a double free in stm_register_device()
usb: gadget: u_audio: Clear uac pointer when freed.
greybus: arche-ctrl: move device table to its right location
serial: max3100: Fix bitwise types
serial: max3100: Update uart_driver_registered on driver removal
serial: max3100: Lock port->lock when calling uart_handle_cts_change()
firmware: dmi-id: add a release callback function
dmaengine: idma64: Add check for dma_set_max_seg_size
greybus: lights: check return of get_channel_from_mode
sched/fair: Allow disabling sched_balance_newidle with sched_relax_domain_level
sched/topology: Don't set SD_BALANCE_WAKE on cpuset domain relax
af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
netrom: fix possible dead-lock in nr_rt_ioctl()
RDMA/IPoIB: Fix format truncation compilation errors
RDMA/ipoib: Fix use of sizeof()
selftests/kcmp: remove unused open mode
selftests/kcmp: Make the test output consistent and clear
ext4: avoid excessive credit estimate in ext4_tmpfile()
x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map
ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value
fbdev: sh7760fb: allow modular build
media: radio-shark2: Avoid led_names truncations
media: ngene: Add dvb_ca_en50221_init return value check
powerpc/fsl-soc: hide unused const variable
drm/mediatek: Add 0 size check to mtk_drm_gem_obj
fbdev: shmobile: fix snprintf truncation
mtd: rawnand: hynix: fixed typo
ipv6: sr: fix invalid unregister error path
ipv6: sr: fix incorrect unregister order
ipv6: sr: add missing seg6_local_exit
net: openvswitch: fix overwriting ct original tuple for ICMPv6
net: usb: smsc95xx: stop lying about skb->truesize
af_unix: Fix data races in unix_release_sock/unix_stream_sendmsg
m68k: mac: Fix reboot hang on Mac IIci
m68k/mac: Use '030 reset method on SE/30
m68k: Fix spinlock race in kernel thread creation
net: usb: sr9700: stop lying about skb->truesize
wifi: mwl8k: initialize cmd->addr[] properly
scsi: qedf: Ensure the copied buf is NUL terminated
scsi: bfa: Ensure the copied buf is NUL terminated
Revert "sh: Handle calling csum_partial with misaligned data"
sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe()
wifi: ar5523: enable proper endpoint verification
wifi: carl9170: add a proper sanity check for endpoints
macintosh/via-macii: Fix "BUG: sleeping function called from invalid context"
macintosh/via-macii, macintosh/adb-iop: Clean up whitespace
m68k/mac: Add mutual exclusion for IOP interrupt polling
macintosh/via-macii: Remove BUG_ON assertions
wifi: ath10k: Fix an error code problem in ath10k_dbg_sta_write_peer_debug_trigger()
scsi: hpsa: Fix allocation size for Scsi_Host private data
scsi: libsas: Fix the failure of adding phy with zero-address to port
ACPI: disable -Wstringop-truncation
irqchip/alpine-msi: Fix off-by-one in allocation error path
scsi: ufs: core: Perform read back after disabling UIC_COMMAND_COMPL
scsi: ufs: core: Perform read back after disabling interrupts
scsi: ufs: qcom: Perform read back after writing reset bit
x86/boot: Ignore relocations in .notes sections in walk_relocs() too
wifi: ath10k: poll service ready message before failing
nfsd: drop st_mutex before calling move_to_close_lru()
null_blk: Fix missing mutex_destroy() at module removal
jffs2: prevent xattr node from overflowing the eraseblock
crypto: ccp - drop platform ifdef checks
crypto: ccp - Remove forward declaration
parisc: add missing export of __cmpxchg_u8()
nilfs2: fix out-of-range warning
ecryptfs: Fix buffer size for tag 66 packet
firmware: raspberrypi: Use correct device for DMA mappings
crypto: bcm - Fix pointer arithmetic
ASoC: da7219-aad: fix usage of device_get_named_child_node()
ASoC: dt-bindings: rt5645: add cbj sleeve gpio property
ASoC: rt5645: Fix the electric noise due to the CBJ contacts floating
net: usb: qmi_wwan: add Telit FN920C04 compositions
wifi: cfg80211: fix the order of arguments for trace events of the tx_rx_evt class
tty: n_gsm: fix possible out-of-bounds in gsm0_receive()
nilfs2: fix potential hang in nilfs_detach_log_writer()
nilfs2: fix unexpected freezing of nilfs_segctor_sync()
ring-buffer: Fix a race between readers and resize checks
speakup: Fix sizeof() vs ARRAY_SIZE() bug
Conflicts:
fs/f2fs/segment.c
fs/f2fs/super.c
Change-Id: I0c91af7340a7aa467e1a242f9d6dc49d540997af
541 lines
20 KiB
C
541 lines
20 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_MODULE_PARAMS_H
|
|
#define _LINUX_MODULE_PARAMS_H
|
|
/* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */
|
|
#include <linux/init.h>
|
|
#include <linux/stringify.h>
|
|
#include <linux/kernel.h>
|
|
|
|
/* You can override this manually, but generally this should match the
|
|
module name. */
|
|
#ifdef MODULE
|
|
#define MODULE_PARAM_PREFIX /* empty */
|
|
#else
|
|
#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
|
|
#endif
|
|
|
|
/* Chosen so that structs with an unsigned long line up. */
|
|
#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
|
|
|
|
#ifdef MODULE
|
|
#define __MODULE_INFO(tag, name, info) \
|
|
static const char __UNIQUE_ID(name)[] \
|
|
__used __attribute__((section(".modinfo"), unused, aligned(1))) \
|
|
= __stringify(tag) "=" info
|
|
#else /* !MODULE */
|
|
/* This struct is here for syntactic coherency, it is not used */
|
|
#define __MODULE_INFO(tag, name, info) \
|
|
struct __UNIQUE_ID(name) {}
|
|
#endif
|
|
#define __MODULE_PARM_TYPE(name, _type) \
|
|
__MODULE_INFO(parmtype, name##type, #name ":" _type)
|
|
|
|
/* One for each parameter, describing how to use it. Some files do
|
|
multiple of these per line, so can't just use MODULE_INFO. */
|
|
#define MODULE_PARM_DESC(_parm, desc) \
|
|
__MODULE_INFO(parm, _parm, #_parm ":" desc)
|
|
|
|
struct kernel_param;
|
|
|
|
/*
|
|
* Flags available for kernel_param_ops
|
|
*
|
|
* NOARG - the parameter allows for no argument (foo instead of foo=1)
|
|
*/
|
|
enum {
|
|
KERNEL_PARAM_OPS_FL_NOARG = (1 << 0)
|
|
};
|
|
|
|
struct kernel_param_ops {
|
|
/* How the ops should behave */
|
|
unsigned int flags;
|
|
/* Returns 0, or -errno. arg is in kp->arg. */
|
|
int (*set)(const char *val, const struct kernel_param *kp);
|
|
/* Returns length written or -errno. Buffer is 4k (ie. be short!) */
|
|
int (*get)(char *buffer, const struct kernel_param *kp);
|
|
/* Optional function to free kp->arg when module unloaded. */
|
|
void (*free)(void *arg);
|
|
};
|
|
|
|
/*
|
|
* Flags available for kernel_param
|
|
*
|
|
* UNSAFE - the parameter is dangerous and setting it will taint the kernel
|
|
* HWPARAM - Hardware param not permitted in lockdown mode
|
|
*/
|
|
enum {
|
|
KERNEL_PARAM_FL_UNSAFE = (1 << 0),
|
|
KERNEL_PARAM_FL_HWPARAM = (1 << 1),
|
|
};
|
|
|
|
struct kernel_param {
|
|
const char *name;
|
|
struct module *mod;
|
|
const struct kernel_param_ops *ops;
|
|
const u16 perm;
|
|
s8 level;
|
|
u8 flags;
|
|
union {
|
|
void *arg;
|
|
const struct kparam_string *str;
|
|
const struct kparam_array *arr;
|
|
};
|
|
};
|
|
|
|
extern const struct kernel_param __start___param[], __stop___param[];
|
|
|
|
/* Special one for strings we want to copy into */
|
|
struct kparam_string {
|
|
unsigned int maxlen;
|
|
char *string;
|
|
};
|
|
|
|
/* Special one for arrays */
|
|
struct kparam_array
|
|
{
|
|
unsigned int max;
|
|
unsigned int elemsize;
|
|
unsigned int *num;
|
|
const struct kernel_param_ops *ops;
|
|
void *elem;
|
|
};
|
|
|
|
/**
|
|
* module_param - typesafe helper for a module/cmdline parameter
|
|
* @value: the variable to alter, and exposed parameter name.
|
|
* @type: the type of the parameter
|
|
* @perm: visibility in sysfs.
|
|
*
|
|
* @value becomes the module parameter, or (prefixed by KBUILD_MODNAME and a
|
|
* ".") the kernel commandline parameter. Note that - is changed to _, so
|
|
* the user can use "foo-bar=1" even for variable "foo_bar".
|
|
*
|
|
* @perm is 0 if the the variable is not to appear in sysfs, or 0444
|
|
* for world-readable, 0644 for root-writable, etc. Note that if it
|
|
* is writable, you may need to use kernel_param_lock() around
|
|
* accesses (esp. charp, which can be kfreed when it changes).
|
|
*
|
|
* The @type is simply pasted to refer to a param_ops_##type and a
|
|
* param_check_##type: for convenience many standard types are provided but
|
|
* you can create your own by defining those variables.
|
|
*
|
|
* Standard types are:
|
|
* byte, short, ushort, int, uint, long, ulong
|
|
* charp: a character pointer
|
|
* bool: a bool, values 0/1, y/n, Y/N.
|
|
* invbool: the above, only sense-reversed (N = true).
|
|
*/
|
|
#define module_param(name, type, perm) \
|
|
module_param_named(name, name, type, perm)
|
|
|
|
/**
|
|
* module_param_unsafe - same as module_param but taints kernel
|
|
*/
|
|
#define module_param_unsafe(name, type, perm) \
|
|
module_param_named_unsafe(name, name, type, perm)
|
|
|
|
/**
|
|
* module_param_named - typesafe helper for a renamed module/cmdline parameter
|
|
* @name: a valid C identifier which is the parameter name.
|
|
* @value: the actual lvalue to alter.
|
|
* @type: the type of the parameter
|
|
* @perm: visibility in sysfs.
|
|
*
|
|
* Usually it's a good idea to have variable names and user-exposed names the
|
|
* same, but that's harder if the variable must be non-static or is inside a
|
|
* structure. This allows exposure under a different name.
|
|
*/
|
|
#define module_param_named(name, value, type, perm) \
|
|
param_check_##type(name, &(value)); \
|
|
module_param_cb(name, ¶m_ops_##type, &value, perm); \
|
|
__MODULE_PARM_TYPE(name, #type)
|
|
|
|
/**
|
|
* module_param_named_unsafe - same as module_param_named but taints kernel
|
|
*/
|
|
#define module_param_named_unsafe(name, value, type, perm) \
|
|
param_check_##type(name, &(value)); \
|
|
module_param_cb_unsafe(name, ¶m_ops_##type, &value, perm); \
|
|
__MODULE_PARM_TYPE(name, #type)
|
|
|
|
/**
|
|
* module_param_cb - general callback for a module/cmdline parameter
|
|
* @name: a valid C identifier which is the parameter name.
|
|
* @ops: the set & get operations for this parameter.
|
|
* @perm: visibility in sysfs.
|
|
*
|
|
* The ops can have NULL set or get functions.
|
|
*/
|
|
#define module_param_cb(name, ops, arg, perm) \
|
|
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
|
|
|
|
#define module_param_cb_unsafe(name, ops, arg, perm) \
|
|
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \
|
|
KERNEL_PARAM_FL_UNSAFE)
|
|
|
|
/**
|
|
* <level>_param_cb - general callback for a module/cmdline parameter
|
|
* to be evaluated before certain initcall level
|
|
* @name: a valid C identifier which is the parameter name.
|
|
* @ops: the set & get operations for this parameter.
|
|
* @perm: visibility in sysfs.
|
|
*
|
|
* The ops can have NULL set or get functions.
|
|
*/
|
|
#define __level_param_cb(name, ops, arg, perm, level) \
|
|
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0)
|
|
|
|
#define core_param_cb(name, ops, arg, perm) \
|
|
__level_param_cb(name, ops, arg, perm, 1)
|
|
|
|
#define postcore_param_cb(name, ops, arg, perm) \
|
|
__level_param_cb(name, ops, arg, perm, 2)
|
|
|
|
#define arch_param_cb(name, ops, arg, perm) \
|
|
__level_param_cb(name, ops, arg, perm, 3)
|
|
|
|
#define subsys_param_cb(name, ops, arg, perm) \
|
|
__level_param_cb(name, ops, arg, perm, 4)
|
|
|
|
#define fs_param_cb(name, ops, arg, perm) \
|
|
__level_param_cb(name, ops, arg, perm, 5)
|
|
|
|
#define device_param_cb(name, ops, arg, perm) \
|
|
__level_param_cb(name, ops, arg, perm, 6)
|
|
|
|
#define late_param_cb(name, ops, arg, perm) \
|
|
__level_param_cb(name, ops, arg, perm, 7)
|
|
|
|
/* On alpha, ia64 and ppc64 relocations to global data cannot go into
|
|
read-only sections (which is part of respective UNIX ABI on these
|
|
platforms). So 'const' makes no sense and even causes compile failures
|
|
with some compilers. */
|
|
#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
|
|
#define __moduleparam_const
|
|
#else
|
|
#define __moduleparam_const const
|
|
#endif
|
|
|
|
/* This is the fundamental function for registering boot/module
|
|
parameters. */
|
|
#define __module_param_call(prefix, name, ops, arg, perm, level, flags) \
|
|
/* Default value instead of permissions? */ \
|
|
static const char __param_str_##name[] = prefix #name; \
|
|
static struct kernel_param __moduleparam_const __param_##name \
|
|
__used \
|
|
__attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
|
|
= { __param_str_##name, THIS_MODULE, ops, \
|
|
VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }
|
|
|
|
/* Obsolete - use module_param_cb() */
|
|
#define module_param_call(name, _set, _get, arg, perm) \
|
|
static const struct kernel_param_ops __param_ops_##name = \
|
|
{ .flags = 0, .set = _set, .get = _get }; \
|
|
__module_param_call(MODULE_PARAM_PREFIX, \
|
|
name, &__param_ops_##name, arg, perm, -1, 0)
|
|
|
|
#ifdef CONFIG_SYSFS
|
|
extern void kernel_param_lock(struct module *mod);
|
|
extern void kernel_param_unlock(struct module *mod);
|
|
#else
|
|
static inline void kernel_param_lock(struct module *mod)
|
|
{
|
|
}
|
|
static inline void kernel_param_unlock(struct module *mod)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#ifndef MODULE
|
|
/**
|
|
* core_param - define a historical core kernel parameter.
|
|
* @name: the name of the cmdline and sysfs parameter (often the same as var)
|
|
* @var: the variable
|
|
* @type: the type of the parameter
|
|
* @perm: visibility in sysfs
|
|
*
|
|
* core_param is just like module_param(), but cannot be modular and
|
|
* doesn't add a prefix (such as "printk."). This is for compatibility
|
|
* with __setup(), and it makes sense as truly core parameters aren't
|
|
* tied to the particular file they're in.
|
|
*/
|
|
#define core_param(name, var, type, perm) \
|
|
param_check_##type(name, &(var)); \
|
|
__module_param_call("", name, ¶m_ops_##type, &var, perm, -1, 0)
|
|
|
|
/**
|
|
* core_param_unsafe - same as core_param but taints kernel
|
|
*/
|
|
#define core_param_unsafe(name, var, type, perm) \
|
|
param_check_##type(name, &(var)); \
|
|
__module_param_call("", name, ¶m_ops_##type, &var, perm, \
|
|
-1, KERNEL_PARAM_FL_UNSAFE)
|
|
|
|
#endif /* !MODULE */
|
|
|
|
/**
|
|
* module_param_string - a char array parameter
|
|
* @name: the name of the parameter
|
|
* @string: the string variable
|
|
* @len: the maximum length of the string, incl. terminator
|
|
* @perm: visibility in sysfs.
|
|
*
|
|
* This actually copies the string when it's set (unlike type charp).
|
|
* @len is usually just sizeof(string).
|
|
*/
|
|
#define module_param_string(name, string, len, perm) \
|
|
static const struct kparam_string __param_string_##name \
|
|
= { len, string }; \
|
|
__module_param_call(MODULE_PARAM_PREFIX, name, \
|
|
¶m_ops_string, \
|
|
.str = &__param_string_##name, perm, -1, 0);\
|
|
__MODULE_PARM_TYPE(name, "string")
|
|
|
|
/**
|
|
* parameq - checks if two parameter names match
|
|
* @name1: parameter name 1
|
|
* @name2: parameter name 2
|
|
*
|
|
* Returns true if the two parameter names are equal.
|
|
* Dashes (-) are considered equal to underscores (_).
|
|
*/
|
|
extern bool parameq(const char *name1, const char *name2);
|
|
|
|
/**
|
|
* parameqn - checks if two parameter names match
|
|
* @name1: parameter name 1
|
|
* @name2: parameter name 2
|
|
* @n: the length to compare
|
|
*
|
|
* Similar to parameq(), except it compares @n characters.
|
|
*/
|
|
extern bool parameqn(const char *name1, const char *name2, size_t n);
|
|
|
|
/* Called on module insert or kernel boot */
|
|
extern char *parse_args(const char *name,
|
|
char *args,
|
|
const struct kernel_param *params,
|
|
unsigned num,
|
|
s16 level_min,
|
|
s16 level_max,
|
|
void *arg,
|
|
int (*unknown)(char *param, char *val,
|
|
const char *doing, void *arg));
|
|
|
|
/* Called by module remove. */
|
|
#ifdef CONFIG_SYSFS
|
|
extern void destroy_params(const struct kernel_param *params, unsigned num);
|
|
#else
|
|
static inline void destroy_params(const struct kernel_param *params,
|
|
unsigned num)
|
|
{
|
|
}
|
|
#endif /* !CONFIG_SYSFS */
|
|
|
|
/* All the helper functions */
|
|
/* The macros to do compile-time type checking stolen from Jakub
|
|
Jelinek, who IIRC came up with this idea for the 2.4 module init code. */
|
|
#define __param_check(name, p, type) \
|
|
static inline type __always_unused *__check_##name(void) { return(p); }
|
|
|
|
extern const struct kernel_param_ops param_ops_byte;
|
|
extern int param_set_byte(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_byte(char *buffer, const struct kernel_param *kp);
|
|
#define param_check_byte(name, p) __param_check(name, p, unsigned char)
|
|
|
|
extern const struct kernel_param_ops param_ops_short;
|
|
extern int param_set_short(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_short(char *buffer, const struct kernel_param *kp);
|
|
#define param_check_short(name, p) __param_check(name, p, short)
|
|
|
|
extern const struct kernel_param_ops param_ops_ushort;
|
|
extern int param_set_ushort(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_ushort(char *buffer, const struct kernel_param *kp);
|
|
#define param_check_ushort(name, p) __param_check(name, p, unsigned short)
|
|
|
|
extern const struct kernel_param_ops param_ops_int;
|
|
extern int param_set_int(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_int(char *buffer, const struct kernel_param *kp);
|
|
#define param_check_int(name, p) __param_check(name, p, int)
|
|
|
|
extern const struct kernel_param_ops param_ops_uint;
|
|
extern int param_set_uint(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_uint(char *buffer, const struct kernel_param *kp);
|
|
int param_set_uint_minmax(const char *val, const struct kernel_param *kp,
|
|
unsigned int min, unsigned int max);
|
|
#define param_check_uint(name, p) __param_check(name, p, unsigned int)
|
|
|
|
extern const struct kernel_param_ops param_ops_long;
|
|
extern int param_set_long(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_long(char *buffer, const struct kernel_param *kp);
|
|
#define param_check_long(name, p) __param_check(name, p, long)
|
|
|
|
extern const struct kernel_param_ops param_ops_ulong;
|
|
extern int param_set_ulong(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_ulong(char *buffer, const struct kernel_param *kp);
|
|
#define param_check_ulong(name, p) __param_check(name, p, unsigned long)
|
|
|
|
extern const struct kernel_param_ops param_ops_ullong;
|
|
extern int param_set_ullong(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_ullong(char *buffer, const struct kernel_param *kp);
|
|
#define param_check_ullong(name, p) __param_check(name, p, unsigned long long)
|
|
|
|
extern const struct kernel_param_ops param_ops_charp;
|
|
extern int param_set_charp(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_charp(char *buffer, const struct kernel_param *kp);
|
|
extern void param_free_charp(void *arg);
|
|
#define param_check_charp(name, p) __param_check(name, p, char *)
|
|
|
|
/* We used to allow int as well as bool. We're taking that away! */
|
|
extern const struct kernel_param_ops param_ops_bool;
|
|
extern int param_set_bool(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_bool(char *buffer, const struct kernel_param *kp);
|
|
#define param_check_bool(name, p) __param_check(name, p, bool)
|
|
|
|
extern const struct kernel_param_ops param_ops_bool_enable_only;
|
|
extern int param_set_bool_enable_only(const char *val,
|
|
const struct kernel_param *kp);
|
|
/* getter is the same as for the regular bool */
|
|
#define param_check_bool_enable_only param_check_bool
|
|
|
|
extern const struct kernel_param_ops param_ops_invbool;
|
|
extern int param_set_invbool(const char *val, const struct kernel_param *kp);
|
|
extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
|
|
#define param_check_invbool(name, p) __param_check(name, p, bool)
|
|
|
|
/* An int, which can only be set like a bool (though it shows as an int). */
|
|
extern const struct kernel_param_ops param_ops_bint;
|
|
extern int param_set_bint(const char *val, const struct kernel_param *kp);
|
|
#define param_get_bint param_get_int
|
|
#define param_check_bint param_check_int
|
|
|
|
/**
|
|
* module_param_array - a parameter which is an array of some type
|
|
* @name: the name of the array variable
|
|
* @type: the type, as per module_param()
|
|
* @nump: optional pointer filled in with the number written
|
|
* @perm: visibility in sysfs
|
|
*
|
|
* Input and output are as comma-separated values. Commas inside values
|
|
* don't work properly (eg. an array of charp).
|
|
*
|
|
* ARRAY_SIZE(@name) is used to determine the number of elements in the
|
|
* array, so the definition must be visible.
|
|
*/
|
|
#define module_param_array(name, type, nump, perm) \
|
|
module_param_array_named(name, name, type, nump, perm)
|
|
|
|
/**
|
|
* module_param_array_named - renamed parameter which is an array of some type
|
|
* @name: a valid C identifier which is the parameter name
|
|
* @array: the name of the array variable
|
|
* @type: the type, as per module_param()
|
|
* @nump: optional pointer filled in with the number written
|
|
* @perm: visibility in sysfs
|
|
*
|
|
* This exposes a different name than the actual variable name. See
|
|
* module_param_named() for why this might be necessary.
|
|
*/
|
|
#define module_param_array_named(name, array, type, nump, perm) \
|
|
param_check_##type(name, &(array)[0]); \
|
|
static const struct kparam_array __param_arr_##name \
|
|
= { .max = ARRAY_SIZE(array), .num = nump, \
|
|
.ops = ¶m_ops_##type, \
|
|
.elemsize = sizeof(array[0]), .elem = array }; \
|
|
__module_param_call(MODULE_PARAM_PREFIX, name, \
|
|
¶m_array_ops, \
|
|
.arr = &__param_arr_##name, \
|
|
perm, -1, 0); \
|
|
__MODULE_PARM_TYPE(name, "array of " #type)
|
|
|
|
enum hwparam_type {
|
|
hwparam_ioport, /* Module parameter configures an I/O port */
|
|
hwparam_iomem, /* Module parameter configures an I/O mem address */
|
|
hwparam_ioport_or_iomem, /* Module parameter could be either, depending on other option */
|
|
hwparam_irq, /* Module parameter configures an IRQ */
|
|
hwparam_dma, /* Module parameter configures a DMA channel */
|
|
hwparam_dma_addr, /* Module parameter configures a DMA buffer address */
|
|
hwparam_other, /* Module parameter configures some other value */
|
|
};
|
|
|
|
/**
|
|
* module_param_hw_named - A parameter representing a hw parameters
|
|
* @name: a valid C identifier which is the parameter name.
|
|
* @value: the actual lvalue to alter.
|
|
* @type: the type of the parameter
|
|
* @hwtype: what the value represents (enum hwparam_type)
|
|
* @perm: visibility in sysfs.
|
|
*
|
|
* Usually it's a good idea to have variable names and user-exposed names the
|
|
* same, but that's harder if the variable must be non-static or is inside a
|
|
* structure. This allows exposure under a different name.
|
|
*/
|
|
#define module_param_hw_named(name, value, type, hwtype, perm) \
|
|
param_check_##type(name, &(value)); \
|
|
__module_param_call(MODULE_PARAM_PREFIX, name, \
|
|
¶m_ops_##type, &value, \
|
|
perm, -1, \
|
|
KERNEL_PARAM_FL_HWPARAM | (hwparam_##hwtype & 0)); \
|
|
__MODULE_PARM_TYPE(name, #type)
|
|
|
|
#define module_param_hw(name, type, hwtype, perm) \
|
|
module_param_hw_named(name, name, type, hwtype, perm)
|
|
|
|
/**
|
|
* module_param_hw_array - A parameter representing an array of hw parameters
|
|
* @name: the name of the array variable
|
|
* @type: the type, as per module_param()
|
|
* @hwtype: what the value represents (enum hwparam_type)
|
|
* @nump: optional pointer filled in with the number written
|
|
* @perm: visibility in sysfs
|
|
*
|
|
* Input and output are as comma-separated values. Commas inside values
|
|
* don't work properly (eg. an array of charp).
|
|
*
|
|
* ARRAY_SIZE(@name) is used to determine the number of elements in the
|
|
* array, so the definition must be visible.
|
|
*/
|
|
#define module_param_hw_array(name, type, hwtype, nump, perm) \
|
|
param_check_##type(name, &(name)[0]); \
|
|
static const struct kparam_array __param_arr_##name \
|
|
= { .max = ARRAY_SIZE(name), .num = nump, \
|
|
.ops = ¶m_ops_##type, \
|
|
.elemsize = sizeof(name[0]), .elem = name }; \
|
|
__module_param_call(MODULE_PARAM_PREFIX, name, \
|
|
¶m_array_ops, \
|
|
.arr = &__param_arr_##name, \
|
|
perm, -1, \
|
|
KERNEL_PARAM_FL_HWPARAM | (hwparam_##hwtype & 0)); \
|
|
__MODULE_PARM_TYPE(name, "array of " #type)
|
|
|
|
|
|
extern const struct kernel_param_ops param_array_ops;
|
|
|
|
extern const struct kernel_param_ops param_ops_string;
|
|
extern int param_set_copystring(const char *val, const struct kernel_param *);
|
|
extern int param_get_string(char *buffer, const struct kernel_param *kp);
|
|
|
|
/* for exporting parameters in /sys/module/.../parameters */
|
|
|
|
struct module;
|
|
|
|
#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
|
|
extern int module_param_sysfs_setup(struct module *mod,
|
|
const struct kernel_param *kparam,
|
|
unsigned int num_params);
|
|
|
|
extern void module_param_sysfs_remove(struct module *mod);
|
|
#else
|
|
static inline int module_param_sysfs_setup(struct module *mod,
|
|
const struct kernel_param *kparam,
|
|
unsigned int num_params)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void module_param_sysfs_remove(struct module *mod)
|
|
{ }
|
|
#endif
|
|
|
|
#endif /* _LINUX_MODULE_PARAMS_H */
|