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

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