NFS 创建文件(覆盖)= 零大小?
我正在实现 NFS 并且几乎完成了,但是 RFC 第 3.3.8 节 在其描述中这样说:
模式 未经检查、受保护和排他性之一。 未选中 意味着应该在不检查的情况下创建文件 同一文件中是否存在重复文件 目录。在本例中,how.obj_attributes 是 sattr3 描述文件的初始属性。 GUARDED 指定服务器应检查是否存在 在执行创建之前复制文件 如果出现以下情况,则应使请求失败并返回 NFS3ERR_EXIST: 存在重复文件。如果该文件不存在,则 请求按照 UNCHECKED 的描述执行。 EXCLUSIVE 指定服务器要遵循 独占创建语义,使用验证器 确保目标的唯一创建。无属性 在这种情况下可以提供,因为服务器可以使用 存储createverf3的目标文件元数据 验证者。
所以问题是,如果 UNCHECKED 是模式,我应该将文件的长度设置为零,还是应该让文件保持原样?如果它是一个目录,我应该删除所有内容吗?
Im implementing NFS and almoste done but the RFC section 3.3.8 says this in its description:
mode
One of UNCHECKED, GUARDED, and EXCLUSIVE. UNCHECKED
means that the file should be created without checking
for the existence of a duplicate file in the same
directory. In this case, how.obj_attributes is a sattr3
describing the initial attributes for the file. GUARDED
specifies that the server should check for the presence
of a duplicate file before performing the create and
should fail the request with NFS3ERR_EXIST if a
duplicate file exists. If the file does not exist, the
request is performed as described for UNCHECKED.
EXCLUSIVE specifies that the server is to follow
exclusive creation semantics, using the verifier to
ensure exclusive creation of the target. No attributes
may be provided in this case, since the server may use
the target file metadata to store the createverf3
verifier.
so the question if UNCHECKED is the mode should i just set the length of the file to Zero or should i let the file be as it is? and if its a directory should i remove all the content?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信带有
UNCHECKED
的CREATE
的想法是应用古老的 Unix 系统调用creat
的语义 - 因此,截断文件的现有内容(如果有)是隐含的。但是我找不到文档中明确指定的所有内容(!)。尝试
CREATE
现有目录在任何情况下都是一个错误——有一个单独的MKDIR
(在NFS 3中,这同样适用于特殊文件,带有MKNOD
--CREATE
现在仅适用于常规、普通、普通的旧文件!-)I believe the idea of
CREATE
withUNCHECKED
is to apply the semantics of good old Unix system callcreat
-- so, truncation of a file's existing contents (if any) is implied. However I cannot find this specified all that clearly in the docs (!).Trying to
CREATE
an existing directory is an error in any case -- there's a separateMKDIR
for that (in NFS 3, the same applies to special files, withMKNOD
--CREATE
is now for regular, normal, plain good old files only!-)