if (entry < count-1) {
memmove(&locks[entry], &locks[entry+1], sizeof(*locks)*((count-1) - entry));
}
- dbuf.dsize -= sizeof(*locks);
+ dbuf.dsize -= sizeof(struct posix_lock);
tdb_store(posix_lock_tdb, kbuf, dbuf, TDB_REPLACE);
}
char *tp;
dbuf.dptr = NULL;
+ dbuf.dsize = 0;
dbuf = tdb_fetch(posix_lock_tdb, kbuf);
- *pentry_num = (size_t)(dbuf.dsize / sizeof(pl));
+ *pentry_num = (size_t)(dbuf.dsize / sizeof(struct posix_lock));
/*
* Add new record.
pl.size = size;
pl.lock_type = lock_type;
- tp = SMB_REALLOC(dbuf.dptr, dbuf.dsize + sizeof(pl));
+ tp = SMB_REALLOC(dbuf.dptr, dbuf.dsize + sizeof(struct posix_lock));
if (!tp) {
DEBUG(0,("add_posix_lock_entry: Realloc fail !\n"));
goto fail;
} else
dbuf.dptr = tp;
- memcpy(dbuf.dptr + dbuf.dsize, &pl, sizeof(pl));
- dbuf.dsize += sizeof(pl);
+ memcpy(dbuf.dptr + dbuf.dsize, &pl, sizeof(struct posix_lock));
+ dbuf.dsize += sizeof(struct posix_lock);
if (tdb_store(posix_lock_tdb, kbuf, dbuf, TDB_REPLACE) == -1) {
DEBUG(0,("add_posix_lock: Failed to add lock entry on file %s\n", fsp->fsp_name));
/* There are existing locks - find a match. */
locks = (struct posix_lock *)dbuf.dptr;
- count = (size_t)(dbuf.dsize / sizeof(*locks));
+ count = (size_t)(dbuf.dsize / sizeof(struct posix_lock));
/*
* Search for and delete the first record that matches the
tdb_delete(posix_lock_tdb, kbuf);
} else {
if (i < count-1) {
- memmove(&locks[i], &locks[i+1], sizeof(*locks)*((count-1) - i));
+ memmove(&locks[i], &locks[i+1], sizeof(struct posix_lock)*((count-1) - i));
}
- dbuf.dsize -= sizeof(*locks);
+ dbuf.dsize -= sizeof(struct posix_lock);
tdb_store(posix_lock_tdb, kbuf, dbuf, TDB_REPLACE);
}
count--;
return F_WRLCK;
}
- /*
- * This return should be the most normal, as we attempt
- * to always open files read/write.
- */
+ /*
+ * This return should be the most normal, as we attempt
+ * to always open files read/write.
+ */
- return (lock_type == READ_LOCK) ? F_RDLCK : F_WRLCK;
+ return (lock_type == READ_LOCK) ? F_RDLCK : F_WRLCK;
}
/****************************************************************************
****************************************************************************/
static BOOL posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
- SMB_BIG_UINT u_offset, SMB_BIG_UINT u_count)
+ SMB_BIG_UINT u_offset, SMB_BIG_UINT u_count)
{
SMB_OFF_T offset = (SMB_OFF_T)u_offset;
SMB_OFF_T count = (SMB_OFF_T)u_count;
*/
struct lock_list {
- struct lock_list *next;
- struct lock_list *prev;
- SMB_OFF_T start;
- SMB_OFF_T size;
+ struct lock_list *next;
+ struct lock_list *prev;
+ SMB_OFF_T start;
+ SMB_OFF_T size;
};
/****************************************************************************
return lhead;
locks = (struct posix_lock *)dbuf.dptr;
- num_locks = (size_t)(dbuf.dsize / sizeof(*locks));
+ num_locks = (size_t)(dbuf.dsize / sizeof(struct posix_lock));
/*
* Check the current lock list on this dev/inode pair.
num_overlapped_entries = delete_posix_lock_entry(fsp, offset, count, &deleted_lock);
if (num_overlapped_entries == -1) {
- smb_panic("release_posix_lock: unable find entry to delete !\n");
+ smb_panic("release_posix_lock: unable find entry to delete !\n");
}
/*