Home
last modified time | relevance | path

Searched refs:sectorsize (Results 1 – 25 of 118) sorted by relevance

12345

/freebsd/sbin/geom/misc/
H A Dsubr.c121 g_parse_lba(const char *lbastr, unsigned int sectorsize, off_t *sectors) in g_parse_lba() argument
127 assert(sectorsize > 0); in g_parse_lba()
135 unit = sectorsize; in g_parse_lba()
167 unit = sectorsize; /* sector */ in g_parse_lba()
182 if (number % sectorsize) in g_parse_lba()
184 number /= sectorsize; in g_parse_lba()
208 ssize_t sectorsize; in g_get_sectorsize() local
214 sectorsize = g_sectorsize(fd); in g_get_sectorsize()
215 if (sectorsize == -1) in g_get_sectorsize()
216 sectorsize = 0; in g_get_sectorsize()
[all …]
/freebsd/usr.sbin/diskinfo/
H A Ddiskinfo.c71 static void speeddisk(int fd, off_t mediasize, u_int sectorsize);
72 static void commandtime(int fd, off_t mediasize, u_int sectorsize);
73 static void iopsbench(int fd, off_t mediasize, u_int sectorsize);
75 static void slogbench(int fd, int isreg, off_t mediasize, u_int sectorsize);
91 u_int sectorsize, fwsectors, fwheads, zoned = 0, isreg; in main() local
168 sectorsize = S_BLKSIZE; in main()
203 error = ioctl(fd, DIOCGSECTORSIZE, &sectorsize); in main()
227 printf("\t%u", sectorsize); in main()
229 printf("\t%jd", (intmax_t)mediasize/sectorsize); in main()
234 (fwsectors * fwheads * sectorsize)); in main()
[all …]
/freebsd/sbin/newfs/
H A Dnewfs.c88 int sectorsize; /* bytes/sector */ variable
169 rval = expand_number_int(optarg, &sectorsize); in main()
170 if (rval < 0 || sectorsize <= 0) in main()
334 if (sectorsize == 0) in main()
335 sectorsize = 512; in main()
339 if (sectorsize == 0) in main()
340 if (ioctl(disk.d_fd, DIOCGSECTORSIZE, &sectorsize) == -1) in main()
341 sectorsize = 0; /* back out on error for safety */ in main()
342 if (sectorsize && ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize) != -1) in main()
343 getfssize(&fssize, special, mediasize / sectorsize, reserved); in main()
[all …]
/freebsd/sys/geom/part/
H A Dg_part_bsd64.c316 blksize = pp->sectorsize < BLKSIZE ? BLKSIZE: pp->sectorsize; in g_part_bsd64_create()
340 table->d_bbase = ressize / pp->sectorsize; in g_part_bsd64_create()
342 ~blkmask) / pp->sectorsize; in g_part_bsd64_create()
344 basetable->gpt_first = pbase / pp->sectorsize; in g_part_bsd64_create()
361 if (pp->sectorsize > offsetof(struct disklabel64, d_magic)) in g_part_bsd64_destroy()
451 rounddown2(pp->mediasize - table->d_bbase * pp->sectorsize, in g_part_bsd64_resize()
452 table->d_align) / pp->sectorsize; in g_part_bsd64_resize()
480 v = rounddown2(pp->sectorsize + offsetof(struct disklabel64, d_magic), in g_part_bsd64_probe()
481 pp->sectorsize); in g_part_bsd64_probe()
505 v32 = roundup2(sizeof(struct disklabel64), pp->sectorsize); in g_part_bsd64_read()
[all …]
H A Dg_part_apm.c195 buf = g_read_data(cp, pp->sectorsize * blk, pp->sectorsize, &error); in apm_read_ent()
199 swab(buf, pp->sectorsize); in apm_read_ent()
260 if (pp->sectorsize != 512 || in g_part_apm_create()
261 pp->mediasize < (2 + 2 * basetable->gpt_entries) * pp->sectorsize) in g_part_apm_create()
265 last = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX) - 1; in g_part_apm_create()
271 table->ddr.ddr_blksize = pp->sectorsize; in g_part_apm_create()
367 basetable->gpt_last = MIN(pp->mediasize / pp->sectorsize, in g_part_apm_resize()
405 if (pp->mediasize < 4 * pp->sectorsize) in g_part_apm_probe()
409 buf = g_read_data(cp, 0L, pp->sectorsize, &error); in g_part_apm_probe()
418 if (table->ddr.ddr_blksize != pp->sectorsize) in g_part_apm_probe()
[all …]
H A Dg_part_gpt.c352 MIN(pp->mediasize / pp->sectorsize - 1, UINT32_MAX)); in gpt_create_pmbr()
451 last = (pp->mediasize / pp->sectorsize) - 1; in gpt_read_hdr()
462 buf = g_read_data(cp, table->lba[elt] * pp->sectorsize, pp->sectorsize, in gpt_read_hdr()
472 if (sz < 92 || sz > pp->sectorsize) in gpt_read_hdr()
520 pp->sectorsize) - 1; in gpt_read_hdr()
566 sectors = howmany(tblsz, pp->sectorsize); in gpt_read_tbl()
567 buf = g_malloc(sectors * pp->sectorsize, M_WAITOK | M_ZERO); in gpt_read_tbl()
568 for (idx = 0; idx < sectors; idx += maxphys / pp->sectorsize) { in gpt_read_tbl()
569 size = (sectors - idx > maxphys / pp->sectorsize) ? maxphys: in gpt_read_tbl()
570 (sectors - idx) * pp->sectorsize; in gpt_read_tbl()
[all …]
H A Dg_part_ebr.c270 (off_t)(start + basetable->gpt_sectors) * pp->sectorsize; in g_part_ebr_add()
326 if (pp->sectorsize < EBRSIZE) in g_part_ebr_create()
328 if (pp->sectorsize > 4096) in g_part_ebr_create()
346 msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); in g_part_ebr_create()
418 basetable->gpt_last = MIN(pp->mediasize / pp->sectorsize, in g_part_ebr_resize()
458 if (pp->sectorsize < EBRSIZE || pp->mediasize < pp->sectorsize) in g_part_ebr_probe()
460 if (pp->sectorsize > 4096) in g_part_ebr_probe()
479 buf = g_read_data(cp, 0L, pp->sectorsize, &error); in g_part_ebr_probe()
518 msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); in g_part_ebr_read()
522 ofs = (off_t)lba * pp->sectorsize; in g_part_ebr_read()
[all …]
H A Dg_part_bsd.c205 if (pp->sectorsize < sizeof(struct disklabel)) in g_part_bsd_create()
207 if (BBSIZE % pp->sectorsize) in g_part_bsd_create()
210 msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); in g_part_bsd_create()
216 ptr = table->bbarea + pp->sectorsize; in g_part_bsd_create()
219 le32enc(ptr + 40, pp->sectorsize); /* d_secsize */ in g_part_bsd_create()
312 msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); in bsd_set_rawsize()
313 le32enc(table->bbarea + pp->sectorsize + 60, msize); /* d_secperunit */ in bsd_set_rawsize()
364 if (pp->sectorsize < sizeof(struct disklabel) || in g_part_bsd_probe()
367 if (BBSIZE % pp->sectorsize) in g_part_bsd_probe()
371 buf = g_read_data(cp, pp->sectorsize, pp->sectorsize, &error); in g_part_bsd_probe()
[all …]
/freebsd/sbin/gbde/
H A Dgbde.c
/freebsd/stand/common/
H A Ddisk.c48 u_int sectorsize; member
59 display_size(uint64_t size, u_int sectorsize) in display_size() argument
64 size = size * sectorsize / 1024; in display_size()
94 offset *= (od->sectorsize / 512); in ptblread()
100 blocks * od->sectorsize, (char *)buf, NULL)); in ptblread()
117 sectsize = od->sectorsize; in ptable_print()
184 blocks * od->sectorsize, buf, NULL); in disk_read()
197 blocks * od->sectorsize, buf, NULL); in disk_write()
212 *(u_int *)data = od->sectorsize; in disk_ioctl()
218 *(uint64_t *)data = od->entrysize * od->sectorsize; in disk_ioctl()
[all …]
H A Dpart.c75 uint16_t sectorsize; member
148 uint16_t sectorsize) in gpt_checkhdr() argument
157 if (sz < 92 || sz > sectorsize) { in gpt_checkhdr()
187 sectorsize % hdr->hdr_entsz != 0) { in gpt_checkhdr()
238 buf = malloc(table->sectorsize); in ptable_gptread()
241 tbl = malloc(table->sectorsize * MAXTBLSZ); in ptable_gptread()
255 table->sectorsize); in ptable_gptread()
260 table->sectorsize)); in ptable_gptread()
262 gpt_checktbl(phdr, tbl, size * table->sectorsize, in ptable_gptread()
274 table->sectors - 1, table->sectorsize); in ptable_gptread()
[all …]
/freebsd/sys/geom/bde/
H A Dg_bde_crypt.c
H A Dg_bde.c
H A Dg_bde_lock.c
/freebsd/tools/tools/bootparttest/
H A Dbootparttest.c61 uint16_t sectorsize; member
81 (blk + dev->d_offset) * disk.sectorsize); in disk_strategy()
107 disk.sectorsize = 512; in main()
114 disk.sectorsize = g_sectorsize(disk.fd); in main()
122 disk.mediasize, disk.mediasize / disk.sectorsize, disk.sectorsize); in main()
124 if (disk_open(&dev, disk.mediasize, disk.sectorsize) != 0) in main()
/freebsd/tools/regression/geom/MdLoad/
H A DMdLoad.c60 int sectorsize; member
100 sc->sp = calloc(1, sizeof(*sc->sp) + sc->sectorsize); in startElement()
123 sc->sectorsize = strtoul(sbuf_data(sc->sbuf), &p, 0); in endElement()
150 memset(sc->sp->data, j, sc->sectorsize); in endElement()
154 for (i = 0; i < sc->sectorsize; i++) { in endElement()
242 sc->mediasize = sc->lastsector + sc->sectorsize * 10; in main()
243 if (sc->sectorsize == 0) in main()
244 sc->sectorsize = 512; in main()
246 (intmax_t)sc->mediasize / sc->sectorsize, sc->sectorsize); in main()
263 error = write(fd, dsp->data, sc->sectorsize); in main()
[all …]
/freebsd/sys/geom/label/
H A Dg_label_ufs.c101 if (fs->fs_sblockloc < pp->sectorsize * 2) in g_label_ufs_ignore_bsdlabel_slice()
105 if (pp->sectorsize < sizeof(struct disklabel) || in g_label_ufs_ignore_bsdlabel_slice()
108 if (BBSIZE % pp->sectorsize) in g_label_ufs_ignore_bsdlabel_slice()
112 buf = g_read_data(cp, pp->sectorsize, pp->sectorsize, &error); in g_label_ufs_ignore_bsdlabel_slice()
139 KASSERT(pp->sectorsize != 0, ("Tasting a disk with 0 sectorsize")); in g_label_ufs_taste_common()
140 if (SBLOCKSIZE % pp->sectorsize != 0 || ffs_sbget(cp, &fs, UFS_STDSB, in g_label_ufs_taste_common()
H A Dg_label_iso9660.c52 KASSERT(pp->sectorsize != 0, ("Tasting a disk with 0 sectorsize")); in g_label_iso9660_taste()
53 if (pp->sectorsize < 0x28 + VOLUME_LEN) in g_label_iso9660_taste()
55 if ((ISO9660_OFFSET % pp->sectorsize) != 0) in g_label_iso9660_taste()
57 sector = g_read_data(cp, ISO9660_OFFSET, pp->sectorsize, NULL); in g_label_iso9660_taste()
H A Dg_label_ext2fs.c62 KASSERT(pp->sectorsize != 0, ("Tasting a disk with 0 sectorsize")); in g_label_ext2fs_taste()
63 if (pp->sectorsize < sizeof(*fs)) in g_label_ext2fs_taste()
65 if ((EXT2FS_SB_OFFSET % pp->sectorsize) != 0) in g_label_ext2fs_taste()
68 fs = g_read_data(cp, EXT2FS_SB_OFFSET, pp->sectorsize, NULL); in g_label_ext2fs_taste()
/freebsd/sys/geom/eli/
H A Dg_eli_integrity.c147 decr_secsize = bp->bio_to->sectorsize; in g_eli_auth_read_done()
150 LIST_FIRST(&sc->sc_geom->consumer)->provider->sectorsize; in g_eli_auth_read_done()
183 decr_secsize = bp->bio_to->sectorsize; in g_eli_auth_read_done()
185 encr_secsize = LIST_FIRST(&sc->sc_geom->consumer)->provider->sectorsize; in g_eli_auth_read_done()
212 decr_secsize = bp->bio_to->sectorsize; in g_eli_auth_read_done()
214 encr_secsize = LIST_FIRST(&sc->sc_geom->consumer)->provider->sectorsize; in g_eli_auth_read_done()
337 nsec = bp->bio_length / bp->bio_to->sectorsize; in g_eli_auth_write_done()
339 nsec = (nsec * sc->sc_bytes_per_sector) / cp->provider->sectorsize; in g_eli_auth_write_done()
341 cbp->bio_length = cp->provider->sectorsize * nsec; in g_eli_auth_write_done()
342 cbp->bio_offset = (bp->bio_offset / bp->bio_to->sectorsize) * sc->sc_bytes_per_sector; in g_eli_auth_write_done()
[all …]
H A Dg_eli_ctl.c256 intmax_t *keylen, *sectorsize; in g_eli_ctl_onetime() local
360 sectorsize = gctl_get_paraml(req, "sectorsize", sizeof(*sectorsize)); in g_eli_ctl_onetime()
361 if (sectorsize == NULL) { in g_eli_ctl_onetime()
365 if (*sectorsize == 0) in g_eli_ctl_onetime()
366 md.md_sectorsize = pp->sectorsize; in g_eli_ctl_onetime()
368 if (*sectorsize < 0 || (*sectorsize % pp->sectorsize) != 0) { in g_eli_ctl_onetime()
372 if (*sectorsize > PAGE_SIZE) { in g_eli_ctl_onetime()
376 md.md_sectorsize = *sectorsize; in g_eli_ctl_onetime()
624 sector = malloc(pp->sectorsize, M_ELI, M_WAITOK | M_ZERO); in g_eli_ctl_configure()
626 error = g_write_data(cp, pp->mediasize - pp->sectorsize, sector, in g_eli_ctl_configure()
[all …]
/freebsd/usr.sbin/fstyp/
H A Dgeli.c43 u_int sectorsize; in fstyp_geli() local
50 error = ioctl(fileno(fp), DIOCGSECTORSIZE, &sectorsize); in fstyp_geli()
53 buf = (u_char *)read_buf(fp, mediasize - sectorsize, sectorsize); in fstyp_geli()
/freebsd/stand/userboot/userboot/
H A Duserboot_disk.c41 uint16_t sectorsize; member
83 u_int sectorsize; in userdisk_init() local
93 &sectorsize) != 0 || CALLBACK(diskioctl, i, in userdisk_init()
97 ud_info[i].sectorsize = sectorsize; in userdisk_init()
142 ud_info[i].sectorsize) == 0) { in userdisk_print()
172 ud_info[dev->dd.d_unit].sectorsize)); in userdisk_open()
215 off = dblk * ud_info[dev->dd.d_unit].sectorsize; in userdisk_realstrategy()
/freebsd/sys/geom/raid/
H A Dmd_intel.c593 if (pp->sectorsize < sizeof(*meta)) in intel_meta_read()
597 pp->mediasize - pp->sectorsize * 2, pp->sectorsize, &error); in intel_meta_read()
620 memcpy(meta, buf, min(size, pp->sectorsize)); in intel_meta_read()
624 if (meta->config_size > pp->sectorsize) { in intel_meta_read()
625 left = (meta->config_size - 1) / pp->sectorsize; in intel_meta_read()
627 pp->mediasize - pp->sectorsize * (2 + left), in intel_meta_read()
628 pp->sectorsize * left, &error); in intel_meta_read()
636 memcpy(((char *)meta) + pp->sectorsize, buf, in intel_meta_read()
637 pp->sectorsize * left); in intel_meta_read()
777 sectors = howmany(meta->config_size, pp->sectorsize); in intel_meta_write()
[all …]
/freebsd/sys/dev/md/
H A Dmd.c255 unsigned sectorsize; member
497 md_malloc_move_ma(vm_page_t **mp, int *ma_offs, unsigned sectorsize, in md_malloc_move_ma() argument
518 for (n = sectorsize; n != 0; n -= sz) { in md_malloc_move_ma()
674 nsec = bp->bio_length / sc->sectorsize; in mdstart_malloc()
675 secno = bp->bio_offset / sc->sectorsize; in mdstart_malloc()
686 sc->sectorsize, NULL, 0, in mdstart_malloc()
690 &ma_offs, sc->sectorsize, NULL, 0, in mdstart_malloc()
693 bzero(dst, sc->sectorsize); in mdstart_malloc()
697 sc->sectorsize, NULL, osp, in mdstart_malloc()
701 &ma_offs, sc->sectorsize, NULL, osp, in mdstart_malloc()
[all …]

12345