Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__do_proc_doulongvec_minmax

Proto:static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul, unsigned long convdiv)

Type:int

Parameter:

TypeParameterName
void *data
struct ctl_table *table
intwrite
void __user *buffer
size_t *lenp
loff_t *ppos
unsigned longconvmul
unsigned longconvdiv
2854  first = 1 , err = 0
2856  kbuf = NULL
2858  If Not data || Not maxlen || Not lenp || ppos && Not write Then
2859  lenp = 0
2860  Return 0
2863  i = data
2864  min = extra1
2865  max = extra2
2866  vleft = maxlen / sizeof(unsignedlong)
2867  left = lenp
2869  If write Then
2870  If proc_first_pos_non_zero_ignore - check if first position is allowed*@ppos: file position*@table: the sysctl table* Returns true if the first position is non-zero and the sysctl_writes_strict* mode indicates this is not allowed for numeric input types Then Go to out
2873  If left > PAGE_SIZE - 1 Then left = PAGE_SIZE - 1
2875  p = kbuf = memdup_user_nul(buffer, left)
2876  If IS_ERR(kbuf) Then Return PTR_ERR(kbuf)
2880  When left && vleft-- cycle
2883  If write Then
2886  left -= proc_skip_spaces( & p)
2887  If Not left Then Break
2893  If err Then Break
2895  If neg Then Continue
2897  val = convmul * val / convdiv
2898  If min && val < min || max && val > max Then
2899  err = -EINVAL
2900  Break
2902  i = val
2903  Else
2904  val = convdiv * i / convmul
2905  If Not first Then
2906  err = proc_put_char( & buffer, & left, '\t')
2907  If err Then Break
2911  If err Then Break
2916  If Not write && Not first && left && Not err Then err = proc_put_char( & buffer, & left, '\n')
2918  If write && Not err Then left -= proc_skip_spaces( & p)
2920  If write Then
2921  free previously allocated memory
2922  If first Then Return If err Else -EINVAL
2925  lenp -= left
2926  out :
2927  ppos += lenp
2928  Return err
Caller
NameDescribe
do_proc_doulongvec_minmax