Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\partitions\ldm.c Create Date:2022-07-28 17:28:38
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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

Proto:static bool ldm_frag_add(const u8 *data, int size, struct list_head *frags)

Type:bool

Parameter:

TypeParameterName
const u8 *data
intsize
struct list_head *frags
1233  BUG_ON(!data || !frags)
1235  If size < 2 * size of a vblk's static parts Then
1236  ldm_error("Value of size is to small.")
1237  Return false
1240  group = get_unaligned_be32(data + 0x08)
1241  rec = get_unaligned_be16(data + 0x0C)
1242  num = get_unaligned_be16(data + 0x0E)
1243  If num < 1 || num > 4 Then
1244  ldm_error("A VBLK claims to have %d parts.", num)
1245  Return false
1247  If rec >= num Then
1248  ldm_error("REC value (%d) exceeds NUM value (%d)", rec, num)
1249  Return 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  If group == group Then Go to found
1258  f = Allocation memory
1259  If Not f Then
1260  ldm_crit("Out of memory.")
1261  Return 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  list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
1270  found :
1271  If rec >= Total number of records Then
1272  ldm_error("REC value (%d) exceeds NUM value (%d)", rec, Total number of records )
1273  Return false
1275  If Which portions are in use & 1 << rec Then
1276  ldm_error("Duplicate VBLK, part %d.", rec)
1277  Which portions are in use &= 0x7F
1278  Return false
1280  Which portions are in use |= 1 << rec
1281  If Not rec Then memcpy(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  Return true
Caller
NameDescribe
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