9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Mouse jumps in vmware
@ 2008-12-07  8:27 Rodolfo kix Garcia
  2008-12-07  8:44 ` lucio
  2008-12-07  9:22 ` Skip Tavakkolian
  0 siblings, 2 replies; 16+ messages in thread
From: Rodolfo kix Garcia @ 2008-12-07  8:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi!

I use acme in vmware (windows) with two different virtual machines, a
Plan9 virtual machine and Linux+p9p virtual machine. The problem is the
same.

When I make r-click in acme (to search, or open a file), and the mouse
jumps to other place in the screen and vmware lost the mouse reference.
This is probably because the mouse is not moved, only the pointer on the
screen is drawed. Then I have problems moving it, the mouse is slow in
some places of the screen, ...

Is possible that acme sends to vmware (or the real os) something like
"move left, move left, ... move up, move up, ..." to the new position?
Then the relation between the real mouse pointer (vmware) and the
virtual mouse pointer (plan9 or linux+x11+p9p) will be equal and then we
will not have this problems.

Yes, I know, the problem is vmware :-)

kix



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07  8:27 [9fans] Mouse jumps in vmware Rodolfo kix Garcia
@ 2008-12-07  8:44 ` lucio
  2008-12-07  9:12   ` Rodolfo kix Garcia
  2008-12-07 11:00   ` Uriel
  2008-12-07  9:22 ` Skip Tavakkolian
  1 sibling, 2 replies; 16+ messages in thread
From: lucio @ 2008-12-07  8:44 UTC (permalink / raw)
  To: 9fans

> Yes, I know, the problem is vmware :-)

No, the problem is _not_ vmware.  At least to the extent that vmware
is just another hardware model.  The only really unfortunate thing
about vmware is that they are holding a few cards close to their chest
with a view to making a bit of a profit.  It may not be to one's
greatest advantage, but it seems legitimate to me and above the of
criticism levelled in the above.

++L

PS: I'm a contented small time user of vmware's ESX Server 3i.  All
the products from vmware (not many, I must confess) I have had
occasion to use and in keeping with impressions gained while
monitoring dicussions on the Xen developers' mailing list, convince me
that vmware strive for professionalism, understandably within the
limits set by the marketplace.  It's my personal opinion that none of
the equivalent tools available today are in the same league, so I
can't resist defending what I consider to be the market leader; feel
free to correct me (privately, preferably).




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07  8:44 ` lucio
@ 2008-12-07  9:12   ` Rodolfo kix Garcia
  2008-12-07  9:17     ` lucio
  2008-12-07 11:00   ` Uriel
  1 sibling, 1 reply; 16+ messages in thread
From: Rodolfo kix Garcia @ 2008-12-07  9:12 UTC (permalink / raw)
  To: lucio, Fans of the OS Plan 9 from Bell Labs

Hi Lucio,

I am happy with vmware. Is very good environment for my plan9, because 
my wifi card is not supported, ...

"the problem is vmware" is to avoid comments about it.

lucio@proxima.alt.za escribió:
>> Yes, I know, the problem is vmware :-)
>>     
>
> No, the problem is _not_ vmware.  At least to the extent that vmware
> is just another hardware model.  The only really unfortunate thing
> about vmware is that they are holding a few cards close to their chest
> with a view to making a bit of a profit.  It may not be to one's
> greatest advantage, but it seems legitimate to me and above the of
> criticism levelled in the above.
>
> ++L
>
> PS: I'm a contented small time user of vmware's ESX Server 3i.  All
> the products from vmware (not many, I must confess) I have had
> occasion to use and in keeping with impressions gained while
> monitoring dicussions on the Xen developers' mailing list, convince me
> that vmware strive for professionalism, understandably within the
> limits set by the marketplace.  It's my personal opinion that none of
> the equivalent tools available today are in the same league, so I
> can't resist defending what I consider to be the market leader; feel
> free to correct me (privately, preferably).
>
>
>   




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07  9:12   ` Rodolfo kix Garcia
@ 2008-12-07  9:17     ` lucio
  2008-12-07  9:33       ` Rodolfo kix Garcia
  0 siblings, 1 reply; 16+ messages in thread
From: lucio @ 2008-12-07  9:17 UTC (permalink / raw)
  To: 9fans

> I am happy with vmware. Is very good environment for my plan9, because
> my wifi card is not supported, ...

No offence intended or taken, I just thought that vmware generally get
an undeservedly bad rap on this list :-)

++L




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07  8:27 [9fans] Mouse jumps in vmware Rodolfo kix Garcia
  2008-12-07  8:44 ` lucio
