Subject: Re: modstat + gehenna-devsw
To: Love <lha@stacken.kth.se>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: current-users
Date: 09/17/2002 19:41:57
I thought gehenna had some patch to modstat, similar to yours.
> offset = (long)sbuf.offset;
> - if (offset < 0)
> + if (sbuf.type == LM_DEV) {
> + int len = 0;
> +
> + if (block_major(offset) > 0)
> + len = snprintf(offset_string, sizeof(offset_string),
> + "%3d%s", block_major(offset),
> + char_major(offset) > 0 ? "/" : "");
> + if (char_major(offset) > 0 && len < sizeof(offset_string))
> + (void) snprintf(offset_string + len,
> + sizeof(offset_string) - len,
> + "%3d", char_major(offset));
> +
> + } else if (offset < 0)
The check for type should go into else branch, i.e. should only
be visited if offset is >= 0. You could then also simplify
the block_major()/char_major() checks. BTW, are block_major/char_major()
new macros? Should be uppercase in that case.
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow. Do not let this distract you.'' -=-