1b4d0d230SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 235dbfba3SDavid Howells /* YFS protocol bits 335dbfba3SDavid Howells * 435dbfba3SDavid Howells * Copyright (C) 2018 Red Hat, Inc. All Rights Reserved. 535dbfba3SDavid Howells * Written by David Howells (dhowells@redhat.com) 635dbfba3SDavid Howells */ 735dbfba3SDavid Howells 835dbfba3SDavid Howells #define YFS_FS_SERVICE 2500 935dbfba3SDavid Howells #define YFS_CM_SERVICE 2501 1035dbfba3SDavid Howells 1135dbfba3SDavid Howells #define YFSCBMAX 1024 1235dbfba3SDavid Howells 1335dbfba3SDavid Howells enum YFS_CM_Operations { 1435dbfba3SDavid Howells YFSCBProbe = 206, /* probe client */ 1535dbfba3SDavid Howells YFSCBGetLock = 207, /* get contents of CM lock table */ 1635dbfba3SDavid Howells YFSCBXStatsVersion = 209, /* get version of extended statistics */ 1735dbfba3SDavid Howells YFSCBGetXStats = 210, /* get contents of extended statistics data */ 1835dbfba3SDavid Howells YFSCBInitCallBackState3 = 213, /* initialise callback state, version 3 */ 1935dbfba3SDavid Howells YFSCBProbeUuid = 214, /* check the client hasn't rebooted */ 2035dbfba3SDavid Howells YFSCBGetServerPrefs = 215, 2135dbfba3SDavid Howells YFSCBGetCellServDV = 216, 2235dbfba3SDavid Howells YFSCBGetLocalCell = 217, 2335dbfba3SDavid Howells YFSCBGetCacheConfig = 218, 2435dbfba3SDavid Howells YFSCBGetCellByNum = 65537, 2535dbfba3SDavid Howells YFSCBTellMeAboutYourself = 65538, /* get client capabilities */ 2635dbfba3SDavid Howells YFSCBCallBack = 64204, 2735dbfba3SDavid Howells }; 2835dbfba3SDavid Howells 2930062bd1SDavid Howells enum YFS_FS_Operations { 30ae46578bSDavid Howells YFSFETCHACL = 64131, /* YFS Fetch file AFS3 ACL */ 3130062bd1SDavid Howells YFSFETCHSTATUS = 64132, /* YFS Fetch file status */ 32ae46578bSDavid Howells YFSSTOREACL = 64134, /* YFS Store file AFS3 ACL */ 3330062bd1SDavid Howells YFSSTORESTATUS = 64135, /* YFS Store file status */ 3430062bd1SDavid Howells YFSREMOVEFILE = 64136, /* YFS Remove a file */ 3530062bd1SDavid Howells YFSCREATEFILE = 64137, /* YFS Create a file */ 3630062bd1SDavid Howells YFSRENAME = 64138, /* YFS Rename or move a file or directory */ 3730062bd1SDavid Howells YFSSYMLINK = 64139, /* YFS Create a symbolic link */ 3830062bd1SDavid Howells YFSLINK = 64140, /* YFS Create a hard link */ 3930062bd1SDavid Howells YFSMAKEDIR = 64141, /* YFS Create a directory */ 4030062bd1SDavid Howells YFSREMOVEDIR = 64142, /* YFS Remove a directory */ 4130062bd1SDavid Howells YFSGETVOLUMESTATUS = 64149, /* YFS Get volume status information */ 4230062bd1SDavid Howells YFSSETVOLUMESTATUS = 64150, /* YFS Set volume status information */ 4330062bd1SDavid Howells YFSSETLOCK = 64156, /* YFS Request a file lock */ 4430062bd1SDavid Howells YFSEXTENDLOCK = 64157, /* YFS Extend a file lock */ 4530062bd1SDavid Howells YFSRELEASELOCK = 64158, /* YFS Release a file lock */ 4630062bd1SDavid Howells YFSLOOKUP = 64161, /* YFS lookup file in directory */ 4730062bd1SDavid Howells YFSFLUSHCPS = 64165, 48ae46578bSDavid Howells YFSFETCHOPAQUEACL = 64168, /* YFS Fetch file YFS ACL */ 4930062bd1SDavid Howells YFSWHOAMI = 64170, 5030062bd1SDavid Howells YFSREMOVEACL = 64171, 5130062bd1SDavid Howells YFSREMOVEFILE2 = 64173, 5230062bd1SDavid Howells YFSSTOREOPAQUEACL2 = 64174, 5330062bd1SDavid Howells YFSINLINEBULKSTATUS = 64536, /* YFS Fetch multiple file statuses with errors */ 5430062bd1SDavid Howells YFSFETCHDATA64 = 64537, /* YFS Fetch file data */ 5530062bd1SDavid Howells YFSSTOREDATA64 = 64538, /* YFS Store file data */ 5630062bd1SDavid Howells YFSUPDATESYMLINK = 64540, 5730062bd1SDavid Howells }; 5830062bd1SDavid Howells 5935dbfba3SDavid Howells struct yfs_xdr_u64 { 6035dbfba3SDavid Howells __be32 msw; 6135dbfba3SDavid Howells __be32 lsw; 6235dbfba3SDavid Howells } __packed; 6335dbfba3SDavid Howells 6435dbfba3SDavid Howells static inline u64 xdr_to_u64(const struct yfs_xdr_u64 x) 6535dbfba3SDavid Howells { 6635dbfba3SDavid Howells return ((u64)ntohl(x.msw) << 32) | ntohl(x.lsw); 6735dbfba3SDavid Howells } 6835dbfba3SDavid Howells 6935dbfba3SDavid Howells static inline struct yfs_xdr_u64 u64_to_xdr(const u64 x) 7035dbfba3SDavid Howells { 7135dbfba3SDavid Howells return (struct yfs_xdr_u64){ .msw = htonl(x >> 32), .lsw = htonl(x) }; 7235dbfba3SDavid Howells } 7335dbfba3SDavid Howells 7435dbfba3SDavid Howells struct yfs_xdr_vnode { 7535dbfba3SDavid Howells struct yfs_xdr_u64 lo; 7635dbfba3SDavid Howells __be32 hi; 7735dbfba3SDavid Howells __be32 unique; 7835dbfba3SDavid Howells } __packed; 7935dbfba3SDavid Howells 8035dbfba3SDavid Howells struct yfs_xdr_YFSFid { 8135dbfba3SDavid Howells struct yfs_xdr_u64 volume; 8235dbfba3SDavid Howells struct yfs_xdr_vnode vnode; 8335dbfba3SDavid Howells } __packed; 8430062bd1SDavid Howells 8530062bd1SDavid Howells 8630062bd1SDavid Howells struct yfs_xdr_YFSFetchStatus { 8730062bd1SDavid Howells __be32 type; 8830062bd1SDavid Howells __be32 nlink; 8930062bd1SDavid Howells struct yfs_xdr_u64 size; 9030062bd1SDavid Howells struct yfs_xdr_u64 data_version; 9130062bd1SDavid Howells struct yfs_xdr_u64 author; 9230062bd1SDavid Howells struct yfs_xdr_u64 owner; 9330062bd1SDavid Howells struct yfs_xdr_u64 group; 9430062bd1SDavid Howells __be32 mode; 9530062bd1SDavid Howells __be32 caller_access; 9630062bd1SDavid Howells __be32 anon_access; 9730062bd1SDavid Howells struct yfs_xdr_vnode parent; 9830062bd1SDavid Howells __be32 data_access_protocol; 9930062bd1SDavid Howells struct yfs_xdr_u64 mtime_client; 10030062bd1SDavid Howells struct yfs_xdr_u64 mtime_server; 10130062bd1SDavid Howells __be32 lock_count; 10230062bd1SDavid Howells __be32 abort_code; 10330062bd1SDavid Howells } __packed; 10430062bd1SDavid Howells 10530062bd1SDavid Howells struct yfs_xdr_YFSCallBack { 10630062bd1SDavid Howells __be32 version; 10730062bd1SDavid Howells struct yfs_xdr_u64 expiration_time; 10830062bd1SDavid Howells __be32 type; 10930062bd1SDavid Howells } __packed; 11030062bd1SDavid Howells 11130062bd1SDavid Howells struct yfs_xdr_YFSStoreStatus { 11230062bd1SDavid Howells __be32 mask; 11330062bd1SDavid Howells __be32 mode; 11430062bd1SDavid Howells struct yfs_xdr_u64 mtime_client; 11530062bd1SDavid Howells struct yfs_xdr_u64 owner; 11630062bd1SDavid Howells struct yfs_xdr_u64 group; 11730062bd1SDavid Howells } __packed; 11830062bd1SDavid Howells 11930062bd1SDavid Howells struct yfs_xdr_RPCFlags { 12030062bd1SDavid Howells __be32 rpc_flags; 12130062bd1SDavid Howells } __packed; 12230062bd1SDavid Howells 12330062bd1SDavid Howells struct yfs_xdr_YFSVolSync { 12430062bd1SDavid Howells struct yfs_xdr_u64 vol_creation_date; 12530062bd1SDavid Howells struct yfs_xdr_u64 vol_update_date; 12630062bd1SDavid Howells struct yfs_xdr_u64 max_quota; 12730062bd1SDavid Howells struct yfs_xdr_u64 blocks_in_use; 12830062bd1SDavid Howells struct yfs_xdr_u64 blocks_avail; 12930062bd1SDavid Howells } __packed; 13030062bd1SDavid Howells 13130062bd1SDavid Howells enum yfs_volume_type { 13230062bd1SDavid Howells yfs_volume_type_ro = 0, 13330062bd1SDavid Howells yfs_volume_type_rw = 1, 13430062bd1SDavid Howells }; 13530062bd1SDavid Howells 13630062bd1SDavid Howells #define yfs_FVSOnline 0x1 13730062bd1SDavid Howells #define yfs_FVSInservice 0x2 13830062bd1SDavid Howells #define yfs_FVSBlessed 0x4 13930062bd1SDavid Howells #define yfs_FVSNeedsSalvage 0x8 14030062bd1SDavid Howells 14130062bd1SDavid Howells struct yfs_xdr_YFSFetchVolumeStatus { 14230062bd1SDavid Howells struct yfs_xdr_u64 vid; 14330062bd1SDavid Howells struct yfs_xdr_u64 parent_id; 14430062bd1SDavid Howells __be32 flags; 14530062bd1SDavid Howells __be32 type; 14630062bd1SDavid Howells struct yfs_xdr_u64 max_quota; 14730062bd1SDavid Howells struct yfs_xdr_u64 blocks_in_use; 14830062bd1SDavid Howells struct yfs_xdr_u64 part_blocks_avail; 14930062bd1SDavid Howells struct yfs_xdr_u64 part_max_blocks; 15030062bd1SDavid Howells struct yfs_xdr_u64 vol_copy_date; 15130062bd1SDavid Howells struct yfs_xdr_u64 vol_backup_date; 15230062bd1SDavid Howells } __packed; 15330062bd1SDavid Howells 15430062bd1SDavid Howells struct yfs_xdr_YFSStoreVolumeStatus { 15530062bd1SDavid Howells __be32 mask; 15630062bd1SDavid Howells struct yfs_xdr_u64 min_quota; 15730062bd1SDavid Howells struct yfs_xdr_u64 max_quota; 15830062bd1SDavid Howells struct yfs_xdr_u64 file_quota; 15930062bd1SDavid Howells } __packed; 1605edc22ccSMarc Dionne 1615edc22ccSMarc Dionne enum yfs_lock_type { 1625edc22ccSMarc Dionne yfs_LockNone = -1, 1635edc22ccSMarc Dionne yfs_LockRead = 0, 1645edc22ccSMarc Dionne yfs_LockWrite = 1, 1655edc22ccSMarc Dionne yfs_LockExtend = 2, 1665edc22ccSMarc Dionne yfs_LockRelease = 3, 1675edc22ccSMarc Dionne yfs_LockMandatoryRead = 0x100, 1685edc22ccSMarc Dionne yfs_LockMandatoryWrite = 0x101, 1695edc22ccSMarc Dionne yfs_LockMandatoryExtend = 0x102, 1705edc22ccSMarc Dionne }; 171*b537a3c2SDavid Howells 172*b537a3c2SDavid Howells /* RXYFS Viced Capability Flags */ 173*b537a3c2SDavid Howells #define YFS_VICED_CAPABILITY_ERRORTRANS 0x0001 /* Deprecated v0.195 */ 174*b537a3c2SDavid Howells #define YFS_VICED_CAPABILITY_64BITFILES 0x0002 /* Deprecated v0.195 */ 175*b537a3c2SDavid Howells #define YFS_VICED_CAPABILITY_WRITELOCKACL 0x0004 /* Can lock a file even without lock perm */ 176*b537a3c2SDavid Howells #define YFS_VICED_CAPABILITY_SANEACLS 0x0008 /* Deprecated v0.195 */ 177