@ 2008-12-07  9:22 ` Skip Tavakkolian
  1 sibling, 0 replies; 16+ messages in thread
From: Skip Tavakkolian @ 2008-12-07  9:22 UTC (permalink / raw)
  To: 9fans

> Is possible that acme sends to vmware (or the real os) something like
> "move left, move left, ... move up, move up, ..." to the new position?
> Then the relation between the real mouse pointer (vmware) and the
> virtual mouse pointer (plan9 or linux+x11+p9p) will be equal and then we
> will not have this problems.

acme definitely writes to /dev/mouse to position the cursor where
the search found a pattern; mouse(3) describes the format. i would
check the plan9 mouse driver for vmware.  i don't see the problem
with vmware 4.5 and a kernel from earlier this year.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07  9:17     ` lucio
@ 2008-12-07  9:33       ` Rodolfo kix Garcia
  2008-12-07 10:00         ` [9fans] VM support (Was: Mouse jumps in vmware) lucio
  2008-12-07 14:10         ` [9fans] Mouse jumps in vmware erik quanstrom
  0 siblings, 2 replies; 16+ messages in thread
From: Rodolfo kix Garcia @ 2008-12-07  9:33 UTC (permalink / raw)
  To: lucio, Fans of the OS Plan 9 from Bell Labs

I tryed xen, qemu and vmware ... and IMO vmware is better for my plan9 
virtual machines.

In other thread (probably long) ... we need think about to support any 
emulated software. We are not many people and write drivers is a hard 
work. I am not sure what is the rate of 9fans using real/emulated hardware.

lucio@proxima.alt.za escribió:
>> I am happy with vmware. Is very good environment for my plan9, because 
>> my wifi card is not supported, ...
>>     
>
> No offence intended or taken, I just thought that vmware generally get
> an undeservedly bad rap on this list :-)
>
> ++L
>
>
>   




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [9fans]  VM support (Was: Mouse jumps in vmware)
  2008-12-07  9:33       ` Rodolfo kix Garcia
@ 2008-12-07 10:00         ` lucio
  2008-12-07 10:37           ` Charles Forsyth
  2008-12-07 14:10         ` [9fans] Mouse jumps in vmware erik quanstrom
  1 sibling, 1 reply; 16+ messages in thread
From: lucio @ 2008-12-07 10:00 UTC (permalink / raw)
  To: 9fans

> In other thread (probably long) ... we need think about to support any
> emulated software. We are not many people and write drivers is a hard
> work. I am not sure what is the rate of 9fans using real/emulated hardware.

Ron seems to do all the necessary exploring of novel VM approaches,
bless his soul.  In an ideal world, I believe that
(para)virtualisation should be founded on Plan 9, allowing the Open
Source kernels to exploit the simplicity of the Plan 9 device driver
interface, but reality is otherwise.  Unfortunately, in the same
reality it is unprofitable to invest in improving the foundations for
better Plan 9 support: what we all want is better served by Windows
and Linux applications.

What is missing is an understanding that the current way is much too
complex and is not getting any better.  As soon as Joe Public realises
that there is a price to pay for the superfluous complexity,
conditions may change.  Problem is, there is an even steeper price to
be paid to get Joe Public to figure this out.

++L




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] VM support (Was: Mouse jumps in vmware)
  2008-12-07 10:00         ` [9fans] VM support (Was: Mouse jumps in vmware) lucio
