Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:pio_data find_cpio_data - Search for files in an uncompressed cpio*@path: The directory to search for, including a slash at the end*@data: Pointer to the the cpio archive or a header inside*@len: Remaining length of the cpio based on data

Proto:struct cpio_data find_cpio_data(const char *path, void *data, size_t len, long *nextoff)

Type:struct cpio_data

Parameter:

TypeParameterName
const char *path
void *data
size_tlen
long *nextoff
62  cpio_header_len = 8 * C_NFIELDS - 2
63  struct cpio_data cd = {NULL, 0, ""}
67  mypathsize = strlen(path)
70  p = data
72  When len > cpio_header_len cycle
73  If Not p Then
75  p += 4
76  len -= 4
77  Continue
80  j = 6
81  chp = ch
82  When i cycle
83  v = 0
84  When j-- cycle
85  v <<= 4
86  c = p++
88  x = c - '0'
89  If x < 10 Then
90  v += x
91  Continue
94  x = (c | 0x20) - 'a'
95  If x < 6 Then
96  v += x + 10
97  Continue
100  Go to quit
102  chp++ = v
103  j = 8
106  If ch[C_MAGIC] - 0x070701 > 1 Then Go to quit
109  len -= cpio_header_len
111  dptr = PTR_ALIGN(p + ch[C_NAMESIZE], 4)
112  nptr = PTR_ALIGN(dptr + ch[C_FILESIZE], 4)
114  If nptr > p + len || dptr < p || nptr < dptr Then Go to quit
117  If (ch[C_MODE] & 0170000) == 0100000 && ch[C_NAMESIZE] >= mypathsize && Not memcmp(p, path, mypathsize) Then
121  If nextoff Then nextoff = nptr - data
125  pr_warn("File %s exceeding MAX_CPIO_FILE_NAME [%d]\n", p, MAX_CPIO_FILE_NAME)
131  data = dptr
132  size = ch[C_FILESIZE]
133  Return cd
135  len -= nptr - p
136  p = nptr
139  quit :
140  Return cd