mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-30 08:43:23 +00:00
Add disk_enumerate() for finding names of disks. Vinum and libh will
need this RSN. Remove a pointless warning in the root device locating code. Remove the "wd" compatibility name from the "ad" driver. WARNING: If you have not updated to use /dev/wd* in your /etc/fstab and modern bootblocks, it would be a very good idea to do so BEFORE you upgrade your kernel.
This commit is contained in:
parent
0b1574bd33
commit
4bd02a5609
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=61717
@ -276,10 +276,8 @@ setroot()
|
||||
}
|
||||
majdev = B_TYPE(bootdev);
|
||||
dev = makebdev(majdev, 0);
|
||||
if (devsw(dev) == NULL) {
|
||||
printf("no devsw (majdev=%d bootdev=%#lx)\n", majdev, bootdev);
|
||||
if (devsw(dev) == NULL)
|
||||
return;
|
||||
}
|
||||
unit = B_UNIT(bootdev);
|
||||
slice = B_SLICE(bootdev);
|
||||
if (slice == WHOLE_DISK_SLICE)
|
||||
|
@ -72,23 +72,6 @@ static struct cdevsw ad_cdevsw = {
|
||||
/* bmaj */ 30
|
||||
};
|
||||
static struct cdevsw addisk_cdevsw;
|
||||
static struct cdevsw fakewd_cdevsw = {
|
||||
/* open */ adopen,
|
||||
/* close */ nullclose,
|
||||
/* read */ physread,
|
||||
/* write */ physwrite,
|
||||
/* ioctl */ noioctl,
|
||||
/* poll */ nopoll,
|
||||
/* mmap */ nommap,
|
||||
/* strategy */ adstrategy,
|
||||
/* name */ "wd",
|
||||
/* maj */ 3,
|
||||
/* dump */ addump,
|
||||
/* psize */ nopsize,
|
||||
/* flags */ D_DISK,
|
||||
/* bmaj */ 0
|
||||
};
|
||||
static struct cdevsw fakewddisk_cdevsw;
|
||||
|
||||
/* prototypes */
|
||||
static void ad_timeout(struct ad_request *);
|
||||
@ -196,12 +179,6 @@ ad_attach(struct ata_softc *scp, int32_t device)
|
||||
dev->si_iosize_max = 256 * DEV_BSIZE;
|
||||
adp->dev1 = dev;
|
||||
|
||||
dev = disk_create(adp->lun, &adp->disk, 0, &fakewd_cdevsw,
|
||||
&fakewddisk_cdevsw);
|
||||
dev->si_drv1 = adp;
|
||||
dev->si_iosize_max = 256 * DEV_BSIZE;
|
||||
adp->dev2 = dev;
|
||||
|
||||
bioq_init(&adp->queue);
|
||||
}
|
||||
|
||||
@ -210,7 +187,6 @@ ad_detach(struct ad_softc *adp)
|
||||
{
|
||||
disk_invalidate(&adp->disk);
|
||||
disk_destroy(adp->dev1);
|
||||
disk_destroy(adp->dev2);
|
||||
devstat_remove_entry(&adp->stats);
|
||||
ata_free_lun(&adp_lun_map, adp->lun);
|
||||
free(adp, M_AD);
|
||||
|
@ -276,10 +276,8 @@ setroot()
|
||||
}
|
||||
majdev = B_TYPE(bootdev);
|
||||
dev = makebdev(majdev, 0);
|
||||
if (devsw(dev) == NULL) {
|
||||
printf("no devsw (majdev=%d bootdev=%#lx)\n", majdev, bootdev);
|
||||
if (devsw(dev) == NULL)
|
||||
return;
|
||||
}
|
||||
unit = B_UNIT(bootdev);
|
||||
slice = B_SLICE(bootdev);
|
||||
if (slice == WHOLE_DISK_SLICE)
|
||||
|
@ -27,6 +27,8 @@ static d_open_t diskopen;
|
||||
static d_close_t diskclose;
|
||||
static d_ioctl_t diskioctl;
|
||||
static d_psize_t diskpsize;
|
||||
|
||||
static LIST_HEAD(, disk) disklist = LIST_HEAD_INITIALIZER(&disklist);
|
||||
|
||||
dev_t
|
||||
disk_create(int unit, struct disk *dp, int flags, struct cdevsw *cdevsw, struct cdevsw *proto)
|
||||
@ -49,12 +51,13 @@ disk_create(int unit, struct disk *dp, int flags, struct cdevsw *cdevsw, struct
|
||||
if (bootverbose)
|
||||
printf("Creating DISK %s%d\n", cdevsw->d_name, unit);
|
||||
dev = make_dev(proto, dkmakeminor(unit, WHOLE_DISK_SLICE, RAW_PART),
|
||||
0, 0, 0, "r%s%d", cdevsw->d_name, unit);
|
||||
0, 0, 0, "%s%d", cdevsw->d_name, unit);
|
||||
|
||||
dev->si_disk = dp;
|
||||
dp->d_dev = dev;
|
||||
dp->d_dsflags = flags;
|
||||
dp->d_devsw = cdevsw;
|
||||
LIST_INSERT_HEAD(&disklist, dp, d_list);
|
||||
return (dev);
|
||||
}
|
||||
|
||||
@ -95,11 +98,22 @@ disk_invalidate (struct disk *disk)
|
||||
void
|
||||
disk_destroy(dev_t dev)
|
||||
{
|
||||
LIST_REMOVE(dev->si_disk, d_list);
|
||||
bzero(dev->si_disk, sizeof(*dev->si_disk));
|
||||
dev->si_disk = NULL;
|
||||
destroy_dev(dev);
|
||||
return;
|
||||
}
|
||||
|
||||
struct disk *
|
||||
disk_enumerate(struct disk *disk)
|
||||
{
|
||||
if (!disk)
|
||||
return (LIST_FIRST(&disklist));
|
||||
else
|
||||
return (LIST_NEXT(disk, d_list));
|
||||
}
|
||||
|
||||
/*
|
||||
* The cdevsw functions
|
||||
*/
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include <sys/disklabel.h>
|
||||
#endif /* _SYS_DISKLABEL */
|
||||
|
||||
#include <sys/queue.h>
|
||||
|
||||
struct disk {
|
||||
u_int d_flags;
|
||||
u_int d_dsflags;
|
||||
@ -28,6 +30,7 @@ struct disk {
|
||||
dev_t d_dev;
|
||||
struct diskslices *d_slice;
|
||||
struct disklabel d_label;
|
||||
LIST_ENTRY(disk) d_list;
|
||||
};
|
||||
|
||||
#define DISKFLAG_LOCK 0x1
|
||||
@ -36,6 +39,7 @@ struct disk {
|
||||
dev_t disk_create __P((int unit, struct disk *disk, int flags, struct cdevsw *cdevsw, struct cdevsw *diskdevsw));
|
||||
void disk_destroy __P((dev_t dev));
|
||||
int disk_dumpcheck __P((dev_t dev, u_int *count, u_int *blkno, u_int *secsize));
|
||||
struct disk *disk_enumerate __P((struct disk *disk));
|
||||
void disk_invalidate __P((struct disk *disk));
|
||||
|
||||
#endif /* _SYS_DISK_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user