Update disk's stripesize and stripeoffset parameters on provider open.

They are media-dependent and may change in run-time, same as sectorsize
and/or mediasize.

SCSI devices return physical sector size and offset via READ CAPACITY(16)
command and so can not report it until media inserted or at least until
probe sequence completed. UNMAP support is also reported there.
This commit is contained in:
Alexander Motin 2011-06-03 13:49:18 +00:00
parent 190367ef1c
commit 0330cb3bf7

View File

@ -154,6 +154,12 @@ g_disk_access(struct g_provider *pp, int r, int w, int e)
}
pp->mediasize = dp->d_mediasize;
pp->sectorsize = dp->d_sectorsize;
if (dp->d_flags & DISKFLAG_CANDELETE)
pp->flags |= G_PF_CANDELETE;
else
pp->flags &= ~G_PF_CANDELETE;
pp->stripeoffset = dp->d_stripeoffset;
pp->stripesize = dp->d_stripesize;
dp->d_flags |= DISKFLAG_OPEN;
if (dp->d_maxsize == 0) {
printf("WARNING: Disk drive %s%d has no d_maxsize\n",