struct ntvfs_request *req,
union smb_flush *io)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f;
switch (io->generic.level) {
struct ntvfs_request *req, union smb_fsinfo *fs)
{
NTSTATUS status;
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
uint64_t blocks_free, blocks_total;
uint_t bpunit;
struct stat st;
static NTSTATUS pvfs_ntioctl(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_ioctl *io)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f;
f = pvfs_find_fd(pvfs, req, io->ntioctl.in.file.ntvfs);
*/
static void pvfs_pending_lock_continue(void *private_data, enum pvfs_wait_notice reason)
{
- struct pvfs_pending_lock *pending = private_data;
+ struct pvfs_pending_lock *pending = talloc_get_type(private_data,
+ struct pvfs_pending_lock);
struct pvfs_state *pvfs = pending->pvfs;
struct pvfs_file *f = pending->f;
struct ntvfs_request *req = pending->req;
NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_lock *lck)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f;
struct smb_lock_entry *locks;
int i;
NTSTATUS pvfs_mkdir(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_mkdir *md)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
NTSTATUS status;
struct pvfs_filename *name;
mode_t mode;
NTSTATUS pvfs_rmdir(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, struct smb_rmdir *rd)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
NTSTATUS status;
struct pvfs_filename *name;
/* destroy a pending request */
static int pvfs_odb_retry_destructor(struct pvfs_odb_retry *r)
{
- struct pvfs_state *pvfs = r->ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(r->ntvfs->private_data,
+ struct pvfs_state);
if (r->odb_locking_key.data) {
struct odb_lock *lck;
lck = odb_lock(r->req, pvfs->odb_context, &r->odb_locking_key);
void *private_data,
enum pvfs_wait_notice reason))
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_odb_retry *r;
struct pvfs_wait *wait_handle;
NTSTATUS status;
struct ntvfs_request *req, union smb_open *io,
struct pvfs_file *f, struct odb_lock *lck)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f2;
struct pvfs_filename *name;
NTSTATUS status;
struct odb_lock *lck,
NTSTATUS parent_status)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
NTSTATUS status;
struct timeval end_time;
struct timeval *final_timeout = NULL;
NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_open *io)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
int flags = 0;
struct pvfs_filename *name;
struct pvfs_file *f;
NTSTATUS pvfs_close(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_close *io)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f;
if (io->generic.level == RAW_CLOSE_SPLCLOSE) {
NTSTATUS pvfs_logoff(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f, *next;
for (f=pvfs->files.list;f;f=next) {
NTSTATUS pvfs_exit(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f, *next;
for (f=pvfs->files.list;f;f=next) {
NTSTATUS pvfs_oplock_release(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_lock *lck)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f;
uint8_t oplock_break;
NTSTATUS status;
NTSTATUS pvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_fileinfo *info)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_filename *name;
NTSTATUS status;
NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_fileinfo *info)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f;
struct pvfs_file_handle *h;
NTSTATUS status;
NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_read *rd)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
ssize_t ret;
struct pvfs_file *f;
NTSTATUS status;
struct odb_lock *lck,
NTSTATUS status)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct timeval end_time;
if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
static NTSTATUS pvfs_rename_mv(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_rename *ren)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
NTSTATUS status;
struct pvfs_filename *name1, *name2;
struct odb_lock *lck = NULL;
struct ntvfs_request *req, union smb_rename *ren,
struct pvfs_filename *name1)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
NTSTATUS status;
struct odb_lock *lck = NULL;
static NTSTATUS pvfs_rename_nt(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_rename *ren)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
NTSTATUS status;
struct pvfs_filename *name1, *name2;
struct odb_lock *lck = NULL;
NTSTATUS pvfs_rename(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_rename *ren)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f;
switch (ren->generic.level) {
time_t t = time(NULL);
for (i=0;i<MAX_OLD_SEARCHES;i++) {
- struct pvfs_search_state *search = idr_find(pvfs->search.idtree, i);
- if (search == NULL) return;
+ struct pvfs_search_state *search;
+ void *p = idr_find(pvfs->search.idtree, i);
+
+ if (p == NULL) return;
+
+ search = talloc_get_type(p, struct pvfs_search_state);
if (pvfs_list_eos(search->dir, search->current_index) &&
search->last_used != 0 &&
t > search->last_used + 30) {
bool (*callback)(void *, const union smb_search_data *))
{
struct pvfs_dir *dir;
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t search_attrib;
void *search_private,
bool (*callback)(void *, const union smb_search_data *))
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
+ void *p;
struct pvfs_search_state *search;
struct pvfs_dir *dir;
uint_t reply_count, max_count;
handle = io->search_next.in.id.handle | (io->search_next.in.id.reserved<<8);
max_count = io->search_next.in.max_count;
- search = idr_find(pvfs->search.idtree, handle);
- if (search == NULL) {
+ p = idr_find(pvfs->search.idtree, handle);
+ if (p == NULL) {
/* we didn't find the search handle */
return NT_STATUS_INVALID_HANDLE;
}
+ search = talloc_get_type(p, struct pvfs_search_state);
+
dir = search->dir;
status = pvfs_list_seek_ofs(dir, io->search_next.in.id.server_cookie,
bool (*callback)(void *, const union smb_search_data *))
{
struct pvfs_dir *dir;
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t search_attrib, max_count;
void *search_private,
bool (*callback)(void *, const union smb_search_data *))
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
+ void *p;
struct pvfs_search_state *search;
struct pvfs_dir *dir;
uint_t reply_count;
handle = io->t2fnext.in.handle;
- search = idr_find(pvfs->search.idtree, handle);
- if (search == NULL) {
+ p = idr_find(pvfs->search.idtree, handle);
+ if (p == NULL) {
/* we didn't find the search handle */
return NT_STATUS_INVALID_HANDLE;
}
-
+
+ search = talloc_get_type(p, struct pvfs_search_state);
+
dir = search->dir;
status = NT_STATUS_OK;
bool (*callback)(void *, const union smb_search_data *))
{
struct pvfs_dir *dir;
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t max_count;
void *search_private,
bool (*callback)(void *, const union smb_search_data *))
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t max_count;
NTSTATUS pvfs_search_close(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_close *io)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
+ void *p;
struct pvfs_search_state *search;
uint16_t handle = INVALID_SEARCH_HANDLE;
break;
}
- search = idr_find(pvfs->search.idtree, handle);
- if (search == NULL) {
+ p = idr_find(pvfs->search.idtree, handle);
+ if (p == NULL) {
/* we didn't find the search handle */
return NT_STATUS_INVALID_HANDLE;
}
+ search = talloc_get_type(p, struct pvfs_search_state);
+
talloc_free(search);
return NT_STATUS_OK;
struct ntvfs_request *req,
union smb_seek *io)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f;
struct pvfs_file_handle *h;
NTSTATUS status;
struct ntvfs_request *req,
union smb_setfileinfo *info)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_file *f;
struct pvfs_file_handle *h;
struct pvfs_filename newstats;
struct odb_lock *lck,
NTSTATUS status)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct timeval end_time;
if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_setfileinfo *info)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_filename *name;
struct pvfs_filename newstats;
NTSTATUS status;
struct odb_lock *lck,
NTSTATUS status)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct timeval end_time;
if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
struct ntvfs_request *req,
union smb_unlink *unl)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_dir *dir;
NTSTATUS status;
uint32_t total_deleted=0;
*/
NTSTATUS pvfs_cancel(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_wait *pwait;
for (pwait=pvfs->wait_list;pwait;pwait=pwait->next) {
NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_write *wr)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
ssize_t ret;
struct pvfs_file *f;
NTSTATUS status;
struct ntvfs_request *req,
union smb_chkpath *cp)
{
- struct pvfs_state *pvfs = ntvfs->private_data;
+ struct pvfs_state *pvfs = talloc_get_type(ntvfs->private_data,
+ struct pvfs_state);
struct pvfs_filename *name;
NTSTATUS status;