Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
* Counting Disks...
@ 2000-08-01  4:00 Gary Schmidt
  2000-08-02  4:00 ` Gary Schmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Schmidt @ 2000-08-01  4:00 UTC (permalink / raw)


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-)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Counting Disks...
@ 2000-08-01  4:00 Gary Schmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Schmidt @ 2000-08-01  4:00 UTC (permalink / raw)


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.

Opinions, pointers, better ideas all welcome.

	Cheers,
		Gary	B-)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Counting Disks...
  2000-08-01  4:00 Counting Disks Gary Schmidt
@ 2000-08-02  4:00 ` Gary Schmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Schmidt @ 2000-08-02  4:00 UTC (permalink / raw)


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-)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-08-02  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-08-01  4:00 Counting Disks Gary Schmidt
2000-08-02  4:00 ` Gary Schmidt
  -- strict thread matches above, loose matches on Subject: below --
2000-08-01  4:00 Gary Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox