grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / dos / samelock.c
blob93c3d2321d7ee4082d72cc9063810086dfac3bc8
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include "dos_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/dos.h>
15 AROS_LH2(LONG, SameLock,
17 /* SYNOPSIS */
18 AROS_LHA(BPTR, lock1, D1),
19 AROS_LHA(BPTR, lock2, D2),
21 /* LOCATION */
22 struct DosLibrary *, DOSBase, 70, Dos)
24 /* FUNCTION
25 Compares two locks.
27 INPUTS
28 lock1, lock2 - locks to compare
30 RESULT
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
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
43 INTERNALS
45 *****************************************************************************/
47 AROS_LIBFUNC_INIT
49 struct FileLock *fl1;
50 struct FileLock *fl2;
51 LONG status;
52 SIPTR res;
54 if(!SameDevice(lock1, lock2))
55 return LOCK_DIFFERENT;
57 fl1 = (struct FileLock *)BADDR(lock1);
58 fl2 = (struct FileLock *)BADDR(lock2);
60 status = dopacket2(DOSBase, &res, fl1->fl_Task, ACTION_SAME_LOCK, lock1, lock2);
61 if (status)
62 return LOCK_SAME;
63 if (res == ERROR_ACTION_NOT_KNOWN) {
64 SetIoErr(0);
65 if (fl1->fl_Volume == fl2->fl_Volume && fl1->fl_Key == fl2->fl_Key)
66 return LOCK_SAME;
67 if (fl1->fl_Volume == fl2->fl_Volume)
68 return LOCK_SAME_VOLUME;
70 return LOCK_DIFFERENT;
72 AROS_LIBFUNC_EXIT
73 } /* SameLock */