venti.txt

来自「这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易」· 文本 代码 · 共 268 行

TXT
268
字号
protocol version idboth client and server send '\n' terminated ascii of the formventi-<versions>-<software><software> = is a software id which is ignored but may be useful for debuggingIf the server and client have the same version number then thisversion is used.  Otherwise backup to the greatest commonmajor version number, e.g. 1.00 2.00 etc.  If no version incommon then abort.  The idea is both client and server shouldsupport a continusous range of major versions.  The minor versionnumbers are used for development purposes.After protocol negotiation switch to binary formatall numbers sent big endianstrings are sent with 2 byte length without nulls and in utf-8 max size of 1KRPC protocolheader 	op[1]	byte op	tid[2]	transation idclient manages the tid space.  Until session is established tid must equal 0.i.e. only one outstanding op.CipherStrength	None,	Auth,	Weak,	StrongCipherAlgorithms	None	SSL3	TLS1CompressionAlgorithms	None	Deflate	Thwack?BlockTypes	Root	Pointer	Data==============================================TPingRPingRError	error: stringTHello	version:string;		know to be supported by both	uid: string	uhash[20]		use for cipher boot strapping	cipherstrength[1]	ncipher[1];	cipher[ncipher];	ncompressor[1];	compressor[ncompressor];RHello	sid: string	shash[20];		use for cipher bott strapping	cipher[1];	compressor[1];use srp style authentication	g=2	N is safe prime 1024 bits - find a good prime!	x = H("venti" H(sid) H(uid) H(password))	v = g^x	a = random	b = random	B = (v + g^b)	A = g^a	u = first four bytes of H(B)	S = (B - g^x) ^ (a + u*x) = (A * v^u) ^ b	K = H(S)	M1 = H(H(versions) H(THello) H(RHello) A B K)	M2 = H(A M1 K)TAuth0	A[128]RAuth0	B[128]TAuth1	M1[20]RAuth1	M2[20]push cipherpush compressionTWrite	length[2] max 56*1024	type[1]	data[length]RWrite	hash[20]TRead	hash[20]	type[1]	length[2]RRead	length[2]	data[length]============================================================simplified access when trusting the serverreduces network bandwidth since pointer blocks are notsent to the client - can also enable permission checkingRReadRoot	root[20]TReadRoot	name: string	type: string	blocksize[2]	nblock[8]	time[4]	uid: string;	gid: stringRReadData	root[20]	block[8]	length[2]TReadData	length[2]	collision[1]	data[length]==============================================maybe some clients should be required to navigate to block via root nodes.This would enable permission checking via access to the root node.RTagOpen	tag[2]	root[20]TTagOpenQTagRead	tag[2]	type[1]	length[2]RTagRead	length[2]	data[length]	QTagWalkRead	tag[2]	ntag[2]		can reuse a tag to do an implict clunk	index[2]	type[1]	length[2]RTagWalkRead	length[2]	data[length]RTagClunk	tag[2]TTagClunk============================Types of blocksDataRoot	name[128]	type[128]	score[20]	- DirBlockPointer	score[20]*	the number of hashes can be less than fanout when the			tree is not fullDirBlock	DirEntry[32]*DirEntry		pointersize[2]	- pointer block size	datasize[2]	- data blocks size	flag[1]		directory	size[7]		in bytes - determines pointer depth - intermidate truncated block count as full	score[20]	root of pointer blocks or data block ============================mode flags	(1<<0)	ModeOtherExec	(1<<1)	ModeOtherWrite	(1<<2)	ModeOtherRead	(1<<3)	ModeGroupExec	(1<<4)	ModeGroupWrite	(1<<5)	ModeGroupRead	(1<<6)	ModeOwnerExec	(1<<7)	ModeOwnerWrite	(1<<8)	ModeOwnerRead	(1<<9)	ModeSticky	(1<<10)	ModeSetUid	(1<<11)	ModeSetGid	(1<<12)	ModeAppend	(1<<13)	ModeExclusive	(1<<14)	ModeLink	(1<<15)	ModeDir	- duplicates dir entry	(1<<16) ModeHidden	(1<<17) ModeSystem	(1<<18) ModeArchive	(1<<19) ModeTemporary	(1<<18) ModeCompressed	(1<<19) ModeEncryptedextraType	2	Plan9	version[4]	muid: string	3 NT Time	createTime[8];	modifyTime[8];	accessTime[8]	MetaEntry	name: string	/* must be first */	direntry[4]	id[8]	uid: string	gui: string	mtime[4]	ctime[4]	atime[4]		mode[4] 		extratype;	extrasize[2]	extra:[nextra]MetaEntry Block	magic[4]	size[2]	free[2]	- used to determine if work compacting	maxindex[2] - size of index table in bytes	nindex[2]	index[2*nindex]per OS directory entries?inode...

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?