1#autoload
2
3local ret stateset fvals cvalsvar cvalind
4typeset -a fvals opts
5
6if [[ $1 = -O* ]]; then
7  opts+=$1
8  shift
9fi
10opts+=(-s , -S =)
11
12cvalind=$argv[(I)-A*]
13
14while (( cvalind )); do
15  if [[ ${(P)cvalind} = -A?* ]]; then
16    cvalsvar=${(P)cvalind[3,-1]}
17    argv[cvalind]=()
18  else
19    cvalsvar=$argv[cvalind+1]
20    argv[cvalind,cvalind+1]=()
21  fi
22  cvalind=$argv[(I)-A*]
23done
24
25fvals=(
26  'ro[mount filesystem read-only]'
27  'allow_other[allow access to other users]'
28  'allow_root[allow access to root]'
29  'nonempty[allow mounts over non-empty file/dir]'
30  'default_permissions[enable permission checking by kernel]'
31  'fsname[set filesystem name]:name'
32  'large_read[issue large read requests (linux v2.4 only)]'
33  'max_read[set maximum size of read requests]:size'
34  'hard_remove[immediate removal (do not hide files)]'
35  'use_ino[let filesystem set inode numbers]'
36  'readdir_ino[try to fill in d_ino in readdir]'
37  'direct_io[use direct I/O]'
38  'kernel_cache[cache files in kernel]'
39  'umask[set file permissions]:permission mask (octal)'
40  'uid[set file owner]:user id:'
41  'gid[set file group]:group id:'
42  'entry_timeout[cache timeout for names]:timeout (s)'
43  'negative_timeout[cache timeout for deleted names]:timeout (s)'
44  'attr_timeout[cache timeout for attributes]:timeout (s)'
45)
46
47[[ -n $cvalsvar ]] && set -- "$@" ${(P)cvalsvar}
48
49if [[ $# -eq 0 ]]; then
50  set -- 'mount options' $fvals
51else
52  set -- "$@" $fvals
53fi
54
55if [[ -n $state ]]; then
56  stateset=$state
57  state=
58fi
59
60_values $opts "$@" && ret=0
61
62if [[ -n $state ]]; then
63  compstate[restore]=
64elif [[ -n $stateset ]]; then
65  state=$stateset
66else
67  unset state
68fi
69
70return $ret
71