函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:ldm_frag_add - Add a VBLK fragment to a list*@data: Raw fragment to be added to the list*@size: Size of the raw fragment*@frags: Linked list of VBLK fragments* Fragmented VBLKs may not be consecutive in the database, so they are placed

函数原型:static bool ldm_frag_add(const u8 *data, int size, struct list_head *frags)

返回类型:bool

参数:

类型参数名称
const u8 *data
intsize
struct list_head *frags
1233  BUG_ON(!data || !frags)
1235  如果size小于2乘size of a vblk's static parts
1236  ldm_error("Value of size is to small.")
1237  返回:false
1240  group等于get_unaligned_be32(data + 0x08)
1241  rec等于get_unaligned_be16(data + 0x0C)
1242  num等于get_unaligned_be16(data + 0x0E)
1243  如果num小于1或num大于4则
1244  ldm_error("A VBLK claims to have %d parts.", num)
1245  返回:false
1247  如果rec大于等于num
1248  ldm_error("REC value (%d) exceeds NUM value (%d)", rec, num)
1249  返回:false
1253  f等于list_entry - get the struct for this entry*@ptr: the &struct list_head pointer.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.(item, structfrag, list)
1254  如果group恒等于group则转到:found
1258  f等于开辟内存
1259  如果非f
1260  ldm_crit("Out of memory.")
1261  返回:false
1264  group等于group
1265  Total number of records 等于num
1266  This is record number n 等于rec
1267  Which portions are in use 等于0xFF左移num
1269  添加链表项
1270  found :
1271  如果rec大于等于 Total number of records
1272  ldm_error("REC value (%d) exceeds NUM value (%d)", rec, Total number of records )
1273  返回:false
1275  如果 Which portions are in use 按位与1左移rec位则
1276  ldm_error("Duplicate VBLK, part %d.", rec)
1277  Which portions are in use 与等于0x7F
1278  返回:false
1280  Which portions are in use 或等于1左移rec
1281  如果非recmemcpy(data, data, size of a vblk's static parts )
1283  data加等于size of a vblk's static parts
1284  size减等于size of a vblk's static parts
1285  memcpy(data + size of a vblk's static parts + rec * size, data, size)
1286  返回:true
调用者
名称描述
ldm_get_vblksldm_get_vblks - Read the on-disk database of VBLKs into memory*@state: Partition check state including device holding the LDM Database*@base: Offset, into @state->bdev, of the database*@ldb: Cache of the database structures* To use the information from