* only be used by systems and drivers which create devices covering others
*/
cdev_t
-make_dev_covering(struct dev_ops *ops, cdev_t rdev, int minor, uid_t uid,
- gid_t gid, int perms, const char *fmt, ...)
+make_dev_covering(struct dev_ops *ops, struct dev_ops *bops, int minor,
+ uid_t uid, gid_t gid, int perms, const char *fmt, ...)
{
cdev_t devfs_dev;
__va_list ap;
*/
compile_dev_ops(ops);
- devfs_dev = devfs_new_cdev(ops, minor, rdev);
+ devfs_dev = devfs_new_cdev(ops, minor, bops);
__va_start(ap, fmt);
kvsnrprintf(devfs_dev->si_name, sizeof(devfs_dev->si_name),
32, fmt, ap);
devfs_clone_bitmap_init(bitmap);
devfs_clone_handler_add(name, nhandler);
- dev = make_dev(&default_dev_ops, 0xffff00ff,
+ dev = make_dev_covering(&default_dev_ops, ops, 0xffff00ff,
uid, gid, perms, "%s", name);
kvasfree(&name);
return dev;
*/
ndev->si_flags |= SI_REPROBE_TEST;
} else {
- ndev = make_dev_covering(&disk_ops, dp->d_rawdev,
+ ndev = make_dev_covering(&disk_ops, dp->d_rawdev->si_ops,
dkmakeminor(dkunit(dp->d_cdev),
slice, i),
UID_ROOT, GID_OPERATOR, 0640,
/*
* Else create new device
*/
- ndev = make_dev_covering(&disk_ops, dp->d_rawdev,
+ ndev = make_dev_covering(&disk_ops, dp->d_rawdev->si_ops,
dkmakewholeslice(dkunit(dev), i),
UID_ROOT, GID_OPERATOR, 0640,
"%ss%d", dev->si_name, sno);
dp->d_rawdev = rawdev;
dp->d_raw_ops = raw_ops;
dp->d_dev_ops = &disk_ops;
- dp->d_cdev = make_dev_covering(&disk_ops, dp->d_rawdev,
+ dp->d_cdev = make_dev_covering(&disk_ops, dp->d_rawdev->si_ops,
dkmakewholedisk(unit),
UID_ROOT, GID_OPERATOR, 0640,
"%s%d", raw_ops->head.name, unit);
uid_t si_uid;
gid_t si_gid;
int si_perms;
- struct cdev *si_rdev;
TAILQ_ENTRY(cdev) link;
int si_uminor;
int si_umajor;
void *si_drv1;
void *si_drv2;
struct dev_ops *si_ops; /* device operations vector */
+ struct dev_ops *si_bops; /* backing devops vector */
int si_iosize_max; /* maximum I/O size (for physio &al) */
struct sysref si_sysref;
union {
int devfs_destroy_dev_by_ops(struct dev_ops *, int);
struct devfs_node *devfs_find_device_node_by_name(struct devfs_node *, char *);
-cdev_t devfs_new_cdev(struct dev_ops *, int, cdev_t);
+cdev_t devfs_new_cdev(struct dev_ops *, int, struct dev_ops *);
cdev_t devfs_find_device_by_name(const char *, ...);
cdev_t devfs_find_device_by_udev(udev_t);
cdev_t make_dev(struct dev_ops *ops, int minor, uid_t uid, gid_t gid,
int perms, const char *fmt, ...) __printflike(6, 7);
-cdev_t make_dev_covering(struct dev_ops *ops, cdev_t rdev, int minor, uid_t uid,
- gid_t gid, int perms, const char *fmt, ...) __printflike(7, 8);
+cdev_t make_dev_covering(struct dev_ops *ops, struct dev_ops *bops, int minor,
+ uid_t uid, gid_t gid, int perms, const char *fmt, ...) __printflike(7, 8);
cdev_t make_only_dev(struct dev_ops *ops, int minor, uid_t uid, gid_t gid,
int perms, const char *fmt, ...) __printflike(6, 7);
cdev_t make_only_devfs_dev(struct dev_ops *ops, int minor, uid_t uid, gid_t gid,
* fields.
*/
cdev_t
-devfs_new_cdev(struct dev_ops *ops, int minor, cdev_t rdev)
+devfs_new_cdev(struct dev_ops *ops, int minor, struct dev_ops *bops)
{
cdev_t dev = sysref_alloc(&cdev_sysref_class);
dev->si_flags = 0;
dev->si_umajor = 0;
dev->si_uminor = minor;
- dev->si_rdev = rdev;
+ dev->si_bops = bops;
/* If there is a backing device, we reference its ops */
dev->si_inode = makeudev(
- devfs_reference_ops((rdev)?(rdev->si_ops):(ops)),
+ devfs_reference_ops((bops)?(bops):(ops)),
minor );
return dev;
lockmgr(&devfs_lock, LK_RELEASE);
/* If there is a backing device, we release the backing device's ops */
- devfs_release_ops((dev->si_rdev)?(dev->si_rdev->si_ops):(dev->si_ops));
+ devfs_release_ops((dev->si_bops)?(dev->si_bops):(dev->si_ops));
/* Finally destroy the device */
sysref_put(&dev->si_sysref);