When offset and session_offset hint are not specified then sets
session_offset hint from CDROMMULTISESSION ioctl which returns start
position of the last session of multisession optical disc.
It is expected that session_offset hint contains position offset in bytes
where starts session of multisession optical disc which should be read.
Filesystems designed for optical discs are expected to use this value when
dealing with multisession optical disc to know where they should start
reading optical disc or image of optical disc.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
if (pr->flags & BLKID_FL_CDROM_DEV) {
cdrom_size_correction(pr, last_written);
+
+# ifdef CDROMMULTISESSION
+ if (!pr->off && blkid_probe_get_hint(pr, "session_offset", NULL) < 0) {
+ struct cdrom_multisession multisession = { .addr_format = CDROM_LBA };
+ if (ioctl(fd, CDROMMULTISESSION, &multisession) == 0 && multisession.xa_flag)
+ blkid_probe_set_hint(pr, "session_offset", (multisession.addr.lba << 11));
+ }
+# endif
}
}
#endif