9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] writing services
@ 2005-01-31 17:01 Sergey Reva
  2005-01-31 17:17 ` Russ Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Reva @ 2005-01-31 17:01 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello Fans

I already understand how work srv (in most part) but have some
question

first is...

My file tree initialized by following strings

mysrv.tree=alloctree(nil,nil,DMDIR|0777,destroyfile);
createfile(mysrv.tree->root,"data",nil,0666,(void*)DATAFILE);
(I use aux pointer for file identification in tree)

How I can set file size, and when I need realloc data pointer?
I try set it in open and/or stat function but it's not work...
In my case I need create fixed size file, and then work with it.

Thanks for advice
-- 
http://rs-rlab.narod.ru                          mailto:rs_rlab@mail.ru



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

* Re: [9fans] writing services
  2005-01-31 17:01 [9fans] writing services Sergey Reva
@ 2005-01-31 17:17 ` Russ Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Russ Cox @ 2005-01-31 17:17 UTC (permalink / raw)
  To: Sergey Reva, Fans of the OS Plan 9 from Bell Labs

> mysrv.tree=alloctree(nil,nil,DMDIR|0777,destroyfile);
> createfile(mysrv.tree->root,"data",nil,0666,(void*)DATAFILE);

> How I can set file size, and when I need realloc data pointer?
> I try set it in open and/or stat function but it's not work...
> In my case I need create fixed size file, and then work with it.

If you create a stat function, then you can do

void
mystat(Req *r)
{
    r->d->length = 1000000;
    respond(r, nil);
}

The data pointer f->aux is yours.  You can do whatever you want with it.

Russ


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

end of thread, other threads:[~2005-01-31 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-31 17:01 [9fans] writing services Sergey Reva
2005-01-31 17:17 ` Russ Cox

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).