|
|
| version 1.5, 2003/08/07 21:17:09 | version 1.6, 2004/05/19 22:52:48 |
|---|---|
| Line 134 open_drive(struct drive *drive, struct p | Line 134 open_drive(struct drive *drive, struct p |
| if ((devminor & 7) == 2) /* partition c */ | if ((devminor & 7) == 2) /* partition c */ |
| return ENOTTY; /* not buying that */ | return ENOTTY; /* not buying that */ |
| drive->dev = makedev(devmajor, devminor); /* find the device */ | drive->dev = udev2dev(makeudev(devmajor, devminor), 0); |
| if (drive->dev == NULL) /* didn't find anything */ | |
| return ENODEV; | |
| drive->dev->si_iosize_max = DFLTPHYS; | drive->dev->si_iosize_max = DFLTPHYS; |
| if (dev_dport(drive->dev) == NULL) | if (dev_is_good(drive->dev)) |
| drive->lasterror = ENOENT; | |
| else | |
| drive->lasterror = dev_dopen(drive->dev, FWRITE, 0, NULL); | drive->lasterror = dev_dopen(drive->dev, FWRITE, 0, NULL); |
| else | |
| drive->lasterror = ENOENT; | |
| if (drive->lasterror != 0) { /* failed */ | if (drive->lasterror != 0) { /* failed */ |
| drive->state = drive_down; /* just force it down */ | drive->state = drive_down; /* just force it down */ |
| Line 771 write_volume_label(int volno) | Line 769 write_volume_label(int volno) |
| struct disklabel *dlp; | struct disklabel *dlp; |
| struct volume *vol; | struct volume *vol; |
| int error; | int error; |
| dev_t dev; | |
| lp = (struct disklabel *) Malloc((sizeof(struct disklabel) + (DEV_BSIZE - 1)) & (DEV_BSIZE - 1)); | lp = (struct disklabel *) Malloc((sizeof(struct disklabel) + (DEV_BSIZE - 1)) & (DEV_BSIZE - 1)); |
| if (lp == 0) | if (lp == 0) |
| Line 794 write_volume_label(int volno) | Line 793 write_volume_label(int volno) |
| * unless it's already there. | * unless it's already there. |
| */ | */ |
| bp = geteblk((int) lp->d_secsize); /* get a buffer */ | bp = geteblk((int) lp->d_secsize); /* get a buffer */ |
| bp->b_dev = makedev(VINUM_CDEV_MAJOR, vol->volno); /* our own raw volume */ | dev = make_adhoc_dev(&vinum_cdevsw, vol->volno); |
| bp->b_dev = dev; | |
| bp->b_blkno = LABELSECTOR * ((int) lp->d_secsize / DEV_BSIZE); | bp->b_blkno = LABELSECTOR * ((int) lp->d_secsize / DEV_BSIZE); |
| bp->b_bcount = lp->d_secsize; | bp->b_bcount = lp->d_secsize; |
| bzero(bp->b_data, lp->d_secsize); | bzero(bp->b_data, lp->d_secsize); |
| Line 814 write_volume_label(int volno) | Line 814 write_volume_label(int volno) |
| error = biowait(bp); | error = biowait(bp); |
| bp->b_flags |= B_INVAL | B_AGE; | bp->b_flags |= B_INVAL | B_AGE; |
| bp->b_flags &= ~B_ERROR; | bp->b_flags &= ~B_ERROR; |
| brelse(bp); | brelse(bp); |
| return error; | return error; |
| } | } |