From: Jorrit Herder Date: Mon, 30 May 2005 08:51:23 +0000 (+0000) Subject: Improved shared device driver code: use SELF instead of 'getprocnr'. X-Git-Tag: v3.1.0~807 X-Git-Url: http://zhaoyanbai.com/repos/host.html?a=commitdiff_plain;h=ed54b1cd6acc47dea8076f5cb30a06fc3cb1a0b3;p=minix.git Improved shared device driver code: use SELF instead of 'getprocnr'. --- diff --git a/drivers/libdriver/drvlib.c b/drivers/libdriver/drvlib.c index c48d24f5e..b5fef949d 100644 --- a/drivers/libdriver/drvlib.c +++ b/drivers/libdriver/drvlib.c @@ -157,24 +157,13 @@ struct part_entry *table; /* four entries */ */ iovec_t iovec1; off_t position; - static int proc_nr = NONE; int s; - /* Read the partition table at 'offset'. */ - if (proc_nr == NONE) { -#if DEAD_CODE - if ((s=getprocnr(&proc_nr)) != OK) { -#endif - if ((s=sys_getprocnr(&proc_nr,0,0)) != OK) { - printf("%s: can't get own proc nr: %d\n", (*dp->dr_name)(), s); - return(0); - } - } position = offset << SECTOR_SHIFT; iovec1.iov_addr = (vir_bytes) tmp_buf; iovec1.iov_size = SECTOR_SIZE; if ((*dp->dr_prepare)(device) != NIL_DEV) { - (void) (*dp->dr_transfer)(proc_nr, DEV_GATHER, position, &iovec1, 1); + (void) (*dp->dr_transfer)(SELF, DEV_GATHER, position, &iovec1, 1); } if (iovec1.iov_size != 0) { printf("%s: can't read partition table\n", (*dp->dr_name)()); @@ -200,7 +189,6 @@ struct part_entry *table; /* four entries */ iovec_t iovec1; off_t position; off_t isosize; - static int proc_nr = NONE; int s; #ifndef CD_SECTOR_SIZE #define CD_SECTOR_SIZE 2048 @@ -208,18 +196,11 @@ struct part_entry *table; /* four entries */ static unsigned char pvd[CD_SECTOR_SIZE]; /* Read the partition table at 'offset'. */ - if (proc_nr == NONE) { - if ((s=sys_getprocnr(&proc_nr,0,0)) != OK) { - printf("%s: can't get own proc nr: %d\n", (*dp->dr_name)(), s); - return 0; - } - } - position = 16*CD_SECTOR_SIZE; iovec1.iov_addr = (vir_bytes) pvd; iovec1.iov_size = CD_SECTOR_SIZE; if ((*dp->dr_prepare)(device) != NIL_DEV) { - (void) (*dp->dr_transfer)(proc_nr, DEV_GATHER, position, &iovec1, 1); + (void) (*dp->dr_transfer)(SELF, DEV_GATHER, position, &iovec1, 1); } if (iovec1.iov_size != 0) { return 0;