Skip to contentSkip to conversation

2.6.0-test2-mm5 working on ppc

PATCH Paul Mackerras 2 participants 2 messages Aug 7, 2003 – Aug 8, 2003 VFS

lore
Share & tools
lore
#0 lore raw

This patch gets 2.6.0-test2-mm5 to boot on my G3 powerbook. The first problem was that we had dev_t in struct stat, thus userland became unhappy when dev_t changed size.

The second problem was that sys_mknod got changed to take an unsigned int rather than a dev_t, but we were still calling it with a dev_t argument in init/do_mounts.h and init/initramfs.c. That might sorta work on x86 but it doesn't on ppc. My solution to that is to export and use do_mknod instead. Of course the do_mknod prototype should really go in a header somewhere but I was too lazy to do that.

Paul.

include/asm-ppc/stat.h +2 -2
diff -urN mm5-orig/include/asm-ppc/stat.h test25/include/asm-ppc/stat.h
@@ -22,13 +22,13 @@
 #define STAT_HAVE_NSEC 1
 
 struct stat {
-	dev_t		st_dev;
+	unsigned int	st_dev;
 	ino_t		st_ino;
 	mode_t		st_mode;
 	nlink_t		st_nlink;
 	uid_t 		st_uid;
 	gid_t 		st_gid;
-	dev_t		st_rdev;
+	unsigned int	st_rdev;
 	off_t		st_size;
 	unsigned long  	st_blksize;
 	unsigned long  	st_blocks;
fs/namei.c +1 -2
diff -urN mm5-orig/fs/namei.c test25/fs/namei.c
@@ -1431,8 +1431,7 @@
 	return error;
 }
 
-static long
-do_mknod(const char __user *filename, int mode, dev_t dev)
+long do_mknod(const char __user *filename, int mode, dev_t dev)
 {
 	int error = 0;
 	char *tmp;
init/do_mounts.h +2 -2
diff -urN mm5-orig/init/do_mounts.h test25/init/do_mounts.h
@@ -10,7 +10,6 @@
 #include <linux/root_dev.h>
 
 asmlinkage long sys_unlink(const char *name);
-asmlinkage long sys_mknod(const char *name, int mode, dev_t dev);
 asmlinkage long sys_newstat(char * filename, struct stat * statbuf);
 asmlinkage long sys_ioctl(int fd, int cmd, unsigned long arg);
 asmlinkage long sys_mkdir(const char *name, int mode);
@@ -22,6 +21,7 @@
 				 unsigned long flags, void *data);
 asmlinkage long sys_umount(char *name, int flags);
 
+long  do_mknod(const char *name, int mode, dev_t dev);
 dev_t name_to_dev_t(char *name);
 void  change_floppy(char *fmt, ...);
 void  mount_block_root(char *name, int flags);
@@ -43,7 +43,7 @@
 static inline int create_dev(char *name, dev_t dev, char *devfs_name)
 {
 	sys_unlink(name);
-	return sys_mknod(name, S_IFBLK|0600, dev);
+	return do_mknod(name, S_IFBLK|0600, dev);
 }
 
 #endif
init/initramfs.c +2 -2
diff -urN mm5-orig/init/initramfs.c test25/init/initramfs.c
@@ -24,7 +24,6 @@
 }
 
 asmlinkage long sys_mkdir(char *name, int mode);
-asmlinkage long sys_mknod(char *name, int mode, dev_t dev);
 asmlinkage long sys_symlink(char *old, char *new);
 asmlinkage long sys_link(char *old, char *new);
 asmlinkage long sys_write(int fd, const char *buf, size_t size);
@@ -33,6 +32,7 @@
 asmlinkage long sys_fchown(int fd, uid_t uid, gid_t gid);
 asmlinkage long sys_chmod(char *name, mode_t mode);
 asmlinkage long sys_fchmod(int fd, mode_t mode);
+long do_mknod(char *name, int mode, dev_t dev);
 
 /* link hash */
 
@@ -264,7 +264,7 @@
 	} else if (S_ISBLK(mode) || S_ISCHR(mode) ||
 		   S_ISFIFO(mode) || S_ISSOCK(mode)) {
 		if (maybe_link() == 0) {
-			sys_mknod(collected, mode, rdev);
+			do_mknod(collected, mode, rdev);
 			sys_chown(collected, uid, gid);
 		}
 	} else
#1 lore raw
Quoted 4 lines · Paul Mackerras

This patch gets 2.6.0-test2-mm5 to boot on my G3 powerbook. The first problem was that we had dev_t in struct stat, thus userland became unhappy when dev_t changed size.

OK.

Quoted 5 lines

The second problem was that sys_mknod got changed to take an unsigned int rather than a dev_t, but we were still calling it with a dev_t argument in init/do_mounts.h and init/initramfs.c. That might sorta work on x86 but it doesn't on ppc. My solution to that is to export and use do_mknod instead.

Well yes. The reason for this problem is that people keep on putting function prototypes into .c files.

I might add that the major sinners are maintainers of non-ia32 architectures.

Quoted 2 lines

Of course the do_mknod prototype should
really go in a header somewhere but I was too lazy to do that.

I'll find somewhere to tuck it. Thanks for working all that out.