linux-insides-zh icon indicating copy to clipboard operation
linux-insides-zh copied to clipboard

4-5 syscall open 翻译问题。

Open woitaylor opened this issue 5 years ago • 0 comments

原文:After we have got allocated new file structure we call the do_tmpfile or do_o_path functions in a case if we have passed O_TMPFILE | O_CREATE or O_PATH flags during call of the open system call. These both cases are quite specific, so let's consider quite usual case when we want to open already existed file and want to read/write from/to it. 翻译:如果我们给 open 系统调用传递了 O_TMPFILE | O_CREATE 或 O_PATH 标志,则调用 do_tmpfile 或 do_o_path 函数。在我们想要打开已存在的文件和想要读写时这些情况是非常特殊的,因此我们仅考虑常见的情形。

这里给人的误解很大,原文的本意应该是do_tmpfile 和 do_o_path这两个函数调用的情况是很特殊的,打开一个已创建的文件并读写是正常情况,翻译恰恰相反。

原文:This macro may be architecture-specific as for example for IA-64 architecture, but in our case the x86_64 does not provide definition of the force_o_largefile and it will be used from include/linux/fcntl.h. 翻译:这个宏因 CPU 架构有所不同,但在我们当前的情况即 x86_64 下,没有提供 force_o_largefile 宏的定义,但这个宏在 include/linux/fcntl.h出现了。

但这个宏在 include/linux/fcntl.h出现了。是不是会让人误解在fcntl.h又定义了。原文的意思是在 x86_64架构中该宏没有被定义,但是会在 include/linux/fcntl.h被使用。

原文:So, in this case the file itself is not opened, but operations like dup, fcntl and other can be used. So, if all file content related operations like read, write and other are not permitted, only O_DIRECTORY | O_NOFOLLOW | O_PATH flags can be used. 翻译:在这种情况下文件自身是没有被打开的,但是像 dup, fcntl 等操作能被使用。因此如果想使用所有与文件内容相关的操作,像 read, write 等,就(必须)使用 O_DIRECTORY | O_NOFOLLOW | O_PATH 标志

原文的意思:在这种情况下,文件本身是没有被打开,但是像 dup, fcntl以及其他类似操作可以使用,所以,如果所有跟文件内容相关的操作,比如 read, write不允许被使用,那么就只能使用O_DIRECTORY | O_NOFOLLOW | O_PATH 这些标志。意思是如果在不能使用read, write的情况下,只允许设置O_DIRECTORY | O_NOFOLLOW | O_PATH 这些flags。再看翻译。

woitaylor avatar Jul 26 '19 07:07 woitaylor