Lines Matching +full:num +full:- +full:cs
35 * make file system for udfs (UDF - ISO13346)
39 * mkfs [-F FSType] [-V] [-m] [options]
40 * [-o specific_options] special size
43 * N - no create
44 * label - volume label
45 * psize - physical block size
82 #define POWEROF2(num) (((num) & ((num) - 1)) == 0) argument
170 static int32_t part_unalloc = -1;
173 /* Set by readvolseq for -m option */
213 gettext("mkfs -F udfs ")); in main()
280 if (optind > (argc - 1)) { in main()
284 argc -= optind; in main()
317 * Get the disk size from the drive or VTOC for the N and N-256 in main()
357 unused = disk_size - fssize; in main()
364 /* Use passed-in size */ in main()
424 * For the -N case, a file descriptor is needed for the llseek() in main()
427 * Get a file descriptor that's read-only so that this code in main()
449 fssize --; in main()
454 rdfs(fssize - 1, sectorsize, buf); in main()
504 tp->ts_usec = 0; in setstamp()
505 tp->ts_husec = 0; in setstamp()
506 tp->ts_csec = 0; in setstamp()
508 tp->ts_sec = res.tm_sec; in setstamp()
509 tp->ts_min = res.tm_min; in setstamp()
510 tp->ts_hour = res.tm_hour; in setstamp()
511 tp->ts_day = res.tm_mday; in setstamp()
512 tp->ts_month = res.tm_mon + 1; in setstamp()
513 tp->ts_year = 1900 + res.tm_year; in setstamp()
515 tp->ts_tzone = 0x1000 + (-tzone & 0xFFF); in setstamp()
521 eap->ext_len = len; in setextad()
522 eap->ext_loc = loc; in setextad()
532 if (length > len - 3) { in setdstring()
533 length = len - 3; in setdstring()
535 dp[len - 1] = length + 1; in setdstring()
537 (void) strncpy(dp, cp, len-2); in setdstring()
545 tp->tag_loc = blk1; in wtvolseq()
546 switch (tp->tag_id) { in wtvolseq()
548 ((struct pri_vol_desc *)tp)->pvd_vdsn = vdsn++; in wtvolseq()
551 ((struct vol_desc_ptr *)tp)->vdp_vdsn = vdsn++; in wtvolseq()
554 ((struct iuvd_desc *)tp)->iuvd_vdsn = vdsn++; in wtvolseq()
557 ((struct part_desc *)tp)->pd_vdsn = vdsn++; in wtvolseq()
560 ((struct log_vol_desc *)tp)->lvd_vdsn = vdsn++; in wtvolseq()
563 ((struct unall_spc_desc *)tp)->ua_vdsn = vdsn++; in wtvolseq()
576 tp->tag_loc = blk2; in wtvolseq()
577 switch (tp->tag_id) { in wtvolseq()
579 ((struct pri_vol_desc *)tp)->pvd_vdsn = vdsn++; in wtvolseq()
582 ((struct vol_desc_ptr *)tp)->vdp_vdsn = vdsn++; in wtvolseq()
585 ((struct iuvd_desc *)tp)->iuvd_vdsn = vdsn++; in wtvolseq()
588 ((struct part_desc *)tp)->pd_vdsn = vdsn++; in wtvolseq()
591 ((struct log_vol_desc *)tp)->lvd_vdsn = vdsn++; in wtvolseq()
594 ((struct unall_spc_desc *)tp)->ua_vdsn = vdsn++; in wtvolseq()
641 /* Zero out the avdp at N - 257 */ in volseqinit()
642 wtfs(fssize - 256, sectorsize, buf); in volseqinit()
654 nsp->nsr_str_type = 0; in volseqinit()
655 nsp->nsr_ver = 1; in volseqinit()
656 (void) strncpy((int8_t *)nsp->nsr_id, "BEA01", 5); in volseqinit()
659 nsp->nsr_str_type = 0; in volseqinit()
660 nsp->nsr_ver = 1; in volseqinit()
661 (void) strncpy((int8_t *)nsp->nsr_id, "NSR02", 5); in volseqinit()
664 nsp->nsr_str_type = 0; in volseqinit()
665 nsp->nsr_ver = 1; in volseqinit()
666 (void) strncpy((int8_t *)nsp->nsr_id, "TEA01", 5); in volseqinit()
690 tp = &pvdp->pvd_tag; in volseqinit()
691 tp->tag_id = UD_PRI_VOL_DESC; in volseqinit()
692 tp->tag_desc_ver = ecma_version; in volseqinit()
693 tp->tag_sno = serialnum; in volseqinit()
694 tp->tag_crc_len = sizeof (struct pri_vol_desc) - in volseqinit()
696 pvdp->pvd_vdsn = 0; in volseqinit()
697 pvdp->pvd_pvdn = 0; in volseqinit()
698 setdstring(pvdp->pvd_vol_id, udfs_label, 32); in volseqinit()
699 pvdp->pvd_vsn = 1; in volseqinit()
700 pvdp->pvd_mvsn = 1; in volseqinit()
701 pvdp->pvd_il = 2; /* Single-volume */ in volseqinit()
702 pvdp->pvd_mil = 3; /* Multi-volume */ in volseqinit()
703 pvdp->pvd_csl = 1; /* CS0 */ in volseqinit()
704 pvdp->pvd_mcsl = 1; /* CS0 */ in volseqinit()
706 setdstring(pvdp->pvd_vsi, vsibuf, 128); in volseqinit()
707 (void) strncpy(pvdp->pvd_vsi + 17, udfs_label, 128 - 17); in volseqinit()
708 setcharspec(&pvdp->pvd_desc_cs, 0, osta_unicode); in volseqinit()
709 setcharspec(&pvdp->pvd_exp_cs, 0, osta_unicode); in volseqinit()
710 setextad(&pvdp->pvd_vol_abs, 0, 0); in volseqinit()
711 setextad(&pvdp->pvd_vcn, 0, 0); in volseqinit()
712 bzero(&pvdp->pvd_appl_id, sizeof (regid_t)); in volseqinit()
713 setstamp(&pvdp->pvd_time); in volseqinit()
714 bcopy(&sunmicro, &pvdp->pvd_ii, sizeof (regid_t)); in volseqinit()
715 pvdp->pvd_flags = 0; in volseqinit()
725 tp = &iudp->iuvd_tag; in volseqinit()
726 tp->tag_id = UD_IMPL_USE_DESC; in volseqinit()
727 tp->tag_desc_ver = ecma_version; in volseqinit()
728 tp->tag_sno = serialnum; in volseqinit()
729 tp->tag_crc_len = sizeof (struct iuvd_desc) - in volseqinit()
731 iudp->iuvd_vdsn = 0; in volseqinit()
732 bcopy(&lvinfo, &iudp->iuvd_ii, sizeof (regid_t)); in volseqinit()
733 setcharspec(&iudp->iuvd_cset, 0, osta_unicode); in volseqinit()
734 setdstring(iudp->iuvd_lvi, udfs_label, 128); in volseqinit()
736 setdstring(iudp->iuvd_ifo1, "", 36); in volseqinit()
737 setdstring(iudp->iuvd_ifo2, "", 36); in volseqinit()
738 setdstring(iudp->iuvd_ifo3, "", 36); in volseqinit()
744 bcopy(&sunmicro, &iudp->iuvd_iid, sizeof (regid_t)); in volseqinit()
754 tp = &pp->pd_tag; in volseqinit()
755 tp->tag_id = UD_PART_DESC; in volseqinit()
756 tp->tag_desc_ver = ecma_version; in volseqinit()
757 tp->tag_sno = serialnum; in volseqinit()
758 tp->tag_crc_len = sizeof (struct part_desc) - in volseqinit()
760 pp->pd_vdsn = 0; in volseqinit()
761 pp->pd_pflags = 1; /* Allocated */ in volseqinit()
762 pp->pd_pnum = 0; in volseqinit()
763 bcopy(&partid, &pp->pd_pcontents, sizeof (regid_t)); in volseqinit()
766 part_len = fssize - part_start; in volseqinit()
767 part_bmp_bytes = (part_len + NBBY - 1) / NBBY; in volseqinit()
768 part_bmp_sectors = (part_bmp_bytes + SPACEMAP_OFF + sectorsize - 1) / in volseqinit()
771 pp->pd_part_start = part_start; in volseqinit()
772 pp->pd_part_length = part_len; in volseqinit()
774 pp->pd_acc_type = acctype; in volseqinit()
781 php = (struct phdr_desc *)&pp->pd_pc_use; in volseqinit()
787 php->phdr_usb.sad_ext_len = in volseqinit()
788 (part_bmp_bytes + SPACEMAP_OFF + sectorsize - 1) & in volseqinit()
789 (~(sectorsize - 1)); in volseqinit()
790 php->phdr_usb.sad_ext_loc = nextlogblock; in volseqinit()
795 bcopy(&sunmicro, &pp->pd_ii, sizeof (regid_t)); in volseqinit()
805 tp = &lvp->lvd_tag; in volseqinit()
806 tp->tag_id = UD_LOG_VOL_DESC; in volseqinit()
807 tp->tag_desc_ver = ecma_version; in volseqinit()
808 tp->tag_sno = serialnum; in volseqinit()
809 tp->tag_crc_len = sizeof (struct log_vol_desc) - in volseqinit()
811 lvp->lvd_vdsn = 0; in volseqinit()
812 setcharspec(&lvp->lvd_desc_cs, 0, osta_unicode); in volseqinit()
813 setdstring(lvp->lvd_lvid, udfs_label, 128); in volseqinit()
814 lvp->lvd_log_bsize = sectorsize; in volseqinit()
815 bcopy(&udf_compliant, &lvp->lvd_dom_id, sizeof (regid_t)); in volseqinit()
816 lap = (long_ad_t *)&lvp->lvd_lvcu; in volseqinit()
817 lap->lad_ext_len = FILESETLEN * sectorsize; in volseqinit()
819 lap->lad_ext_loc = nextlogblock; in volseqinit()
820 lap->lad_ext_prn = 0; in volseqinit()
821 lvp->lvd_mtbl_len = 6; in volseqinit()
822 lvp->lvd_num_pmaps = 1; in volseqinit()
823 bcopy(&sunmicro, &lvp->lvd_ii, sizeof (regid_t)); in volseqinit()
825 pmp = (struct pmap_typ1 *)&lvp->lvd_pmaps; in volseqinit()
826 pmp->map1_type = 1; in volseqinit()
827 pmp->map1_length = 6; in volseqinit()
828 pmp->map1_vsn = SWAP_16(1); in volseqinit()
829 pmp->map1_pn = 0; in volseqinit()
830 tp->tag_crc_len = (char *)(pmp + 1) - buf - sizeof (struct tag); in volseqinit()
831 setextad(&lvp->lvd_int_seq_ext, INTSEQLEN, INTSEQSTART); in volseqinit()
841 tp = &uap->ua_tag; in volseqinit()
842 tp->tag_id = UD_UNALL_SPA_DESC; in volseqinit()
843 tp->tag_desc_ver = ecma_version; in volseqinit()
844 tp->tag_sno = serialnum; in volseqinit()
845 uap->ua_vdsn = 0; in volseqinit()
846 uap->ua_nad = 0; in volseqinit()
847 tp->tag_crc_len = (char *)uap->ua_al_dsc - buf - sizeof (struct tag); in volseqinit()
857 tp = &tdp->td_tag; in volseqinit()
858 tp->tag_id = UD_TERM_DESC; in volseqinit()
859 tp->tag_desc_ver = ecma_version; in volseqinit()
860 tp->tag_sno = serialnum; in volseqinit()
861 tp->tag_crc_len = sizeof (struct term_desc) - in volseqinit()
863 tp->tag_loc = nextblock; in volseqinit()
881 tp = &avp->avd_tag; in volseqinit()
882 tp->tag_id = UD_ANCH_VOL_DESC; in volseqinit()
883 tp->tag_desc_ver = ecma_version; in volseqinit()
884 tp->tag_sno = serialnum; in volseqinit()
885 tp->tag_crc_len = sizeof (struct anch_vol_desc_ptr) - in volseqinit()
887 tp->tag_loc = nextblock; in volseqinit()
888 setextad(&avp->avd_main_vdse, in volseqinit()
890 setextad(&avp->avd_res_vdse, in volseqinit()
898 tp->tag_loc = fssize; in volseqinit()
909 tp = &fsp->fsd_tag; in volseqinit()
910 tp->tag_id = UD_FILE_SET_DESC; in volseqinit()
911 tp->tag_desc_ver = ecma_version; in volseqinit()
912 tp->tag_sno = serialnum; in volseqinit()
913 tp->tag_crc_len = sizeof (struct file_set_desc) - in volseqinit()
915 tp->tag_loc = nextlogblock; in volseqinit()
916 setstamp(&fsp->fsd_time); in volseqinit()
917 fsp->fsd_ilevel = 3; in volseqinit()
918 fsp->fsd_mi_level = 3; in volseqinit()
919 fsp->fsd_cs_list = 1; in volseqinit()
920 fsp->fsd_mcs_list = 1; in volseqinit()
921 fsp->fsd_fs_no = 0; in volseqinit()
922 fsp->fsd_fsd_no = 0; in volseqinit()
923 setcharspec(&fsp->fsd_lvidcs, 0, osta_unicode); in volseqinit()
924 setdstring(fsp->fsd_lvid, udfs_label, 128); in volseqinit()
925 setcharspec(&fsp->fsd_fscs, 0, osta_unicode); in volseqinit()
926 setdstring(fsp->fsd_fsi, udfs_label, 32); in volseqinit()
927 setdstring(fsp->fsd_cfi, "", 32); in volseqinit()
928 setdstring(fsp->fsd_afi, "", 32); in volseqinit()
929 lap = (long_ad_t *)&fsp->fsd_root_icb; in volseqinit()
930 lap->lad_ext_len = sectorsize; in volseqinit()
931 lap->lad_ext_loc = filesetblock + FILESETLEN; in volseqinit()
932 lap->lad_ext_prn = 0; in volseqinit()
933 bcopy(&udf_compliant, &fsp->fsd_did, sizeof (regid_t)); in volseqinit()
944 tp = &tdp->td_tag; in volseqinit()
945 tp->tag_id = UD_TERM_DESC; in volseqinit()
946 tp->tag_desc_ver = ecma_version; in volseqinit()
947 tp->tag_sno = serialnum; in volseqinit()
948 tp->tag_crc_len = sizeof (struct term_desc) - in volseqinit()
950 tp->tag_loc = nextlogblock; in volseqinit()
968 tp = &fp->fe_tag; in volseqinit()
969 tp->tag_id = UD_FILE_ENTRY; in volseqinit()
970 tp->tag_desc_ver = ecma_version; in volseqinit()
971 tp->tag_sno = serialnum; in volseqinit()
972 tp->tag_loc = nextlogblock; in volseqinit()
973 icb = &fp->fe_icb_tag; in volseqinit()
974 icb->itag_prnde = 0; in volseqinit()
975 icb->itag_strategy = STRAT_TYPE4; in volseqinit()
976 icb->itag_param = 0; /* what does this mean? */ in volseqinit()
977 icb->itag_max_ent = 1; in volseqinit()
978 icb->itag_ftype = FTYPE_DIRECTORY; in volseqinit()
979 icb->itag_lb_loc = 0; in volseqinit()
980 icb->itag_lb_prn = 0; in volseqinit()
981 icb->itag_flags = ICB_FLAG_ARCHIVE; in volseqinit()
982 fp->fe_uid = getuid(); in volseqinit()
983 fp->fe_gid = getgid(); in volseqinit()
984 fp->fe_perms = (0x1f << 10) | (0x5 << 5) | 0x5; in volseqinit()
985 fp->fe_lcount = 1; in volseqinit()
986 fp->fe_rec_for = 0; in volseqinit()
987 fp->fe_rec_dis = 0; in volseqinit()
988 fp->fe_rec_len = 0; in volseqinit()
989 fp->fe_info_len = sizeof (struct file_id); in volseqinit()
990 fp->fe_lbr = 1; in volseqinit()
991 setstamp(&fp->fe_acc_time); in volseqinit()
992 setstamp(&fp->fe_mod_time); in volseqinit()
993 setstamp(&fp->fe_attr_time); in volseqinit()
994 fp->fe_ckpoint = 1; in volseqinit()
995 bcopy(&sunmicro, &fp->fe_impl_id, sizeof (regid_t)); in volseqinit()
996 fp->fe_uniq_id = 0; in volseqinit()
997 fp->fe_len_ear = 0; in volseqinit()
998 fp->fe_len_adesc = sizeof (short_ad_t); in volseqinit()
1001 sap = (short_ad_t *)(fp->fe_spec + fp->fe_len_ear); in volseqinit()
1002 sap->sad_ext_len = sizeof (struct file_id); in volseqinit()
1003 sap->sad_ext_loc = nextlogblock + 1; in volseqinit()
1004 rootfelen = (char *)(sap + 1) - buf; in volseqinit()
1005 tp->tag_crc_len = rootfelen - sizeof (struct tag); in volseqinit()
1016 tp = &fip->fid_tag; in volseqinit()
1017 tp->tag_id = UD_FILE_ID_DESC; in volseqinit()
1018 tp->tag_desc_ver = ecma_version; in volseqinit()
1019 tp->tag_sno = serialnum; in volseqinit()
1020 tp->tag_crc_len = sizeof (struct file_id) - in volseqinit()
1022 tp->tag_loc = nextlogblock; in volseqinit()
1023 fip->fid_ver = 1; in volseqinit()
1024 fip->fid_flags = FID_DIR | FID_PARENT; in volseqinit()
1025 fip->fid_idlen = 0; in volseqinit()
1026 fip->fid_iulen = 0; in volseqinit()
1027 fip->fid_icb.lad_ext_len = sectorsize; /* rootfelen; */ in volseqinit()
1028 fip->fid_icb.lad_ext_loc = nextlogblock - 1; in volseqinit()
1029 fip->fid_icb.lad_ext_prn = 0; in volseqinit()
1047 tp = &sbp->sbd_tag; in volseqinit()
1048 tp->tag_id = UD_SPA_BMAP_DESC; in volseqinit()
1049 tp->tag_desc_ver = ecma_version; in volseqinit()
1050 tp->tag_sno = serialnum; in volseqinit()
1051 tp->tag_crc_len = 0; /* Don't do CRCs on bitmaps */ in volseqinit()
1052 tp->tag_loc = part_unalloc; in volseqinit()
1053 sbp->sbd_nbits = part_len; in volseqinit()
1054 sbp->sbd_nbytes = part_bmp_bytes; in volseqinit()
1065 cp[--i] = (unsigned)0xff >> in volseqinit()
1066 (NBBY - part_len % NBBY); in volseqinit()
1080 tp = &lvip->lvid_tag; in volseqinit()
1081 tp->tag_id = UD_LOG_VOL_INT; in volseqinit()
1082 tp->tag_desc_ver = ecma_version; in volseqinit()
1083 tp->tag_sno = serialnum; in volseqinit()
1084 tp->tag_loc = nextblock; in volseqinit()
1085 setstamp(&lvip->lvid_tstamp); in volseqinit()
1086 lvip->lvid_int_type = LOG_VOL_CLOSE_INT; in volseqinit()
1087 setextad(&lvip->lvid_nie, 0, 0); in volseqinit()
1088 lvip->lvid_npart = 1; in volseqinit()
1089 lvip->lvid_liu = 0x2e; in volseqinit()
1090 lvip->lvid_uniqid = MAXID + 1; in volseqinit()
1091 lvip->lvid_fst[0] = part_len - nextlogblock; /* Free space */ in volseqinit()
1092 lvip->lvid_fst[1] = part_len; /* Size */ in volseqinit()
1093 lviup = (struct lvid_iu *)&lvip->lvid_fst[2]; in volseqinit()
1094 bcopy(&sunmicro, &lviup->lvidiu_regid, sizeof (regid_t)); in volseqinit()
1095 lviup->lvidiu_nfiles = 0; in volseqinit()
1096 lviup->lvidiu_ndirs = 1; in volseqinit()
1097 lviup->lvidiu_mread = 0x102; in volseqinit()
1098 lviup->lvidiu_mwrite = 0x102; in volseqinit()
1099 lviup->lvidiu_maxwr = 0x150; in volseqinit()
1100 tp->tag_crc_len = sizeof (struct log_vol_int_desc) + lvip->lvid_liu - in volseqinit()
1112 tp = &tdp->td_tag; in volseqinit()
1113 tp->tag_id = UD_TERM_DESC; in volseqinit()
1114 tp->tag_desc_ver = ecma_version; in volseqinit()
1115 tp->tag_sno = serialnum; in volseqinit()
1116 tp->tag_crc_len = sizeof (struct term_desc) - sizeof (struct tag); in volseqinit()
1117 tp->tag_loc = nextblock; in volseqinit()
1161 if (fso == -1) in wtfs()
1187 gettext("udfs usage: mkfs [-F FSType] [-V]" in usage()
1188 " [-m] [-o options] special size(sectors)\n")); in usage()
1190 gettext(" -m : dump fs cmd line used to make" in usage()
1193 gettext(" -V : print this command line and return\n")); in usage()
1195 gettext(" -o : udfs options: :psize=%d:label=%s\n"), in usage()
1198 gettext("NOTE that all -o suboptions: must" in usage()
1209 (void) printf(gettext("mkfs -F udfs -o ")); in dump_fscmd()
1218 /* Arg: big - maximum valid input number */
1219 /* Global arg: string - pointer to command arg */
1230 char *cs; in number() local
1238 cs = string; in number()
1239 if (*cs == '-') { in number()
1241 cs++; in number()
1244 while ((*cs != ' ') && (*cs != '\0') && (*cs != ',')) { in number()
1245 if ((*cs >= '0') && (*cs <= '9')) { in number()
1246 n = n * 10 + *cs - '0'; in number()
1247 cs++; in number()
1248 } else if ((*cs == '*') || (*cs == 'x')) { in number()
1256 cs++; in number()
1257 string = cs; in number()
1259 cs = string; in number()
1261 } else if (*cs == 'k') { in number()
1269 cs++; in number()
1286 n = -n; in number()
1295 string = cs; in number()
1303 /* Arg: s - pointer to string to match with a command arg */
1304 /* Global arg: string - pointer to command arg */
1315 char *cs; in match() local
1317 cs = string; in match()
1318 while (*cs++ == *s) { in match()
1328 cs--; in match()
1329 string = cs; in match()
1344 " for creating file-system\n")); in get_bsize()
1352 if (ioctl(fso, DKIOCGMEDIAINFO, &dkminfo) != -1) { in get_bsize()
1403 main_vdbuf = malloc(avp->avd_main_vdse.ext_len); in readvolseq()
1409 rdfs(avp->avd_main_vdse.ext_loc, avp->avd_main_vdse.ext_len, in readvolseq()
1411 end = (uint8_t *)main_vdbuf + avp->avd_main_vdse.ext_len; in readvolseq()
1413 nextblock = avp->avd_main_vdse.ext_loc; in readvolseq()
1422 switch (tp->tag_id) { in readvolseq()
1425 serialnum = tp->tag_sno + 1; in readvolseq()
1427 oldlabel = pvolp->pvd_vol_id + 1; in readvolseq()
1438 part_start = partp->pd_part_start; in readvolseq()
1439 part_len = partp->pd_part_length; in readvolseq()