s3: locking: Add some const.
authorJeremy Allison <jra@samba.org>
Mon, 16 May 2016 23:37:47 +0000 (16:37 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 20 May 2016 23:28:27 +0000 (01:28 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>
source3/locking/posix.c
source3/locking/proto.h

index beab9a47b5a8a29c83c5b0d9316cbfe1e23dac5f..1773b2282ba326c5578f3474fc3bafac396c6019 100644 (file)
@@ -346,7 +346,7 @@ struct lock_ref_count_key {
  Form a static locking key for a dev/inode pair for the lock ref count
 ******************************************************************/
 
-static TDB_DATA locking_ref_count_key_fsp(files_struct *fsp,
+static TDB_DATA locking_ref_count_key_fsp(const files_struct *fsp,
                                          struct lock_ref_count_key *tmp)
 {
        ZERO_STRUCTP(tmp);
@@ -359,9 +359,9 @@ static TDB_DATA locking_ref_count_key_fsp(files_struct *fsp,
  Convenience function to get an fd_array key from an fsp.
 ******************************************************************/
 
-static TDB_DATA fd_array_key_fsp(files_struct *fsp)
+static TDB_DATA fd_array_key_fsp(const files_struct *fsp)
 {
-       return make_tdb_data((uint8_t *)&fsp->file_id, sizeof(fsp->file_id));
+       return make_tdb_data((const uint8_t *)&fsp->file_id, sizeof(fsp->file_id));
 }
 
 /*******************************************************************
@@ -414,7 +414,7 @@ bool posix_locking_end(void)
  pair. Creates entry if it doesn't exist.
 ****************************************************************************/
 
-static void increment_lock_ref_count(files_struct *fsp)
+static void increment_lock_ref_count(const files_struct *fsp)
 {
        struct lock_ref_count_key tmp;
        int32_t lock_ref_count = 0;
@@ -431,7 +431,7 @@ static void increment_lock_ref_count(files_struct *fsp)
                  fsp_str_dbg(fsp), (int)lock_ref_count));
 }
 
-static void decrement_lock_ref_count(files_struct *fsp)
+static void decrement_lock_ref_count(const files_struct *fsp)
 {
        struct lock_ref_count_key tmp;
        int32_t lock_ref_count = 0;
@@ -452,7 +452,7 @@ static void decrement_lock_ref_count(files_struct *fsp)
  Fetch the lock ref count.
 ****************************************************************************/
 
-static int32_t get_lock_ref_count(files_struct *fsp)
+static int32_t get_lock_ref_count(const files_struct *fsp)
 {
        struct lock_ref_count_key tmp;
        NTSTATUS status;
@@ -475,7 +475,7 @@ static int32_t get_lock_ref_count(files_struct *fsp)
  Delete a lock_ref_count entry.
 ****************************************************************************/
 
-static void delete_lock_ref_count(files_struct *fsp)
+static void delete_lock_ref_count(const files_struct *fsp)
 {
        struct lock_ref_count_key tmp;
 
@@ -492,7 +492,7 @@ static void delete_lock_ref_count(files_struct *fsp)
  Add an fd to the pending close tdb.
 ****************************************************************************/
 
-static void add_fd_to_close_entry(files_struct *fsp)
+static void add_fd_to_close_entry(const files_struct *fsp)
 {
        struct db_record *rec;
        int *fds;
@@ -532,7 +532,7 @@ static void add_fd_to_close_entry(files_struct *fsp)
  Remove all fd entries for a specific dev/inode pair from the tdb.
 ****************************************************************************/
 
-static void delete_close_entries(files_struct *fsp)
+static void delete_close_entries(const files_struct *fsp)
 {
        struct db_record *rec;
 
@@ -551,7 +551,8 @@ static void delete_close_entries(files_struct *fsp)
 ****************************************************************************/
 
 static size_t get_posix_pending_close_entries(TALLOC_CTX *mem_ctx,
-                                             files_struct *fsp, int **entries)
+                                       const files_struct *fsp,
+                                       int **entries)
 {
        TDB_DATA dbuf;
        NTSTATUS status;
@@ -582,7 +583,7 @@ static size_t get_posix_pending_close_entries(TALLOC_CTX *mem_ctx,
  to delete all locks on this fsp before this function is called.
 ****************************************************************************/
 
-int fd_close_posix(struct files_struct *fsp)
+int fd_close_posix(const struct files_struct *fsp)
 {
        int saved_errno = 0;
        int ret;
index 8ff1c7cd632b465a6b618c34d50a638d3d4c4b15..1eabd6a603cb47a5cb0f792b21228bac51b7c252 100644 (file)
@@ -219,7 +219,7 @@ bool is_posix_locked(files_struct *fsp,
                        enum brl_flavour lock_flav);
 bool posix_locking_init(bool read_only);
 bool posix_locking_end(void);
-int fd_close_posix(struct files_struct *fsp);
+int fd_close_posix(const struct files_struct *fsp);
 bool set_posix_lock_windows_flavour(files_struct *fsp,
                        uint64_t u_offset,
                        uint64_t u_count,