raw scsi device I/O

raw scsi device I/O

Post by Dr. Michael Alber » Fri, 28 Aug 1998 04:00:00



Quote:> I'm trying to write to a 9 GB disk as a raw scsi device.
> The disk is on a SPARC running SunOS 4.1.4, and is scsi device 3.
> I can open the device using the call
>      fd = open("/dev/rsd3a",O_WRONLY);
> without any errors, but when I try to write to it I get the perror message:

I suspect you've done this already, but just to make sure
after the open:

    printf("fd=%d\n", fd);

of
   if(fd==-1){
     fprintf(stderr,"can't open file: %s\n", strerror(errno));
     exit(1);
  }

Best wishes,
  Mike

 
 
 

raw scsi device I/O

Post by Jim Rei » Sat, 29 Aug 1998 04:00:00



> I'm trying to write to a 9 GB disk as a raw scsi device.
> The disk is on a SPARC running SunOS 4.1.4, and is scsi device 3.
> I can open the device using the call

>      fd = open("/dev/rsd3a",O_WRONLY);

> without any errors, but when I try to write to it I get the perror message:

>      "Invalid argument".

> As far as I can tell this means that I'm trying to write to a stream linked
> below a multiplexor, which the OS doesn't like. This error is mentionned
> in paragraph 3 of the man page for streamio(4), but I can't seem to find
> any other information explaining how to deal with this problem.

The STREAMS subsystem shouldn't be going anywhere near a raw disk
interface. I think you're looking at the wrong place in the man
pages. The reason a system call fails "Invalid argument" is
self-evident. One (or more) of the arguments to the system call is
wrong. For reads and writes to the raw disk, the most likely invalid
arguments are reading/writing data that isn't properly aligned in
memory or else using a byte count which isn't some multiple of the
fundamental block size of the device.

 
 
 

raw scsi device I/O

Post by Jim Rei » Sat, 29 Aug 1998 04:00:00



Quote:> > I'm trying to write to a 9 GB disk as a raw scsi device.
> > The disk is on a SPARC running SunOS 4.1.4, and is scsi device 3.
> > I can open the device using the call
> >      fd = open("/dev/rsd3a",O_WRONLY);
> > without any errors, but when I try to write to it I get the perror message:

> I suspect you've done this already, but just to make sure
> after the open:

>     printf("fd=%d\n", fd);

> of
>    if(fd==-1){
>      fprintf(stderr,"can't open file: %s\n", strerror(errno));
>      exit(1);
>   }

You're absolutely right to say that the return values from every
system call should be checked. However, the original poster said that
his write call failed "Invalid argument". If the open of /dev/rsd3a
had failed, the write call would have failed EBADF - "Bad file
descriptor", not EINVAL.
 
 
 

1. character device, block device , raw device?

HI, all.
    could someone explain me.

        character device
        block device
        raw device

    I'm very confusing these concepts. could someone explain me clearly.

    when can I use those?

thank you for your time.

2. How far are we away from an all-ELF Slackware distribution ?

3. scsi raw devices?

4. xanim on Solaris 2.x

5. How to do SCSI commands on raw device?

6. Problems w/ SCSI CD / kernel modules?

7. SCSI Raw Device --- need help!!!

8. Apache 1.2.6

9. raw SCSI devices

10. How relative do raw device bind block device on linux ?

11. Cannot open master raw device '/dev/rawctl' (No such device)