135dbfba3SDavid Howells /* YFS protocol bits 235dbfba3SDavid Howells * 335dbfba3SDavid Howells * Copyright (C) 2018 Red Hat, Inc. All Rights Reserved. 435dbfba3SDavid Howells * Written by David Howells (dhowells@redhat.com) 535dbfba3SDavid Howells * 635dbfba3SDavid Howells * This program is free software; you can redistribute it and/or 735dbfba3SDavid Howells * modify it under the terms of the GNU General Public Licence 835dbfba3SDavid Howells * as published by the Free Software Foundation; either version 935dbfba3SDavid Howells * 2 of the Licence, or (at your option) any later version. 1035dbfba3SDavid Howells */ 1135dbfba3SDavid Howells 1235dbfba3SDavid Howells #define YFS_FS_SERVICE 2500 1335dbfba3SDavid Howells #define YFS_CM_SERVICE 2501 1435dbfba3SDavid Howells 1535dbfba3SDavid Howells #define YFSCBMAX 1024 1635dbfba3SDavid Howells 1735dbfba3SDavid Howells enum YFS_CM_Operations { 1835dbfba3SDavid Howells YFSCBProbe = 206, /* probe client */ 1935dbfba3SDavid Howells YFSCBGetLock = 207, /* get contents of CM lock table */ 2035dbfba3SDavid Howells YFSCBXStatsVersion = 209, /* get version of extended statistics */ 2135dbfba3SDavid Howells YFSCBGetXStats = 210, /* get contents of extended statistics data */ 2235dbfba3SDavid Howells YFSCBInitCallBackState3 = 213, /* initialise callback state, version 3 */ 2335dbfba3SDavid Howells YFSCBProbeUuid = 214, /* check the client hasn't rebooted */ 2435dbfba3SDavid Howells YFSCBGetServerPrefs = 215, 2535dbfba3SDavid Howells YFSCBGetCellServDV = 216, 2635dbfba3SDavid Howells YFSCBGetLocalCell = 217, 2735dbfba3SDavid Howells YFSCBGetCacheConfig = 218, 2835dbfba3SDavid Howells YFSCBGetCellByNum = 65537, 2935dbfba3SDavid Howells YFSCBTellMeAboutYourself = 65538, /* get client capabilities */ 3035dbfba3SDavid Howells YFSCBCallBack = 64204, 3135dbfba3SDavid Howells }; 3235dbfba3SDavid Howells 33*30062bd1SDavid Howells enum YFS_FS_Operations { 34*30062bd1SDavid Howells YFSFETCHACL = 64131, /* YFS Fetch file ACL */ 35*30062bd1SDavid Howells YFSFETCHSTATUS = 64132, /* YFS Fetch file status */ 36*30062bd1SDavid Howells YFSSTOREACL = 64134, /* YFS Store file ACL */ 37*30062bd1SDavid Howells YFSSTORESTATUS = 64135, /* YFS Store file status */ 38*30062bd1SDavid Howells YFSREMOVEFILE = 64136, /* YFS Remove a file */ 39*30062bd1SDavid Howells YFSCREATEFILE = 64137, /* YFS Create a file */ 40*30062bd1SDavid Howells YFSRENAME = 64138, /* YFS Rename or move a file or directory */ 41*30062bd1SDavid Howells YFSSYMLINK = 64139, /* YFS Create a symbolic link */ 42*30062bd1SDavid Howells YFSLINK = 64140, /* YFS Create a hard link */ 43*30062bd1SDavid Howells YFSMAKEDIR = 64141, /* YFS Create a directory */ 44*30062bd1SDavid Howells YFSREMOVEDIR = 64142, /* YFS Remove a directory */ 45*30062bd1SDavid Howells YFSGETVOLUMESTATUS = 64149, /* YFS Get volume status information */ 46*30062bd1SDavid Howells YFSSETVOLUMESTATUS = 64150, /* YFS Set volume status information */ 47*30062bd1SDavid Howells YFSSETLOCK = 64156, /* YFS Request a file lock */ 48*30062bd1SDavid Howells YFSEXTENDLOCK = 64157, /* YFS Extend a file lock */ 49*30062bd1SDavid Howells YFSRELEASELOCK = 64158, /* YFS Release a file lock */ 50*30062bd1SDavid Howells YFSLOOKUP = 64161, /* YFS lookup file in directory */ 51*30062bd1SDavid Howells YFSFLUSHCPS = 64165, 52*30062bd1SDavid Howells YFSFETCHOPAQUEACL = 64168, 53*30062bd1SDavid Howells YFSWHOAMI = 64170, 54*30062bd1SDavid Howells YFSREMOVEACL = 64171, 55*30062bd1SDavid Howells YFSREMOVEFILE2 = 64173, 56*30062bd1SDavid Howells YFSSTOREOPAQUEACL2 = 64174, 57*30062bd1SDavid Howells YFSINLINEBULKSTATUS = 64536, /* YFS Fetch multiple file statuses with errors */ 58*30062bd1SDavid Howells YFSFETCHDATA64 = 64537, /* YFS Fetch file data */ 59*30062bd1SDavid Howells YFSSTOREDATA64 = 64538, /* YFS Store file data */ 60*30062bd1SDavid Howells YFSUPDATESYMLINK = 64540, 61*30062bd1SDavid Howells }; 62*30062bd1SDavid Howells 6335dbfba3SDavid Howells struct yfs_xdr_u64 { 6435dbfba3SDavid Howells __be32 msw; 6535dbfba3SDavid Howells __be32 lsw; 6635dbfba3SDavid Howells } __packed; 6735dbfba3SDavid Howells 6835dbfba3SDavid Howells static inline u64 xdr_to_u64(const struct yfs_xdr_u64 x) 6935dbfba3SDavid Howells { 7035dbfba3SDavid Howells return ((u64)ntohl(x.msw) << 32) | ntohl(x.lsw); 7135dbfba3SDavid Howells } 7235dbfba3SDavid Howells 7335dbfba3SDavid Howells static inline struct yfs_xdr_u64 u64_to_xdr(const u64 x) 7435dbfba3SDavid Howells { 7535dbfba3SDavid Howells return (struct yfs_xdr_u64){ .msw = htonl(x >> 32), .lsw = htonl(x) }; 7635dbfba3SDavid Howells } 7735dbfba3SDavid Howells 7835dbfba3SDavid Howells struct yfs_xdr_vnode { 7935dbfba3SDavid Howells struct yfs_xdr_u64 lo; 8035dbfba3SDavid Howells __be32 hi; 8135dbfba3SDavid Howells __be32 unique; 8235dbfba3SDavid Howells } __packed; 8335dbfba3SDavid Howells 8435dbfba3SDavid Howells struct yfs_xdr_YFSFid { 8535dbfba3SDavid Howells struct yfs_xdr_u64 volume; 8635dbfba3SDavid Howells struct yfs_xdr_vnode vnode; 8735dbfba3SDavid Howells } __packed; 88*30062bd1SDavid Howells 89*30062bd1SDavid Howells 90*30062bd1SDavid Howells struct yfs_xdr_YFSFetchStatus { 91*30062bd1SDavid Howells __be32 type; 92*30062bd1SDavid Howells __be32 nlink; 93*30062bd1SDavid Howells struct yfs_xdr_u64 size; 94*30062bd1SDavid Howells struct yfs_xdr_u64 data_version; 95*30062bd1SDavid Howells struct yfs_xdr_u64 author; 96*30062bd1SDavid Howells struct yfs_xdr_u64 owner; 97*30062bd1SDavid Howells struct yfs_xdr_u64 group; 98*30062bd1SDavid Howells __be32 mode; 99*30062bd1SDavid Howells __be32 caller_access; 100*30062bd1SDavid Howells __be32 anon_access; 101*30062bd1SDavid Howells struct yfs_xdr_vnode parent; 102*30062bd1SDavid Howells __be32 data_access_protocol; 103*30062bd1SDavid Howells struct yfs_xdr_u64 mtime_client; 104*30062bd1SDavid Howells struct yfs_xdr_u64 mtime_server; 105*30062bd1SDavid Howells __be32 lock_count; 106*30062bd1SDavid Howells __be32 abort_code; 107*30062bd1SDavid Howells } __packed; 108*30062bd1SDavid Howells 109*30062bd1SDavid Howells struct yfs_xdr_YFSCallBack { 110*30062bd1SDavid Howells __be32 version; 111*30062bd1SDavid Howells struct yfs_xdr_u64 expiration_time; 112*30062bd1SDavid Howells __be32 type; 113*30062bd1SDavid Howells } __packed; 114*30062bd1SDavid Howells 115*30062bd1SDavid Howells struct yfs_xdr_YFSStoreStatus { 116*30062bd1SDavid Howells __be32 mask; 117*30062bd1SDavid Howells __be32 mode; 118*30062bd1SDavid Howells struct yfs_xdr_u64 mtime_client; 119*30062bd1SDavid Howells struct yfs_xdr_u64 owner; 120*30062bd1SDavid Howells struct yfs_xdr_u64 group; 121*30062bd1SDavid Howells } __packed; 122*30062bd1SDavid Howells 123*30062bd1SDavid Howells struct yfs_xdr_RPCFlags { 124*30062bd1SDavid Howells __be32 rpc_flags; 125*30062bd1SDavid Howells } __packed; 126*30062bd1SDavid Howells 127*30062bd1SDavid Howells struct yfs_xdr_YFSVolSync { 128*30062bd1SDavid Howells struct yfs_xdr_u64 vol_creation_date; 129*30062bd1SDavid Howells struct yfs_xdr_u64 vol_update_date; 130*30062bd1SDavid Howells struct yfs_xdr_u64 max_quota; 131*30062bd1SDavid Howells struct yfs_xdr_u64 blocks_in_use; 132*30062bd1SDavid Howells struct yfs_xdr_u64 blocks_avail; 133*30062bd1SDavid Howells } __packed; 134*30062bd1SDavid Howells 135*30062bd1SDavid Howells enum yfs_volume_type { 136*30062bd1SDavid Howells yfs_volume_type_ro = 0, 137*30062bd1SDavid Howells yfs_volume_type_rw = 1, 138*30062bd1SDavid Howells }; 139*30062bd1SDavid Howells 140*30062bd1SDavid Howells #define yfs_FVSOnline 0x1 141*30062bd1SDavid Howells #define yfs_FVSInservice 0x2 142*30062bd1SDavid Howells #define yfs_FVSBlessed 0x4 143*30062bd1SDavid Howells #define yfs_FVSNeedsSalvage 0x8 144*30062bd1SDavid Howells 145*30062bd1SDavid Howells struct yfs_xdr_YFSFetchVolumeStatus { 146*30062bd1SDavid Howells struct yfs_xdr_u64 vid; 147*30062bd1SDavid Howells struct yfs_xdr_u64 parent_id; 148*30062bd1SDavid Howells __be32 flags; 149*30062bd1SDavid Howells __be32 type; 150*30062bd1SDavid Howells struct yfs_xdr_u64 max_quota; 151*30062bd1SDavid Howells struct yfs_xdr_u64 blocks_in_use; 152*30062bd1SDavid Howells struct yfs_xdr_u64 part_blocks_avail; 153*30062bd1SDavid Howells struct yfs_xdr_u64 part_max_blocks; 154*30062bd1SDavid Howells struct yfs_xdr_u64 vol_copy_date; 155*30062bd1SDavid Howells struct yfs_xdr_u64 vol_backup_date; 156*30062bd1SDavid Howells } __packed; 157*30062bd1SDavid Howells 158*30062bd1SDavid Howells struct yfs_xdr_YFSStoreVolumeStatus { 159*30062bd1SDavid Howells __be32 mask; 160*30062bd1SDavid Howells struct yfs_xdr_u64 min_quota; 161*30062bd1SDavid Howells struct yfs_xdr_u64 max_quota; 162*30062bd1SDavid Howells struct yfs_xdr_u64 file_quota; 163*30062bd1SDavid Howells } __packed; 164