]> git.pld-linux.org Git - packages/util-linux.git/blob - util-linux-2.12-02-base-nfsv4.dif
- init var
[packages/util-linux.git] / util-linux-2.12-02-base-nfsv4.dif
1
2 Add basic nfsv4 support
3
4 ---
5
6  util-linux-2.12-bfields/mount/Makefile     |    2 
7  util-linux-2.12-bfields/mount/fstab.5      |    1 
8  util-linux-2.12-bfields/mount/mount.8      |   75 ++++++
9  util-linux-2.12-bfields/mount/mount.c      |   13 +
10  util-linux-2.12-bfields/mount/nfs.5        |  200 +++++++++++++++++
11  util-linux-2.12-bfields/mount/nfs4_mount.h |   82 +++++++
12  util-linux-2.12-bfields/mount/nfs4mount.c  |  335 +++++++++++++++++++++++++++++
13  util-linux-2.12-bfields/mount/nfsmount.c   |    5 
14  util-linux-2.12-bfields/mount/sundries.h   |    2 
15  util-linux-2.12-bfields/mount/umount.c     |    3 
16  10 files changed, 710 insertions(+), 8 deletions(-)
17
18 diff -puN mount/fstab.5~base-nfsv4 mount/fstab.5
19 --- util-linux-2.12/mount/fstab.5~base-nfsv4    2004-10-13 13:51:50.000000000 -0400
20 +++ util-linux-2.12-bfields/mount/fstab.5       2004-10-13 13:51:50.000000000 -0400
21 @@ -115,6 +115,7 @@ of filesystem types, such as
22  .IR msdos ,
23  .IR ncpfs ,
24  .IR nfs ,
25 +.IR nfs4 ,
26  .IR ntfs ,
27  .IR proc ,
28  .IR qnx4 ,
29 diff -puN mount/Makefile~base-nfsv4 mount/Makefile
30 --- util-linux-2.12/mount/Makefile~base-nfsv4   2004-10-13 13:51:50.000000000 -0400
31 +++ util-linux-2.12-bfields/mount/Makefile      2004-10-13 13:51:50.000000000 -0400
32 @@ -31,7 +31,7 @@
33  
34  LO_OBJS = lomount.o $(LIB)/xstrncpy.o
35  CRYPT_OBJS = cryptsetup.o -lcryptsetup
36 -NFS_OBJS = nfsmount.o nfsmount_xdr.o
37 +NFS_OBJS = nfsmount.o nfsmount_xdr.o nfs4mount.o
38  GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
39  
40  all: $(PROGS)
41 diff -puN mount/mount.8~base-nfsv4 mount/mount.8
42 --- util-linux-2.12/mount/mount.8~base-nfsv4    2004-10-13 13:51:50.000000000 -0400
43 +++ util-linux-2.12-bfields/mount/mount.8       2004-10-13 13:51:50.000000000 -0400
44 @@ -370,6 +370,7 @@ currently supported are:
45  .IR msdos ,
46  .IR ncpfs ,
47  .IR nfs ,
48 +.IR nfs4 ,
49  .IR ntfs ,
50  .IR proc ,
51  .IR qnx4 ,
52 @@ -403,7 +404,7 @@ For most types all the
53  program has to do is issue a simple
54  .IR mount (2)
55  system call, and no detailed knowledge of the filesystem type is required.
56 -For a few types however (like nfs, smbfs, ncpfs) ad hoc code is
57 +For a few types however (like nfs, nfs4, smbfs, ncpfs) ad hoc code is
58  necessary. The nfs ad hoc code is built in, but smbfs and ncpfs
59  have a separate mount program. In order to make it possible to
60  treat all types in a uniform way, mount will execute the program
61 @@ -451,9 +452,10 @@ or, if that does not exist,
62  All of the filesystem types listed there will be tried,
63  except for those that are labeled "nodev" (e.g.,
64  .IR devpts ,
65 -.I proc
66 +.IR proc ,
67 +.IR nfs ,
68  and
69 -.IR nfs ).
70 +.IR nfs4 ).
71  If
72  .I /etc/filesystems
73  ends in a line with a single * only, mount will read
74 @@ -1243,6 +1245,73 @@ Usually it just causes lots of trouble.
75  .B nolock
76  Do not use locking. Do not start lockd.
77  
78 +.SH "Mount options for nfs4"
79 +Instead of a textual option string, parsed by the kernel, the
80 +.I nfs4
81 +file system expects a binary argument of type
82 +.IR "struct nfs4_mount_data" .
83 +The program
84 +.B mount
85 +itself parses the following options of the form `tag=value',
86 +and puts them in the structure mentioned:
87 +.BI rsize= n,
88 +.BI wsize= n,
89 +.BI timeo= n,
90 +.BI retrans= n,
91 +.BI acregmin= n,
92 +.BI acregmax= n,
93 +.BI acdirmin= n,
94 +.BI acdirmax= n,
95 +.BI actimeo= n,
96 +.BI retry= n,
97 +.BI port= n,
98 +.BI proto= n,
99 +.BI clientaddr= n,
100 +.BI sec= n.
101 +The option
102 +.BI addr= n
103 +is accepted but ignored.
104 +Also the following Boolean options, possibly preceded by
105 +.B no
106 +are recognized:
107 +.BR bg ,
108 +.BR fg ,
109 +.BR soft ,
110 +.BR hard ,
111 +.BR intr ,
112 +.BR cto ,
113 +.BR ac ,
114 +For details, see
115 +.BR nfs (5).
116 +
117 +Especially useful options include
118 +.TP
119 +.B rsize=32768,wsize=32768
120 +This will make your NFS connection faster than with the default
121 +buffer size of 4096.
122 +.TP
123 +.B hard
124 +The program accessing a file on a NFS mounted file system will hang
125 +when the server crashes. The process cannot be interrupted or
126 +killed unless you also specify
127 +.BR intr .
128 +When the NFS server is back online the program will continue undisturbed
129 +from where it was. This is probably what you want.
130 +.TP
131 +.B soft
132 +This option allows the kernel to time out if the NFS server is not
133 +responding for some time. The time can be
134 +specified with
135 +.BR timeo=time .
136 +This timeout value is expressed in tenths of a second.
137 +The
138 +.BR soft
139 +option might be useful if your NFS server sometimes doesn't respond
140 +or will be rebooted while some process tries to get a file from the server.
141 +Avoid using this option with
142 +.BR proto=udp
143 +or with a short timeout.
144 +
145  .SH "Mount options for ntfs"
146  .TP
147  .BI iocharset= name
148 diff -puN mount/mount.c~base-nfsv4 mount/mount.c
149 --- util-linux-2.12/mount/mount.c~base-nfsv4    2004-10-13 13:51:50.000000000 -0400
150 +++ util-linux-2.12-bfields/mount/mount.c       2004-10-13 13:51:50.000000000 -0400
151 @@ -821,6 +821,19 @@ retry_nfs:
152                       "without support for the type `nfs'"));
153  #endif
154    }
155 +#ifdef HAVE_NFS
156 +  /*
157 +   * NFSv4 support
158 +   */
159 +  if (!fake && types && streq (types, "nfs4")) {
160 +    mnt_err = nfs4mount(spec, node, &flags, &extra_opts, &mount_opts, bg);
161 +    if (mnt_err)
162 +      return mnt_err;
163 +#else
164 +    die (EX_SOFTWARE, _("mount: this version was compiled "
165 +                     "without support for the type `nfs4'"));
166 +#endif
167 +  }
168  
169    block_signals (SIG_BLOCK);
170  
171 diff -puN /dev/null mount/nfs4mount.c
172 --- /dev/null   2004-08-19 17:44:20.000000000 -0400
173 +++ util-linux-2.12-bfields/mount/nfs4mount.c   2004-10-13 13:52:38.000000000 -0400
174 @@ -0,0 +1,335 @@
175 +/*
176 + * nfs4mount.c -- Linux NFS mount
177 + * Copyright (C) 2002 Trond Myklebust <trond.myklebust@fys.uio.no>
178 + *
179 + * This program is free software; you can redistribute it and/or modify
180 + * it under the terms of the GNU General Public License as published by
181 + * the Free Software Foundation; either version 2, or (at your option)
182 + * any later version.
183 + *
184 + * This program is distributed in the hope that it will be useful,
185 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
186 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
187 + * GNU General Public License for more details.
188 + *
189 + * Note: this file based on the original nfsmount.c
190 + */
191 +
192 +#include "../defines.h"        /* for HAVE_rpcsvc_nfs_prot_h and HAVE_inet_aton */
193 +
194 +#include <linux/posix_types.h>
195 +#include <asm/posix_types.h>
196 +#undef __FD_CLR
197 +#undef __FD_SET
198 +#undef __FD_ISSET
199 +#undef __FD_ZERO
200 +
201 +#include <unistd.h>
202 +#include <stdio.h>
203 +#include <string.h>
204 +#include <errno.h>
205 +#include <netdb.h>
206 +#include <time.h>
207 +#include <sys/socket.h>
208 +#include <sys/time.h>
209 +#include <sys/utsname.h>
210 +#include <sys/stat.h>
211 +#include <netinet/in.h>
212 +#include <arpa/inet.h>
213 +
214 +#include "sundries.h"
215 +
216 +#include "mount_constants.h"
217 +#include "nfs4_mount.h"
218 +
219 +#include "nls.h"
220 +
221 +#ifndef NFS_PORT
222 +#define NFS_PORT 2049
223 +#endif
224 +
225 +static int parse_devname(char *hostdir, char **hostname, char **dirname)
226 +{
227 +       char *s;
228 +
229 +       if (!(s = strchr(hostdir, ':'))) {
230 +               fprintf(stderr,
231 +                       _("mount: "
232 +                         "directory to mount not in host:dir format\n"));
233 +               return -1;
234 +       }
235 +       *hostname = hostdir;
236 +       *dirname = s + 1;
237 +       *s = '\0';
238 +       /* Ignore all but first hostname in replicated mounts
239 +          until they can be fully supported. (mack@sgi.com) */
240 +       if ((s = strchr(hostdir, ','))) {
241 +               *s = '\0';
242 +               fprintf(stderr,
243 +                       _("mount: warning: "
244 +                         "multiple hostnames not supported\n"));
245 +       }
246 +       return 0;
247 +}
248 +
249 +static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr)
250 +{
251 +       struct hostent *hp;
252 +       addr->sin_family = AF_INET;
253 +
254 +       if (inet_aton(hostname, &addr->sin_addr))
255 +               return 0;
256 +       if ((hp = gethostbyname(hostname)) == NULL) {
257 +               fprintf(stderr, _("mount: can't get address for %s\n"),
258 +                       hostname);
259 +               return -1;
260 +       }
261 +       if (hp->h_length > sizeof(struct in_addr)) {
262 +               fprintf(stderr,
263 +                       _("mount: got bad hp->h_length\n"));
264 +               hp->h_length = sizeof(struct in_addr);
265 +       }
266 +       memcpy(&addr->sin_addr, hp->h_addr, hp->h_length);
267 +       return 0;
268 +}
269 +
270 +static int get_my_ipv4addr(char *ip_addr, int len)
271 +{
272 +       char myname[1024];
273 +       struct sockaddr_in myaddr;
274 +
275 +       if (gethostname(myname, sizeof(myname))) {
276 +               fprintf(stderr, _("mount: can't determine client address\n"));
277 +               return -1;
278 +       }
279 +       if (fill_ipv4_sockaddr(myname, &myaddr))
280 +               return -1;
281 +       snprintf(ip_addr, len, "%s", inet_ntoa(myaddr.sin_addr));
282 +       ip_addr[len-1] = '\0';
283 +       return 0;
284 +}
285 +
286 +int nfs4mount(const char *spec, const char *node, int *flags,
287 +             char **extra_opts, char **mount_opts,
288 +             int running_bg)
289 +{
290 +       static struct nfs4_mount_data data;
291 +       static char hostdir[1024];
292 +       static char ip_addr[16] = "127.0.0.1";
293 +       static struct sockaddr_in server_addr;
294 +       static int pseudoflavour = 0;
295 +
296 +       char *hostname, *dirname, *old_opts;
297 +       char new_opts[1024];
298 +       char *opt, *opteq;
299 +       char *s;
300 +       int val;
301 +       int bg, soft, intr;
302 +       int nocto, noac;
303 +       int retry;
304 +       int retval;
305 +
306 +       retval = EX_FAIL;
307 +       if (strlen(spec) >= sizeof(hostdir)) {
308 +               fprintf(stderr, _("mount: "
309 +                                 "excessively long host:dir argument\n"));
310 +               goto fail;
311 +       }
312 +       strcpy(hostdir, spec);
313 +       if (parse_devname(hostdir, &hostname, &dirname))
314 +               goto fail;
315 +
316 +       if (fill_ipv4_sockaddr(hostname, &server_addr))
317 +               goto fail;
318 +       if (get_my_ipv4addr(ip_addr, sizeof(ip_addr)))
319 +               goto fail;
320 +
321 +       /* add IP address to mtab options for use when unmounting */
322 +       s = inet_ntoa(server_addr.sin_addr);
323 +       old_opts = *extra_opts;
324 +       if (!old_opts)
325 +               old_opts = "";
326 +       if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
327 +               fprintf(stderr, _("mount: "
328 +                                 "excessively long option argument\n"));
329 +               goto fail;
330 +       }
331 +       snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s",
332 +                old_opts, *old_opts ? "," : "", s);
333 +       *extra_opts = xstrdup(new_opts);
334 +
335 +       /* Set default options.
336 +        * rsize/wsize and timeo are left 0 in order to
337 +        * let the kernel decide.
338 +        */
339 +       memset(&data, 0, sizeof(data));
340 +       data.retrans    = 3;
341 +       data.acregmin   = 3;
342 +       data.acregmax   = 60;
343 +       data.acdirmin   = 30;
344 +       data.acdirmax   = 60;
345 +       data.proto      = IPPROTO_TCP;
346 +
347 +       bg = 0;
348 +       soft = 0;
349 +       intr = 0;
350 +       nocto = 0;
351 +       noac = 0;
352 +       retry = 10000;          /* 10000 minutes ~ 1 week */
353 +
354 +       /*
355 +        * NFSv4 specifies that the default port should be 2049
356 +        */
357 +       server_addr.sin_port = htons(NFS_PORT);
358 +
359 +       /* parse options */
360 +
361 +       for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) {
362 +               if ((opteq = strchr(opt, '='))) {
363 +                       val = atoi(opteq + 1);
364 +                       *opteq = '\0';
365 +                       if (!strcmp(opt, "rsize"))
366 +                               data.rsize = val;
367 +                       else if (!strcmp(opt, "wsize"))
368 +                               data.wsize = val;
369 +                       else if (!strcmp(opt, "timeo"))
370 +                               data.timeo = val;
371 +                       else if (!strcmp(opt, "retrans"))
372 +                               data.retrans = val;
373 +                       else if (!strcmp(opt, "acregmin"))
374 +                               data.acregmin = val;
375 +                       else if (!strcmp(opt, "acregmax"))
376 +                               data.acregmax = val;
377 +                       else if (!strcmp(opt, "acdirmin"))
378 +                               data.acdirmin = val;
379 +                       else if (!strcmp(opt, "acdirmax"))
380 +                               data.acdirmax = val;
381 +                       else if (!strcmp(opt, "actimeo")) {
382 +                               data.acregmin = val;
383 +                               data.acregmax = val;
384 +                               data.acdirmin = val;
385 +                               data.acdirmax = val;
386 +                       }
387 +                       else if (!strcmp(opt, "retry"))
388 +                               retry = val;
389 +                       else if (!strcmp(opt, "port"))
390 +                               server_addr.sin_port = htons(val);
391 +                       else if (!strcmp(opt, "proto")) {
392 +                               if (!strncmp(opteq+1, "tcp", 3))
393 +                                       data.proto = IPPROTO_TCP;
394 +                               else if (!strncmp(opteq+1, "udp", 3))
395 +                                       data.proto = IPPROTO_UDP;
396 +                               else
397 +                                       printf(_("Warning: Unrecognized proto= option.\n"));
398 +                       } else if (!strcmp(opt, "clientaddr")) {
399 +                               if (strlen(opteq+1) >= sizeof(ip_addr))
400 +                                       printf(_("Invalid client address %s"),
401 +                                                               opteq+1);
402 +                               strncpy(ip_addr,opteq+1, sizeof(ip_addr));
403 +                               ip_addr[sizeof(ip_addr)-1] = '\0';
404 +                       } else if (!strcmp(opt, "sec")) {
405 +                               if (!strcmp(opteq+1, "krb5"))
406 +                                       pseudoflavour = 390003;
407 +                               else if (!strcmp(opteq+1, "krb5i"))
408 +                                       pseudoflavour = 390004;
409 +                               else if (!strcmp(opteq+1, "krb5p"))
410 +                                       pseudoflavour = 390005;
411 +                               else if (!strcmp(opteq+1, "lipkey"))
412 +                                       pseudoflavour = 390006;
413 +                               else if (!strcmp(opteq+1, "lipkey-i"))
414 +                                       pseudoflavour = 390007;
415 +                               else if (!strcmp(opteq+1, "lipkey-p"))
416 +                                       pseudoflavour = 390008;
417 +                               else if (!strcmp(opteq+1, "spkm3"))
418 +                                       pseudoflavour = 390009;
419 +                               else if (!strcmp(opteq+1, "spkm3i"))
420 +                                       pseudoflavour = 390010;
421 +                               else if (!strcmp(opteq+1, "spkm3p"))
422 +                                       pseudoflavour = 390011;
423 +                               else {
424 +                                       printf(_("unknown security type %s\n"),
425 +                                                       opteq+1);
426 +                                       goto fail;
427 +                               }
428 +                       } else if (!strcmp(opt, "addr")) {
429 +                               /* ignore */;
430 +                       } else {
431 +                               printf(_("unknown nfs mount parameter: "
432 +                                        "%s=%d\n"), opt, val);
433 +                               goto fail;
434 +                       }
435 +               } else {
436 +                       val = 1;
437 +                       if (!strncmp(opt, "no", 2)) {
438 +                               val = 0;
439 +                               opt += 2;
440 +                       }
441 +                       if (!strcmp(opt, "bg"))
442 +                               bg = val;
443 +                       else if (!strcmp(opt, "fg"))
444 +                               bg = !val;
445 +                       else if (!strcmp(opt, "soft"))
446 +                               soft = val;
447 +                       else if (!strcmp(opt, "hard"))
448 +                               soft = !val;
449 +                       else if (!strcmp(opt, "intr"))
450 +                               intr = val;
451 +                       else if (!strcmp(opt, "cto"))
452 +                               nocto = !val;
453 +                       else if (!strcmp(opt, "ac"))
454 +                               noac = !val;
455 +                       else {
456 +                               if (!sloppy) {
457 +                                       printf(_("unknown nfs mount option: "
458 +                                                "%s%s\n"), val ? "" : "no", opt);
459 +                                       goto fail;
460 +                               }
461 +                       }
462 +               }
463 +       }
464 +
465 +       data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
466 +               | (intr ? NFS4_MOUNT_INTR : 0)
467 +               | (nocto ? NFS4_MOUNT_NOCTO : 0)
468 +               | (noac ? NFS4_MOUNT_NOAC : 0);
469 +
470 +       if (pseudoflavour != 0) {
471 +               data.auth_flavourlen = 1;
472 +               data.auth_flavours = &pseudoflavour;
473 +       }
474 +
475 +       data.client_addr.data = ip_addr;
476 +       data.client_addr.len = strlen(ip_addr);
477 +
478 +       data.mnt_path.data = dirname;
479 +       data.mnt_path.len = strlen(dirname);
480 +
481 +       data.hostname.data = hostname;
482 +       data.hostname.len = strlen(hostname);
483 +       data.host_addr = (struct sockaddr *)&server_addr;
484 +       data.host_addrlen = sizeof(server_addr);
485 +
486 +#ifdef NFS_MOUNT_DEBUG
487 +       printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
488 +              data.rsize, data.wsize, data.timeo, data.retrans);
489 +       printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n",
490 +              data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
491 +       printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
492 +              ntohs(server_addr.sin_port), bg, retry, data.flags);
493 +       printf("soft = %d, intr = %d, nocto = %d, noac = %d\n",
494 +              (data.flags & NFS4_MOUNT_SOFT) != 0,
495 +              (data.flags & NFS4_MOUNT_INTR) != 0,
496 +              (data.flags & NFS4_MOUNT_NOCTO) != 0,
497 +              (data.flags & NFS4_MOUNT_NOAC) != 0);
498 +       printf("proto = %s\n", (data.proto == IPPROTO_TCP) ? "tcp" : "udp");
499 +#endif
500 +
501 +       data.version = NFS4_MOUNT_VERSION;
502 +
503 +       *mount_opts = (char *) &data;
504 +       /* clean up */
505 +       return 0;
506 +
507 +fail:
508 +       return retval;
509 +}
510 diff -puN /dev/null mount/nfs4_mount.h
511 --- /dev/null   2004-08-19 17:44:20.000000000 -0400
512 +++ util-linux-2.12-bfields/mount/nfs4_mount.h  2004-10-13 13:51:50.000000000 -0400
513 @@ -0,0 +1,82 @@
514 +#ifndef _LINUX_NFS4_MOUNT_H
515 +#define _LINUX_NFS4_MOUNT_H
516 +
517 +/*
518 + *  linux/include/linux/nfs4_mount.h
519 + *
520 + *  Copyright (C) 2002  Trond Myklebust
521 + *
522 + *  structure passed from user-space to kernel-space during an nfsv4 mount
523 + */
524 +
525 +/*
526 + * WARNING!  Do not delete or change the order of these fields.  If
527 + * a new field is required then add it to the end.  The version field
528 + * tracks which fields are present.  This will ensure some measure of
529 + * mount-to-kernel version compatibility.  Some of these aren't used yet
530 + * but here they are anyway.
531 + */
532 +#define NFS4_MOUNT_VERSION     1
533 +
534 +struct nfs_string {
535 +       unsigned int len;
536 +       const char* data;
537 +};
538 +
539 +struct nfs4_mount_data {
540 +       int version;                            /* 1 */
541 +       int flags;                              /* 1 */
542 +       int rsize;                              /* 1 */
543 +       int wsize;                              /* 1 */
544 +       int timeo;                              /* 1 */
545 +       int retrans;                            /* 1 */
546 +       int acregmin;                           /* 1 */
547 +       int acregmax;                           /* 1 */
548 +       int acdirmin;                           /* 1 */
549 +       int acdirmax;                           /* 1 */
550 +
551 +       /* see the definition of 'struct clientaddr4' in RFC3010 */
552 +       struct nfs_string client_addr;          /* 1 */
553 +
554 +       /* Mount path */
555 +       struct nfs_string mnt_path;             /* 1 */
556 +
557 +       /* Server details */
558 +       struct nfs_string hostname;             /* 1 */
559 +       /* Server IP address */
560 +       unsigned int host_addrlen;              /* 1 */
561 +       struct sockaddr* host_addr;             /* 1 */
562 +
563 +       /* Transport protocol to use */
564 +       int proto;                              /* 1 */
565 +
566 +       /* Pseudo-flavours to use for authentication. See RFC2623 */
567 +       int auth_flavourlen;                    /* 1 */
568 +       int *auth_flavours;                     /* 1 */
569 +};
570 +
571 +/* bits in the flags field */
572 +/* Note: the fields that correspond to existing NFSv2/v3 mount options
573 + *      should mirror the values from include/linux/nfs_mount.h
574 + */
575 +
576 +#define NFS4_MOUNT_SOFT                0x0001  /* 1 */
577 +#define NFS4_MOUNT_INTR                0x0002  /* 1 */
578 +#define NFS4_MOUNT_NOCTO       0x0010  /* 1 */
579 +#define NFS4_MOUNT_NOAC                0x0020  /* 1 */
580 +#define NFS4_MOUNT_STRICTLOCK  0x1000  /* 1 */
581 +#define NFS4_MOUNT_FLAGMASK    0xFFFF
582 +
583 +/* pseudoflavors: */
584 +
585 +#define RPC_AUTH_GSS_KRB5       390003
586 +#define RPC_AUTH_GSS_KRB5I      390004
587 +#define RPC_AUTH_GSS_KRB5P      390005
588 +#define RPC_AUTH_GSS_LKEY       390006
589 +#define RPC_AUTH_GSS_LKEYI      390007
590 +#define RPC_AUTH_GSS_LKEYP      390008
591 +#define RPC_AUTH_GSS_SPKM       390009
592 +#define RPC_AUTH_GSS_SPKMI      390010
593 +#define RPC_AUTH_GSS_SPKMP      390011
594 +
595 +#endif
596 diff -puN mount/nfs.5~base-nfsv4 mount/nfs.5
597 --- util-linux-2.12/mount/nfs.5~base-nfsv4      2004-10-13 13:51:50.000000000 -0400
598 +++ util-linux-2.12-bfields/mount/nfs.5 2004-10-13 13:51:50.000000000 -0400
599 @@ -3,7 +3,7 @@
600  .\" patches. "
601  .TH NFS 5 "20 November 1993" "Linux 0.99" "Linux Programmer's Manual"
602  .SH NAME
603 -nfs \- nfs fstab format and options
604 +nfs \- nfs and nfs4 fstab format and options
605  .SH SYNOPSIS
606  .B /etc/fstab
607  .SH DESCRIPTION
608 @@ -17,14 +17,51 @@ the local directory that is the mount po
609  and the NFS specific options that control
610  the way the filesystem is mounted.
611  .P
612 -Here is an example from an \fI/etc/fstab\fP file from an NFS mount.
613 +Three different versions of the NFS protocol are
614 +supported by the Linux NFS client:
615 +NFS version 2, NFS version 3, and NFS version 4.
616 +To mount via NFS version 2, use the
617 +.BR nfs
618 +file system type and specify
619 +.BR nfsvers=2 .
620 +Version 2 is the default protocol version for the
621 +.BR nfs
622 +file system type when
623 +.BR nfsvers=
624 +is not specified on the mount command.
625 +To mount via NFS version 3, use the
626 +.BR nfs
627 +file system type and specify
628 +.BR nfsvers=3 .
629 +To mount via NFS version 4, use the
630 +.BR nfs4
631 +file system type.
632 +The
633 +.BR nfsvers=
634 +keyword is not supported for the
635 +.BR nfs4
636 +file system type.
637 +.P
638 +These file system types share similar mount options;
639 +the differences are listed below.
640 +.P
641 +Here is an example from an \fI/etc/fstab\fP file for an NFSv2 mount
642 +over UDP.
643  .sp
644  .nf
645  .ta 2.5i +0.75i +0.75i +1.0i
646  server:/usr/local/pub  /pub    nfs     rsize=8192,wsize=8192,timeo=14,intr
647  .fi
648 +.P
649 +Here is an example for an NFSv4 mount over TCP using Kerberos
650 +5 mutual authentication.
651 +.sp
652 +.nf
653 +.ta 2.5i +0.75i +0.75i +1.0i
654 +server:/usr/local/pub  /pub    nfs4    proto=tcp,sec=krb5,hard,intr
655 +.fi
656  .DT
657 -.SS Options
658 +.SS Options for the nfs file system type
659  .TP 1.5i
660  .I rsize=n
661  The number of bytes NFS uses when reading files from an NFS server.
662 @@ -208,6 +245,163 @@ is the default.
663  All of the non-value options have corresponding nooption forms.
664  For example, nointr means don't allow file operations to be
665  interrupted.
666 +.SS Options for the nfs4 file system type
667 +.TP 1.5i
668 +.I rsize=n
669 +The number of bytes NFS uses when reading files from an NFS server.
670 +The default value is dependent on the kernel, currently 4096 bytes.
671 +(However, throughput is improved greatly by asking for
672 +.IR rsize=32768 .)
673 +This value is negotiated with the server.
674 +.TP 1.5i
675 +.I wsize=n
676 +The number of bytes NFS uses when writing files to an NFS server.
677 +The default value is dependent on the kernel, currently 4096 bytes.
678 +(However, throughput is improved greatly by asking for
679 +.IR wsize=32768 .)
680 +This value is negotiated with the server.
681 +.TP 1.5i
682 +.I timeo=n
683 +The value in tenths of a second before sending the
684 +first retransmission after an RPC timeout.
685 +The default value depends on whether
686 +.IR proto=udp
687 +or
688 +.IR proto=tcp
689 +is in effect (see below).
690 +The default value for UDP is 7 tenths of a second.
691 +The default value for TCP is 60 seconds.
692 +After the first timeout,
693 +the timeout is doubled after each successive timeout until a maximum
694 +timeout of 60 seconds is reached or the enough retransmissions
695 +have occured to cause a major timeout.  Then, if the filesystem
696 +is hard mounted, each new timeout cascade restarts at twice the
697 +initial value of the previous cascade, again doubling at each
698 +retransmission.  The maximum timeout is always 60 seconds.
699 +.TP 1.5i
700 +.I retrans=n
701 +The number of minor timeouts and retransmissions that must occur before
702 +a major timeout occurs.  The default is 5 timeouts for
703 +.IR proto=udp
704 +and 2 timeouts for
705 +.IR proto=tcp .
706 +When a major timeout
707 +occurs, the file operation is either aborted or a "server not responding"
708 +message is printed on the console.
709 +.TP 1.5i
710 +.I acregmin=n
711 +The minimum time in seconds that attributes of a regular file should
712 +be cached before requesting fresh information from a server.
713 +The default is 3 seconds.
714 +.TP 1.5i
715 +.I acregmax=n
716 +The maximum time in seconds that attributes of a regular file can
717 +be cached before requesting fresh information from a server.
718 +The default is 60 seconds.
719 +.TP 1.5i
720 +.I acdirmin=n
721 +The minimum time in seconds that attributes of a directory should
722 +be cached before requesting fresh information from a server.
723 +The default is 30 seconds.
724 +.TP 1.5i
725 +.I acdirmax=n
726 +The maximum time in seconds that attributes of a directory can
727 +be cached before requesting fresh information from a server.
728 +The default is 60 seconds.
729 +.TP 1.5i
730 +.I actimeo=n
731 +Using actimeo sets all of
732 +.I acregmin,
733 +.I acregmax,
734 +.I acdirmin,
735 +and
736 +.I acdirmax
737 +to the same value.
738 +There is no default value.
739 +.TP 1.5i
740 +.I retry=n
741 +The number of minutes to retry an NFS mount operation
742 +in the foreground or background before giving up.
743 +The default value is 10000 minutes, which is roughly one week.
744 +.TP 1.5i
745 +.I port=n
746 +The numeric value of the port to connect to the NFS server on.
747 +If the port number is 0 (the default) then query the
748 +remote host's portmapper for the port number to use.
749 +If the remote host's NFS daemon is not registered with
750 +its portmapper, the standard NFS port number 2049 is
751 +used instead.
752 +.TP 1.5i
753 +.I proto=n
754 +Mount the NFS filesystem using a specific network protocol
755 +instead of the default UDP protocol.
756 +Many NFS version 4 servers only support TCP.
757 +Valid protocol types are
758 +.IR udp
759 +and
760 +.IR tcp .
761 +.TP 1.5i
762 +.I clientaddr=n
763 +On a multi-homed client, this
764 +causes the client to use a specific callback address when
765 +communicating with an NFS version 4 server.
766 +This option is currently ignored.
767 +.TP 1.5i
768 +.I sec=n
769 +Specify an advanced security mechanism for this file system.
770 +To use Kerberos 5 mutual authentication, specify
771 +.IR krb5 .
772 +Kerberos 5 integrity checking is specified with
773 +.IR krb5i ,
774 +and Kerberos 5 privacy is specified with
775 +.IR krb5p .
776 +Other security mechanisms may become available in the future.
777 +.TP 1.5i
778 +.I bg
779 +If an NFS mount attempt times out, retry the mount
780 +in the background.
781 +After a mount operation is backgrounded, all subsequent mounts
782 +on the same NFS server will be backgrounded immediately, without
783 +first attempting the mount.
784 +A missing mount point is treated as a timeout,
785 +to allow for nested NFS mounts.
786 +.TP 1.5i
787 +.I fg
788 +If the first NFS mount attempt times out, retry the mount
789 +in the foreground.
790 +This is the complement of the
791 +.I bg
792 +option, and also the default behavior.
793 +.TP 1.5i
794 +.I soft
795 +If an NFS file operation has a major timeout then report an I/O error to
796 +the calling program.
797 +The default is to continue retrying NFS file operations indefinitely.
798 +.TP 1.5i
799 +.I hard
800 +If an NFS file operation has a major timeout then report
801 +"server not responding" on the console and continue retrying indefinitely.
802 +This is the default.
803 +.TP 1.5i
804 +.I intr
805 +If an NFS file operation has a major timeout and it is hard mounted,
806 +then allow signals to interupt the file operation and cause it to
807 +return EINTR to the calling program.  The default is to not
808 +allow file operations to be interrupted.
809 +.TP 1.5i
810 +.I nocto
811 +Suppress the retrieval of new attributes when creating a file.
812 +.TP 1.5i
813 +.I noac
814 +Disable attribute caching, and force synchronous writes.
815 +This extracts a
816 +server performance penalty but it allows two different NFS clients
817 +to get reasonable good results when both clients are actively
818 +writing to common filesystem on the server.
819 +.P
820 +All of the non-value options have corresponding nooption forms.
821 +For example, nointr means don't allow file operations to be
822 +interrupted.
823  .SH FILES
824  .I /etc/fstab
825  .SH "SEE ALSO"
826 diff -puN mount/nfsmount.c~base-nfsv4 mount/nfsmount.c
827 --- util-linux-2.12/mount/nfsmount.c~base-nfsv4 2004-10-13 13:51:50.000000000 -0400
828 +++ util-linux-2.12-bfields/mount/nfsmount.c    2004-10-13 13:51:50.000000000 -0400
829 @@ -706,7 +706,10 @@ static inline int
830  nfsmnt_check_compat(const struct pmap *nfs_pmap, const struct pmap *mnt_pmap)
831  {
832         if (nfs_pmap->pm_vers > MAX_NFSPROT) {
833 -               fprintf(stderr, _("NFSv%ld not supported!\n"), nfs_pmap->pm_vers);
834 +               if (nfs_pmap->pm_vers == 4)
835 +                       fprintf(stderr, _("'vers=4' is not supported.  Use '-t nfs4' instead.\n"));
836 +               else
837 +                       fprintf(stderr, _("NFSv%ld not supported!\n"), nfs_pmap->pm_vers);
838                 goto out_bad;
839         }
840         if (mnt_pmap->pm_vers > MAX_MNTPROT) {
841 diff -puN mount/sundries.h~base-nfsv4 mount/sundries.h
842 --- util-linux-2.12/mount/sundries.h~base-nfsv4 2004-10-13 13:51:50.000000000 -0400
843 +++ util-linux-2.12-bfields/mount/sundries.h    2004-10-13 13:51:50.000000000 -0400
844 @@ -37,6 +37,8 @@ void die (int errcode, const char *fmt, 
845  #ifdef HAVE_NFS
846  int nfsmount (const char *spec, const char *node, int *flags,
847               char **orig_opts, char **opt_args, int *version, int running_bg);
848 +int nfs4mount (const char *spec, const char *node, int *flags,
849 +               char **orig_opts, char **opt_args, int running_bg);
850  int nfsumount(const char *spec, const char *opts);
851  #endif
852  
853 diff -puN mount/umount.c~base-nfsv4 mount/umount.c
854 --- util-linux-2.12/mount/umount.c~base-nfsv4   2004-10-13 13:51:50.000000000 -0400
855 +++ util-linux-2.12-bfields/mount/umount.c      2004-10-13 13:51:50.000000000 -0400
856 @@ -89,6 +89,9 @@
857  /* True if ruid != euid.  */
858  int suid = 0;
859  
860 +/* Needed by nfs4mount.c */
861 +int sloppy = 0;
862 +
863  /*
864   * check_special_umountprog()
865   *     If there is a special umount program for this type, exec it.
866
This page took 0.080122 seconds and 3 git commands to generate.