source: trunk/athena/bin/quota/attach.h @ 10995

Revision 10995, 4.7 KB checked in by ghudson, 27 years ago (diff)
Don't assume anything about i386.
Line 
1/*
2 * $Id: attach.h,v 1.5 1998-01-03 03:38:03 ghudson Exp $
3 *
4 * Copyright (c) 1988,1991 by the Massachusetts Institute of Technology.
5 *
6 * For redistribution rights, see "mit-copyright.h"
7 */
8
9#include "config.h"
10
11#include <stdio.h>
12#include <ctype.h>
13#include <errno.h>
14#include <netdb.h>
15#include <string.h>
16
17#include <sys/types.h>
18#include <sys/file.h>
19#include <sys/param.h>
20#include <sys/socket.h>
21#include <sys/time.h>
22
23#include <netinet/in.h>
24
25#define MAXOWNERS 64
26#define MAXHOSTS 64
27
28/*
29 * We don't really want to deal with malloc'ing and free'ing stuff
30 * in this structure...
31 */
32
33struct _attachtab {
34        struct _attachtab       *next, *prev;
35        char            version[3];
36        char            explicit;
37        char            status;
38        char            mode;
39        struct _fstypes *fs;
40        struct          in_addr hostaddr[MAXHOSTS];
41        int             rmdir;
42        int             drivenum;
43        int             flags;
44        int             nowners;
45        uid_t           owners[MAXOWNERS];
46        char            hesiodname[BUFSIZ];
47        char            host[BUFSIZ];
48        char            hostdir[MAXPATHLEN];
49        char            mntpt[MAXPATHLEN];
50};
51
52/*
53 * Attach flags defines
54 *
55 * FLAG_NOSETUID --- this filesystem was mounted nosetuid (no meaning
56 *      for afs filesystems)
57 * FLAG_LOCKED --- this filesystem is passed over by detach -a, and
58 *      you must be the owner of the filesystem to detach it.
59 * FLAG_ANYONE --- anyone can detach this filesystem  (not yet implemented)
60 * FLAG_PERMANENT --- when this filesytem is detached, don't do
61 *      actually unmount it; just deauthenticate, if necessary.  attach
62 *      sets this flag if it finds the filesystem already mounted but
63 *      not in attachtab.
64 */
65#define FLAG_NOSETUID   1
66#define FLAG_LOCKED     2
67#define FLAG_ANYONE     4
68#define FLAG_PERMANENT  8
69
70#define ATTACH_VERSION  "A1"
71
72#define ATTACHTABMODE   644
73
74#define STATUS_ATTACHED         '+'
75#define STATUS_ATTACHING        '*'
76#define STATUS_DETACHING        '-'
77
78#define TYPE_NFS        001
79#define TYPE_RVD        002
80#define TYPE_UFS        004
81#define TYPE_ERR        010
82#define TYPE_AFS        020
83#define TYPE_MUL        040
84#define ALL_TYPES       067
85
86/*
87 * Attach configuration defines
88 */
89#define MAXFILTAB       100
90#define MAXTRUIDTAB     100
91
92/*
93 * Type table
94 */
95
96struct _fstypes {
97    char        *name;
98    int         type;
99#if 0
100    int         mount_type;
101    int         flags;
102    char        *good_flags;
103    int         (*attach)();
104    int         (*detach)();
105    char **     (*explicit)();
106    int         (*flush)();
107#endif
108};
109
110/*
111 * Flags for _fstypes.flags
112 */
113#define AT_FS_MNTPT             1
114#define AT_FS_REMOTE            2
115#define AT_FS_PARENTMNTPT       4
116#define AT_FS_MNTPT_CANON       8
117
118extern struct _fstypes fstypes[];
119
120/*
121 * Mount options
122 */
123#ifndef M_RDONLY
124#define M_RDONLY        0x01            /* mount fs read-only */
125#endif
126#ifndef M_NOSUID
127#define M_NOSUID        0x02            /* mount fs without setuid perms */
128#endif
129/*
130 * Generic defines
131 */
132
133#define SUCCESS 0
134#define FAILURE 1
135
136/*
137 * Error status defininitions
138 */
139
140#define ERR_NONE        0       /* No error */
141#define ERR_BADARGS     1       /* Bad arguments */
142#define ERR_SOMETHING   2       /* Something wrong - > 1 args */
143#define ERR_FATAL       3       /* Internal failure */
144#define ERR_INTERRUPT   4       /* Program externally aborted */
145#define ERR_BADCONF     5       /* Bad configuration file */
146#define ERR_BADFSDSC    6       /* Bad filesystem description */
147#define ERR_BADFSFLAG   7       /* Bad filsys flag */
148
149#define ERR_KERBEROS    10      /* Kerberos failure */
150#define ERR_HOST        11      /* General host communication failure */
151#define ERR_AUTHFAIL    12      /* Authentication failure */
152#define ERR_NOPORTS     13      /* Out of reserved ports */
153
154#define ERR_NFSIDNOTATTACHED 20 /* Filesystem with -f not attached */
155#define ERR_NFSIDBADHOST 21     /* Can't resolve hostname */
156#define ERR_NFSIDPERM   22      /* unauthorized nfsid -p */
157
158#define ERR_ATTACHBADFILSYS 20  /* Bad filesystem name */
159#define ERR_ATTACHINUSE 21      /* Filesystem in use by another proc */
160#define ERR_ATTACHNEEDPW 22     /* RVD spinup needs a password */
161#define ERR_ATTACHFSCK  23      /* FSCK returned error on RVD */
162#define ERR_ATTACHNOTALLOWED 24 /* User not allowed to do operation */
163#define ERR_ATTACHBADMNTPT 25   /* User not allowed to mount a */
164                                /* filesystem here */
165#define ERR_ATTACHNOFILSYS 26   /* The remote filesystem doesn't exist */
166#define ERR_ATTACHDIRINUSE 27 /* Some other filesystem is using the */
167                              /* mountpoint directory */
168
169#define ERR_DETACHNOTATTACHED 20 /* Filesystem not attached */
170#define ERR_DETACHINUSE 21      /* Filesystem in use by another proc */
171#define ERR_DETACHNOTALLOWED 22 /* User not allowed to do operations */
172
173#define ERR_ZINITZLOSING        20      /* Random zephyr lossage */
174
175/*
176 * Zephyr definitions
177 */
178
179#ifdef ZEPHYR
180#define ZEPHYR_CLASS "filsrv"
181#define ZEPHYR_MAXSUBS 100      /* 50 filesystems... */
182#define ZEPHYR_TIMEOUT  60      /* 1 minute timeout */
183#endif /* ZEPHYR */
184
185
186extern void lock_attachtab(), unlock_attachtab();
187extern void get_attachtab(), free_attachtab();
188extern struct _fstypes *get_fs();
189extern struct _attachtab
190    *attachtab_first,
191    *attachtab_lookup(),
192    *attachtab_lookup_mntpt();
Note: See TracBrowser for help on using the repository browser.