From: David van Moolenbroek Date: Tue, 26 Aug 2014 16:39:02 +0000 (+0000) Subject: VFS: complete the devmajor_t/devminor_t switch X-Git-Tag: v3.3.0~46 X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch03.html?a=commitdiff_plain;h=3b4688844fa1500a44f640cc60f12958f7a0488a;p=minix.git VFS: complete the devmajor_t/devminor_t switch Change-Id: I9f809283f19d577cf7e02705fdbb2310ae2b6cba --- diff --git a/minix/servers/vfs/dmap.c b/minix/servers/vfs/dmap.c index d9b3cfea1..01bcce099 100644 --- a/minix/servers/vfs/dmap.c +++ b/minix/servers/vfs/dmap.c @@ -110,7 +110,8 @@ int do_mapdriver(void) * 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; @@ -165,7 +166,8 @@ int do_mapdriver(void) 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)) { @@ -233,7 +235,7 @@ void init_dmap(void) /*===========================================================================* * 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) @@ -246,7 +248,7 @@ int dmap_driver_match(endpoint_t proc, int major) * 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); @@ -261,8 +263,7 @@ void dmap_endpt_up(endpoint_t proc_e, int is_blk) /* 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; @@ -303,8 +304,8 @@ struct dmap *get_dmap(endpoint_t proc_e) { /* 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]); diff --git a/minix/servers/vfs/filedes.c b/minix/servers/vfs/filedes.c index 9e74ac637..a810feb2f 100644 --- a/minix/servers/vfs/filedes.c +++ b/minix/servers/vfs/filedes.c @@ -209,7 +209,7 @@ void invalidate_filp(struct filp *rfilp) /*===========================================================================* * 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; diff --git a/minix/servers/vfs/mount.c b/minix/servers/vfs/mount.c index 350dfc95c..17ef918dc 100644 --- a/minix/servers/vfs/mount.c +++ b/minix/servers/vfs/mount.c @@ -50,7 +50,8 @@ static void update_bspec(dev_t dev, endpoint_t fs_e, int send_drv_e) */ 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) { diff --git a/minix/servers/vfs/open.c b/minix/servers/vfs/open.c index cbe82893d..740b89964 100644 --- a/minix/servers/vfs/open.c +++ b/minix/servers/vfs/open.c @@ -84,7 +84,8 @@ int do_creat(void) 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; diff --git a/minix/servers/vfs/proto.h b/minix/servers/vfs/proto.h index 8e1ec8e29..ad0449dc9 100644 --- a/minix/servers/vfs/proto.h +++ b/minix/servers/vfs/proto.h @@ -40,7 +40,7 @@ void cdev_reply(void); 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 */ @@ -48,10 +48,10 @@ void lock_dmap(struct dmap *dp); 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); @@ -76,7 +76,7 @@ void unlock_filp(struct filp *filp); 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); @@ -328,8 +328,8 @@ int do_select(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); diff --git a/minix/servers/vfs/select.c b/minix/servers/vfs/select.c index 65495620e..66ff4ffad 100644 --- a/minix/servers/vfs/select.c +++ b/minix/servers/vfs/select.c @@ -362,7 +362,8 @@ static int select_request_char(struct filp *f, int *ops, int block) * 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); @@ -596,7 +597,7 @@ static void select_cancel_filp(struct filp *f) /* 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); @@ -729,8 +730,8 @@ void select_timeout_check(minix_timer_t *timer) 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; @@ -765,15 +766,12 @@ void select_unsuspend_by_endpt(endpoint_t proc_e) /*===========================================================================* * 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; @@ -863,16 +861,14 @@ int status; /*===========================================================================* * 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;