From: Volker Lendecke Date: Wed, 4 Nov 2020 11:39:48 +0000 (+0100) Subject: locking: hide share_mode_lock definition X-Git-Tag: samba-4.14.0rc1~648 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=d762ab558ae6c16ba5007fb38e44c9667d952e2b;p=samba.git locking: hide share_mode_lock definition This makes "struct share_mode_lock" an opaque data structure opened up only to the code in locking/. This makes it much safer to modify the data structure with defined accessor functions in share_mode_lock.c. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Tue Nov 10 21:12:48 UTC 2020 on sn-devel-184 --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 9c2674f7d19..5fd117ac31e 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -40,6 +40,7 @@ #include "system/filesys.h" #include "lib/util/server_id.h" #include "share_mode_lock.h" +#include "share_mode_lock_private.h" #include "locking/proto.h" #include "smbd/globals.h" #include "dbwrap/dbwrap.h" diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index c193748e5e8..c9012f7454b 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -39,6 +39,7 @@ #include "system/filesys.h" #include "lib/util/server_id.h" #include "share_mode_lock.h" +#include "share_mode_lock_private.h" #include "locking/proto.h" #include "smbd/globals.h" #include "dbwrap/dbwrap.h" diff --git a/source3/locking/share_mode_lock.h b/source3/locking/share_mode_lock.h index 6221a039491..09a354c0d01 100644 --- a/source3/locking/share_mode_lock.h +++ b/source3/locking/share_mode_lock.h @@ -17,9 +17,7 @@ #define __LOCKING_SHARE_MODE_LOCK_H__ struct share_mode_data; -struct share_mode_lock { - struct share_mode_data *data; -}; +struct share_mode_lock; bool locking_init(void); bool locking_init_readonly(void); diff --git a/source3/locking/share_mode_lock_private.h b/source3/locking/share_mode_lock_private.h new file mode 100644 index 00000000000..14a3c1b2a47 --- /dev/null +++ b/source3/locking/share_mode_lock_private.h @@ -0,0 +1,24 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __LOCKING_SHARE_MODE_LOCK_PRIVATE_H__ +#define __LOCKING_SHARE_MODE_LOCK_PRIVATE_H__ + +struct share_mode_data; +struct share_mode_lock { + struct share_mode_data *data; +}; + +#endif