[ENBD] /proc/nbdinfo

Julien Rennard jrennard at cri74.org
Wed Jan 7 07:54:25 MST 2004


On Wed, 2004-01-07 at 15:19, Peter T. Breuer wrote:
> "Also sprach Julien Rennard:"
> > On Wed, 2004-01-07 at 11:23, Peter T. Breuer wrote:
> > I have some compilation errors :
> > > Hmm ... I don't see anything in proc. The relevant code is this table
> > > in enbd.c:
> > > 
> > > static struct procfntable {
> > >     char *name;
> > >     void (*fn)(int, int);
> > > } procfns[] = {
> > >         { "merge_requests", enbd_set_merge_requests, },
> > >         { "debug", enbd_set_debug, },
> > >         { "dbg_blockmap", enbd_set_blockmap, },
> > >         { "sync_intvl", enbd_set_sync_intvl, },
> > >         { "sync", enbd_set_sync_intvl, },
> > >         { "show_errs", enbd_set_show_errs, },
> > >         { "plug", enbd_set_plug, },
> > >         { "md5sum", enbd_set_md5sum, },
> > >         { "rahead", enbd_set_ra, },
> > >         { cct", enbd_set_acct, },
> > > #ifndef NO_BUFFERED_WRITES
> > >         { "buffer_writes", enbd_set_buffer_writes, },
> > > #endif          /* NO_BUFFERED_WRITES */
> > >         { "enable", enbd_set_enabled, },
> > >         { "direct", enbd_set_direct, },
> > >         { "zero", enbd_zero_counters, },
> > Here I put
> 
> > 	  { "reset", enbd_reset, },
> 
> That's fine, provided of course that enbd_reset has already been defined
> above, and is declared static (hey, and even if not!).  I.e.  put the
> definition of the function above this point.
> 
> > and gcc complains about : error: initializer element is not constant
> > ???? above my C skills ... 
solved thanks
> > >         { NULL, NULL, },
> > > };
> > > 
> > > which tells the /proc/nbdinfo to accept commands like "show_errs[a]=1".
> > > 
> > > There is nothing at all that resets the signature in the code. You
> > > might want to add an extra entry of your own which calls a function like
> > > 
> > > 
> > > static void
> > > enbd_reset(int reset, int index) {
> > >         void do_reset(void) {
> > >                 struct enbd_device *lo = enbd_dev[i];
> 
> I meant "index", not "i". There is no "i" here.
so I put : struct enbd_decice * lo = enbd_dev[index];
and compilation OK

> Sorry about that - I was typing while listening to the news on TV.
No need to be sorry if only I was able to write C so fast I'll aways 
do something at the same time to make it more challenging !

The bad thing is that it does not work... I tried 
echo reset[a]=1 > /proc/nbdinfo
after all the enbd-client where stoped and nothing change in
/proc/nbdinfo

I'll try the more "brutal" solution !




More information about the ENBD mailing list