函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\genhd.c Create Date:2022-07-27 18:53:07
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:gister_blkdev - register a new block device*@major: the requested major device number [1..BLKDEV_MAJOR_MAX-1]. If*@major = 0, try to allocate any unused major number.*@name: the name of the new block device as a zero terminated string

函数原型:int register_blkdev(unsigned int major, const char *name)

返回类型:int

参数:

类型参数名称
unsigned intmajor
const char *name
357  ret等于0
359  mutex_lock( & block_class_lock)
362  如果major恒等于0则
363 index大于0循环
364  如果(major_names[index] == NULL)则退出
368  如果index恒等于0则
371  ret等于负EBUSY
372  转到:out
374  major等于index
375  ret等于major
378  如果major大于等于BLKDEV_MAJOR_MAX
379  打印错误信息("%s: major requested (%u) is greater than the maximum (%u) for %s\n", __func__, major, BLKDEV_MAJOR_MAX - 1, name)
382  ret等于负EINVAL
383  转到:out
386  p等于开辟内存
387  如果(p == NULL)则
388  ret等于负ENOMEM
389  转到:out
392  major等于major
393  长字符串复制
394  next = NULL
395  index等于dex in the above - for now: assume no multimajor ranges
397 n循环
398  如果major恒等于major退出
401  如果非nn等于p
403  否则ret等于负EBUSY
406  如果ret小于0则
407  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
409  释放内存
411  out :
412  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.
413  返回:ret
调用者
名称描述
genhd_device_init