diff --git a/support/minimig/miminig_fs_messages.h b/support/minimig/miminig_fs_messages.h index d65f906..bdc1af2 100644 --- a/support/minimig/miminig_fs_messages.h +++ b/support/minimig/miminig_fs_messages.h @@ -28,6 +28,7 @@ #define ACTION_DISK_TYPE 32 #define ACTION_DISK_CHANGE 33 #define ACTION_SET_DATE 34 +#define ACTION_SAME_LOCK 40 #define ACTION_SCREEN_MODE 994 #define ACTION_READ_RETURN 1001 #define ACTION_WRITE_RETURN 1002 @@ -74,6 +75,10 @@ #define SHARED_LOCK -2 #define EXCLUSIVE_LOCK -1 +#define LOCK_DIFFERENT -1 +#define LOCK_SAME 0 +#define LOCK_SAME_VOLUME 1 + #define MODE_OLDFILE 1005 #define MODE_NEWFILE 1006 #define MODE_READWRITE 1004 @@ -356,6 +361,21 @@ struct SetCommentResponse long error_code; }; +struct SameLockRequest +{ + long sz; + long type; + long key1; + long key2; +}; + +struct SameLockResponse +{ + long sz; + long success; + long error_code; +}; + struct DiskInfoRequest { long sz; diff --git a/support/minimig/minimig_share.cpp b/support/minimig/minimig_share.cpp index 954ab77..f065360 100644 --- a/support/minimig/minimig_share.cpp +++ b/support/minimig/minimig_share.cpp @@ -781,6 +781,30 @@ static int process_request(void *reqres_buffer) ret = 0; } break; + + case ACTION_SAME_LOCK: + { + dbg_print("> ACTION_SAME_LOCK\n"); + SameLockRequest *req = (SameLockRequest*)reqres_buffer; + + uint32_t key1 = SWAP_INT(req->key1); + uint32_t key2 = SWAP_INT(req->key2); + + if ((locks.find(key1) == locks.end()) || (locks.find(key2) == locks.end())) + { + ret = LOCK_DIFFERENT; + break; + } + + if (locks[key1].path == locks[key2].path) + { + ret = LOCK_SAME; + break; + } + + ret = LOCK_SAME_VOLUME; + } + break; } int success = ret ? 0 : 1;