Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\sysctl.c Create Date:2022-07-28 09:11:46
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:proc_do_large_bitmap - read/write from/to a large bitmap*@table: the sysctl table*@write: %TRUE if this is a write to the sysctl file*@buffer: the user buffer*@lenp: the size of the user buffer*@ppos: file position* The bitmap is stored at table->data and

Proto:int proc_do_large_bitmap(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos)

Type:int

Parameter:

TypeParameterName
struct ctl_table *table
intwrite
void __user *buffer
size_t *lenp
loff_t *ppos
3169  err = 0
3170  first = 1
3171  left = lenp
3172  bitmap_len = maxlen
3173  bitmap = data
3174  unsigned long * tmp_bitmap = NULL
3175  char tr_a[] = {'-', ',', '\n'}, tr_b[] = {',', '\n', 0}, c
3177  If Not bitmap || Not bitmap_len || Not left || ppos && Not write Then
3178  lenp = 0
3179  Return 0
3182  If write Then
3184  skipped = 0
3186  If left > PAGE_SIZE - 1 Then
3187  left = PAGE_SIZE - 1
3189  skipped = lenp - left
3192  p = kbuf = memdup_user_nul(buffer, left)
3193  If IS_ERR(kbuf) Then Return PTR_ERR(kbuf)
3196  tmp_bitmap = bitmap_zalloc(bitmap_len, GFP_KERNEL)
3197  If Not tmp_bitmap Then
3199  Return -ENOMEM
3201  proc_skip_char( & p, & left, '\n')
3202  When Not err && left cycle
3208  saved_left = left
3216  If left <= 1 && skipped Then
3217  left = saved_left
3218  Break
3221  If err Then Break
3223  If val_a >= bitmap_len || neg Then
3224  err = -EINVAL
3225  Break
3228  val_b = val_a
3229  If left Then
3230  p++
3231  left--
3234  If c == '-' Then
3261  first = 0
3262  proc_skip_char( & p, & left, '\n')
3264  free previously allocated memory
3265  left += skipped
3266  Else
3267  bit_b = 0
3269  When left cycle
3271  If bit_a >= bitmap_len Then Break
3276  If Not first Then
3277  err = proc_put_char( & buffer, & left, ',')
3278  If err Then Break
3282  If err Then Break
3284  If bit_a != bit_b Then
3293  first = 0
3293  bit_b++
3295  If Not err Then err = proc_put_char( & buffer, & left, '\n')
3299  If Not err Then
3300  If write Then
3306  lenp -= left
3307  ppos += lenp
3310  bitmap_free(tmp_bitmap)
3311  Return err
Caller
NameDescribe
proc_watchdog_cpumaskThe cpumask is the mask of possible cpus that the watchdog can run* on, not the mask of cpus it is actually running on. This allows the* user to specify a mask that will include cpus that have not yet* been brought online, if desired.