Re: simple cdrom eject command

"Peter T. Breuer" <[email protected]>
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
"Also sprach Alexander Esmont:"
> PTB> You might want to decompose my suggested stanza into two parts,
> PTB> "before" and "after" to better fit in with the existing code.
>  
> At this time I have simple test - 
> # eject /dev/nda
> ....
> # eject -t /dev/nda
> 
> for open and close tray. After this command I have Segmentation fault in
> kernel, and module does not removed from kernel (Device busy).

I have just tried it here on kernel 2.6.12.3. Works fine.

I started the remote server with:

   # /usr/sbin/enbd-server 5005 -m -r -s 700M /dev/cdrom

and the local client with:

   # /tmp/enbd-client remote-server:5005 -n 1 /dev/ndb

I started with a cdrom in the caddy before starting up the server (I
don't know what difference it makes - I gave the size on the command
line so it doesn't have to look at the device in case there is no media
there).

Then at the client end I ran:

    # strace eject /dev/ndb

and the trace showed the ioctl going through OK:

    ioctl(3, CDROMCLOSETRAY, 0xbf8dc08c)    = 0

Moreover, I was stracing the server at the other end too, and I saw the
ioctl being delivered:

   fcntl(10, F_GETFL)                      = 0x8000 (flags O_RDONLY|0x8000)
   close(10)                               = 0
   open("/dev/cdrom", O_RDONLY|O_NONBLOCK|0x8000) = 10
   ioctl(10, CDROMEJECT, 0xbf882f4c)       = 0
   fcntl(10, F_SETFL, O_RDONLY|0x8000)     = 0

and the tray closed (and opened, with eject -t).

So I don't see any problem.

Peter


> Please test this command at your machine and tell me - 
> its work correct or no?
> 
> That's my commands:
> # make clean
> ...
> # make
> ...
> # insmod /root/nbd-2.4.32/build/enbd.o
> # insmod /root/nbd-2.4.32/build/enbd_ioctl.o
> # /root/nbd-2.4.32/build/enbd-server 4004 -m -r /dev/hdc
> ...
> # /root/nbd-2.4.32/build/enbd-client localhost:4004 /dev/nda
> ...
> # eject /dev/nda
> # eject -t /dev/nda
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.