verfügbare Dateisysteme



  • hallo,

    mit welchen funktionen (API) kann ich mir die verfügbaren Dateisysteme meines Systems auflisten lassen? So wie das /proc/filesystems macht?

    mfg blan



  • das proc dateisystem wurde doch meines wissens nach extra dafür entwickelt um mit einfachen dateioperationen (hier: auslesen) auf systeminformation zuzugreifen und dadurch auf solche API-funktionen zu verzichten



  • falls es noch jemand benötigt:

    #include <stdio.h>
    #include <linux/unistd.h>
    
    /* define the 3-arg version of sysfs() */
    static _syscall3(int,sysfs,int,option,unsigned int,fsindex,char *,buf);
    
    /* define the 1-arg version of sysfs() */
    static int sysfs1(int i) {
        return sysfs(i,0,NULL);
    }
    
    main(){
        int i, tot;
        char buf[100];      /* how long is a filesystem type name?? */
    
        tot = sysfs1(3);
        if (tot == -1) {
            perror("sysfs(3)");
            exit(1);
        }
    
        for (i=0; i<tot; i++) {
            if (sysfs(2, i, buf)) {
                perror("sysfs(2)");
                exit(1);
            }
            printf("%2d: %s\n", i, buf);
        }
        return 0;
    }
    

    mfg blan


Anmelden zum Antworten