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
)
40 *****************************************************************************/
44 struct IOFileSys iofs
;
45 struct FileHandle
*fh1
;
46 struct FileHandle
*fh2
;
48 if(!SameDevice(lock1
, lock2
))
49 return LOCK_DIFFERENT
;
51 fh1
= (struct FileHandle
*)BADDR(lock1
);
52 fh2
= (struct FileHandle
*)BADDR(lock2
);
54 /* Check if it is the same lock */
56 /* Prepare I/O request. */
57 InitIOFS(&iofs
, FSA_SAME_LOCK
, DOSBase
);
59 iofs
.IOFS
.io_Device
= fh1
->fh_Device
;
60 iofs
.IOFS
.io_Unit
= fh1
->fh_Unit
;
61 iofs
.io_Union
.io_SAME_LOCK
.io_Lock
[0] = fh1
->fh_Unit
;
62 iofs
.io_Union
.io_SAME_LOCK
.io_Lock
[1] = fh2
->fh_Unit
;
63 iofs
.io_Union
.io_SAME_LOCK
.io_Same
= LOCK_DIFFERENT
;
65 /* Send the request. */
68 /* Set error code and return */
69 SetIoErr(iofs
.io_DosError
);
71 if(iofs
.io_DosError
!= 0)
72 return LOCK_DIFFERENT
;
75 if(iofs
.io_Union
.io_SAME_LOCK
.io_Same
== LOCK_SAME
)
78 return LOCK_SAME_VOLUME
;