Lines Matching +full:num +full:- +full:cs
78 #define POWEROF2(num) (((num) & ((num) - 1)) == 0) argument
122 static int minfree = -1; /* free space threshold */
131 static int rot = -1; /* rotational delay (msecs) */
133 static int maxcontig = -1; /* maximum number of contig blocks */
141 * based on the size/type of the disk and is used only for non-EFI labeled
214 maxcontig = number("maxcontig", optarg, NR_NONE, -1); in main()
313 fatal(gettext("-%c: unknown flag"), optopt); in main()
318 /* The raw-special-device itself. If not, print usage message. */ in main()
319 if ((argc - optind) != 1) { in main()
366 * of devices with SMI labels (that is, non-EFI labels), the in main()
371 * nsectors - sectors per track in main()
372 * ntracks - tracks per cylinder in main()
373 * rpm - disk revolutions per minute in main()
380 * bsize - file system block size in main()
465 rot = -1; in main()
470 * non-EFI labels, most geometries result in cylinder in main()
471 * groups of around 40 - 50 MB, so we arbitrarily choose in main()
503 * equal to the block size, and set the cylinders-per-group value in main()
504 * passed to mkfs to -1, which tells mkfs to make cylinder groups in main()
511 cpg = -1; /* says make cyl groups as big as possible */ in main()
528 * a signed 32-bit quantity, so the number of sectors in the in main()
553 /* XXX - following defaults are both here and in mkfs */ in main()
558 density = (int)((((longlong_t)fssize + (GBSEC - 1)) / in main()
575 maxcpg = (bsize - sizeof (struct cg) - howmany(maxipg, NBBY)) / in main()
593 ntracks -= (ntracks % 16); in main()
605 (*sbp->fs_fsmnt != '\0')) { in main()
608 special, sbp->fs_fsmnt); in main()
621 * If alternates-per-cylinder is ever implemented: in main()
622 * need to get apc from dp->d_apc if no -a switch??? in main()
624 (void) snprintf(cmd, sizeof (cmd), "mkfs -F ufs " in main()
626 Nflag ? "-o N " : "", binary_sb ? "-o calcbinsb " : "", in main()
627 text_sb ? "-o calcsb " : "", special, in main()
782 * If ntracks of -1 is passed to mkfs, mkfs uses DEF_TRACKS_EFI in getdiskbydev()
788 ntracks = use_efi_dflts ? -1 : g.dkg_nhead; in getdiskbydev()
800 if (maxcontig == -1 && ioctl(fd, DKIOCINFO, &ci) == 0) { in getdiskbydev()
884 slicesize = efi_vtoc->efi_parts[index].p_size; in get_device_size()
898 * in most cases, but we've seen at least one third-party driver
917 if (((llseek(fd, (offset_t)0, SEEK_SET)) == -1) || in brute_force_get_device_size()
918 ((read(fd, buf, DEV_BSIZE)) == -1)) in brute_force_get_device_size()
936 SEEK_SET)) == -1) || in brute_force_get_device_size()
956 while (min_fail - max_succeed > 1) { in brute_force_get_device_size()
957 cur_db_off = max_succeed + (min_fail - max_succeed)/2; in brute_force_get_device_size()
959 SEEK_SET)) == -1) || in brute_force_get_device_size()
988 if ((llseek(fd, (offset_t)((size - 1) * DEV_BSIZE), SEEK_SET) == -1) || in validate_size()
998 * read_sb(char * rawdev) - Attempt to read the superblock from a raw device
1055 (sblock.fs_ncg - 1) * sblock.fs_cpg >= sblock.fs_ncyl) in read_sb()
1066 * appear to be a UFS file system, return non-zero, indicating that
1069 * cylinder group. If they appear to be randomized (non-zero), return
1071 * counts are all zero, then we must call fsirand, so return non-zero.
1089 if ((fd = open64(special, 0)) == -1) in notrand()
1091 if (llseek(fd, (offset_t)SBLOCK * DEV_BSIZE, 0) == -1 || in notrand()
1093 ((fs->fs_magic != FS_MAGIC) && (fs->fs_magic != MTB_UFS_MAGIC))) { in notrand()
1101 while (inum < fs->fs_ipg) { in notrand()
1104 if (llseek(fd, seekaddr, 0) == -1 || in notrand()
1110 if (dip->di_gen != 0) { in notrand()
1125 "usage: newfs [ -v ] [ mkfs-options ] raw-special-device\n")); in usage()
1126 (void) fprintf(stderr, gettext("where mkfs-options are:\n")); in usage()
1128 "\t-N do not create file system, just print out parameters\n")); in usage()
1130 "\t-T configure file system for eventual growth to over a terabyte\n")); in usage()
1131 (void) fprintf(stderr, gettext("\t-s file system size (sectors)\n")); in usage()
1132 (void) fprintf(stderr, gettext("\t-b block size\n")); in usage()
1133 (void) fprintf(stderr, gettext("\t-f frag size\n")); in usage()
1134 (void) fprintf(stderr, gettext("\t-t tracks/cylinder\n")); in usage()
1135 (void) fprintf(stderr, gettext("\t-c cylinders/group\n")); in usage()
1136 (void) fprintf(stderr, gettext("\t-m minimum free space %%\n")); in usage()
1138 "\t-o optimization preference (`space' or `time')\n")); in usage()
1139 (void) fprintf(stderr, gettext("\t-r revolutions/minute\n")); in usage()
1140 (void) fprintf(stderr, gettext("\t-i number of bytes per inode\n")); in usage()
1142 "\t-a number of alternates per cylinder\n")); in usage()
1143 (void) fprintf(stderr, gettext("\t-C maxcontig\n")); in usage()
1144 (void) fprintf(stderr, gettext("\t-d rotational delay\n")); in usage()
1146 "\t-n number of rotational positions\n")); in usage()
1148 "\t-S print a textual version of the calculated superblock to stdout\n")); in usage()
1150 "\t-B dump a binary version of the calculated superblock to stdout\n")); in usage()
1154 * Error-detecting version of atoi(3). Adapted from mkfs' number().
1159 char *cs; in number() local
1164 cs = value; in number()
1165 if (*cs == '-') { in number()
1167 cs += 1; in number()
1169 if ((*cs < '0') || (*cs > '9')) { in number()
1173 while ((*cs >= '0') && (*cs <= '9') && (n <= cut)) { in number()
1174 n = n*10 + *cs++ - '0'; in number()
1177 n = -n; in number()
1179 switch (*cs++) { in number()
1206 * Error-detecting version of atoi(3). Adapted from mkfs' number().
1211 char *cs; in number64() local
1216 cs = value; in number64()
1217 if (*cs == '-') { in number64()
1219 cs += 1; in number64()
1221 if ((*cs < '0') || (*cs > '9')) { in number64()
1225 while ((*cs >= '0') && (*cs <= '9') && (n <= cut)) { in number64()
1226 n = n*10 + *cs++ - '0'; in number64()
1229 n = -n; in number64()
1231 switch (*cs++) { in number64()