MFen 1.34 -> 1.36 plus minor language improvements.

Obtained from:	The FreeBSD Simplified Chinese Project
This commit is contained in:
Xin LI 2006-06-03 15:10:24 +00:00
parent bc82cefb7d
commit f85dc878cd
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=28010

View file

@ -2,7 +2,7 @@
The FreeBSD Documentation Project
The FreeBSD Simplified Chinese Project
Original Revision: 1.34
Original Revision: 1.36
$FreeBSD$
-->
@ -240,14 +240,13 @@ static struct cdevsw echo_cdevsw = {
-1
};
struct s_echo {
typedef struct s_echo {
char msg[BUFFERSIZE];
int len;
} t_echo;
/* 变量 */
static dev_t sdev;
static int len;
static int count;
static t_echo *echomsg;
@ -337,13 +336,13 @@ echo_write(dev_t dev, struct uio *uio, int ioflag)
{
int err = 0;
/* 将字符串从用户空间的内存拷贝到内核空间 */
/* 将字符串从用户空间的内存复制到内核空间 */
err = copyin(uio->uio_iov->iov_base, echomsg->msg,
MIN(uio->uio_iov->iov_len,BUFFERSIZE - 1));
MIN(uio->uio_iov->iov_len, BUFFERSIZE - 1));
/* 现在需要以null结束字符串并记录长度 */
*(echomsg->msg + MIN(uio->uio_iov->iov_len,BUFFERSIZE - 1)) = 0;
echomsg->len = MIN(uio->uio_iov->iov_len,BUFFERSIZE);
*(echomsg->msg + MIN(uio->uio_iov->iov_len, BUFFERSIZE - 1)) = 0;
echomsg->len = MIN(uio->uio_iov->iov_len, BUFFERSIZE);
if (err != 0) {
uprintf("Write failed: bad address!\n");
@ -474,9 +473,9 @@ echo_read(struct cdev *dev, struct uio *uio, int ioflag)
* 这个读操作有多大?
* 等于用户请求的大小,或者等于剩余数据的大小。
*/
amt = MIN(uio->uio_resid, (echomsg->len - uio->uio_offset > 0) ?
amt = MIN(uio->uio_resid, (echomsg->len - uio->uio_offset > 0) ?
echomsg->len - uio->uio_offset : 0);
if ((err = uiomove(echomsg->msg + uio->uio_offset,amt,uio)) != 0) {
if ((err = uiomove(echomsg->msg + uio->uio_offset, amt, uio)) != 0) {
uprintf("uiomove failed!\n");
}
return(err);
@ -491,13 +490,13 @@ echo_write(struct cdev *dev, struct uio *uio, int ioflag)
{
int err = 0;
/* 将字符串从用户空间的内存拷贝到内核空间 */
/* 将字符串从用户空间的内存复制到内核空间 */
err = copyin(uio->uio_iov->iov_base, echomsg->msg,
MIN(uio->uio_iov->iov_len,BUFFERSIZE));
MIN(uio->uio_iov->iov_len, BUFFERSIZE - 1));
/* 现在需要以null结束字符串并记录长度 */
*(echomsg->msg + MIN(uio->uio_iov->iov_len,BUFFERSIZE)) = 0;
echomsg->len = MIN(uio->uio_iov->iov_len,BUFFERSIZE);
*(echomsg->msg + MIN(uio->uio_iov->iov_len, BUFFERSIZE - 1)) = 0;
echomsg->len = MIN(uio->uio_iov->iov_len, BUFFERSIZE);
if (err != 0) {
uprintf("Write failed: bad address!\n");