Lines Matching +full:no +full:- +full:temp +full:- +full:support
3 /*-
4 * SPDX-License-Identifier: BSD-2-Clause AND BSD-4-Clause
7 * Perez-Rathke and Ram Vedam. All rights reserved.
10 * Alan Perez-Rathke and Ram Vedam.
23 * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM ``AS IS'' AND ANY EXPRESS OR
26 * DISCLAIMED. IN NO EVENT SHALL DANIEL WATT, WALTER DEIGNAN, RYAN
27 * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM BE LIABLE FOR ANY DIRECT, INDIRECT,
61 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
89 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
170 cd9660node *temp = ecalloc(1, sizeof(*temp)); in cd9660_allocate_cd9660node() local
172 TAILQ_INIT(&temp->cn_children); in cd9660_allocate_cd9660node()
173 temp->parent = temp->dot_record = temp->dot_dot_record = NULL; in cd9660_allocate_cd9660node()
174 temp->ptnext = temp->ptprev = temp->ptlast = NULL; in cd9660_allocate_cd9660node()
175 temp->node = NULL; in cd9660_allocate_cd9660node()
176 temp->isoDirRecord = NULL; in cd9660_allocate_cd9660node()
177 temp->isoExtAttributes = NULL; in cd9660_allocate_cd9660node()
178 temp->rr_real_parent = temp->rr_relocated = NULL; in cd9660_allocate_cd9660node()
179 temp->su_tail_data = NULL; in cd9660_allocate_cd9660node()
180 return temp; in cd9660_allocate_cd9660node()
190 diskStructure->sectorSize = 2048; in cd9660_set_defaults()
193 diskStructure->verbose_level = 0; in cd9660_set_defaults()
194 diskStructure->keep_bad_images = 0; in cd9660_set_defaults()
195 diskStructure->isoLevel = 2; in cd9660_set_defaults()
197 diskStructure->rock_ridge_enabled = 0; in cd9660_set_defaults()
198 diskStructure->rock_ridge_renamed_dir_name = 0; in cd9660_set_defaults()
199 diskStructure->rock_ridge_move_count = 0; in cd9660_set_defaults()
200 diskStructure->rr_moved_dir = 0; in cd9660_set_defaults()
202 diskStructure->chrp_boot = 0; in cd9660_set_defaults()
204 diskStructure->include_padding_areas = 1; in cd9660_set_defaults()
207 diskStructure->allow_deep_trees = in cd9660_set_defaults()
208 diskStructure->allow_start_dot = in cd9660_set_defaults()
209 diskStructure->allow_max_name = in cd9660_set_defaults()
210 diskStructure->allow_illegal_chars = in cd9660_set_defaults()
211 diskStructure->allow_lowercase = in cd9660_set_defaults()
212 diskStructure->allow_multidot = in cd9660_set_defaults()
213 diskStructure->omit_trailing_period = 0; in cd9660_set_defaults()
216 memset(&diskStructure->primaryDescriptor, 0, 2048); in cd9660_set_defaults()
218 memset(diskStructure->primaryDescriptor.publisher_id, 0x20,128); in cd9660_set_defaults()
219 memset(diskStructure->primaryDescriptor.preparer_id, 0x20,128); in cd9660_set_defaults()
220 memset(diskStructure->primaryDescriptor.application_id, 0x20,128); in cd9660_set_defaults()
221 memset(diskStructure->primaryDescriptor.copyright_file_id, 0x20,37); in cd9660_set_defaults()
222 memset(diskStructure->primaryDescriptor.abstract_file_id, 0x20,37); in cd9660_set_defaults()
223 memset(diskStructure->primaryDescriptor.bibliographic_file_id, 0x20,37); in cd9660_set_defaults()
225 strcpy(diskStructure->primaryDescriptor.system_id, "FreeBSD"); in cd9660_set_defaults()
227 /* Boot support: Initially disabled */ in cd9660_set_defaults()
228 diskStructure->has_generic_bootimage = 0; in cd9660_set_defaults()
229 diskStructure->generic_bootimage = NULL; in cd9660_set_defaults()
231 diskStructure->boot_image_directory = 0; in cd9660_set_defaults()
232 /*memset(diskStructure->boot_descriptor, 0, 2048);*/ in cd9660_set_defaults()
234 diskStructure->is_bootable = 0; in cd9660_set_defaults()
235 TAILQ_INIT(&diskStructure->boot_images); in cd9660_set_defaults()
236 LIST_INIT(&diskStructure->boot_entries); in cd9660_set_defaults()
248 { letter, name, &diskStructure->field, \ in cd9660_prep_opts()
249 sizeof(diskStructure->field) == 8 ? OPT_INT64 : \ in cd9660_prep_opts()
250 (sizeof(diskStructure->field) == 4 ? OPT_INT32 : \ in cd9660_prep_opts()
251 (sizeof(diskStructure->field) == 2 ? OPT_INT16 : OPT_INT8)), \ in cd9660_prep_opts()
264 "Enable Rock-Ridge extensions"), in cd9660_prep_opts()
265 OPT_BOOL('C', "chrp-boot", chrp_boot, in cd9660_prep_opts()
267 OPT_BOOL('K', "keep-bad-images", keep_bad_images, in cd9660_prep_opts()
269 OPT_BOOL('D', "allow-deep-trees", allow_deep_trees, in cd9660_prep_opts()
271 OPT_BOOL('a', "allow-max-name", allow_max_name, in cd9660_prep_opts()
273 OPT_BOOL('i', "allow-illegal-chars", allow_illegal_chars, in cd9660_prep_opts()
275 OPT_BOOL('m', "allow-multidot", allow_multidot, in cd9660_prep_opts()
277 OPT_BOOL('o', "omit-trailing-period", omit_trailing_period, in cd9660_prep_opts()
279 OPT_BOOL('\0', "allow-lowercase", allow_lowercase, in cd9660_prep_opts()
281 OPT_BOOL('\0', "no-trailing-padding", include_padding_areas, in cd9660_prep_opts()
290 OPT_STR('G', "generic-bootimage", "Generic boot image param"), in cd9660_prep_opts()
292 OPT_STR('\0', "no-emul-boot", "No boot emulation"), in cd9660_prep_opts()
293 OPT_STR('\0', "no-boot", "No boot support"), in cd9660_prep_opts()
294 OPT_STR('\0', "hard-disk-boot", "Boot from hard disk"), in cd9660_prep_opts()
295 OPT_STR('\0', "boot-load-segment", "Boot load segment"), in cd9660_prep_opts()
301 fsopts->fs_specific = diskStructure; in cd9660_prep_opts()
302 fsopts->fs_options = copy_opts(cd9660_options); in cd9660_prep_opts()
310 free(fsopts->fs_specific); in cd9660_cleanup_opts()
311 free(fsopts->fs_options); in cd9660_cleanup_opts()
334 warnx("error: '%s' must be composed of %c-characters", in cd9660_arguments_set_string()
343 * Command-line parsing function
350 iso9660_disk *diskStructure = fsopts->fs_specific; in cd9660_parse_opts()
351 option_t *cd9660_options = fsopts->fs_options; in cd9660_parse_opts()
361 if (i == -1) in cd9660_parse_opts()
376 diskStructure->primaryDescriptor.volume_id); in cd9660_parse_opts()
380 diskStructure->primaryDescriptor.application_id); in cd9660_parse_opts()
384 diskStructure->primaryDescriptor.publisher_id); in cd9660_parse_opts()
388 diskStructure->primaryDescriptor.preparer_id); in cd9660_parse_opts()
392 diskStructure->primaryDescriptor.volume_set_id); in cd9660_parse_opts()
421 diskStructure->boot_image_directory = in cd9660_parse_opts()
425 'd', diskStructure->boot_image_directory); in cd9660_parse_opts()
427 } else if (strcmp(name, "no-emul-boot") == 0 || in cd9660_parse_opts()
428 strcmp(name, "no-boot") == 0 || in cd9660_parse_opts()
429 strcmp(name, "hard-disk-boot") == 0) { in cd9660_parse_opts()
433 } else if (strcmp(name, "boot-load-segment") == 0 || in cd9660_parse_opts()
469 iso9660_disk *diskStructure = fsopts->fs_specific; in cd9660_makefs()
471 if (diskStructure->verbose_level > 0) in cd9660_makefs()
473 diskStructure->isoLevel); in cd9660_makefs()
474 if (diskStructure->isoLevel < 2 && in cd9660_makefs()
475 diskStructure->allow_multidot) in cd9660_makefs()
476 errx(EXIT_FAILURE, "allow-multidot requires iso level of 2"); in cd9660_makefs()
482 if (diskStructure->verbose_level > 0) in cd9660_makefs()
495 real_root->isoDirRecord = emalloc(sizeof(*real_root->isoDirRecord)); in cd9660_makefs()
497 memset(real_root->isoDirRecord->name, 0, in cd9660_makefs()
500 real_root->level = 0; in cd9660_makefs()
501 diskStructure->rootNode = real_root; in cd9660_makefs()
502 real_root->type = CD9660_TYPE_DIR; in cd9660_makefs()
504 real_root->node = root; in cd9660_makefs()
508 if (TAILQ_EMPTY(&real_root->cn_children)) { in cd9660_makefs()
514 if (diskStructure->verbose_level > 0) in cd9660_makefs()
523 if (diskStructure->verbose_level > 0) in cd9660_makefs()
527 if (diskStructure->rock_ridge_enabled) { in cd9660_makefs()
528 cd9660_susp_initialize(diskStructure, diskStructure->rootNode, in cd9660_makefs()
529 diskStructure->rootNode, NULL); in cd9660_makefs()
533 diskStructure->pathTableLength = cd9660_generate_path_table( in cd9660_makefs()
536 pathTableSectors = CD9660_BLOCKS(diskStructure->sectorSize, in cd9660_makefs()
537 diskStructure->pathTableLength); in cd9660_makefs()
540 if (diskStructure->is_bootable) { in cd9660_makefs()
547 diskStructure->primaryLittleEndianTableSector = firstAvailableSector; in cd9660_makefs()
548 diskStructure->primaryBigEndianTableSector = in cd9660_makefs()
549 diskStructure->primaryLittleEndianTableSector + pathTableSectors; in cd9660_makefs()
551 /* Set the secondary ones to -1, not going to use them for now */ in cd9660_makefs()
552 diskStructure->secondaryBigEndianTableSector = -1; in cd9660_makefs()
553 diskStructure->secondaryLittleEndianTableSector = -1; in cd9660_makefs()
555 diskStructure->dataFirstSector = in cd9660_makefs()
556 diskStructure->primaryBigEndianTableSector + pathTableSectors; in cd9660_makefs()
557 if (diskStructure->verbose_level > 0) in cd9660_makefs()
561 diskStructure->pathTableLength, pathTableSectors); in cd9660_makefs()
563 startoffset = diskStructure->sectorSize*diskStructure->dataFirstSector; in cd9660_makefs()
567 diskStructure->totalSectors = diskStructure->dataFirstSector + in cd9660_makefs()
568 CD9660_BLOCKS(diskStructure->sectorSize, totalSpace); in cd9660_makefs()
571 if (diskStructure->rock_ridge_enabled) { in cd9660_makefs()
572 diskStructure->susp_continuation_area_start_sector = in cd9660_makefs()
573 diskStructure->totalSectors; in cd9660_makefs()
574 diskStructure->totalSectors += in cd9660_makefs()
575 CD9660_BLOCKS(diskStructure->sectorSize, in cd9660_makefs()
576 diskStructure->susp_continuation_area_size); in cd9660_makefs()
577 cd9660_susp_finalize(diskStructure, diskStructure->rootNode); in cd9660_makefs()
584 /* diskStructure->totalSectors+=150; */ in cd9660_makefs()
587 if (diskStructure->verbose_level > 0) { in cd9660_makefs()
588 printf("%s: Sectors 0-15 reserved\n", __func__); in cd9660_makefs()
591 diskStructure->primaryLittleEndianTableSector); in cd9660_makefs()
593 PRId64 "\n", __func__, diskStructure->dataFirstSector); in cd9660_makefs()
595 PRId64 "\n", __func__, diskStructure->totalSectors); in cd9660_makefs()
602 if (diskStructure->include_padding_areas) in cd9660_makefs()
603 diskStructure->totalSectors += 150; in cd9660_makefs()
607 if (diskStructure->verbose_level > 1) { in cd9660_makefs()
616 if (diskStructure->verbose_level > 0) in cd9660_makefs()
620 /* Generic function pointer - implement later */
628 /* root should be a fixed size of 34 bytes since it has no name */ in cd9660_finalize_PVD()
629 memcpy(diskStructure->primaryDescriptor.root_directory_record, in cd9660_finalize_PVD()
630 diskStructure->rootNode->dot_record->isoDirRecord, 34); in cd9660_finalize_PVD()
633 diskStructure->primaryDescriptor.root_directory_record[0] = 34; in cd9660_finalize_PVD()
636 cd9660_bothendian_dword(diskStructure->totalSectors, in cd9660_finalize_PVD()
637 (unsigned char *)diskStructure->primaryDescriptor.volume_space_size); in cd9660_finalize_PVD()
639 (unsigned char *)diskStructure->primaryDescriptor.volume_set_size); in cd9660_finalize_PVD()
642 diskStructure->primaryDescriptor.volume_sequence_number); in cd9660_finalize_PVD()
643 cd9660_bothendian_word(diskStructure->sectorSize, in cd9660_finalize_PVD()
645 diskStructure->primaryDescriptor.logical_block_size); in cd9660_finalize_PVD()
646 cd9660_bothendian_dword(diskStructure->pathTableLength, in cd9660_finalize_PVD()
647 (unsigned char *)diskStructure->primaryDescriptor.path_table_size); in cd9660_finalize_PVD()
649 cd9660_731(diskStructure->primaryLittleEndianTableSector, in cd9660_finalize_PVD()
650 (u_char *)diskStructure->primaryDescriptor.type_l_path_table); in cd9660_finalize_PVD()
651 cd9660_732(diskStructure->primaryBigEndianTableSector, in cd9660_finalize_PVD()
652 (u_char *)diskStructure->primaryDescriptor.type_m_path_table); in cd9660_finalize_PVD()
654 diskStructure->primaryDescriptor.file_structure_version[0] = 1; in cd9660_finalize_PVD()
657 cd9660_pad_string_spaces(diskStructure->primaryDescriptor.volume_id, 32); in cd9660_finalize_PVD()
658 cd9660_pad_string_spaces(diskStructure->primaryDescriptor.system_id, 32); in cd9660_finalize_PVD()
659 cd9660_pad_string_spaces(diskStructure->primaryDescriptor.volume_set_id, in cd9660_finalize_PVD()
661 cd9660_pad_string_spaces(diskStructure->primaryDescriptor.publisher_id, in cd9660_finalize_PVD()
663 cd9660_pad_string_spaces(diskStructure->primaryDescriptor.preparer_id, in cd9660_finalize_PVD()
665 cd9660_pad_string_spaces(diskStructure->primaryDescriptor.application_id, in cd9660_finalize_PVD()
668 diskStructure->primaryDescriptor.copyright_file_id, 37); in cd9660_finalize_PVD()
670 diskStructure->primaryDescriptor.abstract_file_id, 37); in cd9660_finalize_PVD()
672 diskStructure->primaryDescriptor.bibliographic_file_id, 37); in cd9660_finalize_PVD()
676 (unsigned char *)diskStructure->primaryDescriptor.creation_date, in cd9660_finalize_PVD()
679 (unsigned char *)diskStructure->primaryDescriptor.modification_date, in cd9660_finalize_PVD()
683 cd9660_set_date(diskStructure->primaryDescriptor.expiration_date, in cd9660_finalize_PVD()
687 memset(diskStructure->primaryDescriptor.expiration_date, '0', 16); in cd9660_finalize_PVD()
688 diskStructure->primaryDescriptor.expiration_date[16] = 0; in cd9660_finalize_PVD()
691 (unsigned char *)diskStructure->primaryDescriptor.effective_date, in cd9660_finalize_PVD()
694 cd9660_time_915(diskStructure->rootNode->dot_record->isoDirRecord->date, in cd9660_finalize_PVD()
705 record->ext_attr_length[0] = ext_attr_length; in cd9660_populate_iso_dir_record()
706 cd9660_time_915(record->date, tstamp); in cd9660_populate_iso_dir_record()
707 record->flags[0] = ISO_FLAG_CLEAR | flags; in cd9660_populate_iso_dir_record()
708 record->file_unit_size[0] = 0; in cd9660_populate_iso_dir_record()
709 record->interleave[0] = 0; in cd9660_populate_iso_dir_record()
710 cd9660_bothendian_word(1, record->volume_sequence_number); in cd9660_populate_iso_dir_record()
711 record->name_len[0] = name_len; in cd9660_populate_iso_dir_record()
712 memset(record->name, '\0', sizeof (record->name)); in cd9660_populate_iso_dir_record()
713 memcpy(record->name, name, name_len); in cd9660_populate_iso_dir_record()
714 record->length[0] = 33 + name_len; in cd9660_populate_iso_dir_record()
717 record->length[0] += (record->length[0] & 1) ? 1 : 0; in cd9660_populate_iso_dir_record()
723 cd9660_populate_iso_dir_record(diskStructure->rootNode->isoDirRecord, in cd9660_setup_root_node()
728 /*********** SUPPORT FUNCTIONS ***********/
735 volume_descriptor *temp, *t; in cd9660_setup_volume_descriptors() local
738 temp = emalloc(sizeof(*temp)); in cd9660_setup_volume_descriptors()
739 temp->volumeDescriptorData = in cd9660_setup_volume_descriptors()
740 (unsigned char *)&diskStructure->primaryDescriptor; in cd9660_setup_volume_descriptors()
741 temp->volumeDescriptorData[0] = ISO_VOLUME_DESCRIPTOR_PVD; in cd9660_setup_volume_descriptors()
742 temp->volumeDescriptorData[6] = 1; in cd9660_setup_volume_descriptors()
743 temp->sector = sector; in cd9660_setup_volume_descriptors()
744 memcpy(temp->volumeDescriptorData + 1, in cd9660_setup_volume_descriptors()
746 diskStructure->firstVolumeDescriptor = temp; in cd9660_setup_volume_descriptors()
749 /* Set up boot support if enabled. BVD must reside in sector 17 */ in cd9660_setup_volume_descriptors()
750 if (diskStructure->is_bootable) { in cd9660_setup_volume_descriptors()
752 t->volumeDescriptorData = ecalloc(1, 2048); in cd9660_setup_volume_descriptors()
753 temp->next = t; in cd9660_setup_volume_descriptors()
754 temp = t; in cd9660_setup_volume_descriptors()
755 t->sector = 17; in cd9660_setup_volume_descriptors()
756 if (diskStructure->verbose_level > 0) in cd9660_setup_volume_descriptors()
764 t->volumeDescriptorData = ecalloc(1, 2048); in cd9660_setup_volume_descriptors()
765 temp->next = t; in cd9660_setup_volume_descriptors()
766 t->volumeDescriptorData[0] = ISO_VOLUME_DESCRIPTOR_TERMINATOR; in cd9660_setup_volume_descriptors()
767 t->next = NULL; in cd9660_setup_volume_descriptors()
768 t->volumeDescriptorData[6] = 1; in cd9660_setup_volume_descriptors()
769 t->sector = sector; in cd9660_setup_volume_descriptors()
770 memcpy(t->volumeDescriptorData + 1, in cd9660_setup_volume_descriptors()
780 * cd9660 support
785 node->isoExtAttributes = emalloc(sizeof(*node->isoExtAttributes));
794 char temp[ISO_FILENAME_MAXLENGTH_WITH_PADDING]; in cd9660_translate_node_common() local
797 memset(temp, 0, ISO_FILENAME_MAXLENGTH_WITH_PADDING); in cd9660_translate_node_common()
799 (void)cd9660_convert_filename(diskStructure, newnode->node->name, in cd9660_translate_node_common()
800 temp, !(S_ISDIR(newnode->node->type))); in cd9660_translate_node_common()
803 if (S_ISDIR(newnode->node->type)) in cd9660_translate_node_common()
806 cd9660_populate_iso_dir_record(newnode->isoDirRecord, 0, in cd9660_translate_node_common()
807 flag, strlen(temp), temp); in cd9660_translate_node_common()
809 cd9660_bothendian_dword(newnode->fileDataLength, in cd9660_translate_node_common()
810 newnode->isoDirRecord->size); in cd9660_translate_node_common()
812 if (S_ISLNK(newnode->node->type)) in cd9660_translate_node_common()
813 newnode->fileDataLength = 0; in cd9660_translate_node_common()
831 if (diskStructure->verbose_level > 0) in cd9660_translate_node()
835 newnode->isoDirRecord = emalloc(sizeof(*newnode->isoDirRecord)); in cd9660_translate_node()
837 newnode->node = node; in cd9660_translate_node()
840 if (!(S_ISDIR(node->type))) in cd9660_translate_node()
841 newnode->fileDataLength = node->inode->st.st_size; in cd9660_translate_node()
847 cd9660_time_915(newnode->isoDirRecord->date, in cd9660_translate_node()
848 stampst.st_ino ? stampst.st_mtime : node->inode->st.st_mtime); in cd9660_translate_node()
857 * @returns : -1 if first is less than second, 0 if they are the same, 1 if
873 while (p1 < ISO_FILENAME_MAXLENGTH_BEFORE_VERSION-1 in cd9660_compare_filename()
874 && p2 < ISO_FILENAME_MAXLENGTH_BEFORE_VERSION-1) { in cd9660_compare_filename()
891 return -1; in cd9660_compare_filename()
900 while (p1 < ISO_FILENAME_MAXLENGTH_BEFORE_VERSION - 1 in cd9660_compare_filename()
901 && p2 < ISO_FILENAME_MAXLENGTH_BEFORE_VERSION - 1) { in cd9660_compare_filename()
918 return -1; in cd9660_compare_filename()
936 struct cd9660_children_head *head = &parent->cn_children; in cd9660_sorted_child_insert()
939 cn_new->parent = parent; in cd9660_sorted_child_insert()
943 * if . or .., this means no other entry may be written before first in cd9660_sorted_child_insert()
949 * Dont insert a node twice - in cd9660_sorted_child_insert()
955 compare = cd9660_compare_filename(cn_new->isoDirRecord->name, in cd9660_sorted_child_insert()
956 cn->isoDirRecord->name); in cd9660_sorted_child_insert()
959 compare = cd9660_compare_filename(cn_new->node->name, in cd9660_sorted_child_insert()
960 cn->node->name); in cd9660_sorted_child_insert()
988 for (iter = TAILQ_FIRST(&colliding->cn_children); in cd9660_handle_collisions()
990 if (strcmp(iter->isoDirRecord->name, in cd9660_handle_collisions()
991 next->isoDirRecord->name) != 0) { in cd9660_handle_collisions()
999 temp_skip--; in cd9660_handle_collisions()
1010 temp_past--; in cd9660_handle_collisions()
1025 int numbts, digit, digits, temp, powers, count; in cd9660_rename_filename() local
1030 if (diskStructure->verbose_level > 0) in cd9660_rename_filename()
1033 assert(1 <= diskStructure->isoLevel && diskStructure->isoLevel <= 2); in cd9660_rename_filename()
1035 if (diskStructure->isoLevel == 1) in cd9660_rename_filename()
1037 else if (diskStructure->isoLevel == 2) in cd9660_rename_filename()
1053 naming = iter->o_name; in cd9660_rename_filename()
1072 numbts = maxlength - (digits); in cd9660_rename_filename()
1073 numbts -= delete_chars; in cd9660_rename_filename()
1075 /* 8.3 rules - keep the extension, add before the dot */ in cd9660_rename_filename()
1083 if (diskStructure->isoLevel == 1) { in cd9660_rename_filename()
1084 numbts = 8 - digits - delete_chars; in cd9660_rename_filename()
1096 memcpy(tmp, (iter->o_name), numbts); in cd9660_rename_filename()
1099 temp = i; in cd9660_rename_filename()
1101 digit = (int)(temp / powers); in cd9660_rename_filename()
1102 temp = temp - digit * powers; in cd9660_rename_filename()
1104 digits--; in cd9660_rename_filename()
1123 memcpy((iter->isoDirRecord->name), tmp, numbts + 3); in cd9660_rename_filename()
1139 if (TAILQ_EMPTY(&node->cn_children)) in cd9660_copy_filenames()
1142 if (TAILQ_FIRST(&node->cn_children)->isoDirRecord == NULL) { in cd9660_copy_filenames()
1143 debug_print_tree(diskStructure, diskStructure->rootNode, 0); in cd9660_copy_filenames()
1147 TAILQ_FOREACH(cn, &node->cn_children, cn_next_child) { in cd9660_copy_filenames()
1149 memcpy(cn->o_name, cn->isoDirRecord->name, in cd9660_copy_filenames()
1159 TAILQ_FOREACH(cn, &node->cn_children, cn_next_child) in cd9660_sorting_nodes()
1171 TAILQ_FOREACH(cn, &node->cn_children, cn_next_child) { in cd9660_sort_nodes()
1174 else if (strcmp(next->isoDirRecord->name, in cd9660_sort_nodes()
1175 cn->isoDirRecord->name) >= 0) in cd9660_sort_nodes()
1177 TAILQ_REMOVE(&node->cn_children, next, cn_next_child); in cd9660_sort_nodes()
1193 if (cd9660_compare_filename(iter->isoDirRecord->name, in cd9660_count_collisions()
1194 next->isoDirRecord->name) == 0) in cd9660_count_collisions()
1202 compare = cd9660_compare_filename(iter->isoDirRecord->name, in cd9660_count_collisions()
1203 next->isoDirRecord->name); in cd9660_count_collisions()
1226 * and rename it to "diskStructure->rock_ridge_move_count" (as a string) in cd9660_rrip_move_directory()
1230 if (diskStructure->rr_moved_dir == NULL) { in cd9660_rrip_move_directory()
1231 diskStructure->rr_moved_dir = cd9660_create_directory( in cd9660_rrip_move_directory()
1233 diskStructure->rootNode, dir); in cd9660_rrip_move_directory()
1234 if (diskStructure->rr_moved_dir == NULL) in cd9660_rrip_move_directory()
1236 cd9660_time_915(diskStructure->rr_moved_dir->isoDirRecord->date, in cd9660_rrip_move_directory()
1241 tfile = cd9660_create_file(diskStructure, dir->node->name, dir->parent, in cd9660_rrip_move_directory()
1246 diskStructure->rock_ridge_move_count++; in cd9660_rrip_move_directory()
1248 diskStructure->rock_ridge_move_count); in cd9660_rrip_move_directory()
1251 dir->rr_real_parent = dir->parent; in cd9660_rrip_move_directory()
1254 if (TAILQ_EMPTY(&dir->rr_real_parent->cn_children)) { in cd9660_rrip_move_directory()
1255 TAILQ_INSERT_HEAD(&dir->rr_real_parent->cn_children, tfile, in cd9660_rrip_move_directory()
1258 cd9660_sorted_child_insert(dir->rr_real_parent, tfile); in cd9660_rrip_move_directory()
1262 dir->parent = diskStructure->rr_moved_dir; in cd9660_rrip_move_directory()
1265 tfile->rr_relocated = dir; in cd9660_rrip_move_directory()
1268 cd9660_sorted_child_insert(diskStructure->rr_moved_dir, dir); in cd9660_rrip_move_directory()
1273 memset(dir->isoDirRecord->name, 0, ISO_FILENAME_MAXLENGTH_WITH_PADDING); in cd9660_rrip_move_directory()
1274 strncpy(dir->isoDirRecord->name, newname, 8); in cd9660_rrip_move_directory()
1275 dir->isoDirRecord->length[0] = 34 + 8; in cd9660_rrip_move_directory()
1276 dir->isoDirRecord->name_len[0] = 8; in cd9660_rrip_move_directory()
1284 struct cd9660_children_head *head = &root->cn_children; in cd9660_add_dot_records()
1288 if ((cn->type & CD9660_TYPE_DIR) == 0) in cd9660_add_dot_records()
1328 /* Test for an empty directory - makefs still gives us the . record */ in cd9660_convert_structure()
1329 if ((S_ISDIR(root->type)) && (root->name[0] == '.') in cd9660_convert_structure()
1330 && (root->name[1] == '\0')) { in cd9660_convert_structure()
1331 root = root->next; in cd9660_convert_structure()
1349 if (!S_ISDIR(iterator->type) || in cd9660_convert_structure()
1350 strcmp(iterator->name, ".") != 0) { in cd9660_convert_structure()
1353 this_node->parent = parent_node; in cd9660_convert_structure()
1356 this_node->level = level; in cd9660_convert_structure()
1358 if (S_ISDIR(iterator->type)) { in cd9660_convert_structure()
1360 this_node->type = CD9660_TYPE_DIR; in cd9660_convert_structure()
1369 if ((!diskStructure->allow_deep_trees) && in cd9660_convert_structure()
1370 (!diskStructure->rock_ridge_enabled)) { in cd9660_convert_structure()
1376 } else if (diskStructure-> in cd9660_convert_structure()
1383 this_node->level = in cd9660_convert_structure()
1384 working_level - 1; in cd9660_convert_structure()
1400 if (iterator->child != NULL) { in cd9660_convert_structure()
1402 iterator->child, this_node, in cd9660_convert_structure()
1415 assert(iterator->child == NULL); in cd9660_convert_structure()
1417 this_node->type = CD9660_TYPE_FILE; in cd9660_convert_structure()
1429 if (iterator->next != NULL) { in cd9660_convert_structure()
1435 iterator = iterator->next; in cd9660_convert_structure()
1462 while ((cn = TAILQ_FIRST(&root->cn_children)) != NULL) { in cd9660_free_structure()
1463 TAILQ_REMOVE(&root->cn_children, cn, cn_next_child); in cd9660_free_structure()
1482 n->node = t;\
1496 cd9660node *cn, *dirNode = diskStructure->rootNode; in cd9660_generate_path_table()
1504 PTQUEUE_NEW(n, ptq_entry, -1, diskStructure->rootNode); in cd9660_generate_path_table()
1509 /* Breadth-first traversal of file structure */ in cd9660_generate_path_table()
1512 dirNode = n->node; in cd9660_generate_path_table()
1518 + dirNode->isoDirRecord->name_len[0]+ in cd9660_generate_path_table()
1519 (dirNode->isoDirRecord->name_len[0] % 2 == 0 ? 0 : 1); in cd9660_generate_path_table()
1522 dirNode->ptnumber=counter; in cd9660_generate_path_table()
1524 last->ptnext = dirNode; in cd9660_generate_path_table()
1525 dirNode->ptprev = last; in cd9660_generate_path_table()
1530 TAILQ_FOREACH(cn, &dirNode->cn_children, cn_next_child) { in cd9660_generate_path_table()
1535 if ((cn->type != CD9660_TYPE_DOT) in cd9660_generate_path_table()
1536 && (cn->type != CD9660_TYPE_DOTDOT)) { in cd9660_generate_path_table()
1538 if (S_ISDIR(cn->node->type)) { in cd9660_generate_path_table()
1539 PTQUEUE_NEW(n, ptq_entry, -1, cn); in cd9660_generate_path_table()
1555 len = snprintf(buf, len, "%s/%s/%s", node->node->root, in cd9660_compute_full_filename()
1556 node->node->path, node->node->name); in cd9660_compute_full_filename()
1613 if (!found_ext && !diskStructure->omit_trailing_period) in cd9660_level1_convert_filename()
1632 * File version number (5 characters, 1-32767) in cd9660_level2_convert_filename()
1643 if (diskStructure->allow_multidot) { in cd9660_level2_convert_filename()
1660 else if (diskStructure->allow_multidot && in cd9660_level2_convert_filename()
1675 if (!found_ext && !diskStructure->omit_trailing_period) in cd9660_level2_convert_filename()
1695 assert(1 <= diskStructure->isoLevel && diskStructure->isoLevel <= 2); in cd9660_convert_filename()
1696 if (diskStructure->isoLevel == 1) in cd9660_convert_filename()
1699 else if (diskStructure->isoLevel == 2) in cd9660_convert_filename()
1708 int size = node->isoDirRecord->length[0]; in cd9660_compute_record_size()
1710 if (diskStructure->rock_ridge_enabled) in cd9660_compute_record_size()
1711 size += node->susp_entry_size; in cd9660_compute_record_size()
1712 size += node->su_tail_size; in cd9660_compute_record_size()
1721 node->dot_record->fileDataSector = node->fileDataSector; in cd9660_populate_dot_records()
1722 memcpy(node->dot_record->isoDirRecord,node->isoDirRecord, 34); in cd9660_populate_dot_records()
1723 node->dot_record->isoDirRecord->name_len[0] = 1; in cd9660_populate_dot_records()
1724 node->dot_record->isoDirRecord->name[0] = 0; in cd9660_populate_dot_records()
1725 node->dot_record->isoDirRecord->name[1] = 0; in cd9660_populate_dot_records()
1726 node->dot_record->isoDirRecord->length[0] = 34; in cd9660_populate_dot_records()
1727 node->dot_record->fileRecordSize = in cd9660_populate_dot_records()
1728 cd9660_compute_record_size(diskStructure, node->dot_record); in cd9660_populate_dot_records()
1730 if (node == diskStructure->rootNode) { in cd9660_populate_dot_records()
1731 node->dot_dot_record->fileDataSector = node->fileDataSector; in cd9660_populate_dot_records()
1732 memcpy(node->dot_dot_record->isoDirRecord,node->isoDirRecord, in cd9660_populate_dot_records()
1735 node->dot_dot_record->fileDataSector = in cd9660_populate_dot_records()
1736 node->parent->fileDataSector; in cd9660_populate_dot_records()
1737 memcpy(node->dot_dot_record->isoDirRecord, in cd9660_populate_dot_records()
1738 node->parent->isoDirRecord,34); in cd9660_populate_dot_records()
1740 node->dot_dot_record->isoDirRecord->name_len[0] = 1; in cd9660_populate_dot_records()
1741 node->dot_dot_record->isoDirRecord->name[0] = 1; in cd9660_populate_dot_records()
1742 node->dot_dot_record->isoDirRecord->name[1] = 0; in cd9660_populate_dot_records()
1743 node->dot_dot_record->isoDirRecord->length[0] = 34; in cd9660_populate_dot_records()
1744 node->dot_dot_record->fileRecordSize = in cd9660_populate_dot_records()
1745 cd9660_compute_record_size(diskStructure, node->dot_dot_record); in cd9660_populate_dot_records()
1750 * @param int The offset (in bytes) - SHOULD align to the beginning of a sector
1774 * the "real root" node, since for it, node->node is undefined in cd9660_compute_offsets()
1777 node->fileDataSector = -1; in cd9660_compute_offsets()
1779 if (node->type & CD9660_TYPE_DIR) { in cd9660_compute_offsets()
1780 node->fileRecordSize = cd9660_compute_record_size( in cd9660_compute_offsets()
1783 node->fileDataSector = in cd9660_compute_offsets()
1784 CD9660_BLOCKS(diskStructure->sectorSize,startOffset); in cd9660_compute_offsets()
1786 cd9660_bothendian_dword(node->fileDataSector, in cd9660_compute_offsets()
1787 node->isoDirRecord->extent); in cd9660_compute_offsets()
1793 node->fileSectorsUsed = 1; in cd9660_compute_offsets()
1794 TAILQ_FOREACH(child, &node->cn_children, cn_next_child) { in cd9660_compute_offsets()
1795 node->fileDataLength += in cd9660_compute_offsets()
1799 diskStructure->sectorSize) { in cd9660_compute_offsets()
1801 node->fileSectorsUsed++; in cd9660_compute_offsets()
1808 cd9660_bothendian_dword(node->fileSectorsUsed * in cd9660_compute_offsets()
1809 diskStructure->sectorSize,node->isoDirRecord->size); in cd9660_compute_offsets()
1815 used_bytes += node->fileSectorsUsed * diskStructure->sectorSize; in cd9660_compute_offsets()
1817 for (child = TAILQ_NEXT(node->dot_dot_record, cn_next_child); in cd9660_compute_offsets()
1820 if (S_ISDIR(child->node->type)) { in cd9660_compute_offsets()
1824 if (r != -1) in cd9660_compute_offsets()
1827 return -1; in cd9660_compute_offsets()
1835 for (child = TAILQ_NEXT(node->dot_dot_record, cn_next_child); in cd9660_compute_offsets()
1839 if (S_ISDIR(child->node->type)) in cd9660_compute_offsets()
1841 child->fileRecordSize = in cd9660_compute_offsets()
1844 child->fileSectorsUsed = in cd9660_compute_offsets()
1845 CD9660_BLOCKS(diskStructure->sectorSize, in cd9660_compute_offsets()
1846 child->fileDataLength); in cd9660_compute_offsets()
1848 inode = child->node->inode; in cd9660_compute_offsets()
1849 if ((inode->flags & FI_ALLOCATED) == 0) { in cd9660_compute_offsets()
1850 inode->ino = in cd9660_compute_offsets()
1851 CD9660_BLOCKS(diskStructure->sectorSize, in cd9660_compute_offsets()
1853 inode->flags |= FI_ALLOCATED; in cd9660_compute_offsets()
1854 used_bytes += child->fileSectorsUsed * in cd9660_compute_offsets()
1855 diskStructure->sectorSize; in cd9660_compute_offsets()
1859 (int)inode->st.st_ino, inode->ino)); in cd9660_compute_offsets()
1861 child->fileDataSector = inode->ino; in cd9660_compute_offsets()
1862 cd9660_bothendian_dword(child->fileDataSector, in cd9660_compute_offsets()
1863 child->isoDirRecord->extent); in cd9660_compute_offsets()
1875 to->node->inode->st.st_dev = 0;
1876 to->node->inode->st.st_ino = 0;
1877 to->node->inode->st.st_size = 0;
1878 to->node->inode->st.st_blksize = from->node->inode->st.st_blksize;
1879 to->node->inode->st.st_atime = from->node->inode->st.st_atime;
1880 to->node->inode->st.st_mtime = from->node->inode->st.st_mtime;
1881 to->node->inode->st.st_ctime = from->node->inode->st.st_ctime;
1882 to->node->inode->st.st_uid = from->node->inode->st.st_uid;
1883 to->node->inode->st.st_gid = from->node->inode->st.st_gid;
1884 to->node->inode->st.st_mode = from->node->inode->st.st_mode;
1886 to->node->inode->st.st_mode = to->node->inode->st.st_mode & ~(S_IFMT);
1888 to->node->inode->st.st_mode |= S_IFREG;
1890 to->node->inode->st.st_mode |= S_IFDIR;
1899 cd9660node *temp; in cd9660_create_virtual_entry() local
1904 temp = cd9660_allocate_cd9660node(); in cd9660_create_virtual_entry()
1905 if (temp == NULL) in cd9660_create_virtual_entry()
1909 tfsnode->name = estrdup(name); in cd9660_create_virtual_entry()
1910 temp->isoDirRecord = emalloc(sizeof(*temp->isoDirRecord)); in cd9660_create_virtual_entry()
1912 cd9660_convert_filename(diskStructure, tfsnode->name, in cd9660_create_virtual_entry()
1913 temp->isoDirRecord->name, file); in cd9660_create_virtual_entry()
1915 temp->node = tfsnode; in cd9660_create_virtual_entry()
1916 temp->parent = parent; in cd9660_create_virtual_entry()
1919 if (temp->parent != NULL) { in cd9660_create_virtual_entry()
1920 temp->level = temp->parent->level + 1; in cd9660_create_virtual_entry()
1921 if (!TAILQ_EMPTY(&temp->parent->cn_children)) in cd9660_create_virtual_entry()
1922 cd9660_sorted_child_insert(temp->parent, temp); in cd9660_create_virtual_entry()
1924 TAILQ_INSERT_HEAD(&temp->parent->cn_children, in cd9660_create_virtual_entry()
1925 temp, cn_next_child); in cd9660_create_virtual_entry()
1929 if (parent->node != NULL) { in cd9660_create_virtual_entry()
1930 tfsnode->type = parent->node->type; in cd9660_create_virtual_entry()
1934 tfsnode->type &= ~(S_IFMT); in cd9660_create_virtual_entry()
1936 tfsnode->type |= S_IFREG; in cd9660_create_virtual_entry()
1938 tfsnode->type |= S_IFDIR; in cd9660_create_virtual_entry()
1940 /* Indicate that there is no spec entry (inode) */ in cd9660_create_virtual_entry()
1941 tfsnode->flags &= ~(FSNODE_F_HASSPEC); in cd9660_create_virtual_entry()
1943 cd9660_copy_stat_info(parent, temp, file); in cd9660_create_virtual_entry()
1945 return temp; in cd9660_create_virtual_entry()
1952 cd9660node *temp; in cd9660_create_file() local
1954 temp = cd9660_create_virtual_entry(diskStructure, name, parent, 1, 1); in cd9660_create_file()
1955 if (temp == NULL) in cd9660_create_file()
1958 temp->fileDataLength = 0; in cd9660_create_file()
1960 temp->type = CD9660_TYPE_FILE | CD9660_TYPE_VIRTUAL; in cd9660_create_file()
1962 temp->node->inode = ecalloc(1, sizeof(*temp->node->inode)); in cd9660_create_file()
1963 *temp->node->inode = *me->node->inode; in cd9660_create_file()
1965 if (cd9660_translate_node_common(diskStructure, temp) == 0) in cd9660_create_file()
1967 return temp; in cd9660_create_file()
1980 cd9660node *temp; in cd9660_create_directory() local
1982 temp = cd9660_create_virtual_entry(diskStructure, name, parent, 0, 1); in cd9660_create_directory()
1983 if (temp == NULL) in cd9660_create_directory()
1985 temp->node->type |= S_IFDIR; in cd9660_create_directory()
1987 temp->type = CD9660_TYPE_DIR | CD9660_TYPE_VIRTUAL; in cd9660_create_directory()
1989 temp->node->inode = ecalloc(1, sizeof(*temp->node->inode)); in cd9660_create_directory()
1990 *temp->node->inode = *me->node->inode; in cd9660_create_directory()
1992 if (cd9660_translate_node_common(diskStructure, temp) == 0) in cd9660_create_directory()
1994 return temp; in cd9660_create_directory()
2001 cd9660node *temp, *first; in cd9660_create_special_directory() local
2014 if ((temp = cd9660_create_virtual_entry(diskStructure, na, parent, in cd9660_create_special_directory()
2018 temp->parent = parent; in cd9660_create_special_directory()
2019 temp->type = type; in cd9660_create_special_directory()
2020 temp->isoDirRecord->length[0] = 34; in cd9660_create_special_directory()
2023 parent->dot_record = temp; in cd9660_create_special_directory()
2024 TAILQ_INSERT_HEAD(&parent->cn_children, temp, cn_next_child); in cd9660_create_special_directory()
2027 parent->dot_dot_record = temp; in cd9660_create_special_directory()
2032 if ((first = TAILQ_FIRST(&parent->cn_children)) == NULL || in cd9660_create_special_directory()
2033 (first->type & CD9660_TYPE_DOT) == 0) { in cd9660_create_special_directory()
2034 TAILQ_INSERT_HEAD(&parent->cn_children, temp, in cd9660_create_special_directory()
2037 TAILQ_INSERT_AFTER(&parent->cn_children, first, temp, in cd9660_create_special_directory()
2042 return temp; in cd9660_create_special_directory()
2057 diskStructure->generic_bootimage = estrdup(bootimage); in cd9660_add_generic_bootimage()
2060 if (lstat(diskStructure->generic_bootimage, &stbuf) == -1) in cd9660_add_generic_bootimage()
2062 diskStructure->generic_bootimage); in cd9660_add_generic_bootimage()
2065 warnx("Error: Boot image must be no greater than 32768 bytes"); in cd9660_add_generic_bootimage()
2069 if (diskStructure->verbose_level > 0) { in cd9660_add_generic_bootimage()
2074 diskStructure->has_generic_bootimage = 1; in cd9660_add_generic_bootimage()