void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) { struct vfs_fsp_data *head; head = (struct vfs_fsp_data *)vfs_memctx_fsp_extension(handle, fsp); if (head != NULL) { return EXT_DATA_AREA(head); } return NULL; }
void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) { struct vfs_fsp_data *head; for (head = fsp->vfs_extension; head; head = head->next) { if (head->owner == handle) { return EXT_DATA_AREA(head); } } return NULL; }
void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle, files_struct *fsp, size_t ext_size) { struct vfs_fsp_data *ext; void * ext_data; /* Prevent VFS modules adding multiple extensions. */ if ((ext_data = vfs_fetch_fsp_extension(handle, fsp))) { return ext_data; } ext = (struct vfs_fsp_data *)TALLOC_ZERO( handle->conn->mem_ctx, sizeof(struct vfs_fsp_data) + ext_size); if (ext == NULL) { return NULL; } ext->owner = handle; ext->next = fsp->vfs_extension; fsp->vfs_extension = ext; return EXT_DATA_AREA(ext); }
void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) { struct vfs_fsp_data *curr; struct vfs_fsp_data *prev; for (curr = fsp->vfs_extension, prev = NULL; curr; prev = curr, curr = curr->next) { if (curr->owner == handle) { if (prev) { prev->next = curr->next; } else { fsp->vfs_extension = curr->next; } if (curr->destroy) { curr->destroy(EXT_DATA_AREA(curr)); } TALLOC_FREE(curr); return; } } }