Hi! Another Wisconsin student and I are trying to use the SGI RawIO patch to
do some experiments relating to HTTP web caching, and we are not quite sure
how to set it up. Here's what we've done:
- applied the patch to a 2.2.13 kernel (set the CONFIG_RAW, using make
xconfig) and booted with it.
- added a raw device with the command:
mknod raw c 8 9
where sda9 was a spare partition on my scsi disk.
[root@calamata raw-prelim]# ls -la /dev/sda*
brw-rw---- 1 root disk 8, 0 May 5 1998 /dev/sda
brw-rw---- 1 root disk 8, 1 May 5 1998 /dev/sda1
brw-rw---- 1 root disk 8, 10 May 5 1998 /dev/sda10
brw-rw---- 1 root disk 8, 11 May 5 1998 /dev/sda11
brw-rw---- 1 root disk 8, 12 May 5 1998 /dev/sda12
brw-rw---- 1 root disk 8, 13 May 5 1998 /dev/sda13
brw-rw---- 1 root disk 8, 14 May 5 1998 /dev/sda14
brw-rw---- 1 root disk 8, 15 May 5 1998 /dev/sda15
brw-rw---- 1 root disk 8, 2 May 5 1998 /dev/sda2
brw-rw---- 1 root disk 8, 3 May 5 1998 /dev/sda3
brw-rw---- 1 root disk 8, 4 May 5 1998 /dev/sda4
brw-rw---- 1 root disk 8, 5 May 5 1998 /dev/sda5
brw-rw---- 1 root disk 8, 6 May 5 1998 /dev/sda6
brw-rw---- 1 root disk 8, 7 May 5 1998 /dev/sda7
brw-rw---- 1 root disk 8, 8 May 5 1998 /dev/sda8
brw-rw---- 1 root disk 8, 9 May 5 1998 /dev/sda9
And then I've tried to run the two follow C programs but, by the looks of the
output, things aren't quite working:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main () {
printf ("hi!");
int fd = open ("/dev/raw", O_WRONLY);
if (fd < 2) {
printf ("bad fd = %d\n", fd);
exit (-1);
}
char *bufOut;
bufOut = new char [512];
sprintf (bufOut, "i'm hungry.");
int writeLen = write (fd, bufOut, 512);
printf ("fd=%d %d %s\n", fd, writeLen, bufOut);
close (fd);
}
***************************************
output:
[root@calamata raw-prelim]# ./write
hi!fd=3 -1 i'm hungry.
**************************************
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main () {
printf ("hi!");
int fd = open ("/dev/raw", O_RDONLY);
if (fd < 2) {
printf ("bad fd = %d\n", fd);
exit (-1);
}
char *bufIn;
bufIn = new char [512];
int readLen = read (fd, bufIn, 512);
printf ("fd = %d readLen=%d %s\n", fd, readLen, bufIn);
close (fd);
}
******************************************
output:
[root@calamata raw-prelim]# ./read
hi!fd = 3 readLen=-1
******************************************
Thanks for _any_ suggestions!
-jonathan
|