Lines Matching refs:params
21 static int FillBuffer(CgptFindParams *params, int fd, uint64_t pos, in FillBuffer() argument
23 uint8_t *bufptr = params->comparebuf; in FillBuffer()
42 static int match_content(CgptFindParams *params, struct drive *drive, in match_content() argument
46 if (!params->matchlen) in match_content()
51 if (params->matchoffset + params->matchlen > part_size) { in match_content()
56 if (!FillBuffer(params, in match_content()
58 (LBA_SIZE * entry->starting_lba) + params->matchoffset, in match_content()
59 params->matchlen)) { in match_content()
65 if (0 == memcmp(params->matchbuf, params->comparebuf, params->matchlen)) { in match_content()
74 static void showmatch(CgptFindParams *params, char *filename, in showmatch() argument
80 if (params->numeric) { in showmatch()
83 if (params->show_fn) { in showmatch()
84 params->show_fn(params, filename, partnum, entry); in showmatch()
89 if (params->verbose > 0) in showmatch()
90 EntryDetails(entry, partnum - 1, params->numeric); in showmatch()
95 static void chromeos_mtd_show(CgptFindParams *params, char *filename, in chromeos_mtd_show() argument
110 static int gpt_search(CgptFindParams *params, struct drive *drive, in gpt_search() argument
128 if ((params->set_unique && GuidEqual(¶ms->unique_guid, &entry->unique)) in gpt_search()
129 || (params->set_type && GuidEqual(¶ms->type_guid, &entry->type))) { in gpt_search()
131 } else if (params->set_label) { in gpt_search()
138 if (!strncmp(params->label, partlabel, sizeof(partlabel))) in gpt_search()
141 if (found && match_content(params, drive, entry)) { in gpt_search()
142 params->hits++; in gpt_search()
144 showmatch(params, filename, i+1, entry); in gpt_search()
145 if (!params->match_partnum) in gpt_search()
146 params->match_partnum = i+1; in gpt_search()
153 static int do_search(CgptFindParams *params, char *fileName) { in do_search() argument
157 if (CGPT_OK != DriveOpen(fileName, &drive, O_RDONLY, params->drive_size)) in do_search()
160 retval = gpt_search(params, &drive, fileName); in do_search()
212 static int scan_real_devs(CgptFindParams *params) { in scan_real_devs() argument
234 if (do_search(params, pathname)) { in scan_real_devs()
258 if (params->drive_size == 0) { in scan_real_devs()
259 if (GetMtdSize("/dev/mtd0", ¶ms->drive_size) != 0) { in scan_real_devs()
270 params->show_fn = chromeos_mtd_show; in scan_real_devs()
271 if (do_search(params, nor_file)) { in scan_real_devs()
274 params->show_fn = NULL; in scan_real_devs()
287 void CgptFind(CgptFindParams *params) { in CgptFind() argument
288 if (params == NULL) in CgptFind()
291 if (params->drive_name != NULL) in CgptFind()
292 do_search(params, params->drive_name); in CgptFind()
294 scan_real_devs(params); in CgptFind()