source: trunk/athena/lib/locker/locker_private.h @ 22841

Revision 22841, 4.4 KB checked in by tabbott, 16 years ago (diff)
In locker: * Merged quilt patches into mainline Athena tree
Line 
1/* $Id: locker_private.h,v 1.8 2006-08-08 21:50:10 ghudson Exp $ */
2
3/* Copyright 1998 by the Massachusetts Institute of Technology.
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software and its documentation for any purpose and without
7 * fee is hereby granted, provided that the above copyright
8 * notice appear in all copies and that both that copyright
9 * notice and this permission notice appear in supporting
10 * documentation, and that the name of M.I.T. not be used in
11 * advertising or publicity pertaining to distribution of the
12 * software without specific, written prior permission.
13 * M.I.T. makes no representations about the suitability of
14 * this software for any purpose.  It is provided "as is"
15 * without express or implied warranty.
16 */
17
18#include <sys/types.h>
19#include <regex.h>
20#include <stdarg.h>
21
22#define LOCKER_PATH_ATTACHTAB "/var/run/attachtab"
23#define LOCKER_PATH_ATTACH_CONF "/etc/athena/attach.conf"
24#define LOCKER_PATH_LOCAL "/var/athena/local-validated"
25
26#define LOCKER_AFS_MOUNT_DIR "/mit"
27#define LOCKER_UFS_MOUNT_DIR "/mnt"
28#define LOCKER_LOC_MOUNT_DIR "/mit"
29
30#define LOCKER_NFS_KSERVICE "rvdsrv"
31
32#define LOCKER_DEFAULT_GID 101
33
34#define LOCKER_MOUNT_TIMEOUT 20
35
36#define LOCKER_ZEPHYR_CLASS "filsrv"
37
38enum explstate { LOCKER_DONT_CARE, LOCKER_EXPLICIT, LOCKER_NOEXPLICIT };
39
40union locker__datum {
41  char *string;
42  int flag;
43};
44
45struct locker__regexp {
46  int fstypes;
47  enum explstate explicit;
48  regex_t pattern;
49  union locker__datum data;
50};
51
52struct locker__regexp_list {
53  struct locker__regexp *tab;
54  int size, num;
55  int defflag;
56};
57
58struct locker_context {
59  /* attach.conf variables */
60  int exp_desc, exp_mountpoint, keep_mount, nfs_root_hack, ownercheck;
61  int use_krb4;
62  char *afs_mount_dir, *attachtab, *nfs_mount_dir, *local_dir;
63  struct locker__regexp_list allow, setuid, mountpoint;
64  struct locker__regexp_list allowopts, defopts, filesystem, reqopts;
65
66  /* Defined fs types */
67  struct locker_ops **fstype;
68  int nfstypes;
69
70  /* error reporting function and its cookie */
71  locker_error_fun errfun;
72  void *errdata;
73
74  /* user we're acting on behalf of, and whether or not s/he is trusted */
75  uid_t user;
76  int trusted;
77
78  /* Hesiod context */
79  void *hes_context;
80
81  /* Queued zephyr subs */
82  char **zsubs;
83  int nzsubs;
84
85  /* Number of locks held on attachtab */
86  int locks;
87};
88
89/* "kind"s for locker__attachtab_pathname */
90#define LOCKER_LOCK 0
91#define LOCKER_NAME 1
92#define LOCKER_MOUNTPOINT 2
93#define LOCKER_DIRECTORY 3
94/* Already a full path: don't touch it. */
95#define LOCKER_FULL_PATH 4
96
97/* options for locker__canonicalize_path */
98#define LOCKER_CANON_CHECK_NONE 0
99#define LOCKER_CANON_CHECK_MOST 1
100#define LOCKER_CANON_CHECK_ALL 2
101
102/* Prototypes from attachtab.c */
103locker_attachent *locker__new_attachent(locker_context context,
104                                        struct locker_ops *type);
105int locker__lookup_attachent(locker_context context, char *name,
106                             char *mountpoint, int create,
107                             locker_attachent **atp);
108int locker__lookup_attachent_explicit(locker_context context, char *type,
109                                      char *desc, char *mountpoint,
110                                      int create, locker_attachent **atp);
111void locker__update_attachent(locker_context context, locker_attachent *at);
112char *locker__attachtab_pathname(locker_context context,
113                                 int kind, char *name);
114
115/* Prototypes from conf.c */
116int locker__fs_ok(locker_context context, struct locker__regexp_list list,
117                  struct locker_ops *fs, char *filesystem);
118char *locker__fs_data(locker_context context, struct locker__regexp_list list,
119                      struct locker_ops *fs, char *filesystem);
120struct locker_ops *locker__get_fstype(locker_context context, char *fstype);
121void locker__error(locker_context context, char *fmt, ...);
122
123/* Prototypes from mount.c */
124int locker__mount(locker_context context, locker_attachent *at,
125                  char *mountoptions);
126int locker__unmount(locker_context context, locker_attachent *at);
127
128/* Prototypes from mountpoint.c */
129int locker__canonicalize_path(locker_context context, int check,
130                              char **pathp, char **extp);
131int locker__build_mountpoint(locker_context context, locker_attachent *at);
132int locker__remove_mountpoint(locker_context context, locker_attachent *at);
133void locker__put_mountpoint(locker_context context, locker_attachent *at);
134
135/* Prototypes from util.c */
136int locker__read_line(FILE *fp, char **buf, int *bufsize);
137
138/* Prototypes from zephyr.c */
139int locker__add_zsubs(locker_context context, char **subs, int nsubs);
140void locker__free_zsubs(locker_context context);
Note: See TracBrowser for help on using the repository browser.