@ 2008-12-07 10:37           ` Charles Forsyth
  0 siblings, 0 replies; 16+ messages in thread
From: Charles Forsyth @ 2008-12-07 10:37 UTC (permalink / raw)
  To: lucio, 9fans

>what we all want is better served by Windows and Linux applications.

>What is missing is an understanding ...

 ... of how to design and write usable applications.
from time to time i might need to do some non-programming work.
on linux, there are a great many applications, but almost as many are
both hardly usable and incomplete, and the ones that are "complete"
are infuriating (eg, gimp).  i just hate using them.
on windows, i can find almost nothing useful delivered with the
machine (even worse than plan 9, in many ways), so i either pay
a lot of money [and then as with acrobat i am mostly disappointed]
or revert to linux (see above).



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07  8:44 ` lucio
  2008-12-07  9:12   ` Rodolfo kix Garcia
@ 2008-12-07 11:00   ` Uriel
  2008-12-09  7:57     ` Russ Cox
  1 sibling, 1 reply; 16+ messages in thread
From: Uriel @ 2008-12-07 11:00 UTC (permalink / raw)
  To: lucio, Fans of the OS Plan 9 from Bell Labs

On Sun, Dec 7, 2008 at 9:44 AM,  <lucio@proxima.alt.za> wrote:
>> Yes, I know, the problem is vmware :-)
>
> No, the problem is _not_ vmware.  At least to the extent that vmware
> is just another hardware model.  The only really unfortunate thing
> about vmware is that they are holding a few cards close to their chest
> with a view to making a bit of a profit.  It may not be to one's
> greatest advantage, but it seems legitimate to me and above the of
> criticism levelled in the above.

Wrong: http://open-vm-tools.sourceforge.net/

Now maybe somebody will release the code for the /bin/aux/vm* vmware
tools so we can fix them.

Peace

uriel - Not holding his breath.

> ++L
>
> PS: I'm a contented small time user of vmware's ESX Server 3i.  All
> the products from vmware (not many, I must confess) I have had
> occasion to use and in keeping with impressions gained while
> monitoring dicussions on the Xen developers' mailing list, convince me
> that vmware strive for professionalism, understandably within the
> limits set by the marketplace.  It's my personal opinion that none of
> the equivalent tools available today are in the same league, so I
> can't resist defending what I consider to be the market leader; feel
> free to correct me (privately, preferably).
>
>
>



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07  9:33       ` Rodolfo kix Garcia
  2008-12-07 10:00         ` [9fans] VM support (Was: Mouse jumps in vmware) lucio
@ 2008-12-07 14:10         ` erik quanstrom
  2008-12-07 14:37           ` Richard Miller
  1 sibling, 1 reply; 16+ messages in thread
From: erik quanstrom @ 2008-12-07 14:10 UTC (permalink / raw)
  To: 9fans

> We are not many people and write drivers is a hard
> work.

why not give it a shot?

writing drivers is the most straightforward and rewarding
part of my job.

- erik




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07 14:10         ` [9fans] Mouse jumps in vmware erik quanstrom
@ 2008-12-07 14:37           ` Richard Miller
  2008-12-07 14:47             ` erik quanstrom
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Miller @ 2008-12-07 14:37 UTC (permalink / raw)
  To: 9fans

> writing drivers is the most straightforward

Have you found some devices with fully documented programming interfaces,
which actually behave as the documentation describes?  Lucky man.

> and rewarding
> part of my job.

There I agree with you.  But I like solving puzzles.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07 14:37           ` Richard Miller
@ 2008-12-07 14:47             ` erik quanstrom
  0 siblings, 0 replies; 16+ messages in thread
From: erik quanstrom @ 2008-12-07 14:47 UTC (permalink / raw)
  To: 9fans

>> writing drivers is the most straightforward
>
> Have you found some devices with fully documented programming interfaces,
> which actually behave as the documentation describes?  Lucky man.

sure.  intel writes good documentation these days.

