Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\livepatch\core.c Create Date:2022-07-28 10:30:19
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:enabled_store

Proto:static ssize_t enabled_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)

Type:ssize_t

Parameter:

TypeParameterName
struct kobject *kobj
struct kobj_attribute *attr
const char *buf
size_tcount
319  ret = kstrtobool - convert common user inputs into boolean values*@s: input string*@res: result* This routine returns 0 iff the first character is one of 'Yy1Nn0', or* [oO][NnFf] for "on" and "off". Otherwise it will return -EINVAL. Value
320  If ret Then Return ret
323  patch = container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(kobj, structklp_patch, kobj)
325  mutex_lock( & klp_mutex is a coarse lock which serializes access to klp data)
327  If enabled == enabled Then
329  ret = -EINVAL
330  Go to out
340  If patch == klp_transition_patch Then This function can be called in the middle of an existing transition to* reverse the direction of the target patch state. This can be done to* effectively cancel an existing enable or disable operation if there are any
342  Else if Not enabled Then ret = Sysfs Interface* /sys/kernel/livepatch* /sys/kernel/livepatch/* /sys/kernel/livepatch//enabled* /sys/kernel/livepatch//transition* /sys/kernel/livepatch//force* /sys/kernel/livepatch//*
344  Else ret = -EINVAL
347  out :
348  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
350  If ret Then Return ret
352  Return count