int qcount;
struct hpq queue;
struct selinfo sel;
- void (*old_devfs_node_added)(cdev_t dev);
- void (*old_devfs_node_removed)(cdev_t dev);
+ void (*old_devfs_node_added)(struct hotplug_device *hpdev);
+ void (*old_devfs_node_removed)(struct hotplug_device *hpdev);
} hpsc;
-extern void (*devfs_node_added)(cdev_t dev);
-extern void (*devfs_node_removed)(cdev_t dev);
+extern void (*devfs_node_added)(struct hotplug_device *hpdev);
+extern void (*devfs_node_removed)(struct hotplug_device *hpdev);
-void hotplug_devfs_node_added(cdev_t dev);
-void hotplug_devfs_node_removed(cdev_t dev);
+void hotplug_devfs_node_added(struct hotplug_device *hpdev);
+void hotplug_devfs_node_removed(struct hotplug_device *hpdev);
static int hotplug_get_event(struct hotplug_event *he);
static int hotplug_put_event(struct hotplug_event *he);
}
void
-hotplug_devfs_node_added(cdev_t dev) {
+hotplug_devfs_node_added(struct hotplug_device *hpdev) {
struct hotplug_event he;
u_int class;
char *name;
- if(!dev || !hpsc.opened)
+ if(!hpdev->dev || !hpsc.opened)
return;
- class = dev->si_ops->head.flags;
- name = dev->si_name;
+ class = hpdev->dev->si_ops->head.flags;
+ name = hpdev->name;
he.he_type = HOTPLUG_DEVAT;
he.he_devclass = ((class == D_TTY) ? DV_TTY : ((class == D_TAPE) ? DV_TAPE : ((class == D_DISK) ? DV_DISK : DV_DULL)));
strlcpy(he.he_devname, name, sizeof(he.he_devname));
}
void
-hotplug_devfs_node_removed(cdev_t dev) {
+hotplug_devfs_node_removed(struct hotplug_device *hpdev) {
struct hotplug_event he;
u_int class;
char *name;
- if(!dev || !hpsc.opened)
+ if(!hpdev->dev || !hpsc.opened)
return;
- class = dev->si_ops->head.flags;
- name = dev->si_name;
+ class = hpdev->dev->si_ops->head.flags;
+ name = hpdev->name;
he.he_type = HOTPLUG_DEVDT;
he.he_devclass = ((class == D_TTY) ? DV_TTY : ((class == D_TAPE) ? DV_TAPE : ((class == D_DISK) ? DV_DISK : DV_DULL)));
strlcpy(he.he_devname, name, sizeof(he.he_devname));
#include <sys/systm.h>
#include <sys/devfs.h>
#include <sys/devfs_rules.h>
+#include <sys/hotplug.h>
MALLOC_DEFINE(M_DEVFS, "devfs", "Device File System (devfs) allocations");
DEVFS_DECLARE_CLONE_BITMAP(ops_id);
devfs_inode_to_vnode_worker_callback(struct devfs_node *, ino_t *);
/* hotplug */
-void (*devfs_node_added)(cdev_t) = NULL;
-void (*devfs_node_removed)(cdev_t) = NULL;
+void (*devfs_node_added)(struct hotplug_device*) = NULL;
+void (*devfs_node_removed)(struct hotplug_device*) = NULL;
/*
* devfs_debug() is a SYSCTL and TUNABLE controlled debug output function
devfs_unlinkp(struct devfs_node *node)
{
struct devfs_node *parent;
+ struct hotplug_device *hpdev;
KKASSERT(node);
/*
node->flags &= ~DEVFS_NODE_LINKED;
}
/* hotplug handler */
- if(devfs_node_removed)
- devfs_node_removed(node->d_dev);
+ if(devfs_node_removed) {
+ hpdev = kmalloc(sizeof(struct hotplug_device), M_TEMP, M_WAITOK);
+ hpdev->dev = node->d_dev;
+ if(hpdev->dev)
+ hpdev->name = node->d_dev->si_name;
+ devfs_node_removed(hpdev);
+ kfree(hpdev, M_TEMP);
+ }
node->parent = NULL;
return 0;
}
struct mount *mp = target->mp;
struct devfs_node *parent = DEVFS_MNTDATA(mp)->root_node;
struct devfs_node *linknode;
+ struct hotplug_device *hpdev;
char *create_path = NULL;
char *name;
char *name_buf;
done:
/* hotplug handler */
- if(devfs_node_added)
- devfs_node_added(target->d_dev);
+ if(devfs_node_added) {
+ hpdev = kmalloc(sizeof(struct hotplug_device), M_TEMP, M_WAITOK);
+ hpdev->dev = target->d_dev;
+ hpdev->name = name_orig;
+ devfs_node_added(hpdev);
+ kfree(hpdev, M_TEMP);
+ }
kfree(name_buf, M_TEMP);
return (result);
}
char *dev_name, char *path_fmt, ...)
{
struct devfs_node *parent, *node = NULL;
+ struct hotplug_device *hpdev;
char *path = NULL;
char *name;
char *name_buf;
node->flags |= (DEVFS_PTY | DEVFS_INVISIBLE);
}
/* hotplug handler */
- if(devfs_node_added)
- devfs_node_added(node->d_dev);
+ if(devfs_node_added) {
+ hpdev = kmalloc(sizeof(struct hotplug_device), M_TEMP, M_WAITOK);
+ hpdev->dev = node->d_dev;
+ hpdev->name = node->d_dev->si_name;
+ devfs_node_added(hpdev);
+ kfree(hpdev, M_TEMP);
+ }
out:
kfree(name_buf, M_TEMP);