您的位置:首页 > 其它

Documentation_filesystems_pohmelfs_netwo....txt

2013-10-30 14:21 369 查看
Chinese translated version of Documentation_filesystems_pohmelfs_netwo....

If you have any comment or update to the content, please contact the

original document maintainer directly. However, if you have a problem

communicating in English you can also ask the Chinese maintainer for

help. Contact the Chinese maintainer if this translation is outdated

or if there is a problem with the translation.

Chinese maintainer: <1538850747@qq.com>

---------------------------------------------------------------------

Documentation_filesystems_pohmelfs_netwo....的中文翻译

如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文

交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻

译存在问题,请联系中文版维护者。

中文版维护者: 孙航海 <1538850747@qq.com>

中文版翻译者: 孙航海 <1538850747@qq.com>

中文版校译者: 孙航海 <1538850747@qq.com>

以下为正文

---------------------------------------------------------------------

POHMELFS network protocol.

POHMELFS网络协议。

Basic structure used in network communication is following command:

用于网络通信的基本结构有如下命令:

struct netfs_cmd

{

__u16 cmd; /* Command number */

__u16 csize; /* Attached crypto information size */

__u16 cpad; /* Attached padding size */

__u16 ext; /* External flags */

__u32 size; /* Size of the attached data */

__u32 trans; /* Transaction id */

__u64 id; /* Object ID to operate on. Used for feedback.*/

__u64 start; /* Start of the object. */

__u64 iv; /* IV sequence */

__u8 data[0];

};

struct netfs_cmd

{

__u16 cmd; /* 命令号 */

__u16 csize; /* 附加的加密信息的大小 */

__u16 cpad; /* 附加的填充物大小 */

__u16 ext; /* 外部标志 */

__u32 size; /* 附加数据的大小 */

__u32 trans; /* 事务ID */

__u64 id; /* 要操作的对象ID。用于反馈。*/

__u64 start; /* 对象的开始。 */

__u64 iv; /* 四序列 */

__u8 data[0];

};

Commands can be embedded into transaction command (which in turn has own command),

so one can extend protocol as needed without breaking backward compatibility as long

as old commands are supported. All string lengths include tail 0 byte.

命令可以嵌入到交易指令(这反过来又具有自己的命令),这样可以延长协议只要旧的命令支持

就无需打破向后兼容性。所有字符串长度包括尾部0字节。

All commands are transferred over the network in big-endian. CPU endianness is used at the end peers.

所有的命令都在网络上以big-endian方式转移。CPU字节顺序在结束节点使用。

@cmd - command number, which specifies command to be processed. Following

commands are used currently:

@cmd - 命令号,指定要处理的命令。目前使用下面的命令:

NETFS_READDIR = 1, /* Read directory for given inode number */

NETFS_READ_PAGE, /* Read data page from the server */

NETFS_WRITE_PAGE, /* Write data page to the server */

NETFS_CREATE, /* Create directory entry */

NETFS_REMOVE, /* Remove directory entry */

NETFS_LOOKUP, /* Lookup single object */

NETFS_LINK, /* Create a link */

NETFS_TRANS, /* Transaction */

NETFS_OPEN, /* Open intent */

NETFS_INODE_INFO, /* Metadata cache coherency synchronization message */

NETFS_PAGE_CACHE, /* Page cache invalidation message */

NETFS_READ_PAGES, /* Read multiple contiguous pages in one go */

NETFS_RENAME, /* Rename object */

NETFS_CAPABILITIES, /* Capabilities of the client, for example supported crypto */

NETFS_LOCK, /* Distributed lock message */

NETFS_XATTR_SET, /* Set extended attribute */

NETFS_XATTR_GET, /* Get extended attribute */

NETFS_READDIR = 1, /* 阅读给定的inode号目录inode */

NETFS_READ_PAGE, /* 从服务器读取数据页 */

NETFS_WRITE_PAGE, /* 数据页写入到服务器 */

NETFS_CREATE, /* 创建目录项 */

NETFS_REMOVE, /* 删除目录项 */

NETFS_LOOKUP, /* 查找单个对象 */

NETFS_LINK, /* 创建一个链接 */

NETFS_TRANS, /* 事务 */

NETFS_OPEN, /* 开放的意图 */

NETFS_INODE_INFO, /* 元数据高速缓存一致性同步消息 */

NETFS_PAGE_CACHE, /* 页面缓存失效消息 */

NETFS_READ_PAGES, /* 一口气读多个连续页面 */

NETFS_RENAME, /* 重命名对象 */

NETFS_CAPABILITIES, /* 客户端的功能,例如支持的加密 */

NETFS_LOCK, /* 分布式的锁消息 */

NETFS_XATTR_SET, /* 设置扩展属性 */

NETFS_XATTR_GET, /* 获得扩展属性 */

@ext - external flags. Used by different commands to specify some extra arguments

