From: Gary Schmidt <gschmidt@oz.quest.com>
Subject: Re: Counting Disks...
Date: 2000/08/02 [thread overview]
Message-ID: <39878A7D.F2E8F0C6@oz.quest.com> (raw)
In-Reply-To: 39865C56.A8351A8B@oz.quest.com
Gary Schmidt wrote:
>
> How, programmatically _and_ portably to determine how many (physical)
> disks are attached to a Tru64 box??
>
> In 4.x, we could loop using table(TBL_DKINFO,...), and stop on .di_name
> == "dk".
> With 5.x, it seems that loop table(TBL_DKINFO,...) until failed, then
> decrement count by one gives the number.
>
> I'd like to do it _one_way_ on both versions, so I don't have to be
> checking what version I'm running on (I hate parsing uname(2)).
>
> Opinions, pointers, better ideas all welcome.
>
> Cheers,
> Gary B-)
I hate following up myself, but this is what I've (temporarily) settled
on:
int k, n;
struct tbl_dkinfo dkcnt;
/* Count disks.
* On 4.x: 'dk' is the default disk name.
* Real disks will be called something different.
* On 5.x: We get a failure from table() after last disk
*/
n = 0;
dkcnt.di_name[0] = '\0';
while ((k = table(TBL_DKINFO, n, &dkcnt, 1, sizeof(struct
tbl_dkinfo))) == 1
&& strcmp(dkcnt.di_name, "dk")) {
++n;
}
Cheers,
Gary B-)
next prev parent reply other threads:[~2000-08-02 4:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-08-01 4:00 Counting Disks Gary Schmidt
2000-08-02 4:00 ` Gary Schmidt [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-08-01 4:00 Gary Schmidt
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox