locking: hide share_mode_lock definition
authorVolker Lendecke <vl@samba.org>
Wed, 4 Nov 2020 11:39:48 +0000 (12:39 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 10 Nov 2020 21:12:48 +0000 (21:12 +0000)
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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Nov 10 21:12:48 UTC 2020 on sn-devel-184

source3/locking/locking.c
source3/locking/share_mode_lock.c
source3/locking/share_mode_lock.h
source3/locking/share_mode_lock_private.h [new file with mode: 0644]

index 9c2674f7d1970d40a54a772f3dcf8f727c6c2d05..5fd117ac31e53e47790a98d0cf4980555e695130 100644 (file)
@@ -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"
index c193748e5e8821364582b177f6c9d77d59be85f0..c9012f7454b63372d445f159988dec08c0b8617e 100644 (file)
@@ -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"
index 6221a0394915b8e519d1ad74eb08de37ff928ea4..09a354c0d01f1ee2cf562c984353174c24e83d81 100644 (file)
@@ -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 (file)
index 0000000..14a3c1b
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+
+#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