[comp.sys.amiga.tech] InfoData->id_VolumeNode->ln_Name ??

sirius@recondo.UUCP (Michael Stilson) (05/08/89)

While working on a little utility, I wanted to include the volume name.  So...
I looked through the structures, and found what I __THOUGHT__ I was looking
for.  I call Info(), fill the InfoData structure.  Get the other information I
need from it, but when I try to get the volume name from id_VolumeNode (yes, I
converted it from a BPTR) it either returns a NULL BSTR or compleat garbage. 
I manage to get it out of the DeviceList structure (from the lock) without
much trouble, although it requires a Forbid/Permit which I'd really like to
avoid.  There _SHOULD_ be an easier way than this, or am I missing something
really obvious here?



--
--

              Mike 'Sirius' Stilson      -      Sirius Software
                                sirius@recondo.UUCP
                              ..!uunet!recondo!sirius
                         (412) 793-1242 or (412) 793-5765
                                    USNail:
                1312 Universal Rd.   Penn Hills, PA  15235-3936

c60c-1ea@web-2a.berkeley.edu (Yen Yuanchi Hsieh) (05/09/89)

In article <0285.AA0285@recondo> sirius@recondo.UUCP (Michael Stilson) writes:
>Subject: Re: InfoData->id_VolumeNode->ln_Name ??
					^
  As far as I know, id_VolumeNode points (via BCPL conventions) to a
DeviceNode structure, not an exec Node structure.  You're undoubtedly going
to the wrong place with your dereferencing.  I'm suprised you never Guru'd
with 000...003.xxx...xxx  ...  :-)

>While working on a little utility, I wanted to include the volume name.  So...
>I looked through the structures, and found what I __THOUGHT__ I was looking
>for.

Okay, see above...
Look up structure of DeviceNode in dos.h, or dosextens.h, or something like
that.

>... or am I missing something really obvious here?

  Yes.

-------------------------------------------------
David Navas   c60c-1ea@WEB.Berkeley.Edu
Ideas?  What ideas?  If I had any idea I'd have
an idea, I wouldn't have posted this nonsense.

sirius@recondo.UUCP (Michael Stilson) (05/09/89)

In article: <24171@agate.BERKELY.EDU> c60c-1ea@WEB.Berkely.Edu writes:
>In article <0285.AA0285@recondo> sirius@recondo.UUCP (Michael Stilson) writes:
>>Subject: Re: InfoData->id_VolumeNode->ln_Name ??
>					^
>  As far as I know, id_VolumeNode points (via BCPL conventions) to a
>DeviceNode structure, not an exec Node structure.  You're undoubtedly going
>to the wrong place with your dereferencing.  I'm suprised you never Guru'd
>with 000...003.xxx...xxx  ...  :-)

Maybe it felt sorry for me.. I had 12 Software Error-Task Held's on the screen
at once today..  Although it DID cause Gomf to yell a little bit now & again.

(I did do the proper casting, etc..  and I WILL say the results were.. 
Interesting, to say the least.. :-)

I started doing it through a DosNode, but (at the time) it seemed to me that
it could be found from the InfoData pointer, rather than having to incorporate
yet another structure.. 


Here's the section of code that gets the name of the volume.  If anyone knows
a better way, feel free to suggest it.

----
#define B_TO_C(cast,var) ((struct cast *)(BADDR((ULONG)var)))

char *GetName(Var)
struct Variables *Var;
{

	Forbid();

		Var->lock = B_TO_C(FileLock, Var->mylock);
		Var->dev = B_TO_C(DeviceList, Var->lock->fl_Volume);
		Var->temp = (char *)BADDR(Var->dev->dl_Name);
	        strncpy(Var->name, &Var->temp[1], Var->temp[0]);
		Var->name[Var->temp[0]] = NULL;

	Permit();

	return(Var->name);
}
----

That's how I tried it first, and it worked...  Then I decided to start messing
with success...

>>... or am I missing something really obvious here?
>  Yes.
Somehow, I find that very easy to believe :)


Thanks...   Mike.

--
--

              Mike 'Sirius' Stilson      -      Sirius Software
                                sirius@recondo.UUCP
                              ..!uunet!recondo!sirius
                         (412) 793-1242 or (412) 793-5765
                                    USNail:
                1312 Universal Rd.   Penn Hills, PA  15235-3936