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

Revision 14654, 4.3 KB checked in by mwhitson, 25 years ago (diff)
Add fstype "LOC", which symlinks local filesystem trees.
Line 
1/* $Id: locker_private.h,v 1.5 2000-04-24 02:13:44 mwhitson 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/athena/attachtab"
23#define LOCKER_PATH_ATTACH_CONF "/etc/athena/attach.conf"
24
25#define LOCKER_AFS_MOUNT_DIR "/mit"
26#define LOCKER_UFS_MOUNT_DIR "/mnt"
27#define LOCKER_LOC_MOUNT_DIR "/mit"
28
29#define LOCKER_NFS_KSERVICE "rvdsrv"
30
31#define LOCKER_DEFAULT_GID 101
32
33#define LOCKER_MOUNT_TIMEOUT 20
34
35#define LOCKER_ZEPHYR_CLASS "filsrv"
36
37enum explstate { LOCKER_DONT_CARE, LOCKER_EXPLICIT, LOCKER_NOEXPLICIT };
38
39union locker__datum {
40  char *string;
41  int flag;
42};
43
44struct locker__regexp {
45  int fstypes;
46  enum explstate explicit;
47  regex_t pattern;
48  union locker__datum data;
49};
50
51struct locker__regexp_list {
52  struct locker__regexp *tab;
53  int size, num;
54  int defflag;
55};
56
57struct locker_context {
58  /* attach.conf variables */
59  int exp_desc, exp_mountpoint, keep_mount, nfs_root_hack, ownercheck;
60  char *afs_mount_dir, *attachtab, *nfs_mount_dir;
61  struct locker__regexp_list allow, setuid, mountpoint;
62  struct locker__regexp_list allowopts, defopts, filesystem, reqopts;
63
64  /* Defined fs types */
65  struct locker_ops **fstype;
66  int nfstypes;
67
68  /* error reporting function and its cookie */
69  locker_error_fun errfun;
70  void *errdata;
71
72  /* user we're acting on behalf of, and whether or not s/he is trusted */
73  uid_t user;
74  int trusted;
75
76  /* Hesiod context */
77  void *hes_context;
78
79  /* Queued zephyr subs */
80  char **zsubs;
81  int nzsubs;
82
83  /* Number of locks held on attachtab */
84  int locks;
85};
86
87/* "kind"s for locker__attachtab_pathname */
88#define LOCKER_LOCK 0
89#define LOCKER_NAME 1
90#define LOCKER_MOUNTPOINT 2
91#define LOCKER_DIRECTORY 3
92/* Already a full path: don't touch it. */
93#define LOCKER_FULL_PATH 4
94
95/* options for locker__canonicalize_path */
96#define LOCKER_CANON_CHECK_NONE 0
97#define LOCKER_CANON_CHECK_MOST 1
98#define LOCKER_CANON_CHECK_ALL 2
99
100/* Prototypes from attachtab.c */
101locker_attachent *locker__new_attachent(locker_context context,
102                                        struct locker_ops *type);
103int locker__lookup_attachent(locker_context context, char *name,
104                             char *mountpoint, int create,
105                             locker_attachent **atp);
106int locker__lookup_attachent_explicit(locker_context context, char *type,
107                                      char *desc, char *mountpoint,
108                                      int create, locker_attachent **atp);
109void locker__update_attachent(locker_context context, locker_attachent *at);
110char *locker__attachtab_pathname(locker_context context,
111                                 int kind, char *name);
112
113/* Prototypes from conf.c */
114int locker__fs_ok(locker_context context, struct locker__regexp_list list,
115                  struct locker_ops *fs, char *filesystem);
116char *locker__fs_data(locker_context context, struct locker__regexp_list list,
117                      struct locker_ops *fs, char *filesystem);
118struct locker_ops *locker__get_fstype(locker_context context, char *fstype);
119void locker__error(locker_context context, char *fmt, ...);
120
121/* Prototypes from mount.c */
122int locker__mount(locker_context context, locker_attachent *at,
123                  char *mountoptions);
124int locker__unmount(locker_context context, locker_attachent *at);
125
126/* Prototypes from mountpoint.c */
127int locker__canonicalize_path(locker_context context, int check,
128                              char **pathp, char **extp);
129int locker__build_mountpoint(locker_context context, locker_attachent *at);
130int locker__remove_mountpoint(locker_context context, locker_attachent *at);
131
132/* Prototypes from util.c */
133int locker__read_line(FILE *fp, char **buf, int *bufsize);
134
135/* Prototypes from zephyr.c */
136int locker__add_zsubs(locker_context context, char **subs, int nsubs);
137void locker__free_zsubs(locker_context context);
Note: See TracBrowser for help on using the repository browser.