Messages in this thread Patch in this message |  | | Date | Tue, 12 Jan 1999 20:13:45 -0700 (MST) | | From | Brad Midgley <> | | Subject | [PATCH] sysctl real-root-dev on non-intel |
| |
Linus,
This patch allows /proc/sys/kernel/real_root_dev to be read and written on big-endian (not JUST little-endian) machines. I need this so my installer and booter in TurboLinux/PPC will work. Please consider it!!
Patch (and long justification) are also at http://pht.com/~brad/patches/
brad
--- kernel/sysctl.c.orig Mon Jan 4 20:02:02 1999 +++ kernel/sysctl.c Tue Jan 5 07:42:28 1999 @@ -162,7 +162,7 @@ {KERN_PANIC, "panic", &panic_timeout, sizeof(int), 0644, NULL, &proc_dointvec}, #ifdef CONFIG_BLK_DEV_INITRD - {KERN_REALROOTDEV, "real-root-dev", &real_root_dev, sizeof(int), + {KERN_REALROOTDEV, "real-root-dev", &real_root_dev, sizeof(real_root_dev), 0644, NULL, &proc_dointvec}, #endif #ifdef CONFIG_BINFMT_JAVA @@ -688,10 +688,11 @@ } i = (int *) table->data; - vleft = table->maxlen / sizeof(int); + vleft = table->maxlen; left = *lenp; - for (; left && vleft--; i++, first=0) { + for (; left && vleft > 0; i++, first=0) { + vleft -= sizeof(int); if (write) { while (left) { char c; @@ -726,12 +727,18 @@ val = -val; buffer += len; left -= len; - *i = val; + if(vleft >= 0) + *i = val; + else + *((unsigned short *)i) = val; } else { p = buf; if (!first) *p++ = '\t'; - sprintf(p, "%d", (*i) / conv); + if(vleft >= 0) + sprintf(p, "%d", (*i) / conv); + else + sprintf(p, "%hd", (*((unsigned short *)i)) / (unsigned short)conv); len = strlen(buf); if (len > left) len = left;
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
|  |