xref: /openbmc/linux/fs/afs/protocol_yfs.h (revision 35dbfba3111a5ef0663bb89185ce8dfdbef63f8d)
1*35dbfba3SDavid Howells /* YFS protocol bits
2*35dbfba3SDavid Howells  *
3*35dbfba3SDavid Howells  * Copyright (C) 2018 Red Hat, Inc. All Rights Reserved.
4*35dbfba3SDavid Howells  * Written by David Howells (dhowells@redhat.com)
5*35dbfba3SDavid Howells  *
6*35dbfba3SDavid Howells  * This program is free software; you can redistribute it and/or
7*35dbfba3SDavid Howells  * modify it under the terms of the GNU General Public Licence
8*35dbfba3SDavid Howells  * as published by the Free Software Foundation; either version
9*35dbfba3SDavid Howells  * 2 of the Licence, or (at your option) any later version.
10*35dbfba3SDavid Howells  */
11*35dbfba3SDavid Howells 
12*35dbfba3SDavid Howells #define YFS_FS_SERVICE	2500
13*35dbfba3SDavid Howells #define YFS_CM_SERVICE	2501
14*35dbfba3SDavid Howells 
15*35dbfba3SDavid Howells #define YFSCBMAX 1024
16*35dbfba3SDavid Howells 
17*35dbfba3SDavid Howells enum YFS_CM_Operations {
18*35dbfba3SDavid Howells 	YFSCBProbe		= 206,	/* probe client */
19*35dbfba3SDavid Howells 	YFSCBGetLock		= 207,	/* get contents of CM lock table */
20*35dbfba3SDavid Howells 	YFSCBXStatsVersion	= 209,	/* get version of extended statistics */
21*35dbfba3SDavid Howells 	YFSCBGetXStats		= 210,	/* get contents of extended statistics data */
22*35dbfba3SDavid Howells 	YFSCBInitCallBackState3	= 213,	/* initialise callback state, version 3 */
23*35dbfba3SDavid Howells 	YFSCBProbeUuid		= 214,	/* check the client hasn't rebooted */
24*35dbfba3SDavid Howells 	YFSCBGetServerPrefs	= 215,
25*35dbfba3SDavid Howells 	YFSCBGetCellServDV	= 216,
26*35dbfba3SDavid Howells 	YFSCBGetLocalCell	= 217,
27*35dbfba3SDavid Howells 	YFSCBGetCacheConfig	= 218,
28*35dbfba3SDavid Howells 	YFSCBGetCellByNum	= 65537,
29*35dbfba3SDavid Howells 	YFSCBTellMeAboutYourself = 65538, /* get client capabilities */
30*35dbfba3SDavid Howells 	YFSCBCallBack		= 64204,
31*35dbfba3SDavid Howells };
32*35dbfba3SDavid Howells 
33*35dbfba3SDavid Howells struct yfs_xdr_u64 {
34*35dbfba3SDavid Howells 	__be32			msw;
35*35dbfba3SDavid Howells 	__be32			lsw;
36*35dbfba3SDavid Howells } __packed;
37*35dbfba3SDavid Howells 
38*35dbfba3SDavid Howells static inline u64 xdr_to_u64(const struct yfs_xdr_u64 x)
39*35dbfba3SDavid Howells {
40*35dbfba3SDavid Howells 	return ((u64)ntohl(x.msw) << 32) | ntohl(x.lsw);
41*35dbfba3SDavid Howells }
42*35dbfba3SDavid Howells 
43*35dbfba3SDavid Howells static inline struct yfs_xdr_u64 u64_to_xdr(const u64 x)
44*35dbfba3SDavid Howells {
45*35dbfba3SDavid Howells 	return (struct yfs_xdr_u64){ .msw = htonl(x >> 32), .lsw = htonl(x) };
46*35dbfba3SDavid Howells }
47*35dbfba3SDavid Howells 
48*35dbfba3SDavid Howells struct yfs_xdr_vnode {
49*35dbfba3SDavid Howells 	struct yfs_xdr_u64	lo;
50*35dbfba3SDavid Howells 	__be32			hi;
51*35dbfba3SDavid Howells 	__be32			unique;
52*35dbfba3SDavid Howells } __packed;
53*35dbfba3SDavid Howells 
54*35dbfba3SDavid Howells struct yfs_xdr_YFSFid {
55*35dbfba3SDavid Howells 	struct yfs_xdr_u64	volume;
56*35dbfba3SDavid Howells 	struct yfs_xdr_vnode	vnode;
57*35dbfba3SDavid Howells } __packed;
58