From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Farmer, John" Newsgroups: gmane.os.tru64.managers Subject: Summary: C programming language / query for hardware attributes q uestion. Date: Thu, 14 Apr 2005 10:47:29 -0400 Message-ID: <6C774F36DDBFE34C8D3DC8DA8313F5BC2A5A99@tanorw-ex01.thcg.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: sea.gmane.org 1113489912 30576 80.91.229.2 (14 Apr 2005 14:45:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 14 Apr 2005 14:45:12 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Thu Apr 14 16:45:10 2005 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by ciao.gmane.org with smtp (Exim 4.43) id 1DM5aS-0000T0-80 for gotm-tru64-unix-managers@gmane.org; Thu, 14 Apr 2005 16:44:56 +0200 Original-Received: (qmail 10828 invoked by uid 5); 14 Apr 2005 14:48:09 -0000 Original-Sender: tru64-unix-managers-owner@ornl.gov Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 10766 invoked by uid 49501); 14 Apr 2005 14:48:09 -0000 Original-Received: from John.Farmer@TycoHealthcare.com by sws1 by uid 49491 with qmail-scanner-1.21 (clamdscan: 0.70-rc. iscan: v3.1/v5.600-1011/847/50540. spamassassin: 2.63. Clear:RC:0(160.91.4.110):SA:0(-2.6/5.0):. Processed in 2.461794 secs); 14 Apr 2005 14:48:09 -0000 X-Spam-Status: No, hits=-2.6 required=5.0 Original-Received: from unknown (HELO emroute3.ornl.gov) (160.91.4.110) by 0 with SMTP; 14 Apr 2005 14:48:06 -0000 Original-Received: from emroute3.ornl.gov (localhost [127.0.0.1]) by emroute3.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0IEX00EJVYG27A@emroute3.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT Tru64-UNIX-Managers@ornl.gov) ; Thu, 14 Apr 2005 10:48:05 -0400 (EDT) Original-Received: from VIRUSCAN-DAEMON.emroute3.ornl.gov by emroute3.ornl.gov (PMDF V6.2-X27 #30899) id <0IEX00J02YFDUB@emroute3.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT Tru64-UNIX-Managers@ornl.gov) ; Thu, 14 Apr 2005 10:47:51 -0400 (EDT) Original-Received: from mail01.tycohealthcare.com (mail01.tycohealthcare.com [216.75.208.55]) by emroute3.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0IEX00I8NYFCUE@emroute3.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT Tru64-UNIX-Managers@ornl.gov) ; Thu, 14 Apr 2005 10:47:37 -0400 (EDT) Original-Received: from nasmtp01.thcg.net ([10.0.201.21]) by mail01.tycohealthcare.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 14 Apr 2005 10:47:31 -0400 Original-Received: by nasmtp01.thcg.net with Internet Mail Service (5.5.2658.27) id <26PARWZZ>; Thu, 14 Apr 2005 10:47:35 -0400 Content-return: allowed Original-To: Tru64-UNIX-Managers@ornl.gov X-Mailer: Internet Mail Service (5.5.2658.27) X-Envelope-From: X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on spam2.ornl.gov X-Spam-Level: X-OriginalArrivalTime: 14 Apr 2005 14:47:31.0046 (UTC) FILETIME=[E2C78860:01C54100] Xref: news.gmane.org gmane.os.tru64.managers:8215 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:8215 Thanks to all who contributed. Below is the original question and following that are the various contributions(with credit to their authors cited) that I received in response. Original Question: > Tru64 5.1A and/or 5.1B. > > # hwmgr -view devices -cat disk > HWID: Device Name Mfg Model Location > > ---------------------------------------------------------------------------- > -- > 123: /dev/disk/dsk1c COMPAQ HSV110 (C)COMPAQ IDENTIFIER=11 > > # hwmgr -get attributes -a dev_base_name=dsk1 -a phys_location > 123: > dev_base_name = dsk1 > phys_location = IDENTIFIER=11 > > Above are two samples of the use of the hwmgr utility to query a system to > determine the 'location' (i.e. IDENTIFIER=11) associated with a specific > device base name. I am currently writing a program in 'C' for which I need > a function which will programmatically obtain the above information. > > Loose Pseudo-code example of what I am looking for: > > struct hw_structure_definition *a > a=some_routine_to_query_system_for_hw_info("dsk1") > printf("%s\n",a->phys_location) > > Please note the above is pseudo-code - the text does not represent actual > structure names, variable names or function names. I suspect that the > functions I need are in existence but not documented in the normal man pages > (perhaps in the "Writing Device Drivers" manual?? which I do not have a copy > of for 5.1x stream) > > Over the phone HP support has indicated that they think it is going to > involve some combination of the use of the table() function and the ioctl() > function. They are getting back to me on the specifics and I am diligently > reading through the man pages and querying my friends on tru64 managers list > in the meanwhile. > > Searching around the /usr/include/io/cam directory I found some interesting > function names that might relate to what I am looking for but without an > associated man page I cannot be sure. Example: cam3.h > xpt_get_phys_attribute(). > > If anyone knows a function/routine and its associated calling standard that > would achieve the above I would be very appreciative. > > John Farmer, Senior Systems Programmer > Tyco Healthcare/US Surgical > 150 Glover Ave > Norwalk, CT 06856 > Contributions:- Thanks to Doctor Thomas Blinn (as always!), Thomas Cunningham, Tom Linden, and Bluejay Adametz for their contributions to my question. The summary is as follows: Dr. Blinn informed me that the the table() and ioctl() functions were not what I was looking for. Instead, he advised that 1) The routines I would need are actually a part of the hardware management subsystem library routines. 2) The routines are particularly messy to use and that I would have a bear of a time figuring them out unless I had examples (such as hwmgr which calls them directly but alas, the sources are not available for customer review). 3) Although not elegant I might be better off using the system() function to pass it a hwmgr command and then parse the output. Dr. Blinn has answered several of my questions in the past and has never lead me wrong. It will be quite the prize if I can ever prove him incorrect or mistaken on a technical topic!! I'm not holding my breath though. Thomas Cunningham provided me with links to HP online documentation incuding the manual titled writing device drivers. He provided me with an additional set of links pointing to various device i/o functions. I am still digesting the information on these pages but they are certainly a good read for anyone working directly with hardware devices. The links are: http://h30097.www3.hp.com/docs/dev_doc/DOCUMENTATION/HTML/DDK_R2/DOCS/HTML/M AN/INDEXES/INDEX_D.HTM http://h30097.www3.hp.com/docs/pub_page/doc_list.html Bluejay Adametz suggested the same as Dr. Blinn that I make a call to the hwmgr command and parse the output. Tom Linden suggested that I use take a look at the getsysinfo() function. Quite a good function with many useful applications but it did not have the pieces of info I was looking for. He was also generous enough to provide a program titled tiptoe.c which returned various pieces of information regarding the hardware hierarchy. An HP support person over the phone told me that he had a book with an example of what I wanted to do but that he didn't have a soft copy to provide me with. Additionally the relevant information was occupying more than 50 pages so it was too much to fax. The title of this document is: Writing Device Drivers for the SCSI/CAM Architecture Interfaces with a Part Number of AA-PS3GD-TE. This book is apparently different from the "Writing Device Drivers" book that I referenced above in the contribution from Tom Cunningham. Again, thanks to everyone who contributed. John Today must be Thursday. I never could get the hang of Thursdays... --Arthur Dent - character from "The Hitchhikers Guide to the Galaxy"