like partial size of the embedded objects or creation flags.

@ext - 外部标志。使用不同的命令来指定一些额外的参数,如嵌入式对象或创建标志的部分大小。

@size - size of the attached data. For NETFS_READ_PAGE and NETFS_READ_PAGES no data is attached,

but size of the requested data is incorporated here. It does not include size of the command

header (struct netfs_cmd) itself.

@size - 附加数据的大小。对于NETFS_READ_PAGE和NETFS_READ_PAGES没有附加数据,但请求数据的大小是包含在这

里的。 它不包括命令头(结构netfs_cmd)本身的大小。

@id - id of the object this command operates on. Each command can use it for own purpose.

@id - ID标识的对象上运行这个命令。每个命令都可以使用它为了自己的目的。

@start - start of the object this command operates on. Each command can use it for own purpose.

@start -对象启动时运行这个命令。每个命令都可以使用它为了自己的目的。

@csize, @cpad - size and padding size of the (attached if needed) crypto information.

@csize, @cpad - 加密信息(如果需要的话)的大小和填充大小。

Command specifications.

命令规范。

@NETFS_READDIR

This command is used to sync content of the remote dir to the client.

@ext - length of the path to object.

@size - the same.

@id - local inode number of the directory to read.

@start - zero.

@NETFS_READDIR

此命令是用来给客户端同步远程目录的内容。

@ext - 对象路径的长度。

@size - 相同。

@id - 本地读取目录的inode号。

@start - 零。

@NETFS_READ_PAGE

This command is used to read data from remote server.

Data size does not exceed local page cache size.

@id - inode number.

@start - first byte offset.

@size - number of bytes to read plus length of the path to object.

@ext - object path length.

@NETFS_READ_PAGE

此命令用于从远程服务器中读取数据。

数据大小不超过本地的页面高速缓存大小。

@id - inode号。

@start - 第一个字节偏移量。

@size - 要读取的字节数加上对象路径长度。

@ext - 对象路径长度。

@NETFS_CREATE

Used to create object.

It does not require that all directories on top of the object were

already created, it will create them automatically. Each object has

associated @netfs_path_entry data structure, which contains creation

mode (permissions and type) and length of the name as long as name itself.

@start - 0

@size - size of the all data structures needed to create a path

@id - local inode number

@ext - 0

@NETFS_CREATE

用于创建对象。

它不要求的对象上的所有目录已经创建,它会自动创建它们。 每个对象都有

相关的@ netfs_path_entry数据结构,其中包含创造模式(权限和类型)和名

称的长度与它自己一样长。

@start - 0

@size - 所有需要创建一个路径的数据结构的大小

@id - 本地inode号

@ext - 0

@NETFS_REMOVE

Used to remove object.

@ext - length of the path to object.

@size - the same.

@id - local inode number.

@start - zero.

@NETFS_REMOVE

用于去除对象。

@ext - 对象路径的长度。

@size - 相同。

@id - 本地inode号。

@start - 零。

@NETFS_LOOKUP

Lookup information about object on server.

@ext - length of the path to object.

@size - the same.

@id - local inode number of the directory to look object in.

@start - local inode number of the object to look at.

@NETFS_LOOKUP

查找服务器上的对象的信息。

@ext - 对象路径的长度。

@size - 相同。

@id - 目录的本地inode号用来观察对象。

@start - 本地的inode号来看待对象。

@NETFS_LINK

Create hard of symlink.

Command is sent as "object_path|target_path".

@size - size of the above string.

@id - parent local inode number.

@start - 1 for symlink, 0 for hardlink.

@ext - size of the "object_path" above.

@NETFS_LINK

创建硬链接。

命令作为“object_path|target_path”发送。

@size - 上述的字符串的大小。

@id - 先前的当地inode号。

@start - 1为符号链接,0为硬链接。

@ext - “object_path”以上的大小。

@NETFS_TRANS

Transaction header.

@size - incorporates all embedded command sizes including theirs header sizes.

@start - transaction generation number - unique id used to find transaction.

@ext - transaction flags. Unused at the moment.

@id - 0.

@NETFS_TRANS

事务头。

@size - 集成了所有嵌入的命令大小,包括他们的头大小。

@start - 事务产生号码-独特的ID,用于寻找事务。

@ext - 事务标志。未使用的时刻。

@id - 0.

@NETFS_OPEN

Open intent for given transaction.

@id - local inode number.

@start - 0.

@size - path length to the object.

@ext - open flags (O_RDWR and so on).

@NETFS_OPEN

打开对于给定的事务意图。

@id - 本地inode号。

@start - 0.

@size - 到该对象的路径的长度。

@ext - 打开的标志位(O_RDWR 等等).

@NETFS_INODE_INFO

Metadata update command.

It is sent to servers when attributes of the object are changed and received

when data or metadata were updated. It operates with the following structure:

