Lines Matching defs:list

27  * This file contains routines that manipulate the defect list.
62 * This routine reads the defect list off the disk. It also reads in the
63 * bad block table if the disk is a BAD144 type. The defect list is
69 read_list(struct defect_list *list)
82 * This indicates that no list manipulation is done in this controller
90 * Panther's working list is maintained by the controller
94 ((*cur_ops->op_ex_cur)(list)) == 0) {
95 if (list->header.magicno != DEFECT_MAGIC) {
96 fmt_print("Defect list BAD\n");
98 fmt_print("Controller working list found\n");
104 ((*cur_ops->op_ex_man)(list)) == 0) {
105 if (list->header.magicno != DEFECT_MAGIC) {
106 fmt_print("Defect list BAD\n");
108 fmt_print("MANUFACTURER's list found\n");
112 fmt_print("No defect list found\n");
117 * Loop for each copy of the defect list until we get a good one.
121 * Try to read the list header.
125 (char *)&list->header, NULL), F_NORMAL)
130 if (list->header.magicno != DEFECT_MAGIC)
133 * Allocate space for the rest of the list.
135 size = deflist_size(cur_blksz, list->header.count);
136 list->list = (struct defect_entry *)zalloc(size * cur_blksz);
138 * Try to read in the rest of the list. If there is an
143 (char *)list->list, F_NORMAL, NULL) ||
144 checkdefsum(list, CK_CHECKSUM)) {
146 * Destroy the list and go on.
148 kill_deflist(list);
169 * Do a sanity check on the list read in. If it passes,
202 * list, depending on the mode parameter. In check mode, it returns
206 checkdefsum(struct defect_list *list, int mode)
213 lp = (int *)list->list;
214 for (i = 0; i < (list->header.count *
221 return (sum != list->header.cksum);
226 list->header.cksum = sum;
264 * This routine calculates where in a defect list a given defect should
267 * adds all logical sector defects to the end of the list. This is
272 sort_defect(struct defect_entry *def, struct defect_list *list)
278 * of the list.
281 return (list->header.count);
283 * It's a bfi defect. Loop through the defect list.
285 for (ptr = list->list; ptr - list->list < list->header.count; ptr++) {
311 return (ptr - list->list);
315 * This routine writes the defect list on the back on the disk. It also
320 write_deflist(struct defect_list *list)
333 * This indicates that no list manipulation is done in this controller
341 * Panther's working list is maintained by the controller
344 (*cur_ops->op_wr_cur)(list);
349 * If the list is null, there is nothing to write.
351 if (list->list != NULL) {
353 * calculate how many sectors the defect list will occupy.
355 size = deflist_size(cur_blksz, list->header.count);
357 * Loop for each copy of the list to be written. Write
358 * out the header of the list followed by the data.
363 (char *)&list->header, F_NORMAL, NULL);
366 "Warning: error saving defect list.\n");
371 (char *)list->list, F_NORMAL, NULL);
374 "Warning: error saving defect list.\n");
404 * This routine adds a logical sector to the given defect list.
407 add_ldef(diskaddr_t blkno, struct defect_list *list)
424 * Calculate the index into the list that the defect belongs at.
426 index = sort_defect(&def, list);
428 * Add the defect to the list.
430 add_def(&def, list, index);
434 * This routine adds the given defect struct to the defect list at
438 add_def(struct defect_entry *def, struct defect_list *list, int index)
443 * If adding this defect makes the list overflow into another
446 count = list->header.count;
448 list->list = (struct defect_entry *)rezalloc((void *)list->list,
451 * Slip all the defects after this one down one slot in the list.
454 *(list->list + i) = *(list->list + i - 1);
458 *(list->list + i) = *def;
462 list->header.count++;
463 (void) checkdefsum(list, CK_MAKESUM);
467 * This routine sets the given defect list back to null.
470 kill_deflist(struct defect_list *list)
476 if (list->list == NULL)
481 destroy_data((char *)list->list);
485 list->list = NULL;
486 list->flags = 0;
490 * This routine returns the defect list size