- erik




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-07 11:00   ` Uriel
@ 2008-12-09  7:57     ` Russ Cox
  2008-12-11 18:47       ` Skip Tavakkolian
  0 siblings, 1 reply; 16+ messages in thread
From: Russ Cox @ 2008-12-09  7:57 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]

> Wrong: http://open-vm-tools.sourceforge.net/
>
>  Now maybe somebody will release the code for the /bin/aux/vm* vmware
>  tools so we can fix them.

In order to get the information that I used to
write aux/vmware, I signed an NDA that prohibits
me from releasing the source code, regardless
of what VMware has done in the interim.  At the
time, that was the only way to get the information.

That said, the mechanism for backdoor calls into
VMware has completely changed at least twice
since I wrote aux/vmware, which is why it no longer
works very well.  It's no loss to start from scratch.
If I thought the program was still useful today, I might
try to get permission to release it.  But it's just not
useful anymore in any real sense.

Also, the program is pretty small:

vx32% wc *.[chs] mkfile
     84     206    1683 all.h
     27      49     289 asmbackdoor.s
     34      83     539 backdoor.c
     16      33     217 calls.c
    642    1303   10148 fs.c
    176     326    2224 inout.c
     33      46     392 isvmware.c
     10      13      98 mousepoll.c
    224     551    3677 msgchan.c
     44      69     554 vmmousepoll.c
     12      11     177 mkfile
   1302    2690   19998 total
vx32%

I have attached fs.c, which is quite generic
and has no VMware-specific goo.  Maybe
someone will be motivated to fill in the rest
using the latest and greatest VMware API
instead of one from seven and a half years ago.
Or maybe Uriel will just keep whining.

Russ

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fs.c --]
[-- Type: text/x-csrc; name=fs.c, Size: 10148 bytes --]

#include "all.h"
#include <fcall.h>
#include <thread.h>
#include <9p.h>

char *mtpt = "/mnt/vmware";
char *srvname;
uint time0;

enum
{
	Qroot = 0,
	Qmousepoint,
	Qsnarf,
	Qgui,
	Qdev,
	Qtime,
	Qbintime,
	Qmsg,
};

typedef struct Tab Tab;
struct Tab
{
	int qid;
	char *name;
	uint perm;
	uint vers;
	void (*open)(Req*);
	void (*read)(Req*);
	void (*write)(Req*);
	void (*close)(Fid*);
};

static void
mousepointread(Req *r)
{
	char buf[32];
	Point p;

	p = getmousepoint();
	snprint(buf, sizeof buf, "%11d %11d ", p.x, p.y);
	readstr(r, buf);
	respond(r, nil);
}

static void
mousepointwrite(Req *r)
{
	char buf[32], *f[3];
	int nf, n;
	Point p;

	n = r->ifcall.count;
	if(n >= sizeof buf){
		respond(r, "write too large");
		return;
	}
	memmove(buf, r->ifcall.data, n);
	buf[n] = '\0';
	nf = tokenize(buf, f, nelem(f));
	if(nf != 2){
		respond(r, "bad point format");
		return;
	}
	p.x = atoi(f[0]);
	p.y = atoi(f[1]);
	setmousepoint(p);
	respond(r, nil);
}

static void
timeread(Req *r)
{
	char buf[32];
	uint sec, microsec, lag;

	gettime(&sec, &microsec, &lag);
	snprint(buf, sizeof buf, "%11d ", sec);
	readstr(r, buf);
	respond(r, nil);
}

static uvlong uvorder = 0x0001020304050607ULL;
static uchar*
vlong2le(uchar *t, vlong from)
{
	uchar *f, *o;
	int i;

	f = (uchar*)&from;
	o = (uchar*)&uvorder;
	for(i = 0; i < sizeof(vlong); i++)
		t[i] = f[o[i]];
	return t+sizeof(vlong);
}

static void
bintimeread(Req *r)
{
	uchar *b;
	int i, n;
	uint sec, microsec, lag;
	vlong nsec;

	b = (uchar*)r->ofcall.data;
	n = r->ifcall.count;

	i = 0;
	if(n >= 8){
		gettime(&sec, &microsec, &lag);
		nsec = sec*1000000000LL+microsec*1000LL;
		vlong2le(b, nsec);
		i = 8;
	}
	if(n >= 16){
		vlong2le(b+8, nsec);
		i = 16;
	}
	if(n >= 24){
		vlong2le(b+16, 1000000000LL);
		i = 24;
	}
	r->ofcall.count = i;
	respond(r, nil);
}

char *snarf;
int nsnarf;
char *tsnarf;
int ntsnarf;

static void
snarfread(Req *r)
{
	int i;

	if(r->ifcall.offset == 0){
		if(snarf)
			free(snarf);
		nsnarf = getsnarflength();
		snarf = emalloc9p(nsnarf+4+1);
		for(i=0; i<nsnarf; i+=4)
			*(uint*)(snarf+i) = getsnarfpiece();
		snarf[nsnarf] = '\0';
		nsnarf = strlen(snarf);	/* there's extra crap because we have to transfer 4 bytes at a time */
	}

	readbuf(r, snarf, nsnarf);
	respond(r, nil);
}

static void
snarfwrite(Req *r)
{
	if(r->ifcall.offset == 0){
		free(tsnarf);
		tsnarf = nil;
		ntsnarf = 0;
	}
	if(r->ifcall.offset > 100*1024){
		respond(r, "snarf buffer too long");
		return;
	}
	tsnarf = erealloc9p(tsnarf, ntsnarf+r->ifcall.count);
	memmove(tsnarf+ntsnarf, r->ifcall.data, r->ifcall.count);
	ntsnarf += r->ifcall.count;
	r->ofcall.count = r->ifcall.count;
	respond(r, nil);
}

static void
snarfclose(Fid *fid)
{
	int i;

	if((fid->omode&3) == OREAD)
		return;

	setsnarflength(ntsnarf);
	for(i=0; i<ntsnarf; i+=4)
		setsnarfpiece(*(uint*)(tsnarf+i));
	free(tsnarf);
	tsnarf = nil;
	ntsnarf = 0;
}

typedef struct Bit Bit;
struct Bit 
{
	char *name;
	uint bit;
};

Bit guibit[] = {
	"autograb",	1,
	"autorelease",	2,
	"autoscroll",	4,
	"autoraise",	8,
	"copypaste",	0x10,
	"hidecursor",	0x20,
	"fullscreen",	0x40,
	"tofullscreen",	0x80,
	"towindow",	0x100,
	"autoraise-disabled",	0x200,
	"synctime",	0x400,
};

static void
guiread(Req *r)
{
	int i;
	char *s;
	Fmt fmt;
	uint val;

	val = getguistate();
	fmtstrinit(&fmt);
	for(i=0; i<nelem(guibit); i++)
		fmtprint(&fmt, "%s %s\n", guibit[i].name, (val & guibit[i].bit) ? "on" : "off");
	s = fmtstrflush(&fmt);
	readstr(r, s);
	free(s);
	respond(r, nil);
}

static void
guiwrite(Req *r)
{
	int i, on;
	uint v;
	Cmdbuf *cb;

	cb = parsecmd(r->ifcall.data, r->ifcall.count);
	if(cb->nf != 2){
		respondcmderror(r, cb, "bad gui ctl");
		free(cb);
		return;
	}

	if(strcmp(cb->f[1], "off")==0)
		on = 0;
	else if(strcmp(cb->f[1], "on") == 0)
		on = 1;
	else{
		respondcmderror(r, cb, "bad gui ctl");
		free(cb);
		return;
	}

	for(i=0; i<nelem(guibit); i++)
		if(strcmp(guibit[i].name, cb->f[0]) == 0)
			goto Have;
	respondcmderror(r, cb, "bad gui ctl");
	free(cb);
	return;

Have:
	v = getguistate();
	if(on)
		v |= guibit[i].bit;
	else
		v &= ~guibit[i].bit;
	setguistate(v);
	r->ofcall.count = r->ifcall.count;
	free(cb);
	respond(r, nil);
}

typedef struct Info Info;
struct Info
{
	char name[32];
	uint uid;
	uint enabled;
};
static int
getinfo(uint id, Info *p)
{
	uint i;

	for(i=0; i<sizeof(Info); i+=4)
		if(getdeviceinfo(id, i, (uint*)((uchar*)p+i)) == 0)
			return -1;
	return 0;
}

static void
devread(Req *r)
{
	int i;
	char *s;
	Fmt fmt;
	Info info;

	fmtstrinit(&fmt);
	memset(&info, 0, sizeof info);
	for(i=0; i<100; i++){
		if(getinfo(i, &info) < 0)
			break;
		fmtprint(&fmt, "%11d %q %s\n", info.uid, info.name, info.enabled ? "on" : "off");
	}
	s = fmtstrflush(&fmt);
	readstr(r, s);
	respond(r, nil);
	free(s);
}

static void
fsmsgread(Req *r)
{
	char *s;
	Msgchan *c;

	c = r->fid->aux;
	if(c == nil){
		respond(r, "message channel not open");
		return;
	}

	if(r->ifcall.offset == 0){
		if(recvmsg(c, &s) < 0){
			respond(r, "no messages waiting");
			return;
		}
	}
	if(c->a == nil){
		respond(r, "no messages waiting");
		return;
	}
	readbuf(r, c->a, c->na);
	respond(r, nil);
}

static void
fsmsgwrite(Req *r)
{
	char buf[32], *p;
	int n;
	Msgchan *c;

	if(r->ifcall.offset != 0){
		respond(r, "must write at offset zero");
		return;
	}

	r->ofcall.count = r->ifcall.count;
	c = r->fid->aux;
	if(c == nil){
		if(r->ifcall.count >= sizeof buf){
			respond(r, "bad message channel number");
			return;
		}
		memmove(buf, r->ifcall.data, r->ifcall.count);
		buf[r->ifcall.count] = 0;
		p = buf;
		n = strtol(buf, &p, 0);
		if(p == buf){
			respond(r, "bad message channel number");
			return;
		}
		c = openmsg(n);
		if(c == nil){
			respond(r, "could not open message channel");
			return;
		}
		r->fid->aux = c;
		respond(r, nil);
		return;
	}

	if(sendmsg(c, r->ifcall.data, r->ifcall.count) < 0){
		respond(r, "could not send message");
		return;
	}
	respond(r, nil);
}

static void
fsmsgclose(Fid *fid)
{
	Msgchan *c;

	c = fid->aux;
	if(c)
		closemsg(c);
}

Tab tab[] = {
	Qmousepoint, "mouse", 0666, 0, nil, mousepointread, mousepointwrite, nil,
	Qsnarf, "snarf", 0666, 0, nil, snarfread, snarfwrite, snarfclose,
	Qgui, "gui", 0666, 0, nil, guiread, guiwrite, nil,
	Qdev, "dev", 0444, 0, nil, devread, nil, nil,
	Qtime, "time", 0444, 0, nil, timeread, nil, nil,
	Qbintime, "bintime", 0444, 0, nil, bintimeread, nil, nil,
	Qmsg, "msg", 0666, 0, nil, fsmsgread, fsmsgwrite, fsmsgclose,
};

void
fsattach(Req *r)
{
	char *spec;

	spec = r->ifcall.aname;
	if(spec && spec[0]){
		respond(r, "invalid attach specifier");
		return;
	}
	r->ofcall.qid = (Qid){Qroot, 0, QTDIR};
	r->fid->qid = r->ofcall.qid;
	respond(r, nil);
}

char*
fswalk1(Fid *fid, char *name, Qid *qid)
{
	int i;

	switch((int)fid->qid.path){
	case Qroot:
		for(i=0; i<nelem(tab); i++){
			if(strcmp(name, tab[i].name) == 0){
				fid->qid.path = tab[i].qid;
				fid->qid.type = tab[i].perm>>24;;
				fid->qid.vers = tab[i].vers;
				*qid = fid->qid;
				return nil;
			}
		}
		break;
	}

	return "file not found";
}

void
fsstat(Req *r)
{
	int i, q;
	Dir *d;

	d = &r->d;
	memset(d, 0, sizeof *d);
	q = r->fid->qid.path;
	d->qid = r->fid->qid;
	switch(q){
	case Qroot:
		d->name = estrdup9p("/");
		d->mode = DMDIR|0777;
		break;

	default:
		for(i=0; i<nelem(tab); i++){
			if(tab[i].qid == q){
				d->qid.vers = tab[i].vers;
				d->qid.type = tab[i].perm>>24;
				d->mode = tab[i].perm;
				goto Out;
			}
		}
		respond(r, "file not found");
	}

Out:
	d->atime = d->mtime = time0;
	d->uid = estrdup9p("vmware");
	d->gid = estrdup9p("vmware");
	d->muid = estrdup9p("");
	respond(r, nil);
}

int
dirgen(int off, Dir *d, void*)
{
	if(off >= nelem(tab))
		return -1;

	memset(d, 0, sizeof *d);
	d->atime = d->mtime = time0;
	d->name = estrdup9p(tab[off].name);
	d->mode = tab[off].perm;
	d->qid.path = tab[off].qid;
	d->qid.vers = tab[off].vers;
	d->qid.type = d->mode>>24;
	d->uid = estrdup9p("vmware");
	d->gid = estrdup9p("vmware");
	d->muid = estrdup9p("");
	return 0;
}

void
fsread(Req *r)
{
	int i, q;

	q = r->fid->qid.path;
	switch(q){
	case Qroot:
		dirread9p(r, dirgen, nil);
		respond(r, nil);
		return;

	default:
		for(i=0; i<nelem(tab); i++)
			if(tab[i].qid == q)
				goto Have;

		respond(r, "cannot happen in fsread");
		return;

	Have:
		if(tab[i].read == nil){
			respond(r, "no read function");
			return;
		}
		tab[i].read(r);
		return;
	}
}

void
fswrite(Req *r)
{
	int i, q;

	q = r->fid->qid.path;
	for(i=0; i<nelem(tab); i++)
		if(tab[i].qid == q){
			if(tab[i].write == nil){
				respond(r, "no write function");
				return;
			}
			tab[i].write(r);
			return;
		}

	respond(r, "cannot happen in fswrite");
}

void
fsopen(Req *r)
{
	int i, q;

	q = r->fid->qid.path;
	for(i=0; i<nelem(tab); i++)
		if(tab[i].qid == q){
			switch(r->ifcall.mode&3){
			case OREAD:
				if(!(tab[i].perm&0400))
					goto Eperm;
				break;
			case OWRITE:
				if(!(tab[i].perm&0200))
					goto Eperm;
				break;
			case ORDWR:
				if((tab[i].perm&0600) != 0600)
					goto Eperm;
				break;
			case OEXEC:
			Eperm:
				respond(r, "permission denied");
				return;
			}
			if(tab[i].open)
				tab[i].open(r);
			else
				respond(r, nil);
			return;
		}

	/* directory */
	if(r->ifcall.mode != OREAD)
		respond(r, "permission denied");
	else
		respond(r, nil);
}

void
fsdestroyfid(Fid *fid)
{
	int i, q;

	q = fid->qid.path;
	for(i=0; i<nelem(tab); i++)
		if(tab[i].qid == q){
			if(tab[i].close)
				tab[i].close(fid);
			break;
		}
}

Srv fs = {
	.attach=	fsattach,
	.open=	fsopen,
	.read=	fsread,
	.write=	fswrite,
	.stat=	fsstat,
	.walk1=	fswalk1,
	.destroyfid=	fsdestroyfid,
};

void
usage(void)
{
	fprint(2, "usage: aux/vmware [-s srvname] [-m mtpt]\n");
	exits("usage");
}

void
main(int argc, char **argv)
{
	quotefmtinstall();

	time0 = time(0);

	ARGBEGIN{
	case 'D':
		chatty9p++;
		break;
	case 's':
		srvname = EARGF(usage());
		break;
	case 'm':
		mtpt = EARGF(usage());
		break;
	default:
		usage();
	}ARGEND

	if(argc != 0)
		usage();

	if(setjmp(backdoorjmp))
		sysfatal("VMware backdoor call failed");

	if(getversion() < 0)
		sysfatal("no vmware");

	postmountsrv(&fs, srvname, mtpt, MREPL);
}

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-09  7:57     ` Russ Cox
@ 2008-12-11 18:47       ` Skip Tavakkolian
  2008-12-11 19:03         ` Russ Cox
  2008-12-11 19:16         ` Rodolfo kix Garcia
  0 siblings, 2 replies; 16+ messages in thread
From: Skip Tavakkolian @ 2008-12-11 18:47 UTC (permalink / raw)
  To: 9fans

> Maybe
> someone will be motivated to fill in the rest
> using the latest and greatest VMware API
> instead of one from seven and a half years ago.

Russ, is this the right API?

http://open-vm-tools.sourceforge.net/




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-11 18:47       ` Skip Tavakkolian
@ 2008-12-11 19:03         ` Russ Cox
  2008-12-11 19:16         ` Rodolfo kix Garcia
  1 sibling, 0 replies; 16+ messages in thread