struct netfs_inode_info

{

unsigned int mode;

unsigned int nlink;

unsigned int uid;

unsigned int gid;

unsigned int blocksize;

unsigned int padding;

__u64 ino;

__u64 blocks;

__u64 rdev;

__u64 size;

__u64 version;

};

It effectively mirrors stat(2) returned data.

@ext - path length to the object.

@size - the same plus size of the netfs_inode_info structure.

@id - local inode number.

@start - 0.

@NETFS_INODE_INFO

元数据更新命令。

当数据或元数据被更新时对象的属性被改变和接收,此时它被发送到服务器。

它具有以下结构:

struct netfs_inode_info

{

unsigned int 模式;

unsigned int 连接;

unsigned int uid;

unsigned int gid;

unsigned int 块大小;

unsigned int 填充;

__u64 ino;

__u64 块;

__u64 rdev;

__u64 大小;

__u64 版本;

};

它可以有效地反映stat(2)返回的数据。

@ext - 对象的路径长度。

@size - 相同并加上结构netfs_inode_info的大小。

@id - 本地inode号。

@start - 0.

@NETFS_PAGE_CACHE

Command is only received by clients. It contains information about

page to be marked as not up-to-date.

@id - client's inode number.

@start - last byte of the page to be invalidated. If it is not equal to

current inode size, it will be vmtruncated().

@size - 0

@ext - 0

@NETFS_PAGE_CACHE

命令是由客户端收到。它包含的页面的信息被标记为不是最新的。

@id - 客户的inode号。

@start - 页面的最后一个字节是无效的。 如果它不等于在当前的inode大小,

它会被vmtruncated()​​。

@size - 0

@ext - 0

@NETFS_READ_PAGES

Used to read multiple contiguous pages in one go.

@start - first byte of the contiguous region to read.

@size - contains of two fields: lower 8 bits are used to represent page cache shift

used by client, another 3 bytes are used to get number of pages.

@id - local inode number.

@ext - path length to the object.

@NETFS_READ_PAGES

用于一口气读取连续的多个页面。

@start - 读取连续区域的第一个字节。

@size - 包含两个字段:低8位是在客户端用来表示页面缓存使用的,其他3个字节被用来获取

页面的数量。

@id - 本地inode号。

@ext - 对象的路径长度。

@NETFS_RENAME

Used to rename object.

Attached data is formed into following string: "old_path|new_path".

@id - local inode number.

@start - parent inode number.

@size - length of the above string.

@ext - length of the old path part.

@NETFS_RENAME

用于重命名对象。

附加的数据被形成为以下字符串:"old_path|new_path"。

@id - 本地inode号。

@start - 先前的inode号。

@size - 上述的字符串的长度。

@ext - 旧路径的一部分的长度。

@NETFS_CAPABILITIES

Used to exchange crypto capabilities with server.

If crypto capabilities are not supported by server, then client will disable it

or fail (if 'crypto_fail_unsupported' mount options was specified).

@id - superblock index. Used to specify crypto information for group of servers.

@size - size of the attached capabilities structure.

@start - 0.

@size - 0.

@scsize - 0.

@NETFS_CAPABILITIES

用于与服务器交换加密功能。

如果服务器不支持加密功能,那么客户端将其禁用或失败

(如果指定'crypto_fail_unsupported'的挂载选项)。

@id - 超级块索引。用于指定组服务器的加密信息。

@size - 附加功能结构的大小。

@start - 0.

@size - 0.

@scsize - 0.

@NETFS_LOCK

Used to send lock request/release messages. Although it sends byte range request

and is capable of flushing pages based on that, it is not used, since all Linux

filesystems lock the whole inode.

@id - lock generation number.

@start - start of the locked range.

@size - size of the locked range.

@ext - lock type: read/write. Not used actually. 15'th bit is used to determine,

if it is lock request (1) or release (0).

@NETFS_LOCK

用于发送锁定请求/释放消息。 虽然它发送受字节范围的要求并且在这基础上能够刷新页,

它还是没有被使用,因为所有的Linux文件系统锁定整个inode。

@id - 锁代数。

@start - 锁定范围的开始。

@size - 锁定范围的大小。

@ext - 锁类型​​:read/write. 没有实际使用。15位是用来确定,如果它是锁请求(1)或

释放(0)。

@NETFS_XATTR_SET

@NETFS_XATTR_GET

Used to set/get extended attributes for given inode.

@id - attribute generation number or xattr setting type

@start - size of the attribute (request or attached)

@size - name length, path len and data size for given attribute

@ext - path length for given object

@NETFS_XATTR_SET

@NETFS_XATTR_GET

用于设置/获取给定的inode的扩展属性。

@id - 属性生成数或XATTR设置类型

@start - 属性大小(请求或附)

@size - 对于给定的属性名的长度,路径len和数据大小

@ext - 对于给定的对象的路径长度
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: