Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
144 user(s) are online (128 user(s) are browsing Forums)

Members: 1
Guests: 143

hotrod, more...

Support us!

Headlines

 
  Register To Post  

LockDosList() troubles
Supreme Council
Supreme Council


See User information
I'm listing all available volumes by using LockDosList(LDF_VOLUMES)+NextDosEntry(LDF_VOLUMES)

This gives me a struct DosList for each mounted volume.

But how do I get the device name for each dosentry?

I can do a Lock() on dl->dol_Name and then use DevNameFromlock() but then it will just lock the first volume with that name. Ie, if I have two volumes with the same name, it will just return the device name for the first device it finds for both volumes.

I guess there's a better way to get the device name?

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: LockDosList() troubles
Not too shy to talk
Not too shy to talk


See User information
@orgin

Walk through the LDF_DEVICES list and check which device has the same dol_Task (or dol_Port) as your volume.

Bye,
Thomas

Go to top
Re: LockDosList() troubles
Just popping in
Just popping in


See User information
Firstly, you MUST NEVER perform any filesystem operations while you have
the doslist locked, as it will most likely end in a deadlock if your
action causes a handler startup or other action that changes the doslist.

Calling any DOS functions is also unwise for that matter as they may take
an innordinant amount of time to complete, and as of V53 the doslist
lock still implies a Forbid(), which means that multitasking stops.

Better to do it this way;
Make a struct MinList, call NewMinList() on it.
Lock the doslist, use the flags; LDF_DEVICES|LDF_VOLUMES|LDF_READ.

Itterate, for each entry returned, allocate a minnode structure that
holds the relevant data you want, namely dol_Type, dol_Port and some
space for the dol_Name string. Something like this will do;

struct MyNode
{
struct MinNode my_Node; /* a simple struct Node */
int32 my_Type; /* holds the dol_Type DLT_xxx value */
struct MsgPort *my_Port; /* ptr to handler process port */
TEXT my_Name[256]; /* A C-String buffer for the BSTR name */
};

Then allocate one of these each time as sizeof(MyNode), and copy out
the relevant fields. Then IExec->AddTail() the node to your minlist.
Do this until you fall out, then unlock the doslist ASAP.

Now, if a DLT_VOLUME node has the same port address as a DLT_DEVICE,
then you have found the matching nodes for a given mounted volume.

Just one caveat, DON'T actually use the port for anything other than
the comparison, as a volume can "go away" at any moment.

Also, don't forget to IExec->RemHead() all your nodes and free them
when you're finished..

Go to top
Re: LockDosList() troubles
Supreme Council
Supreme Council


See User information
@colinw

Okey I'm going for the match msgport pointers method.

Would haven been nice if both device name and volume name was always available in the DosList for LDF_DEVICES/LDF_VOLUMES though. (Volume name only there if actually available for LDF_DEVICES)

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: LockDosList() troubles
Supreme Council
Supreme Council


See User information
@colinw

Worked just fine to match with the device list. Thanks!

http://openamiga.org/index.php?function=viewfiles&projectid=20

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project