#include <mit-copyright.h>
#include <stdio.h>
-#include <sms.h>
+#include <moira.h>
#include "dbck.h"
static char phase2_qc_rcsid[] = "$Header$";
struct nfsphys *n;
struct machine *m;
- if (f->type == 'N' || f->type == 'R') {
- if (!hash_lookup(machines, f->mach_id)) {
- printf("Filesys %s with bad machine %d\n", f->name, f->mach_id);
- if (single_fix("Fix", 0)) {
-## replace filesys (mach_id = 0) where filesys.filsys_id = id
-## inquire_equel(rowcount = "rowcount")
- if (rowcount > 0)
- printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
- else
- printf("Not fixed\n");
- modified("filesys");
- f->mach_id = 0;
- }
+ if (!hash_lookup(machines, f->mach_id)) {
+ printf("Filesys %s with bad machine %d\n", f->name, f->mach_id);
+ if (single_fix("Fix", 0)) {
+## replace filesys (mach_id = 0) where filesys.filsys_id = id
+## inquire_equel(rowcount = "rowcount")
+ if (rowcount > 0)
+ printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
+ else
+ printf("Not fixed\n");
+ modified("filesys");
+ f->mach_id = 0;
}
}
- if (f->type == 'N' || f->type == 'R' || f->type == 'A') {
- if (!hash_lookup(users, f->owner)) {
- printf("Filesys %s with bad owning user %d\n", f->name, f->owner);
- if (single_fix("Fix", 1)) {
- zero_fix("filesys", "owner", "filsys_id", f->filsys_id);
- f->owner = 0;
- }
+
+ if (!hash_lookup(users, f->owner)) {
+ printf("Filesys %s with bad owning user %d\n", f->name, f->owner);
+ if (single_fix("Fix", 1)) {
+ zero_fix("filesys", "owner", "filsys_id", f->filsys_id);
+ f->owner = 0;
}
- if (!hash_lookup(lists, f->owners)) {
- printf("Filesys %s with bad owning group %d\n", f->name, f->owners);
- if (single_fix("Fix", 1)) {
- zero_fix("filesys", "owners", "filsys_id", f->filsys_id);
- f->owners = 0;
- }
+ }
+ if (!hash_lookup(lists, f->owners)) {
+ printf("Filesys %s with bad owning group %d\n", f->name, f->owners);
+ if (single_fix("Fix", 1)) {
+ zero_fix("filesys", "owners", "filsys_id", f->filsys_id);
+ f->owners = 0;
}
}
id2 = f->filsys_id;
id3 = f->mach_id;
if (set_next_object_id("nfsphys_id", "nfsphys") !=
- SMS_SUCCESS) {
+ MR_SUCCESS) {
printf("Unable to assign unique ID\n");
return;
}
case 'F':
t = "FSGROUP";
break;
+ case 'M':
+ t = "MUL";
+ break;
default:
t = "???";
}
##{
## int id1, found = 1;
-## retrieve (id1 = nfsquota.filsys_id) where nfsquota.users_id = id {
+## retrieve (id1 = quota.filsys_id) where quota.entity_id = id and
+## quota.type = "USER" {
found = 0;
- printf("NFSquota on fs %d for non-existant user %d\n", id1, id);
+ printf("Quota on fs %d for non-existant user %d\n", id1, id);
## }
return(found);
##}
-fix_quota_nouser(id)
-{
- single_delete("nfsquota", "users_id", id);
-}
+##show_quota_nolist(id)
+##int id;
+##{
+## int id1, found = 1;
+
+## retrieve (id1 = quota.filsys_id) where quota.entity_id = id and
+## quota.type = "GROUP" {
+ found = 0;
+ printf("Quota on fs %d for non-existant list %d\n", id1, id);
+## }
+ return(found);
+##}
+
+##fix_quota_nouser(id)
+##int id;
+##{
+## int rowcount, id1;
+
+ id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
+## delete quota where quota.entity_id = id and quota.type = "USER"
+## inquire_equel(rowcount = "rowcount")
+ if (rowcount > 0)
+ printf("%d entr%s deleted\n",rowcount, rowcount==1?"y":"ies");
+ else
+ printf("Not deleted\n");
+ modified("quota");
+##}
+
+##fix_quota_nolist(id)
+##int id;
+##{
+## int rowcount, id1;
+
+ id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
+## delete quota where quota.entity_id = id and quota.type = "GROUP"
+## inquire_equel(rowcount = "rowcount")
+ if (rowcount > 0)
+ printf("%d entr%s deleted\n",rowcount, rowcount==1?"y":"ies");
+ else
+ printf("Not deleted\n");
+ modified("quota");
+##}
##show_quota_nofs(id)
##int id;
##{
## int id1, found = 1;
- struct user *u;
+## char type[9];
-## retrieve (id1 = nfsquota.users_id) where nfsquota.filsys_id = id {
- u = (struct user *)hash_lookup(users, id1);
+## retrieve (id1 = quota.entity_id, type = quota.#type)
+## where quota.filsys_id = id {
found = 0;
- printf("NFSquota for user %s on non-existant filesys %d\n", u->login, id);
+ printf("Quota for %s %d on non-existant filesys %d\n", type, id1, id);
## }
return(found);
##}
fix_quota_nofs(id)
{
- single_delete("nfsquota", "filsys_id", id);
+ single_delete("quota", "filsys_id", id);
}
##show_quota_wrongpid(id)
##int id;
##{
## int id1, found = 1;
+## char type[9];
struct user *u;
struct filesys *f;
f = (struct filesys *)hash_lookup(filesys, id);
-## retrieve (id1 = nfsquota.users_id) where nfsquota.filsys_id = id {
- u = (struct user *)hash_lookup(users, id1);
+## retrieve (id1 = quota.entity_id, type = quota.#type)
+## where quota.filsys_id = id {
found = 0;
- printf("NFSquota for user %s on filesys %s has wrong phys_id %d\n",
- u->login, f->name, id);
+ printf("Quota for %s %d on filesys %s has wrong phys_id %d\n",
+ type, id1, f->name, id);
## }
return(found);
##}
## int rowcount, id1;
id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
-## replace nfsquota (phys_id = id1) where nfsquota.filsys_id = id and
-## nfsquota.phys_id != id1
+## replace quota (phys_id = id1) where quota.filsys_id = id and
+## quota.phys_id != id1
## inquire_equel(rowcount = "rowcount")
if (rowcount > 0)
printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
else
printf("Not fixed\n");
- modified("nfsquota");
+ modified("quota");
##}
##show_srv_user(id)
## retrieve (id1 = fsgroup.group_id, id2 = fsgroup.filsys_id) {
if (!(f = (struct filesys *) hash_lookup(filesys, id1)))
sq_save_data(sq1, id1);
- if (f->type != 'F')
- sq_save_data(sq2, f);
if (!hash_lookup(filesys, id2))
sq_save_data(sq3, id2);
## }
generic_delete(sq1, show_fsg_missing, "fsgroup", "group_id", 0);
- generic_fix(sq2, show_fsg_type, "Change to \"FSTYPE\"", fix_fsg_type, 0);
generic_delete(sq3, show_fsg_nomember, "fsgroup", "filsys_id", 1);
- dprintf("Checking nfsquota...\n");
+ dprintf("Checking quotas...\n");
sq1 = sq_create();
sq2 = sq_create();
sq3 = sq_create();
-## retrieve (id1 = nfsquota.users_id, id2 = nfsquota.filsys_id,
-## id3 = nfsquota.phys_id, id4 = nfsquota.quota) {
- if (id1 != 0 && !hash_lookup(users, id1))
+ sq4 = sq_create();
+## retrieve (id1 = quota.entity_id, type = quota.#type, id2 = quota.filsys_id,
+## id3 = quota.phys_id, id4 = quota.quota) {
+ if (type[0] == 'U' && id1 != 0 && !hash_lookup(users, id1))
sq_save_data(sq1, id1);
+ else if (type[0] == 'G' && !hash_lookup(lists, id1))
+ sq_save_data(sq4, id1);
else if (!(f = (struct filesys *) hash_lookup(filesys, id2)))
sq_save_data(sq2, id2);
else if (id3 != f->phys_id ||
generic_fix(sq1, show_quota_nouser, "Delete", fix_quota_nouser, 1);
generic_fix(sq2, show_quota_nofs, "Delete", fix_quota_nofs, 0);
generic_fix(sq3, show_quota_wrongpid, "Fix", fix_quota_physid, 1);
+ generic_fix(sq4, show_quota_nolist, "Delete", fix_quota_nolist, 1);
dprintf("Not checking zephyr.\n");