qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: qemu port


From: Bartosz Fabianowski
Subject: [Qemu-devel] Re: qemu port
Date: Thu, 03 Jun 2004 01:54:59 +0200
User-agent: Mozilla Thunderbird 0.6 (X11/20040602)

OK, I've now taken this and the other FreeBSD patches, added a few small ones of my own and made a port [...]

Awesome! A port was my original idea and the reason for why I started
tinkering with QEMU in the first place.

- needs to run as root in order to use /dev/tap* networking (why?)

I haven't looked at your port yet, but my own compilation of QEMU has
the same problem. It seems to me that this is because on each
invocation, QEMU creates a new tap device. Just run QEMU a few times (as
root) and then look at the output of ifconfig. Each invocation will have
produced a new tap device. Since normal users probably have no
permission to create device nodes, QEMU fails to create its required tap
device and therefore tap networking doesn't work. A fix for this would
be to create a certain amount of tap device nodes at FreeBSD start up
and then to have QEMU recycle the nodes it doesn't need any more. Then
again, maybe I am totally wrong on what is causing this.

- using physical media doesn't work on 4.x hosts (missing
DIOCGMEDIASIZE ioctl)

This is the place where it's actually used:

if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size))
    size = lseek(fd, 0LL, SEEK_END);

This ioctl checks whether the total size of the medium can be retrieved
and thus only succeeds if there is a medium in the drive. So the ioctl
effectively just checks whether there is a medium. The size is then
retrieved separately using lseek.

I haven't tried compiling or running this, but my idea would be to try
something like this instead:
    if((size = lseek(fd, 0LL, SEEK_END)) < 0)
        size = 0;

Now, lseek is always called. If there is no medium, lseek should fail,
returning some negative value. In this case, the size is set to zero to
indicate failure. Otherwise, the size determined by lseek is used.

- Bartosz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]