[ENBD] /proc/nbdinfo
Julien Rennard
jrennard at cri74.org
Wed Jan 7 05:25:29 MST 2004
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, },
and gcc complains about : error: initializer element is not constant
???? above my C skills ...
> { 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];
gcc complains about that "i" it must be a do_reset parameter => (int i)
instead of (void), no ?
> if (reset == 0) {
> return;
> }
> if (!lo)
> return; // not created yet
> if (lo->refcnt > 0)
lo-> refunct does seems to be a integer :
error: invalid operands to binary >
or the error comes from the above wrong "i" ?
> return; // still held open by somebody
> atomic_clear_mask(ENBD_SIGNED, &lo->flags);
> enbd_zero_counters (1, index);
> }
>
> if (index >= 0 && index < MAX_NBD) {
> do_reset ();
put index as a parameter ?
> return;
> }
>
> for (index = 0; index < MAX_NBD; index++) {
> do_reset ();
put index as a parameter ?
> }
> }
>
More information about the ENBD
mailing list