Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
181 user(s) are online (160 user(s) are browsing Forums)

Members: 0
Guests: 181

more...

Support us!

Headlines

 
  Register To Post  

What is the correct tecnique to determine if two files are on the same volume under AmigaOS 4.x?
Home away from home
Home away from home


See User information
I need to upgrade a function in a project I'm working on to AmigaOS 4.

This is the old code.

static BOOL OnSameVolume(STRPTR fname1STRPTR fname2)
{
    
struct InfoData __aligned idata;
    
struct DeviceList *dlist1, *dlist2;
    
BPTR lock;

    
dlist1 dlist2 NULL;
    if (
lock Lock(fname1ACCESS_READ)) {
        if (
Info(lock, &idata))
            
dlist1 BADDR(idata.id_VolumeNode);
        
UnLock(lock);
    }
    if (
lock Lock(fname2ACCESS_READ)) {
        if (
Info(lock, &idata))
            
dlist2 BADDR(idata.id_VolumeNode);
        
UnLock(lock);
    }
    if (
dlist1 && dlist2)
        return((BOOL)(
dlist1->dl_Task == dlist2->dl_Task && dlist1->dl_Name == dlist2->dl_Name));
    else
        return(
FALSE);
}


as struct DeviceList is now in dos/obsolete.h I'm wonder what the correct way to do the above is under AmigaOS 4?


Go to top
Re: What is the correct tecnique to determine if two files are on the same volume under AmigaOS 4.x?
Just can't stay away
Just can't stay away


See User information
@broadblues

Quote:
I need to upgrade a function in a project I'm working on to AmigaOS 4.

This is the old code.
Not just old, ancient Kickstart 1.x code

Since AmigaOS 2.0 it's something like
static BOOL OnSameVolume(STRPTR fname1STRPTR fname2

    
BPTR lock1lock2;
    
BOOL result FALSE;

    
lock1 IDOS->Lock(fname1ACCESS_READ);
    
lock2 IDOS->Lock(fname2ACCESS_READ);

    if (
lock1 && lock2)
    {
       
int32 same IDOS->SameLock(lock1lock2);
       if (
LOCK_SAME == same || LOCK_SAME_VOLUME == same)
       {
          
result TRUE;
       }
    }
    
    if (
lock1IDOS->UnLock(lock1);
    if (
lock2IDOS->UnLock(lock2);

    return 
result;
}


Edited by joerg on 2014/3/3 1:55:31
Go to top
Re: What is the correct tecnique to determine if two files are on the same volume under AmigaOS 4.x?
Home away from home
Home away from home


See User information
@joerg

Quote:

Not just old, ancient Kickstart 1.x code


This thing I'm working on has ancient roots!


Thanks for the solution.

Go to top
Re: What is the correct tecnique to determine if two files are on the same volume under AmigaOS 4.x?
Just can't stay away
Just can't stay away


See User information
@broadblues

Quote:

as struct DeviceList is now in dos/obsolete.h I'm wonder what the correct way to do the above is under AmigaOS 4?


The DeviceList struct was moved to dos/obsolete.h because it's the same as struct VolumeNode only with a less logical name.

Quoting from the dos/obsolete.h include:
Quote:

Obsolete structure definition, although called a "devicelist" it was actually used only for volume nodes, how quaint !.

Go to top
Re: What is the correct tecnique to determine if two files are on the same volume under AmigaOS 4.x?
Home away from home
Home away from home


See User information
@Salass00

Noted: but even if I had realised that before asking the question, the dl_Task entry referenced in the old code, doesn't exist in the 4.x includes. (presumably it was either FSPrivate or one of the reserved.

Best to update either way.


Go to top
Re: What is the correct tecnique to determine if two files are on the same volume under AmigaOS 4.x?
Just can't stay away
Just can't stay away


See User information
@broadblues

Quote:

Noted: but even if I had realised that before asking the question, the dl_Task entry referenced in the old code, doesn't exist in the 4.x includes. (presumably it was either FSPrivate or one of the reserved.


The #?_Task fields in DosList, VolumeNode, DeviceNode, etc. structs are now called #?_Port. The old, obsolete names never made much sense since they point to the filesystem message port or FSVP in case of newer filesystems, not a Task structure.

Also, from dos/obsolete.h:
Quote:

#define dl_Task dl_Port


The equivalent in struct VolumeNode is of course "vn_Port".

Go to top

  Register To Post

 




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




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project