mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
s3: lib: util: Add map_process_lock_to_ofd_lock() utility function.
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Jeff Layton <jlayton@samba.org>
This commit is contained in:
parent
da9b7056fc
commit
5985383167
@ -386,6 +386,7 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist);
|
||||
void free_namearray(name_compare_entry *name_array);
|
||||
bool fcntl_lock(int fd, int op, off_t offset, off_t count, int type);
|
||||
bool fcntl_getlock(int fd, int op, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid);
|
||||
int map_process_lock_to_ofd_lock(int op, bool *use_ofd_locks);
|
||||
bool is_myname(const char *s);
|
||||
void ra_lanman_string( const char *native_lanman );
|
||||
const char *get_remote_arch_str(void);
|
||||
|
@ -1184,6 +1184,37 @@ bool fcntl_getlock(int fd, int op, off_t *poffset, off_t *pcount, int *ptype, pi
|
||||
return True;
|
||||
}
|
||||
|
||||
#if defined(HAVE_OFD_LOCKS)
|
||||
int map_process_lock_to_ofd_lock(int op, bool *use_ofd_locks)
|
||||
{
|
||||
switch (op) {
|
||||
case F_GETLK:
|
||||
case F_OFD_GETLK:
|
||||
op = F_OFD_GETLK;
|
||||
break;
|
||||
case F_SETLK:
|
||||
case F_OFD_SETLK:
|
||||
op = F_OFD_SETLK;
|
||||
break;
|
||||
case F_SETLKW:
|
||||
case F_OFD_SETLKW:
|
||||
op = F_OFD_SETLKW;
|
||||
break;
|
||||
default:
|
||||
*use_ofd_locks = false;
|
||||
return -1;
|
||||
}
|
||||
*use_ofd_locks = true;
|
||||
return op;
|
||||
}
|
||||
#else /* HAVE_OFD_LOCKS */
|
||||
int map_process_lock_to_ofd_lock(int op, bool *use_ofd_locks)
|
||||
{
|
||||
*use_ofd_locks = false;
|
||||
return op;
|
||||
}
|
||||
#endif /* HAVE_OFD_LOCKS */
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_ALL
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user