2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
8 #include "dos_intern.h"
10 /*****************************************************************************
13 #include <proto/dos.h>
15 AROS_LH2(LONG
, SameLock
,
18 AROS_LHA(BPTR
, lock1
, D1
),
19 AROS_LHA(BPTR
, lock2
, D2
),
22 struct DosLibrary
*, DOSBase
, 70, Dos
)
31 LOCK_SAME - locks points to the same object
32 LOCK_SAME_VOLUME - locks are on the same volume
33 LOCK_DIFFERENT - locks are different
45 *****************************************************************************/
49 struct IOFileSys iofs
;
50 struct FileHandle
*fh1
;
51 struct FileHandle
*fh2
;
53 if(!SameDevice(lock1
, lock2
))
54 return LOCK_DIFFERENT
;
56 fh1
= (struct FileHandle
*)BADDR(lock1
);
57 fh2
= (struct FileHandle
*)BADDR(lock2
);
59 /* Check if it is the same lock */
61 /* Prepare I/O request. */
62 InitIOFS(&iofs
, FSA_SAME_LOCK
, DOSBase
);
64 iofs
.IOFS
.io_Device
= fh1
->fh_Device
;
65 iofs
.IOFS
.io_Unit
= fh1
->fh_Unit
;
66 iofs
.io_Union
.io_SAME_LOCK
.io_Lock
[0] = fh1
->fh_Unit
;
67 iofs
.io_Union
.io_SAME_LOCK
.io_Lock
[1] = fh2
->fh_Unit
;
68 iofs
.io_Union
.io_SAME_LOCK
.io_Same
= LOCK_DIFFERENT
;
70 /* Send the request. */
73 /* Set error code and return */
74 SetIoErr(iofs
.io_DosError
);
76 if(iofs
.io_DosError
!= 0)
77 return LOCK_DIFFERENT
;
80 if(iofs
.io_Union
.io_SAME_LOCK
.io_Same
== LOCK_SAME
)
83 return LOCK_SAME_VOLUME
;