IBM-BJ-许加强(110781198) 15:19:06 /dev/null 和/dev/zero有什么区别 百度-SH-孙子荀 (448981776) 15:20:48 in 和 out吧 百度-SH-孙子荀 (448981776) 15:21:12 我用法是。。。一个是吃的 一个是呕的。。 新浪-BJ-张世武(43955806) 15:23:06 新浪-BJ-张世武(43955806) 15:23:11 这个说法形象 腾讯-SZ-张黎明<lynchzhang@xxxxxxxxxx> 15:25:25 IBM-BJ-许加强(110781198) 15:27:17 dd文件的时候 用/dev/zero 生成文件 和用/dev/null生成文件 有啥区别 百度-SH-孙子荀 (448981776) 15:30:22 outto = null 是测速的吧 infrom zero 是产生文件的 腾讯-SZ-eric(3251550) 15:30:47 static const struct file_operations null_fops = { .llseek = null_lseek, .read = read_null, .write = write_null, .splice_write = splice_write_null, }; static const struct file_operations zero_fops = { .llseek = zero_lseek, .read = read_zero, .write = write_zero, .mmap = mmap_zero, }; #define write_zero write_null 百度-SH-孙子荀 (448981776) 15:31:07 额 腾讯-SZ-eric(3251550) 15:31:14 写函数是相同的。只是read不同。 百度-SH-孙子荀 (448981776) 15:31:15 那我倒没注意。。。 秒针-BJ-张少华(512428782) 15:31:54 Data written on a null or zero special file is discarded. Reads from the null special file always return end of file, whereas reads from zero always return \0 characters. IBM-BJ-许加强(110781198) 15:34:27 对于sparse file来说 用/dev/zero和用/dev/null 应该都可以生成,但处理起来却不一样。 百度-SH-孙子荀 (448981776) 15:34:34