From: Arne Welzel Date: Sat, 22 Sep 2012 21:21:43 +0000 (+0000) Subject: memory: use sys_safememset() for /dev/zero X-Git-Tag: v3.2.1~302 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/host.html?a=commitdiff_plain;h=362e4c37a1253fcba6b33a260f3d96161e149846;p=minix.git memory: use sys_safememset() for /dev/zero --- diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index a5f3a6cea..4e8df02fe 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -90,10 +90,6 @@ static struct blockdriver m_bdtab = { NULL /* no threading support */ }; -/* Buffer for the /dev/zero null byte feed. */ -#define ZERO_BUF_SIZE 1024 -static char dev_zero[ZERO_BUF_SIZE]; - #define click_to_round_k(n) \ ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024)) @@ -175,11 +171,6 @@ static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) m_geom[IMGRD_DEV].dv_size= cvul64(imgrd_size); m_vaddrs[IMGRD_DEV] = (vir_bytes) imgrd; - /* Initialize /dev/zero. Simply write zeros into the buffer. */ - for (i=0; i 0) { - chunk = (left > ZERO_BUF_SIZE) ? ZERO_BUF_SIZE : left; - s=sys_safecopyto(endpt, grant, - vir_offset+suboffset, (vir_bytes) dev_zero, chunk); - if(s != OK) - return s; - left -= chunk; - suboffset += chunk; - } - } + if (opcode == DEV_GATHER_S) + if ((s = sys_safememset(endpt, grant, 0, '\0', count)) != OK) + return s; + break; }