[BACK]Return to tcfstat.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tcfs

Annotation of src/usr.bin/tcfs/tcfstat.c, Revision 1.6

1.6     ! fgsch       1: /*     $OpenBSD$       */
        !             2:
1.1       provos      3: /*
                      4:  *     Transparent Cryptographic File System (TCFS) for NetBSD
                      5:  *     Author and mantainer:   Luigi Catuogno [luicat@tcfs.unisa.it]
                      6:  *
                      7:  *     references:             http://tcfs.dia.unisa.it
                      8:  *                             tcfs-bsd@tcfs.unisa.it
                      9:  */
                     10:
                     11: /*
                     12:  *     Base utility set v0.1
                     13:  */
                     14:
                     15: #include <sys/types.h>
                     16: #include <sys/param.h>
                     17: #include <sys/mount.h>
                     18: #include <sys/wait.h>
1.2       fgsch      19: #include <stdio.h>
                     20: #include <string.h>
                     21: #include <unistd.h>
1.1       provos     22:
                     23: #include <miscfs/tcfs/tcfs.h>
1.2       fgsch      24: #include "tcfslib.h"
1.1       provos     25:
                     26: char *stat_usage= "usage: tcfstat [-p mount-point | fs-label]";
                     27:
                     28: int
                     29: stat_main(int argc, char *argv[], char *envp[])
                     30: {
                     31:        struct tcfs_status st;
1.4       aaron      32:        int e, es, ok = 0;
1.1       provos     33:        char filesystem[MAXPATHLEN];
                     34:
1.3       aaron      35:        if (argc == 3 && !strcmp("-p", argv[1])) {
1.1       provos     36:                strlcpy(filesystem, argv[2], sizeof(filesystem));
1.3       aaron      37:                ok = 1;
1.1       provos     38:        }
                     39:
                     40:        if (argc == 2) {
1.3       aaron      41:                if (!(es = tcfs_getfspath(argv[1], filesystem))) {
                     42:                        fprintf(stderr, "filesystem label not found!\n");
1.1       provos     43:                        exit(1);
                     44:                }
                     45:                ok = 1;
                     46:        }
                     47:
                     48:        if (ok == 0 || argc < 2 || argc > 3) {
                     49:                 fprintf(stderr, "%s\n", stat_usage);
                     50:                 exit(1);
                     51:         }
                     52:
                     53:
                     54:        e = tcfs_getstatus(filesystem, &st);
                     55:        if (e == -1) {
1.3       aaron      56:                fprintf(stderr, "filesystem %s not mounted\n", filesystem);
1.1       provos     57:                exit(1);
                     58:        }
                     59:
1.3       aaron      60:        printf("Status: %d; user keys: %d, group keys: %d\n", st.status, st.n_ukey, st.n_gkey);
                     61:        printf("TCFS version: %d, Cipher: %s, keysize: %d, cipher version: %d\n", st.tcfs_version, st.cipher_desc, st.cipher_keysize, st.cipher_version);
1.1       provos     62:
                     63:        exit(0);
                     64: }
                     65: