]> andersk Git - moira.git/commitdiff
added support for fsgroups
authormar <mar>
Thu, 23 Mar 1989 16:49:19 +0000 (16:49 +0000)
committermar <mar>
Thu, 23 Mar 1989 16:49:19 +0000 (16:49 +0000)
gen/hesiod.qc

index 0c96955c66c01d656f787ef54fb20d86e79ff20c..bcdc4eab1d1afb8734fb80428a59f10910c0a4fe 100644 (file)
@@ -473,13 +473,14 @@ register char *p;
 do_filsys()
 ##{
     FILE *out;
-    char outf[64], outft[64], *mach, machbuf[128];
+    char outf[64], outft[64], *mach, machbuf[128], *group;
     register char *p;
     struct stat sb;
     time_t ftime;
+    struct save_queue *sq, *sq_create();
 ##  char name[33], type[9], loc[33], access[2], mount[33], trans[257];
 ##  char *filetime, comments[65];
-##  int flag1, flag2, flag3, id;
+##  int flag1, flag2, flag3, flag4, id, fid;
 
     sprintf(outf, "%s/filsys.db", HESIOD_DIR);
 
@@ -492,7 +493,9 @@ do_filsys()
 ##         where tblstats.table = "machine"
 ##     retrieve (flag3 = int4(interval("min", tblstats.modtime - filetime)))
 ##         where tblstats.table = "alias"
-       if (flag1 < 0 && flag2 < 0 && flag3 < 0) {
+##     retrieve (flag4 = int4(interval("min", tblstats.modtime - filetime)))
+##         where tblstats.table = "fsgroup"
+       if (flag1 < 0 && flag2 < 0 && flag3 < 0 && flag4 < 0) {
            fprintf(stderr, "File filsys.db does not need to be rebuilt.\n");
            return(0);
       }
@@ -507,13 +510,15 @@ do_filsys()
 
     fprintf(stderr, "Building filsys.db\n");
     get_mach();
+    sq = sq_create();
 
 ##  range of f is filesys
 ##  retrieve (name = f.label, type = f.#type, loc = f.#name, id = f.mach_id,
-##           access = f.#access, mount = f.#mount, comments = f.#comments) {
+##           access = f.#access, mount = f.#mount, comments = f.#comments,
+##           fid = f.filsys_id) {
            strtrim(name);
            strtrim(type);
-           if (strcmp(type, "ERR")) {
+           if (!strcmp(type, "NFS") || !strcmp(type, "RVD")) {
                strtrim(loc);
                strtrim(access);
                strtrim(mount);
@@ -528,14 +533,50 @@ do_filsys()
                    fprintf(out, "%s.filsys\tHS UNSPECA \"%s %s %s %s %s\"\n",
                            name, type, loc, machbuf, access, mount);
                }
-           } else {
+           } else if (!strcmp(type, "ERR")) {
                strtrim(comments);
                fprintf(out, "%s.filsys\tHS UNSPECA \"ERR %s\"\n",
                        name, comments);
+           } else if (!strcmp(type, "FSGROUP")) {
+               sprintf(trans, "%s:%d", name, fid);
+               sq_save_data(sq, strsave(trans));
            }
 ##  }
 
-
+##  range of g is fsgroup
+    while (sq_get_data(sq, &group)) {
+       fid = atoi(index(group, ':')+1);
+       *index(group, ':') = 0;
+##      retrieve (type = f.#type, loc = f.#name, id = f.mach_id,
+##               access = f.#access, mount = f.#mount, comments = f.#comments,
+##               name = f.#label, trans = g.#key)
+##           where f.filsys_id = g.filsys_id and g.group_id = fid
+##           sort by #trans, #name {
+           strtrim(type);
+           if (!strcmp(type, "NFS") || !strcmp(type, "RVD")) {
+               strtrim(loc);
+               strtrim(access);
+               strtrim(mount);
+               if (mach = hash_lookup(machines, id)) {
+                   for (p = machbuf; *mach && *mach != '.'; mach++) {
+                       if (isupper(*mach))
+                         *p++ = tolower(*mach);
+                       else
+                         *p++ = *mach;
+                       *p = 0;
+                   }
+                   fprintf(out, "%s.filsys\tHS UNSPECA \"%s %s %s %s %s\"\n",
+                           group, type, loc, machbuf, access, mount);
+               }
+           } else if (!strcmp(type, "ERR")) {
+               strtrim(comments);
+               fprintf(out, "%s.filsys\tHS UNSPECA \"ERR %s\"\n",
+                       group, comments);
+           }
+##     }
+       free(group);
+    }
+    sq_destroy(sq);
 
 ##  range of a is alias
 ##  retrieve (name = a.#name, trans = a.#trans) where a.#type = "FILESYS" {
This page took 0.065614 seconds and 5 git commands to generate.