* etc), and its label. This label is registered with DS, and allows us to
* retrieve the driver's endpoint.
*/
- int r, major, slot;
+ int r, slot;
+ devmajor_t major;
endpoint_t endpoint;
vir_bytes label_vir;
size_t label_len;
void dmap_unmap_by_endpt(endpoint_t proc_e)
{
/* Lookup driver in dmap table by endpoint and unmap it */
- int major, r;
+ devmajor_t major;
+ int r;
for (major = 0; major < NR_DEVICES; major++) {
if (dmap_driver_match(proc_e, major)) {
/*===========================================================================*
* dmap_driver_match *
*===========================================================================*/
-int dmap_driver_match(endpoint_t proc, int major)
+int dmap_driver_match(endpoint_t proc, devmajor_t major)
{
if (major < 0 || major >= NR_DEVICES) return(0);
if (dmap[major].dmap_driver != NONE && dmap[major].dmap_driver == proc)
* dmap_by_major *
*===========================================================================*/
struct dmap *
-get_dmap_by_major(int major)
+get_dmap_by_major(devmajor_t major)
{
if (major < 0 || major >= NR_DEVICES) return(NULL);
if (dmap[major].dmap_driver == NONE) return(NULL);
/* A device driver with endpoint proc_e has been restarted. Go tell everyone
* that might be blocking on it that this device is 'up'.
*/
-
- int major;
+ devmajor_t major;
struct dmap *dp;
struct worker_thread *worker;
{
/* See if 'proc_e' endpoint belongs to a valid dmap entry. If so, return a
* pointer */
+ devmajor_t major;
- int major;
for (major = 0; major < NR_DEVICES; major++)
if (dmap_driver_match(proc_e, major))
return(&dmap[major]);
/*===========================================================================*
* invalidate_filp_by_char_major *
*===========================================================================*/
-void invalidate_filp_by_char_major(int major)
+void invalidate_filp_by_char_major(devmajor_t major)
{
struct filp *f;
*/
struct vnode *vp;
struct dmap *dp;
- int r, major;
+ devmajor_t major;
+ int r;
for (vp = &vnode[0]; vp < &vnode[NR_VNODES]; ++vp)
if (vp->v_ref_count > 0 && S_ISBLK(vp->v_mode) && vp->v_sdev == dev) {
int common_open(char path[PATH_MAX], int oflags, mode_t omode)
{
/* Common code from do_creat and do_open. */
- int b, r, exist = TRUE, major_dev;
+ int b, r, exist = TRUE;
+ devmajor_t major_dev;
dev_t dev;
mode_t bits;
struct filp *filp, *filp2;
int bdev_open(dev_t dev, int access);
int bdev_close(dev_t dev);
void bdev_reply(void);
-void bdev_up(int major);
+void bdev_up(devmajor_t major);
int do_ioctl(void);
/* dmap.c */
void unlock_dmap(struct dmap *dp);
int do_mapdriver(void);
void init_dmap(void);
-int dmap_driver_match(endpoint_t proc, int major);
+int dmap_driver_match(endpoint_t proc, devmajor_t major);
void dmap_endpt_up(endpoint_t proc_nr, int is_blk);
struct dmap *get_dmap(endpoint_t proc_e);
-struct dmap *get_dmap_by_major(int major);
+struct dmap *get_dmap_by_major(devmajor_t major);
void dmap_unmap_by_endpt(endpoint_t proc_nr);
int map_service(struct rprocpub *rpub);
void unlock_filps(struct filp *filp1, struct filp *filp2);
void invalidate_filp(struct filp *);
void invalidate_filp_by_endpt(endpoint_t proc_e);
-void invalidate_filp_by_char_major(int major);
+void invalidate_filp_by_char_major(devmajor_t major);
void close_filp(struct filp *fp);
int do_copyfd(void);
void init_select(void);
void select_callback(struct filp *, int ops);
void select_forget(void);
-void select_reply1(endpoint_t driver_e, int minor, int status);
-void select_reply2(endpoint_t driver_e, int minor, int status);
+void select_reply1(endpoint_t driver_e, devminor_t minor, int status);
+void select_reply2(endpoint_t driver_e, devminor_t minor, int status);
void select_timeout_check(minix_timer_t *);
void select_unsuspend_by_endpt(endpoint_t proc);
* result processing to be deferred. This function MUST NOT block its calling
* thread. The given filp may or may not be locked.
*/
- int r, rops, major;
+ devmajor_t major;
+ int r, rops;
struct dmap *dp;
major = major(f->filp_vno->v_sdev);
/* Reduce the number of select users of this filp. This function MUST NOT block
* its calling thread.
*/
- dev_t major;
+ devmajor_t major;
assert(f);
assert(f->filp_selectors > 0);
void select_unsuspend_by_endpt(endpoint_t proc_e)
{
/* Revive blocked processes when a driver has disappeared */
-
- int fd, s, major;
+ devmajor_t major;
+ int fd, s;
struct selectentry *se;
struct filp *f;
/*===========================================================================*
* select_reply1 *
*===========================================================================*/
-void select_reply1(driver_e, minor, status)
-endpoint_t driver_e;
-int minor;
-int status;
+void select_reply1(endpoint_t driver_e, devminor_t minor, int status)
{
/* Handle the initial reply to CDEV_SELECT request. This function MUST NOT
* block its calling thread.
*/
- int major;
+ devmajor_t major;
dev_t dev;
struct filp *f;
struct dmap *dp;
/*===========================================================================*
* select_reply2 *
*===========================================================================*/
-void select_reply2(driver_e, minor, status)
-endpoint_t driver_e;
-int minor;
-int status;
+void select_reply2(endpoint_t driver_e, devminor_t minor, int status)
{
/* Handle secondary reply to DEV_SELECT request. A secondary reply occurs when
* the select request is 'blocking' until an operation becomes ready. This
* function MUST NOT block its calling thread.
*/
- int major, slot, found, fd;
+ int slot, found, fd;
+ devmajor_t major;
dev_t dev;
struct filp *f;
struct dmap *dp;