From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,6739fd0c7df191d5 X-Google-Attributes: gidfa528,public From: Gary Schmidt Subject: Re: Counting Disks... Date: 2000/08/02 Message-ID: <39878A7D.F2E8F0C6@oz.quest.com>#1/1 X-Deja-AN: 653455720 Content-Transfer-Encoding: 7bit References: <39865C56.A8351A8B@oz.quest.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 965184439 144.132.59.144 (Wed, 02 Aug 2000 12:47:19 EST) Organization: Quest Software MIME-Version: 1.0 NNTP-Posting-Date: Wed, 02 Aug 2000 12:47:19 EST Newsgroups: comp.unix.tru64 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-)