I need to compute the sha1sum of an emmc partition and obviously this involves reading the contents of the partition (if at all it is relevant - the partition is ext4-formatted).
I am performing the read operation on /dev/mmcblkp**
just like any other fd:
while ((ret = read(blk_dev_fd, buffer, BLOCKSIZE))) > 0) {
printf("Read %zd bytes from source_fd\n", ret);
// do something
}
Is this correct? Can I expect read to return 0 on EOF or is there no such thing as EOF on block devices?