0

I use grub and put one distro tinycore linux on windows partition(c:/).I don't know why ntfw doesn't read this partition(sda1).I use this partition(in memory). Below is the code and without "FTW_MOUNT" it will fail

#define _XOPEN_SOURCE 600
#include <ftw.h>
#include <stdio.h>

#define MAX_LEVEL 1

int show(const char* path, const struct stat* st, int flags, struct FTW* ftw) {
    if (ftw->level > MAX_LEVEL)return 0;
    printf("path : %s mode : %o flag : %d\n", path, st->st_mode,flags);
    return 0;
}

int main(){
    if(nftw("/mnt", show, 10,FTW_MOUNT | FTW_DEPTH | FTW_PHYS) != 0){
        printf("error\n");
        return 1;
    }
    return 0;
}

Below is the result(sdb5 is linux)

tc@box:/tmp$ ./walker
path : /mnt/sdb1 mode : 40755 flag : 5
path : /mnt/sdb3 mode : 40755 flag : 5
path : /mnt/sdb5 mode : 40755 flag : 5
path : /mnt/sdb2 mode : 40755 flag : 5
path : /mnt mode : 40775 flag : 5

This is my grub menu.lst from drive c:

title Tiny Core 8
kernel /boot/vmlinuz tce=sda1
initrd /boot/tiny.gz
nimday
  • 333
  • 3
  • 9

0 Answers0