[24319] | 1 | /* $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/dbck/dbck.h $ $Id: dbck.h 3956 2010-01-05 20:56:56Z zacheiss $ |
---|
[23095] | 2 | * |
---|
| 3 | * Declarations for Moira database consistancy checker |
---|
| 4 | * |
---|
| 5 | * (c) Copyright 1988 by the Massachusetts Institute of Technology. |
---|
| 6 | * For copying and distribution information, please see the file |
---|
| 7 | * <mit-copyright.h>. |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include <mit-copyright.h> |
---|
| 11 | #include <moira_site.h> |
---|
| 12 | #include <moira_schema.h> |
---|
| 13 | |
---|
| 14 | #define MODE_ASK 1 |
---|
| 15 | #define MODE_NO 2 |
---|
| 16 | #define MODE_PREEN 3 |
---|
| 17 | #define MODE_YES 4 |
---|
| 18 | |
---|
| 19 | extern int debug, mode, fast, dcmenable, warn; |
---|
| 20 | extern struct hash *users, *machines, *clusters, *lists, *printservers; |
---|
| 21 | extern struct hash *filesys, *nfsphys, *strings, *subnets, *string_dups; |
---|
| 22 | extern struct hash *containers; |
---|
| 23 | |
---|
| 24 | #define MAX_ID_VALUE 131072 |
---|
| 25 | #define MIN_ID_VALUE 100 |
---|
| 26 | |
---|
| 27 | #define dprintf if (debug) printf |
---|
| 28 | |
---|
| 29 | struct user { |
---|
| 30 | char login[USERS_LOGIN_SIZE]; |
---|
| 31 | char potype; |
---|
| 32 | char *fullname; |
---|
| 33 | int status; |
---|
| 34 | int users_id; |
---|
| 35 | int pobox_id; |
---|
| 36 | int comment; |
---|
| 37 | int modby; |
---|
| 38 | int fmodby; |
---|
| 39 | int pmodby; |
---|
| 40 | int sigwho; |
---|
| 41 | char sponsor_type; |
---|
| 42 | int sponsor_id; |
---|
| 43 | }; |
---|
| 44 | |
---|
| 45 | struct machine { |
---|
| 46 | char name[MACHINE_NAME_SIZE]; |
---|
| 47 | char owner_type; |
---|
| 48 | int owner_id; |
---|
| 49 | int snet_id; |
---|
| 50 | int mach_id; |
---|
| 51 | int clucount; |
---|
| 52 | int acomment; |
---|
| 53 | int ocomment; |
---|
| 54 | int creator; |
---|
| 55 | int modby; |
---|
| 56 | }; |
---|
| 57 | |
---|
| 58 | struct subnet { |
---|
| 59 | char name[SUBNET_NAME_SIZE]; |
---|
| 60 | char owner_type; |
---|
| 61 | int owner_id; |
---|
| 62 | int snet_id; |
---|
| 63 | int modby; |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | struct cluster { |
---|
| 67 | char name[CLUSTERS_NAME_SIZE]; |
---|
| 68 | int clu_id; |
---|
| 69 | int modby; |
---|
| 70 | }; |
---|
| 71 | |
---|
| 72 | struct list { |
---|
| 73 | char name[LIST_NAME_SIZE]; |
---|
| 74 | char acl_type; |
---|
| 75 | char memacl_type; |
---|
| 76 | int list_id; |
---|
| 77 | int acl_id; |
---|
| 78 | int memacl_id; |
---|
| 79 | int modby; |
---|
| 80 | int members; |
---|
| 81 | }; |
---|
| 82 | |
---|
| 83 | struct string { |
---|
| 84 | char *name; |
---|
| 85 | int string_id; |
---|
| 86 | int refc; |
---|
| 87 | }; |
---|
| 88 | |
---|
| 89 | struct filesys { |
---|
| 90 | char name[FILESYS_LABEL_SIZE]; |
---|
| 91 | char dir[FILESYS_NAME_SIZE]; |
---|
| 92 | char type; |
---|
| 93 | int filsys_id; |
---|
| 94 | int mach_id; |
---|
| 95 | int owner; |
---|
| 96 | int owners; |
---|
| 97 | int phys_id; |
---|
| 98 | }; |
---|
| 99 | |
---|
| 100 | struct nfsphys { |
---|
| 101 | char dir[NFSPHYS_DIR_SIZE]; |
---|
| 102 | int mach_id; |
---|
| 103 | int nfsphys_id; |
---|
| 104 | unsigned long long allocated; |
---|
| 105 | int modby; |
---|
| 106 | unsigned long long count; |
---|
| 107 | }; |
---|
| 108 | |
---|
| 109 | struct printserver { |
---|
| 110 | int mach_id; |
---|
| 111 | int printer_types; |
---|
| 112 | char owner_type; |
---|
| 113 | int owner_id; |
---|
| 114 | int lpc_acl; |
---|
| 115 | int modby; |
---|
| 116 | }; |
---|
| 117 | |
---|
| 118 | struct container { |
---|
| 119 | char name[CONTAINERS_NAME_SIZE]; |
---|
| 120 | int cnt_id; |
---|
| 121 | int list_id; |
---|
| 122 | char acl_type; |
---|
| 123 | int acl_id; |
---|
| 124 | char memacl_type; |
---|
| 125 | int memacl_id; |
---|
| 126 | int modby; |
---|
| 127 | }; |
---|
| 128 | |
---|
| 129 | void dbmserr(void); |
---|
| 130 | void out_of_mem(char *msg); |
---|
| 131 | void cleanup(void); |
---|
| 132 | |
---|
| 133 | void modified(char *table); |
---|
| 134 | |
---|
| 135 | void phase1(void); |
---|
| 136 | void phase2(void); |
---|
| 137 | void phase3(void); |
---|
| 138 | void phase4(void); |
---|
| 139 | void count_only_setup(void); |
---|
| 140 | |
---|
| 141 | /* prototypes from fix.pc */ |
---|
| 142 | void generic_delete(struct save_queue *sq, int (*pfunc)(void *), char *table, |
---|
| 143 | char *idfield, int preen); |
---|
| 144 | void single_delete(char *table, char *idfield, int id); |
---|
| 145 | void zero_fix(char *tbl, char *zrfield, char *idfield, int id); |
---|
| 146 | int single_fix(char *msg, int preen); |
---|
| 147 | void generic_fix(struct save_queue *sq, int (*pfunc)(void *), char *msg, |
---|
| 148 | void (*ffunc)(void *), int preen); |
---|
| 149 | int prompt(char *msg); |
---|
| 150 | int set_next_object_id(char *object, char *tablename); |
---|
| 151 | int generic_fix_id(char *tbl, char *idfield, char *txtfield, |
---|
| 152 | int oldid, char *name); |
---|
| 153 | |
---|
| 154 | /* prototypes from phase3.pc */ |
---|
| 155 | struct string *string_check(int id); |
---|