From: Russ Cox @ 2008-12-11 19:03 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Thu, Dec 11, 2008 at 10:47 AM, Skip Tavakkolian <9nut@9netics.com> wrote:
>> Maybe
>> someone will be motivated to fill in the rest
>> using the latest and greatest VMware API
>> instead of one from seven and a half years ago.
>
> Russ, is this the right API?
>
> http://open-vm-tools.sourceforge.net/

Presumably that code uses the right API.

Russ


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [9fans] Mouse jumps in vmware
  2008-12-11 18:47       ` Skip Tavakkolian
  2008-12-11 19:03         ` Russ Cox
@ 2008-12-11 19:16         ` Rodolfo kix Garcia
  1 sibling, 0 replies; 16+ messages in thread
From: Rodolfo kix Garcia @ 2008-12-11 19:16 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Ummm,

I am not sure if the problem is vmware-tools, probably not (and Plan 9 
is not the problem too).

I am using linux + plan9port + acme and I get the same problem ...

I am confused... BSOD @ me

Skip Tavakkolian escribió:
>> Maybe
>> someone will be motivated to fill in the rest
>> using the latest and greatest VMware API
>> instead of one from seven and a half years ago.
>>     
>
> Russ, is this the right API? 
>
> http://open-vm-tools.sourceforge.net/
>
>
>   




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-12-11 19:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-07  8:27 [9fans] Mouse jumps in vmware Rodolfo kix Garcia
2008-12-07  8:44 ` lucio
2008-12-07  9:12   ` Rodolfo kix Garcia
2008-12-07  9:17     ` lucio
2008-12-07  9:33       ` Rodolfo kix Garcia
2008-12-07 10:00         ` [9fans] VM support (Was: Mouse jumps in vmware) lucio
2008-12-07 10:37           ` Charles Forsyth
2008-12-07 14:10         ` [9fans] Mouse jumps in vmware erik quanstrom
2008-12-07 14:37           ` Richard Miller
2008-12-07 14:47             ` erik quanstrom
2008-12-07 11:00   ` Uriel
2008-12-09  7:57     ` Russ Cox
2008-12-11 18:47       ` Skip Tavakkolian
2008-12-11 19:03         ` Russ Cox
2008-12-11 19:16         ` Rodolfo kix Garcia
2008-12-07  9:22 ` Skip Tavakkolian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).