Signed-off-by: Paolo 'Blaisorblade' Giarrusso --- um-linux-2.4.27-paolo/arch/um/fs/hostfs/hostfs.h | 2 +- um-linux-2.4.27-paolo/arch/um/fs/hostfs/hostfs_kern.c | 11 ++++++++--- um-linux-2.4.27-paolo/arch/um/fs/hostfs/hostfs_user.c | 10 +++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff -puN arch/um/fs/hostfs/hostfs.h~uml-hostfs-fix-maj-min arch/um/fs/hostfs/hostfs.h --- um-linux-2.4.27/arch/um/fs/hostfs/hostfs.h~uml-hostfs-fix-maj-min 2005-04-15 11:13:15.000000000 +0200 +++ um-linux-2.4.27-paolo/arch/um/fs/hostfs/hostfs.h 2005-04-15 11:13:15.000000000 +0200 @@ -39,7 +39,7 @@ extern int stat_file(const char *path, i int *blksize_out, unsigned long long *blocks_out); extern int access_file(char *path, int r, int w, int x); extern int open_file(char *path, int r, int w, int append); -extern int file_type(const char *path, int *rdev); +extern int file_type(const char *path, int *maj, int *min); extern void *open_dir(char *path, int *err_out); extern char *read_dir(void *stream, unsigned long long *pos, unsigned long long *ino_out, int *len_out); diff -puN arch/um/fs/hostfs/hostfs_kern.c~uml-hostfs-fix-maj-min arch/um/fs/hostfs/hostfs_kern.c --- um-linux-2.4.27/arch/um/fs/hostfs/hostfs_kern.c~uml-hostfs-fix-maj-min 2005-04-15 11:13:15.000000000 +0200 +++ um-linux-2.4.27-paolo/arch/um/fs/hostfs/hostfs_kern.c 2005-04-15 11:13:15.000000000 +0200 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "hostfs.h" #include "kern_util.h" @@ -203,7 +204,7 @@ static int read_inode(struct inode *ino) if(name == NULL) goto out; - if(file_type(name, NULL) == OS_TYPE_SYMLINK){ + if(file_type(name, NULL, NULL) == OS_TYPE_SYMLINK){ name = follow_link(name); if(IS_ERR(name)){ err = PTR_ERR(name); @@ -477,7 +478,9 @@ static struct inode *get_inode(struct su { struct inode *inode; char *name; - int type, err = -ENOMEM, rdev; + int type, err = -ENOMEM; + int maj, min; + dev_t rdev = 0; inode = new_inode(sb); if(inode == NULL) @@ -493,7 +496,9 @@ static struct inode *get_inode(struct su err = -ENOMEM; goto out_put; } - type = file_type(name, &rdev); + type = file_type(name, &maj, &min); + /*Reencode maj and min with the kernel encoding.*/ + rdev = MKDEV(maj, min); kfree(name); } else type = OS_TYPE_DIR; diff -puN arch/um/fs/hostfs/hostfs_user.c~uml-hostfs-fix-maj-min arch/um/fs/hostfs/hostfs_user.c --- um-linux-2.4.27/arch/um/fs/hostfs/hostfs_user.c~uml-hostfs-fix-maj-min 2005-04-15 11:13:15.000000000 +0200 +++ um-linux-2.4.27-paolo/arch/um/fs/hostfs/hostfs_user.c 2005-04-15 11:13:15.000000000 +0200 @@ -46,14 +46,18 @@ int stat_file(const char *path, int *dev return(0); } -int file_type(const char *path, int *rdev) +int file_type(const char *path, int *maj, int *min) { struct stat64 buf; if(lstat64(path, &buf) < 0) return(-errno); - if(rdev != NULL) - *rdev = buf.st_rdev; + /*We cannot pass rdev as is because glibc and the kernel disagree + *about its definition.*/ + if(maj != NULL) + *maj = major(buf.st_rdev); + if(min != NULL) + *min = minor(buf.st_rdev); if(S_ISDIR(buf.st_mode)) return(OS_TYPE_DIR); else if(S_ISLNK(buf.st_mode)) return(OS_TYPE_SYMLINK); _