Lines Matching refs:disk
52 bread(struct uufsd *disk, ufs2_daddr_t blockno, void *data, size_t size) in bread() argument
57 ERROR(disk, NULL); in bread()
61 ERROR(disk, "allocate bounce buffer"); in bread()
64 cnt = pread(disk->d_fd, p2, size, (off_t)(blockno * disk->d_bsize)); in bread()
66 ERROR(disk, "read error from block device"); in bread()
70 ERROR(disk, "end of file from block device"); in bread()
74 ERROR(disk, "short read or read error from block device"); in bread()
90 bwrite(struct uufsd *disk, ufs2_daddr_t blockno, const void *data, size_t size) in bwrite() argument
96 ERROR(disk, NULL); in bwrite()
98 rv = ufs_disk_write(disk); in bwrite()
100 ERROR(disk, "failed to open disk for writing"); in bwrite()
105 ERROR(disk, "allocate bounce buffer"); in bwrite()
110 cnt = pwrite(disk->d_fd, p2, size, (off_t)(blockno * disk->d_bsize)); in bwrite()
114 ERROR(disk, "write error to block device"); in bwrite()
118 ERROR(disk, "short write to block device"); in bwrite()
127 berase_helper(struct uufsd *disk, ufs2_daddr_t blockno, ufs2_daddr_t size) in berase_helper() argument
131 ioarg[0] = blockno * disk->d_bsize; in berase_helper()
133 return (ioctl(disk->d_fd, DIOCGDELETE, ioarg)); in berase_helper()
139 berase_helper(struct uufsd *disk, ufs2_daddr_t blockno, ufs2_daddr_t size) in berase_helper() argument
145 offset = blockno * disk->d_bsize; in berase_helper()
146 zero_chunk_size = 65536 * disk->d_bsize; in berase_helper()
149 ERROR(disk, "failed to allocate memory"); in berase_helper()
156 rv = pwrite(disk->d_fd, zero_chunk, pwrite_size, offset); in berase_helper()
158 ERROR(disk, "failed writing to disk"); in berase_helper()
172 berase(struct uufsd *disk, ufs2_daddr_t blockno, ufs2_daddr_t size) in berase() argument
176 ERROR(disk, NULL); in berase()
177 rv = ufs_disk_write(disk); in berase()
179 ERROR(disk, "failed to open disk for writing"); in berase()
182 return (berase_helper(disk, blockno, size)); in berase()