0004-Add-more-XDR-files-needed-to-build-rpcbind-on-top-of.patch 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653
  1. From baeca7ea594fe9faa1d40d35e76066c6002ca638 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Sat, 10 Nov 2012 17:45:03 +0100
  4. Subject: [PATCH] Add more XDR files needed to build rpcbind on top of libtirpc
  5. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  6. [yann.morin.1998@free.fr: update for 0.3.1]
  7. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  8. ---
  9. Makefile.am | 6 +
  10. tirpc/rpcsvc/mount.x | 257 ++++++++++
  11. tirpc/rpcsvc/nfs_prot.x | 1266 +++++++++++++++++++++++++++++++++++++++++++++++
  12. tirpc/rpcsvc/rquota.x | 67 +++
  13. 4 files changed, 1596 insertions(+)
  14. create mode 100644 tirpc/rpcsvc/mount.x
  15. create mode 100644 tirpc/rpcsvc/nfs_prot.x
  16. create mode 100644 tirpc/rpcsvc/rquota.x
  17. diff --git a/Makefile.am b/Makefile.am
  18. index aa5908e..4999066 100644
  19. --- a/Makefile.am
  20. +++ b/Makefile.am
  21. @@ -2,6 +2,9 @@ SUBDIRS = src man doc rpcgen
  22. ACLOCAL_AMFLAGS = -I m4
  23. GENFILES = tirpc/rpcsvc/crypt.h \
  24. + tirpc/rpcsvc/mount.h \
  25. + tirpc/rpcsvc/nfs_prot.h \
  26. + tirpc/rpcsvc/rquota.h \
  27. tirpc/rpc/rpcb_prot.h
  28. noinst_HEADERS = tirpc/reentrant.h \
  29. @@ -11,6 +14,9 @@ noinst_HEADERS = tirpc/reentrant.h \
  30. nobase_include_HEADERS = tirpc/netconfig.h \
  31. tirpc/rpcsvc/crypt.x \
  32. + tirpc/rpcsvc/mount.x \
  33. + tirpc/rpcsvc/nfs_prot.x \
  34. + tirpc/rpcsvc/rquota.x \
  35. tirpc/rpc/xdr.h \
  36. tirpc/rpc/types.h \
  37. tirpc/rpc/svc_soc.h \
  38. diff --git a/tirpc/rpcsvc/mount.x b/tirpc/rpcsvc/mount.x
  39. new file mode 100644
  40. index 0000000..f68a06f
  41. --- /dev/null
  42. +++ b/tirpc/rpcsvc/mount.x
  43. @@ -0,0 +1,257 @@
  44. +/*
  45. + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  46. + * unrestricted use provided that this legend is included on all tape
  47. + * media and as a part of the software program in whole or part. Users
  48. + * may copy or modify Sun RPC without charge, but are not authorized
  49. + * to license or distribute it to anyone else except as part of a product or
  50. + * program developed by the user.
  51. + *
  52. + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  53. + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  54. + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  55. + *
  56. + * Sun RPC is provided with no support and without any obligation on the
  57. + * part of Sun Microsystems, Inc. to assist in its use, correction,
  58. + * modification or enhancement.
  59. + *
  60. + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  61. + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  62. + * OR ANY PART THEREOF.
  63. + *
  64. + * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  65. + * or profits or other special, indirect and consequential damages, even if
  66. + * Sun has been advised of the possibility of such damages.
  67. + *
  68. + * Sun Microsystems, Inc.
  69. + * 2550 Garcia Avenue
  70. + * Mountain View, California 94043
  71. + */
  72. +
  73. +/*
  74. + * Protocol description for the mount program
  75. + */
  76. +
  77. +#ifndef RPC_HDR
  78. +%#ifndef lint
  79. +%/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/
  80. +%/*static char sccsid[] = "from: @(#)mount.x 2.1 88/08/01 4.0 RPCSRC";*/
  81. +%static const char rcsid[] =
  82. +% "$FreeBSD: src/include/rpcsvc/mount.x,v 1.6 1999/08/27 23:45:08 peter Exp $";
  83. +%#endif /* not lint */
  84. +#endif
  85. +
  86. +const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */
  87. +const MNTNAMLEN = 255; /* maximum bytes in a name argument */
  88. +const FHSIZE = 32; /* size in bytes of a file handle */
  89. +#ifdef WANT_NFS3
  90. +const FHSIZE3 = 64; /* size in bytes of a file handle (v3) */
  91. +#endif
  92. +
  93. +/*
  94. + * The fhandle is the file handle that the server passes to the client.
  95. + * All file operations are done using the file handles to refer to a file
  96. + * or a directory. The file handle can contain whatever information the
  97. + * server needs to distinguish an individual file.
  98. + */
  99. +typedef opaque fhandle[FHSIZE];
  100. +#ifdef WANT_NFS3
  101. +typedef opaque fhandle3<FHSIZE3>;
  102. +#endif
  103. +
  104. +/*
  105. + * If a status of zero is returned, the call completed successfully, and
  106. + * a file handle for the directory follows. A non-zero status indicates
  107. + * some sort of error. The status corresponds with UNIX error numbers.
  108. + */
  109. +union fhstatus switch (unsigned fhs_status) {
  110. +case 0:
  111. + fhandle fhs_fhandle;
  112. +default:
  113. + void;
  114. +};
  115. +
  116. +#ifdef WANT_NFS3
  117. +/*
  118. + * Status codes returned by the version 3 mount call.
  119. + */
  120. +enum mountstat3 {
  121. + MNT3_OK = 0, /* no error */
  122. + MNT3ERR_PERM = 1, /* Not owner */
  123. + MNT3ERR_NOENT = 2, /* No such file or directory */
  124. + MNT3ERR_IO = 5, /* I/O error */
  125. + MNT3ERR_ACCES = 13, /* Permission denied */
  126. + MNT3ERR_NOTDIR = 20, /* Not a directory */
  127. + MNT3ERR_INVAL = 22, /* Invalid argument */
  128. + MNT3ERR_NAMETOOLONG = 63, /* Filename too long */
  129. + MNT3ERR_NOTSUPP = 10004, /* Operation not supported */
  130. + MNT3ERR_SERVERFAULT = 10006 /* A failure on the server */
  131. +};
  132. +
  133. +struct mountres3_ok {
  134. + fhandle3 fhandle;
  135. + int auth_flavors<>;
  136. +};
  137. +
  138. +union mountres3 switch (mountstat3 fhs_status) {
  139. +case 0:
  140. + mountres3_ok mountinfo;
  141. +default:
  142. + void;
  143. +};
  144. +#endif
  145. +
  146. +/*
  147. + * The type dirpath is the pathname of a directory
  148. + */
  149. +typedef string dirpath<MNTPATHLEN>;
  150. +
  151. +/*
  152. + * The type name is used for arbitrary names (hostnames, groupnames)
  153. + */
  154. +typedef string name<MNTNAMLEN>;
  155. +
  156. +/*
  157. + * A list of who has what mounted
  158. + */
  159. +typedef struct mountbody *mountlist;
  160. +struct mountbody {
  161. + name ml_hostname;
  162. + dirpath ml_directory;
  163. + mountlist ml_next;
  164. +};
  165. +
  166. +/*
  167. + * A list of netgroups
  168. + */
  169. +typedef struct groupnode *groups;
  170. +struct groupnode {
  171. + name gr_name;
  172. + groups gr_next;
  173. +};
  174. +
  175. +/*
  176. + * A list of what is exported and to whom
  177. + */
  178. +typedef struct exportnode *exports;
  179. +struct exportnode {
  180. + dirpath ex_dir;
  181. + groups ex_groups;
  182. + exports ex_next;
  183. +};
  184. +
  185. +program MOUNTPROG {
  186. + /*
  187. + * Version one of the mount protocol communicates with version two
  188. + * of the NFS protocol. Version three communicates with
  189. + * version three of the NFS protocol. The only connecting
  190. + * point is the fhandle structure, which is the same for both
  191. + * protocols.
  192. + */
  193. + version MOUNTVERS {
  194. + /*
  195. + * Does no work. It is made available in all RPC services
  196. + * to allow server reponse testing and timing
  197. + */
  198. + void
  199. + MOUNTPROC_NULL(void) = 0;
  200. +
  201. + /*
  202. + * If fhs_status is 0, then fhs_fhandle contains the
  203. + * file handle for the directory. This file handle may
  204. + * be used in the NFS protocol. This procedure also adds
  205. + * a new entry to the mount list for this client mounting
  206. + * the directory.
  207. + * Unix authentication required.
  208. + */
  209. + fhstatus
  210. + MOUNTPROC_MNT(dirpath) = 1;
  211. +
  212. + /*
  213. + * Returns the list of remotely mounted filesystems. The
  214. + * mountlist contains one entry for each hostname and
  215. + * directory pair.
  216. + */
  217. + mountlist
  218. + MOUNTPROC_DUMP(void) = 2;
  219. +
  220. + /*
  221. + * Removes the mount list entry for the directory
  222. + * Unix authentication required.
  223. + */
  224. + void
  225. + MOUNTPROC_UMNT(dirpath) = 3;
  226. +
  227. + /*
  228. + * Removes all of the mount list entries for this client
  229. + * Unix authentication required.
  230. + */
  231. + void
  232. + MOUNTPROC_UMNTALL(void) = 4;
  233. +
  234. + /*
  235. + * Returns a list of all the exported filesystems, and which
  236. + * machines are allowed to import it.
  237. + */
  238. + exports
  239. + MOUNTPROC_EXPORT(void) = 5;
  240. +
  241. + /*
  242. + * Identical to MOUNTPROC_EXPORT above
  243. + */
  244. + exports
  245. + MOUNTPROC_EXPORTALL(void) = 6;
  246. + } = 1;
  247. +#ifdef WANT_NFS3
  248. + version MOUNTVERS3 {
  249. + /*
  250. + * Does no work. It is made available in all RPC services
  251. + * to allow server reponse testing and timing
  252. + */
  253. + void
  254. + MOUNTPROC_NULL(void) = 0;
  255. +
  256. + /*
  257. + * If mountres3.fhs_status is MNT3_OK, then
  258. + * mountres3.mountinfo contains the file handle for
  259. + * the directory and a list of acceptable
  260. + * authentication flavors. This file handle may only
  261. + * be used in the NFS version 3 protocol. This
  262. + * procedure also results in the server adding a new
  263. + * entry to its mount list recording that this client
  264. + * has mounted the directory. AUTH_UNIX authentication
  265. + * or better is required.
  266. + */
  267. + mountres3
  268. + MOUNTPROC_MNT(dirpath) = 1;
  269. +
  270. + /*
  271. + * Returns the list of remotely mounted filesystems. The
  272. + * mountlist contains one entry for each hostname and
  273. + * directory pair.
  274. + */
  275. + mountlist
  276. + MOUNTPROC_DUMP(void) = 2;
  277. +
  278. + /*
  279. + * Removes the mount list entry for the directory
  280. + * Unix authentication required.
  281. + */
  282. + void
  283. + MOUNTPROC_UMNT(dirpath) = 3;
  284. +
  285. + /*
  286. + * Removes all of the mount list entries for this client
  287. + * Unix authentication required.
  288. + */
  289. + void
  290. + MOUNTPROC_UMNTALL(void) = 4;
  291. +
  292. + /*
  293. + * Returns a list of all the exported filesystems, and which
  294. + * machines are allowed to import it.
  295. + */
  296. + exports
  297. + MOUNTPROC_EXPORT(void) = 5;
  298. + } = 3;
  299. +#endif
  300. +} = 100005;
  301. diff --git a/tirpc/rpcsvc/nfs_prot.x b/tirpc/rpcsvc/nfs_prot.x
  302. new file mode 100644
  303. index 0000000..01564f8
  304. --- /dev/null
  305. +++ b/tirpc/rpcsvc/nfs_prot.x
  306. @@ -0,0 +1,1266 @@
  307. +/*
  308. + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  309. + * unrestricted use provided that this legend is included on all tape
  310. + * media and as a part of the software program in whole or part. Users
  311. + * may copy or modify Sun RPC without charge, but are not authorized
  312. + * to license or distribute it to anyone else except as part of a product or
  313. + * program developed by the user.
  314. + *
  315. + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  316. + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  317. + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  318. + *
  319. + * Sun RPC is provided with no support and without any obligation on the
  320. + * part of Sun Microsystems, Inc. to assist in its use, correction,
  321. + * modification or enhancement.
  322. + *
  323. + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  324. + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  325. + * OR ANY PART THEREOF.
  326. + *
  327. + * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  328. + * or profits or other special, indirect and consequential damages, even if
  329. + * Sun has been advised of the possibility of such damages.
  330. + *
  331. + * Sun Microsystems, Inc.
  332. + * 2550 Garcia Avenue
  333. + * Mountain View, California 94043
  334. + */
  335. +
  336. +#ifndef RPC_HDR
  337. +%#ifndef lint
  338. +%/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/
  339. +%/*static char sccsid[] = "from: @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
  340. +%static const char rcsid[] =
  341. +% "$FreeBSD: src/include/rpcsvc/nfs_prot.x,v 1.7 1999/08/27 23:45:08 peter Exp $";
  342. +%#endif /* not lint */
  343. +#endif
  344. +
  345. +const NFS_PORT = 2049;
  346. +const NFS_MAXDATA = 8192;
  347. +const NFS_MAXPATHLEN = 1024;
  348. +const NFS_MAXNAMLEN = 255;
  349. +const NFS_FHSIZE = 32;
  350. +const NFS_COOKIESIZE = 4;
  351. +const NFS_FIFO_DEV = -1; /* size kludge for named pipes */
  352. +
  353. +/*
  354. + * File types
  355. + */
  356. +const NFSMODE_FMT = 0170000; /* type of file */
  357. +const NFSMODE_DIR = 0040000; /* directory */
  358. +const NFSMODE_CHR = 0020000; /* character special */
  359. +const NFSMODE_BLK = 0060000; /* block special */
  360. +const NFSMODE_REG = 0100000; /* regular */
  361. +const NFSMODE_LNK = 0120000; /* symbolic link */
  362. +const NFSMODE_SOCK = 0140000; /* socket */
  363. +const NFSMODE_FIFO = 0010000; /* fifo */
  364. +
  365. +/*
  366. + * Error status
  367. + */
  368. +enum nfsstat {
  369. + NFS_OK= 0, /* no error */
  370. + NFSERR_PERM=1, /* Not owner */
  371. + NFSERR_NOENT=2, /* No such file or directory */
  372. + NFSERR_IO=5, /* I/O error */
  373. + NFSERR_NXIO=6, /* No such device or address */
  374. + NFSERR_ACCES=13, /* Permission denied */
  375. + NFSERR_EXIST=17, /* File exists */
  376. + NFSERR_NODEV=19, /* No such device */
  377. + NFSERR_NOTDIR=20, /* Not a directory*/
  378. + NFSERR_ISDIR=21, /* Is a directory */
  379. + NFSERR_FBIG=27, /* File too large */
  380. + NFSERR_NOSPC=28, /* No space left on device */
  381. + NFSERR_ROFS=30, /* Read-only file system */
  382. + NFSERR_NAMETOOLONG=63, /* File name too long */
  383. + NFSERR_NOTEMPTY=66, /* Directory not empty */
  384. + NFSERR_DQUOT=69, /* Disc quota exceeded */
  385. + NFSERR_STALE=70, /* Stale NFS file handle */
  386. + NFSERR_WFLUSH=99 /* write cache flushed */
  387. +};
  388. +
  389. +/*
  390. + * File types
  391. + */
  392. +enum ftype {
  393. + NFNON = 0, /* non-file */
  394. + NFREG = 1, /* regular file */
  395. + NFDIR = 2, /* directory */
  396. + NFBLK = 3, /* block special */
  397. + NFCHR = 4, /* character special */
  398. + NFLNK = 5, /* symbolic link */
  399. + NFSOCK = 6, /* unix domain sockets */
  400. + NFBAD = 7, /* unused */
  401. + NFFIFO = 8 /* named pipe */
  402. +};
  403. +
  404. +/*
  405. + * File access handle
  406. + */
  407. +struct nfs_fh {
  408. + opaque data[NFS_FHSIZE];
  409. +};
  410. +
  411. +/*
  412. + * Timeval
  413. + */
  414. +struct nfstime {
  415. + unsigned seconds;
  416. + unsigned useconds;
  417. +};
  418. +
  419. +
  420. +/*
  421. + * File attributes
  422. + */
  423. +struct fattr {
  424. + ftype type; /* file type */
  425. + unsigned mode; /* protection mode bits */
  426. + unsigned nlink; /* # hard links */
  427. + unsigned uid; /* owner user id */
  428. + unsigned gid; /* owner group id */
  429. + unsigned size; /* file size in bytes */
  430. + unsigned blocksize; /* prefered block size */
  431. + unsigned rdev; /* special device # */
  432. + unsigned blocks; /* Kb of disk used by file */
  433. + unsigned fsid; /* device # */
  434. + unsigned fileid; /* inode # */
  435. + nfstime atime; /* time of last access */
  436. + nfstime mtime; /* time of last modification */
  437. + nfstime ctime; /* time of last change */
  438. +};
  439. +
  440. +/*
  441. + * File attributes which can be set
  442. + */
  443. +struct sattr {
  444. + unsigned mode; /* protection mode bits */
  445. + unsigned uid; /* owner user id */
  446. + unsigned gid; /* owner group id */
  447. + unsigned size; /* file size in bytes */
  448. + nfstime atime; /* time of last access */
  449. + nfstime mtime; /* time of last modification */
  450. +};
  451. +
  452. +
  453. +typedef string filename<NFS_MAXNAMLEN>;
  454. +typedef string nfspath<NFS_MAXPATHLEN>;
  455. +
  456. +/*
  457. + * Reply status with file attributes
  458. + */
  459. +union attrstat switch (nfsstat status) {
  460. +case NFS_OK:
  461. + fattr attributes;
  462. +default:
  463. + void;
  464. +};
  465. +
  466. +struct sattrargs {
  467. + nfs_fh file;
  468. + sattr attributes;
  469. +};
  470. +
  471. +/*
  472. + * Arguments for directory operations
  473. + */
  474. +struct diropargs {
  475. + nfs_fh dir; /* directory file handle */
  476. + filename name; /* name (up to NFS_MAXNAMLEN bytes) */
  477. +};
  478. +
  479. +struct diropokres {
  480. + nfs_fh file;
  481. + fattr attributes;
  482. +};
  483. +
  484. +/*
  485. + * Results from directory operation
  486. + */
  487. +union diropres switch (nfsstat status) {
  488. +case NFS_OK:
  489. + diropokres diropres;
  490. +default:
  491. + void;
  492. +};
  493. +
  494. +union readlinkres switch (nfsstat status) {
  495. +case NFS_OK:
  496. + nfspath data;
  497. +default:
  498. + void;
  499. +};
  500. +
  501. +/*
  502. + * Arguments to remote read
  503. + */
  504. +struct readargs {
  505. + nfs_fh file; /* handle for file */
  506. + unsigned offset; /* byte offset in file */
  507. + unsigned count; /* immediate read count */
  508. + unsigned totalcount; /* total read count (from this offset)*/
  509. +};
  510. +
  511. +/*
  512. + * Status OK portion of remote read reply
  513. + */
  514. +struct readokres {
  515. + fattr attributes; /* attributes, need for pagin*/
  516. + opaque data<NFS_MAXDATA>;
  517. +};
  518. +
  519. +union readres switch (nfsstat status) {
  520. +case NFS_OK:
  521. + readokres reply;
  522. +default:
  523. + void;
  524. +};
  525. +
  526. +/*
  527. + * Arguments to remote write
  528. + */
  529. +struct writeargs {
  530. + nfs_fh file; /* handle for file */
  531. + unsigned beginoffset; /* beginning byte offset in file */
  532. + unsigned offset; /* current byte offset in file */
  533. + unsigned totalcount; /* total write count (to this offset)*/
  534. + opaque data<NFS_MAXDATA>;
  535. +};
  536. +
  537. +struct createargs {
  538. + diropargs where;
  539. + sattr attributes;
  540. +};
  541. +
  542. +struct renameargs {
  543. + diropargs from;
  544. + diropargs to;
  545. +};
  546. +
  547. +struct linkargs {
  548. + nfs_fh from;
  549. + diropargs to;
  550. +};
  551. +
  552. +struct symlinkargs {
  553. + diropargs from;
  554. + nfspath to;
  555. + sattr attributes;
  556. +};
  557. +
  558. +
  559. +typedef opaque nfscookie[NFS_COOKIESIZE];
  560. +
  561. +/*
  562. + * Arguments to readdir
  563. + */
  564. +struct readdirargs {
  565. + nfs_fh dir; /* directory handle */
  566. + nfscookie cookie;
  567. + unsigned count; /* number of directory bytes to read */
  568. +};
  569. +
  570. +struct entry {
  571. + unsigned fileid;
  572. + filename name;
  573. + nfscookie cookie;
  574. + entry *nextentry;
  575. +};
  576. +
  577. +struct dirlist {
  578. + entry *entries;
  579. + bool eof;
  580. +};
  581. +
  582. +union readdirres switch (nfsstat status) {
  583. +case NFS_OK:
  584. + dirlist reply;
  585. +default:
  586. + void;
  587. +};
  588. +
  589. +struct statfsokres {
  590. + unsigned tsize; /* preferred transfer size in bytes */
  591. + unsigned bsize; /* fundamental file system block size */
  592. + unsigned blocks; /* total blocks in file system */
  593. + unsigned bfree; /* free blocks in fs */
  594. + unsigned bavail; /* free blocks avail to non-superuser */
  595. +};
  596. +
  597. +union statfsres switch (nfsstat status) {
  598. +case NFS_OK:
  599. + statfsokres reply;
  600. +default:
  601. + void;
  602. +};
  603. +
  604. +#ifdef WANT_NFS3
  605. +
  606. +/*
  607. + * NFSv3 constants and types
  608. + */
  609. +const NFS3_FHSIZE = 64; /* maximum size in bytes of a file handle */
  610. +const NFS3_COOKIEVERFSIZE = 8; /* size of a cookie verifier for READDIR */
  611. +const NFS3_CREATEVERFSIZE = 8; /* size of the verifier used for CREATE */
  612. +const NFS3_WRITEVERFSIZE = 8; /* size of the verifier used for WRITE */
  613. +
  614. +typedef unsigned hyper uint64;
  615. +typedef hyper int64;
  616. +typedef unsigned long uint32;
  617. +typedef long int32;
  618. +typedef string filename3<>;
  619. +typedef string nfspath3<>;
  620. +typedef uint64 fileid3;
  621. +typedef uint64 cookie3;
  622. +typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
  623. +typedef opaque createverf3[NFS3_CREATEVERFSIZE];
  624. +typedef opaque writeverf3[NFS3_WRITEVERFSIZE];
  625. +typedef uint32 uid3;
  626. +typedef uint32 gid3;
  627. +typedef uint64 size3;
  628. +typedef uint64 offset3;
  629. +typedef uint32 mode3;
  630. +typedef uint32 count3;
  631. +
  632. +/*
  633. + * Error status (v3)
  634. + */
  635. +enum nfsstat3 {
  636. + NFS3_OK = 0,
  637. + NFS3ERR_PERM = 1,
  638. + NFS3ERR_NOENT = 2,
  639. + NFS3ERR_IO = 5,
  640. + NFS3ERR_NXIO = 6,
  641. + NFS3ERR_ACCES = 13,
  642. + NFS3ERR_EXIST = 17,
  643. + NFS3ERR_XDEV = 18,
  644. + NFS3ERR_NODEV = 19,
  645. + NFS3ERR_NOTDIR = 20,
  646. + NFS3ERR_ISDIR = 21,
  647. + NFS3ERR_INVAL = 22,
  648. + NFS3ERR_FBIG = 27,
  649. + NFS3ERR_NOSPC = 28,
  650. + NFS3ERR_ROFS = 30,
  651. + NFS3ERR_MLINK = 31,
  652. + NFS3ERR_NAMETOOLONG = 63,
  653. + NFS3ERR_NOTEMPTY = 66,
  654. + NFS3ERR_DQUOT = 69,
  655. + NFS3ERR_STALE = 70,
  656. + NFS3ERR_REMOTE = 71,
  657. + NFS3ERR_BADHANDLE = 10001,
  658. + NFS3ERR_NOT_SYNC = 10002,
  659. + NFS3ERR_BAD_COOKIE = 10003,
  660. + NFS3ERR_NOTSUPP = 10004,
  661. + NFS3ERR_TOOSMALL = 10005,
  662. + NFS3ERR_SERVERFAULT = 10006,
  663. + NFS3ERR_BADTYPE = 10007,
  664. + NFS3ERR_JUKEBOX = 10008
  665. +};
  666. +
  667. +/*
  668. + * File types (v3)
  669. + */
  670. +enum ftype3 {
  671. + NF3REG = 1, /* regular file */
  672. + NF3DIR = 2, /* directory */
  673. + NF3BLK = 3, /* block special */
  674. + NF3CHR = 4, /* character special */
  675. + NF3LNK = 5, /* symbolic link */
  676. + NF3SOCK = 6, /* unix domain sockets */
  677. + NF3FIFO = 7 /* named pipe */
  678. +};
  679. +
  680. +struct specdata3 {
  681. + uint32 specdata1;
  682. + uint32 specdata2;
  683. +};
  684. +
  685. +/*
  686. + * File access handle (v3)
  687. + */
  688. +struct nfs_fh3 {
  689. + opaque data<NFS3_FHSIZE>;
  690. +};
  691. +
  692. +/*
  693. + * Timeval (v3)
  694. + */
  695. +struct nfstime3 {
  696. + uint32 seconds;
  697. + uint32 nseconds;
  698. +};
  699. +
  700. +
  701. +/*
  702. + * File attributes (v3)
  703. + */
  704. +struct fattr3 {
  705. + ftype3 type; /* file type */
  706. + mode3 mode; /* protection mode bits */
  707. + uint32 nlink; /* # hard links */
  708. + uid3 uid; /* owner user id */
  709. + gid3 gid; /* owner group id */
  710. + size3 size; /* file size in bytes */
  711. + size3 used; /* prefered block size */
  712. + specdata3 rdev; /* special device # */
  713. + uint64 fsid; /* device # */
  714. + fileid3 fileid; /* inode # */
  715. + nfstime3 atime; /* time of last access */
  716. + nfstime3 mtime; /* time of last modification */
  717. + nfstime3 ctime; /* time of last change */
  718. +};
  719. +
  720. +union post_op_attr switch (bool attributes_follow) {
  721. +case TRUE:
  722. + fattr3 attributes;
  723. +case FALSE:
  724. + void;
  725. +};
  726. +
  727. +struct wcc_attr {
  728. + size3 size;
  729. + nfstime3 mtime;
  730. + nfstime3 ctime;
  731. +};
  732. +
  733. +union pre_op_attr switch (bool attributes_follow) {
  734. +case TRUE:
  735. + wcc_attr attributes;
  736. +case FALSE:
  737. + void;
  738. +};
  739. +
  740. +struct wcc_data {
  741. + pre_op_attr before;
  742. + post_op_attr after;
  743. +};
  744. +
  745. +union post_op_fh3 switch (bool handle_follows) {
  746. +case TRUE:
  747. + nfs_fh3 handle;
  748. +case FALSE:
  749. + void;
  750. +};
  751. +
  752. +/*
  753. + * File attributes which can be set (v3)
  754. + */
  755. +enum time_how {
  756. + DONT_CHANGE = 0,
  757. + SET_TO_SERVER_TIME = 1,
  758. + SET_TO_CLIENT_TIME = 2
  759. +};
  760. +
  761. +union set_mode3 switch (bool set_it) {
  762. +case TRUE:
  763. + mode3 mode;
  764. +default:
  765. + void;
  766. +};
  767. +
  768. +union set_uid3 switch (bool set_it) {
  769. +case TRUE:
  770. + uid3 uid;
  771. +default:
  772. + void;
  773. +};
  774. +
  775. +union set_gid3 switch (bool set_it) {
  776. +case TRUE:
  777. + gid3 gid;
  778. +default:
  779. + void;
  780. +};
  781. +
  782. +union set_size3 switch (bool set_it) {
  783. +case TRUE:
  784. + size3 size;
  785. +default:
  786. + void;
  787. +};
  788. +
  789. +union set_atime switch (time_how set_it) {
  790. +case SET_TO_CLIENT_TIME:
  791. + nfstime3 atime;
  792. +default:
  793. + void;
  794. +};
  795. +
  796. +union set_mtime switch (time_how set_it) {
  797. +case SET_TO_CLIENT_TIME:
  798. + nfstime3 mtime;
  799. +default:
  800. + void;
  801. +};
  802. +
  803. +struct sattr3 {
  804. + set_mode3 mode;
  805. + set_uid3 uid;
  806. + set_gid3 gid;
  807. + set_size3 size;
  808. + set_atime atime;
  809. + set_mtime mtime;
  810. +};
  811. +
  812. +/*
  813. + * Arguments for directory operations (v3)
  814. + */
  815. +struct diropargs3 {
  816. + nfs_fh3 dir; /* directory file handle */
  817. + filename3 name; /* name (up to NFS_MAXNAMLEN bytes) */
  818. +};
  819. +
  820. +/*
  821. + * Arguments to getattr (v3).
  822. + */
  823. +struct GETATTR3args {
  824. + nfs_fh3 object;
  825. +};
  826. +
  827. +struct GETATTR3resok {
  828. + fattr3 obj_attributes;
  829. +};
  830. +
  831. +union GETATTR3res switch (nfsstat3 status) {
  832. +case NFS3_OK:
  833. + GETATTR3resok resok;
  834. +default:
  835. + void;
  836. +};
  837. +
  838. +/*
  839. + * Arguments to setattr (v3).
  840. + */
  841. +union sattrguard3 switch (bool check) {
  842. +case TRUE:
  843. + nfstime3 obj_ctime;
  844. +case FALSE:
  845. + void;
  846. +};
  847. +
  848. +struct SETATTR3args {
  849. + nfs_fh3 object;
  850. + sattr3 new_attributes;
  851. + sattrguard3 guard;
  852. +};
  853. +
  854. +struct SETATTR3resok {
  855. + wcc_data obj_wcc;
  856. +};
  857. +
  858. +struct SETATTR3resfail {
  859. + wcc_data obj_wcc;
  860. +};
  861. +
  862. +union SETATTR3res switch (nfsstat3 status) {
  863. +case NFS3_OK:
  864. + SETATTR3resok resok;
  865. +default:
  866. + SETATTR3resfail resfail;
  867. +};
  868. +
  869. +/*
  870. + * Arguments to lookup (v3).
  871. + */
  872. +struct LOOKUP3args {
  873. + diropargs3 what;
  874. +};
  875. +
  876. +struct LOOKUP3resok {
  877. + nfs_fh3 object;
  878. + post_op_attr obj_attributes;
  879. + post_op_attr dir_attributes;
  880. +};
  881. +
  882. +struct LOOKUP3resfail {
  883. + post_op_attr dir_attributes;
  884. +};
  885. +
  886. +union LOOKUP3res switch (nfsstat3 status) {
  887. +case NFS3_OK:
  888. + LOOKUP3resok resok;
  889. +default:
  890. + LOOKUP3resfail resfail;
  891. +};
  892. +
  893. +/*
  894. + * Arguments to access (v3).
  895. + */
  896. +const ACCESS3_READ = 0x0001;
  897. +const ACCESS3_LOOKUP = 0x0002;
  898. +const ACCESS3_MODIFY = 0x0004;
  899. +const ACCESS3_EXTEND = 0x0008;
  900. +const ACCESS3_DELETE = 0x0010;
  901. +const ACCESS3_EXECUTE = 0x0020;
  902. +
  903. +struct ACCESS3args {
  904. + nfs_fh3 object;
  905. + uint32 access;
  906. +};
  907. +
  908. +struct ACCESS3resok {
  909. + post_op_attr obj_attributes;
  910. + uint32 access;
  911. +};
  912. +
  913. +struct ACCESS3resfail {
  914. + post_op_attr obj_attributes;
  915. +};
  916. +
  917. +union ACCESS3res switch (nfsstat3 status) {
  918. +case NFS3_OK:
  919. + ACCESS3resok resok;
  920. +default:
  921. + ACCESS3resfail resfail;
  922. +};
  923. +
  924. +/*
  925. + * Arguments to readlink (v3).
  926. + */
  927. +struct READLINK3args {
  928. + nfs_fh3 symlink;
  929. +};
  930. +
  931. +struct READLINK3resok {
  932. + post_op_attr symlink_attributes;
  933. + nfspath3 data;
  934. +};
  935. +
  936. +struct READLINK3resfail {
  937. + post_op_attr symlink_attributes;
  938. +};
  939. +
  940. +union READLINK3res switch (nfsstat3 status) {
  941. +case NFS3_OK:
  942. + READLINK3resok resok;
  943. +default:
  944. + READLINK3resfail resfail;
  945. +};
  946. +
  947. +/*
  948. + * Arguments to read (v3).
  949. + */
  950. +struct READ3args {
  951. + nfs_fh3 file;
  952. + offset3 offset;
  953. + count3 count;
  954. +};
  955. +
  956. +struct READ3resok {
  957. + post_op_attr file_attributes;
  958. + count3 count;
  959. + bool eof;
  960. + opaque data<>;
  961. +};
  962. +
  963. +struct READ3resfail {
  964. + post_op_attr file_attributes;
  965. +};
  966. +
  967. +/* XXX: solaris 2.6 uses ``nfsstat'' here */
  968. +union READ3res switch (nfsstat3 status) {
  969. +case NFS3_OK:
  970. + READ3resok resok;
  971. +default:
  972. + READ3resfail resfail;
  973. +};
  974. +
  975. +/*
  976. + * Arguments to write (v3).
  977. + */
  978. +enum stable_how {
  979. + UNSTABLE = 0,
  980. + DATA_SYNC = 1,
  981. + FILE_SYNC = 2
  982. +};
  983. +
  984. +struct WRITE3args {
  985. + nfs_fh3 file;
  986. + offset3 offset;
  987. + count3 count;
  988. + stable_how stable;
  989. + opaque data<>;
  990. +};
  991. +
  992. +struct WRITE3resok {
  993. + wcc_data file_wcc;
  994. + count3 count;
  995. + stable_how committed;
  996. + writeverf3 verf;
  997. +};
  998. +
  999. +struct WRITE3resfail {
  1000. + wcc_data file_wcc;
  1001. +};
  1002. +
  1003. +union WRITE3res switch (nfsstat3 status) {
  1004. +case NFS3_OK:
  1005. + WRITE3resok resok;
  1006. +default:
  1007. + WRITE3resfail resfail;
  1008. +};
  1009. +
  1010. +/*
  1011. + * Arguments to create (v3).
  1012. + */
  1013. +enum createmode3 {
  1014. + UNCHECKED = 0,
  1015. + GUARDED = 1,
  1016. + EXCLUSIVE = 2
  1017. +};
  1018. +
  1019. +union createhow3 switch (createmode3 mode) {
  1020. +case UNCHECKED:
  1021. +case GUARDED:
  1022. + sattr3 obj_attributes;
  1023. +case EXCLUSIVE:
  1024. + createverf3 verf;
  1025. +};
  1026. +
  1027. +struct CREATE3args {
  1028. + diropargs3 where;
  1029. + createhow3 how;
  1030. +};
  1031. +
  1032. +struct CREATE3resok {
  1033. + post_op_fh3 obj;
  1034. + post_op_attr obj_attributes;
  1035. + wcc_data dir_wcc;
  1036. +};
  1037. +
  1038. +struct CREATE3resfail {
  1039. + wcc_data dir_wcc;
  1040. +};
  1041. +
  1042. +union CREATE3res switch (nfsstat3 status) {
  1043. +case NFS3_OK:
  1044. + CREATE3resok resok;
  1045. +default:
  1046. + CREATE3resfail resfail;
  1047. +};
  1048. +
  1049. +/*
  1050. + * Arguments to mkdir (v3).
  1051. + */
  1052. +struct MKDIR3args {
  1053. + diropargs3 where;
  1054. + sattr3 attributes;
  1055. +};
  1056. +
  1057. +struct MKDIR3resok {
  1058. + post_op_fh3 obj;
  1059. + post_op_attr obj_attributes;
  1060. + wcc_data dir_wcc;
  1061. +};
  1062. +
  1063. +struct MKDIR3resfail {
  1064. + wcc_data dir_wcc;
  1065. +};
  1066. +
  1067. +union MKDIR3res switch (nfsstat3 status) {
  1068. +case NFS3_OK:
  1069. + MKDIR3resok resok;
  1070. +default:
  1071. + MKDIR3resfail resfail;
  1072. +};
  1073. +
  1074. +/*
  1075. + * Arguments to symlink (v3).
  1076. + */
  1077. +struct symlinkdata3 {
  1078. + sattr3 symlink_attributes;
  1079. + nfspath3 symlink_data;
  1080. +};
  1081. +
  1082. +struct SYMLINK3args {
  1083. + diropargs3 where;
  1084. + symlinkdata3 symlink;
  1085. +};
  1086. +
  1087. +struct SYMLINK3resok {
  1088. + post_op_fh3 obj;
  1089. + post_op_attr obj_attributes;
  1090. + wcc_data dir_wcc;
  1091. +};
  1092. +
  1093. +struct SYMLINK3resfail {
  1094. + wcc_data dir_wcc;
  1095. +};
  1096. +
  1097. +union SYMLINK3res switch (nfsstat3 status) {
  1098. +case NFS3_OK:
  1099. + SYMLINK3resok resok;
  1100. +default:
  1101. + SYMLINK3resfail resfail;
  1102. +};
  1103. +
  1104. +/*
  1105. + * Arguments to mknod (v3).
  1106. + */
  1107. +struct devicedata3 {
  1108. + sattr3 dev_attributes;
  1109. + specdata3 spec;
  1110. +};
  1111. +
  1112. +union mknoddata3 switch (ftype3 type) {
  1113. +case NF3CHR:
  1114. +case NF3BLK:
  1115. + devicedata3 device;
  1116. +case NF3SOCK:
  1117. +case NF3FIFO:
  1118. + sattr3 pipe_attributes;
  1119. +default:
  1120. + void;
  1121. +};
  1122. +
  1123. +struct MKNOD3args {
  1124. + diropargs3 where;
  1125. + mknoddata3 what;
  1126. +};
  1127. +
  1128. +struct MKNOD3resok {
  1129. + post_op_fh3 obj;
  1130. + post_op_attr obj_attributes;
  1131. + wcc_data dir_wcc;
  1132. +};
  1133. +
  1134. +struct MKNOD3resfail {
  1135. + wcc_data dir_wcc;
  1136. +};
  1137. +
  1138. +union MKNOD3res switch (nfsstat3 status) {
  1139. +case NFS3_OK:
  1140. + MKNOD3resok resok;
  1141. +default:
  1142. + MKNOD3resfail resfail;
  1143. +};
  1144. +
  1145. +/*
  1146. + * Arguments to remove (v3).
  1147. + */
  1148. +struct REMOVE3args {
  1149. + diropargs3 object;
  1150. +};
  1151. +
  1152. +struct REMOVE3resok {
  1153. + wcc_data dir_wcc;
  1154. +};
  1155. +
  1156. +struct REMOVE3resfail {
  1157. + wcc_data dir_wcc;
  1158. +};
  1159. +
  1160. +union REMOVE3res switch (nfsstat3 status) {
  1161. +case NFS3_OK:
  1162. + REMOVE3resok resok;
  1163. +default:
  1164. + REMOVE3resfail resfail;
  1165. +};
  1166. +
  1167. +/*
  1168. + * Arguments to rmdir (v3).
  1169. + */
  1170. +struct RMDIR3args {
  1171. + diropargs3 object;
  1172. +};
  1173. +
  1174. +struct RMDIR3resok {
  1175. + wcc_data dir_wcc;
  1176. +};
  1177. +
  1178. +struct RMDIR3resfail {
  1179. + wcc_data dir_wcc;
  1180. +};
  1181. +
  1182. +union RMDIR3res switch (nfsstat3 status) {
  1183. +case NFS3_OK:
  1184. + RMDIR3resok resok;
  1185. +default:
  1186. + RMDIR3resfail resfail;
  1187. +};
  1188. +
  1189. +/*
  1190. + * Arguments to rename (v3).
  1191. + */
  1192. +struct RENAME3args {
  1193. + diropargs3 from;
  1194. + diropargs3 to;
  1195. +};
  1196. +
  1197. +struct RENAME3resok {
  1198. + wcc_data fromdir_wcc;
  1199. + wcc_data todir_wcc;
  1200. +};
  1201. +
  1202. +struct RENAME3resfail {
  1203. + wcc_data fromdir_wcc;
  1204. + wcc_data todir_wcc;
  1205. +};
  1206. +
  1207. +union RENAME3res switch (nfsstat3 status) {
  1208. +case NFS3_OK:
  1209. + RENAME3resok resok;
  1210. +default:
  1211. + RENAME3resfail resfail;
  1212. +};
  1213. +
  1214. +/*
  1215. + * Arguments to link (v3).
  1216. + */
  1217. +struct LINK3args {
  1218. + nfs_fh3 file;
  1219. + diropargs3 link;
  1220. +};
  1221. +
  1222. +struct LINK3resok {
  1223. + post_op_attr file_attributes;
  1224. + wcc_data linkdir_wcc;
  1225. +};
  1226. +
  1227. +struct LINK3resfail {
  1228. + post_op_attr file_attributes;
  1229. + wcc_data linkdir_wcc;
  1230. +};
  1231. +
  1232. +union LINK3res switch (nfsstat3 status) {
  1233. +case NFS3_OK:
  1234. + LINK3resok resok;
  1235. +default:
  1236. + LINK3resfail resfail;
  1237. +};
  1238. +
  1239. +/*
  1240. + * Arguments to readdir (v3).
  1241. + */
  1242. +struct READDIR3args {
  1243. + nfs_fh3 dir;
  1244. + cookie3 cookie;
  1245. + cookieverf3 cookieverf;
  1246. + count3 count;
  1247. +};
  1248. +
  1249. +struct entry3 {
  1250. + fileid3 fileid;
  1251. + filename3 name;
  1252. + cookie3 cookie;
  1253. + entry3 *nextentry;
  1254. +};
  1255. +
  1256. +struct dirlist3 {
  1257. + entry3 *entries;
  1258. + bool eof;
  1259. +};
  1260. +
  1261. +struct READDIR3resok {
  1262. + post_op_attr dir_attributes;
  1263. + cookieverf3 cookieverf;
  1264. + dirlist3 reply;
  1265. +};
  1266. +
  1267. +struct READDIR3resfail {
  1268. + post_op_attr dir_attributes;
  1269. +};
  1270. +
  1271. +union READDIR3res switch (nfsstat3 status) {
  1272. +case NFS3_OK:
  1273. + READDIR3resok resok;
  1274. +default:
  1275. + READDIR3resfail resfail;
  1276. +};
  1277. +
  1278. +/*
  1279. + * Arguments to readdirplus (v3).
  1280. + */
  1281. +struct READDIRPLUS3args {
  1282. + nfs_fh3 dir;
  1283. + cookie3 cookie;
  1284. + cookieverf3 cookieverf;
  1285. + count3 dircount;
  1286. + count3 maxcount;
  1287. +};
  1288. +
  1289. +struct entryplus3 {
  1290. + fileid3 fileid;
  1291. + filename3 name;
  1292. + cookie3 cookie;
  1293. + post_op_attr name_attributes;
  1294. + post_op_fh3 name_handle;
  1295. + entryplus3 *nextentry;
  1296. +};
  1297. +
  1298. +struct dirlistplus3 {
  1299. + entryplus3 *entries;
  1300. + bool eof;
  1301. +};
  1302. +
  1303. +struct READDIRPLUS3resok {
  1304. + post_op_attr dir_attributes;
  1305. + cookieverf3 cookieverf;
  1306. + dirlistplus3 reply;
  1307. +};
  1308. +
  1309. +struct READDIRPLUS3resfail {
  1310. + post_op_attr dir_attributes;
  1311. +};
  1312. +
  1313. +union READDIRPLUS3res switch (nfsstat3 status) {
  1314. +case NFS3_OK:
  1315. + READDIRPLUS3resok resok;
  1316. +default:
  1317. + READDIRPLUS3resfail resfail;
  1318. +};
  1319. +
  1320. +/*
  1321. + * Arguments to fsstat (v3).
  1322. + */
  1323. +struct FSSTAT3args {
  1324. + nfs_fh3 fsroot;
  1325. +};
  1326. +
  1327. +struct FSSTAT3resok {
  1328. + post_op_attr obj_attributes;
  1329. + size3 tbytes;
  1330. + size3 fbytes;
  1331. + size3 abytes;
  1332. + size3 tfiles;
  1333. + size3 ffiles;
  1334. + size3 afiles;
  1335. + uint32 invarsec;
  1336. +};
  1337. +
  1338. +struct FSSTAT3resfail {
  1339. + post_op_attr obj_attributes;
  1340. +};
  1341. +
  1342. +union FSSTAT3res switch (nfsstat3 status) {
  1343. +case NFS3_OK:
  1344. + FSSTAT3resok resok;
  1345. +default:
  1346. + FSSTAT3resfail resfail;
  1347. +};
  1348. +
  1349. +/*
  1350. + * Arguments to fsinfo (v3).
  1351. + */
  1352. +const FSF3_LINK = 0x0001;
  1353. +const FSF3_SYMLINK = 0x0002;
  1354. +const FSF3_HOMOGENEOUS = 0x0008;
  1355. +const FSF3_CANSETTIME = 0x0010;
  1356. +
  1357. +struct FSINFO3args {
  1358. + nfs_fh3 fsroot;
  1359. +};
  1360. +
  1361. +struct FSINFO3resok {
  1362. + post_op_attr obj_attributes;
  1363. + uint32 rtmax;
  1364. + uint32 rtpref;
  1365. + uint32 rtmult;
  1366. + uint32 wtmax;
  1367. + uint32 wtpref;
  1368. + uint32 wtmult;
  1369. + uint32 dtpref;
  1370. + size3 maxfilesize;
  1371. + nfstime3 time_delta;
  1372. + uint32 properties;
  1373. +};
  1374. +
  1375. +struct FSINFO3resfail {
  1376. + post_op_attr obj_attributes;
  1377. +};
  1378. +
  1379. +union FSINFO3res switch (nfsstat3 status) {
  1380. +case NFS3_OK:
  1381. + FSINFO3resok resok;
  1382. +default:
  1383. + FSINFO3resfail resfail;
  1384. +};
  1385. +
  1386. +/*
  1387. + * Arguments to pathconf (v3).
  1388. + */
  1389. +struct PATHCONF3args {
  1390. + nfs_fh3 object;
  1391. +};
  1392. +
  1393. +struct PATHCONF3resok {
  1394. + post_op_attr obj_attributes;
  1395. + uint32 linkmax;
  1396. + uint32 name_max;
  1397. + bool no_trunc;
  1398. + bool chown_restricted;
  1399. + bool case_insensitive;
  1400. + bool case_preserving;
  1401. +};
  1402. +
  1403. +struct PATHCONF3resfail {
  1404. + post_op_attr obj_attributes;
  1405. +};
  1406. +
  1407. +union PATHCONF3res switch (nfsstat3 status) {
  1408. +case NFS3_OK:
  1409. + PATHCONF3resok resok;
  1410. +default:
  1411. + PATHCONF3resfail resfail;
  1412. +};
  1413. +
  1414. +/*
  1415. + * Arguments to commit (v3).
  1416. + */
  1417. +struct COMMIT3args {
  1418. + nfs_fh3 file;
  1419. + offset3 offset;
  1420. + count3 count;
  1421. +};
  1422. +
  1423. +struct COMMIT3resok {
  1424. + wcc_data file_wcc;
  1425. + writeverf3 verf;
  1426. +};
  1427. +
  1428. +struct COMMIT3resfail {
  1429. + wcc_data file_wcc;
  1430. +};
  1431. +
  1432. +union COMMIT3res switch (nfsstat3 status) {
  1433. +case NFS3_OK:
  1434. + COMMIT3resok resok;
  1435. +default:
  1436. + COMMIT3resfail resfail;
  1437. +};
  1438. +
  1439. +#endif /* WANT_NFS3 */
  1440. +
  1441. +/*
  1442. + * Remote file service routines
  1443. + */
  1444. +program NFS_PROGRAM {
  1445. + version NFS_VERSION {
  1446. + void
  1447. + NFSPROC_NULL(void) = 0;
  1448. +
  1449. + attrstat
  1450. + NFSPROC_GETATTR(nfs_fh) = 1;
  1451. +
  1452. + attrstat
  1453. + NFSPROC_SETATTR(sattrargs) = 2;
  1454. +
  1455. + void
  1456. + NFSPROC_ROOT(void) = 3;
  1457. +
  1458. + diropres
  1459. + NFSPROC_LOOKUP(diropargs) = 4;
  1460. +
  1461. + readlinkres
  1462. + NFSPROC_READLINK(nfs_fh) = 5;
  1463. +
  1464. + readres
  1465. + NFSPROC_READ(readargs) = 6;
  1466. +
  1467. + void
  1468. + NFSPROC_WRITECACHE(void) = 7;
  1469. +
  1470. + attrstat
  1471. + NFSPROC_WRITE(writeargs) = 8;
  1472. +
  1473. + diropres
  1474. + NFSPROC_CREATE(createargs) = 9;
  1475. +
  1476. + nfsstat
  1477. + NFSPROC_REMOVE(diropargs) = 10;
  1478. +
  1479. + nfsstat
  1480. + NFSPROC_RENAME(renameargs) = 11;
  1481. +
  1482. + nfsstat
  1483. + NFSPROC_LINK(linkargs) = 12;
  1484. +
  1485. + nfsstat
  1486. + NFSPROC_SYMLINK(symlinkargs) = 13;
  1487. +
  1488. + diropres
  1489. + NFSPROC_MKDIR(createargs) = 14;
  1490. +
  1491. + nfsstat
  1492. + NFSPROC_RMDIR(diropargs) = 15;
  1493. +
  1494. + readdirres
  1495. + NFSPROC_READDIR(readdirargs) = 16;
  1496. +
  1497. + statfsres
  1498. + NFSPROC_STATFS(nfs_fh) = 17;
  1499. + } = 2;
  1500. +} = 100003;
  1501. +#ifdef WANT_NFS3
  1502. +program NFS3_PROGRAM {
  1503. + version NFS_V3 {
  1504. + void
  1505. + NFSPROC3_NULL(void) = 0;
  1506. +
  1507. + GETATTR3res
  1508. + NFSPROC3_GETATTR(GETATTR3args) = 1;
  1509. +
  1510. + SETATTR3res
  1511. + NFSPROC3_SETATTR(SETATTR3args) = 2;
  1512. +
  1513. + LOOKUP3res
  1514. + NFSPROC3_LOOKUP(LOOKUP3args) = 3;
  1515. +
  1516. + ACCESS3res
  1517. + NFSPROC3_ACCESS(ACCESS3args) = 4;
  1518. +
  1519. + READLINK3res
  1520. + NFSPROC3_READLINK(READLINK3args) = 5;
  1521. +
  1522. + READ3res
  1523. + NFSPROC3_READ(READ3args) = 6;
  1524. +
  1525. + WRITE3res
  1526. + NFSPROC3_WRITE(WRITE3args) = 7;
  1527. +
  1528. + CREATE3res
  1529. + NFSPROC3_CREATE(CREATE3args) = 8;
  1530. +
  1531. + MKDIR3res
  1532. + NFSPROC3_MKDIR(MKDIR3args) = 9;
  1533. +
  1534. + SYMLINK3res
  1535. + NFSPROC3_SYMLINK(SYMLINK3args) = 10;
  1536. +
  1537. + MKNOD3res
  1538. + NFSPROC3_MKNOD(MKNOD3args) = 11;
  1539. +
  1540. + REMOVE3res
  1541. + NFSPROC3_REMOVE(REMOVE3args) = 12;
  1542. +
  1543. + RMDIR3res
  1544. + NFSPROC3_RMDIR(RMDIR3args) = 13;
  1545. +
  1546. + RENAME3res
  1547. + NFSPROC3_RENAME(RENAME3args) = 14;
  1548. +
  1549. + LINK3res
  1550. + NFSPROC3_LINK(LINK3args) = 15;
  1551. +
  1552. + READDIR3res
  1553. + NFSPROC3_READDIR(READDIR3args) = 16;
  1554. +
  1555. + READDIRPLUS3res
  1556. + NFSPROC3_READDIRPLUS(READDIRPLUS3args) = 17;
  1557. +
  1558. + FSSTAT3res
  1559. + NFSPROC3_FSSTAT(FSSTAT3args) = 18;
  1560. +
  1561. + FSINFO3res
  1562. + NFSPROC3_FSINFO(FSINFO3args) = 19;
  1563. +
  1564. + PATHCONF3res
  1565. + NFSPROC3_PATHCONF(PATHCONF3args) = 20;
  1566. +
  1567. + COMMIT3res
  1568. + NFSPROC3_COMMIT(COMMIT3args) = 21;
  1569. + } = 3;
  1570. +} = 100003;
  1571. +#endif
  1572. +
  1573. diff --git a/tirpc/rpcsvc/rquota.x b/tirpc/rpcsvc/rquota.x
  1574. new file mode 100644
  1575. index 0000000..72864d1
  1576. --- /dev/null
  1577. +++ b/tirpc/rpcsvc/rquota.x
  1578. @@ -0,0 +1,67 @@
  1579. +/*
  1580. + * Remote quota protocol
  1581. + * Requires unix authentication
  1582. + */
  1583. +
  1584. +#ifndef RPC_HDR
  1585. +%#ifndef lint
  1586. +%/*static char sccsid[] = "from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/
  1587. +%/*static char sccsid[] = "from: @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC";*/
  1588. +%static const char rcsid[] =
  1589. +% "$FreeBSD: src/include/rpcsvc/rquota.x,v 1.6 1999/08/27 23:45:10 peter Exp $";
  1590. +%#endif /* not lint */
  1591. +#endif
  1592. +
  1593. +const RQ_PATHLEN = 1024;
  1594. +
  1595. +struct getquota_args {
  1596. + string gqa_pathp<RQ_PATHLEN>; /* path to filesystem of interest */
  1597. + int gqa_uid; /* inquire about quota for uid */
  1598. +};
  1599. +
  1600. +/*
  1601. + * remote quota structure
  1602. + */
  1603. +struct rquota {
  1604. + int rq_bsize; /* block size for block counts */
  1605. + bool rq_active; /* indicates whether quota is active */
  1606. + unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */
  1607. + unsigned int rq_bsoftlimit; /* preferred limit on disk blks */
  1608. + unsigned int rq_curblocks; /* current block count */
  1609. + unsigned int rq_fhardlimit; /* absolute limit on allocated files */
  1610. + unsigned int rq_fsoftlimit; /* preferred file limit */
  1611. + unsigned int rq_curfiles; /* current # allocated files */
  1612. + unsigned int rq_btimeleft; /* time left for excessive disk use */
  1613. + unsigned int rq_ftimeleft; /* time left for excessive files */
  1614. +};
  1615. +
  1616. +enum gqr_status {
  1617. + Q_OK = 1, /* quota returned */
  1618. + Q_NOQUOTA = 2, /* noquota for uid */
  1619. + Q_EPERM = 3 /* no permission to access quota */
  1620. +};
  1621. +
  1622. +union getquota_rslt switch (gqr_status status) {
  1623. +case Q_OK:
  1624. + rquota gqr_rquota; /* valid if status == Q_OK */
  1625. +case Q_NOQUOTA:
  1626. + void;
  1627. +case Q_EPERM:
  1628. + void;
  1629. +};
  1630. +
  1631. +program RQUOTAPROG {
  1632. + version RQUOTAVERS {
  1633. + /*
  1634. + * Get all quotas
  1635. + */
  1636. + getquota_rslt
  1637. + RQUOTAPROC_GETQUOTA(getquota_args) = 1;
  1638. +
  1639. + /*
  1640. + * Get active quotas only
  1641. + */
  1642. + getquota_rslt
  1643. + RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
  1644. + } = 1;
  1645. +} = 100011;
  1646. --
  1647. 1.9.1