summaryrefslogtreecommitdiff
path: root/source4/ntvfs/simple/vfs_simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/ntvfs/simple/vfs_simple.c')
-rw-r--r--source4/ntvfs/simple/vfs_simple.c92
1 files changed, 46 insertions, 46 deletions
diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c
index 5d904b4fcb..bf0afcec0a 100644
--- a/source4/ntvfs/simple/vfs_simple.c
+++ b/source4/ntvfs/simple/vfs_simple.c
@@ -50,21 +50,21 @@ static NTSTATUS svfs_connect(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, const char *sharename)
{
struct stat st;
- struct svfs_private *private;
+ struct svfs_private *p;
struct share_config *scfg = ntvfs->ctx->config;
- private = talloc(ntvfs, struct svfs_private);
- NT_STATUS_HAVE_NO_MEMORY(private);
- private->ntvfs = ntvfs;
- private->next_search_handle = 0;
- private->connectpath = talloc_strdup(private, share_string_option(scfg, SHARE_PATH, ""));
- private->open_files = NULL;
- private->search = NULL;
+ p = talloc(ntvfs, struct svfs_private);
+ NT_STATUS_HAVE_NO_MEMORY(p);
+ p->ntvfs = ntvfs;
+ p->next_search_handle = 0;
+ p->connectpath = talloc_strdup(p, share_string_option(scfg, SHARE_PATH, ""));
+ p->open_files = NULL;
+ p->search = NULL;
/* the directory must exist */
- if (stat(private->connectpath, &st) != 0 || !S_ISDIR(st.st_mode)) {
+ if (stat(p->connectpath, &st) != 0 || !S_ISDIR(st.st_mode)) {
DEBUG(0,("'%s' is not a directory, when connecting to [%s]\n",
- private->connectpath, sharename));
+ p->connectpath, sharename));
return NT_STATUS_BAD_NETWORK_NAME;
}
@@ -73,7 +73,7 @@ static NTSTATUS svfs_connect(struct ntvfs_module_context *ntvfs,
ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
- ntvfs->private_data = private;
+ ntvfs->private_data = p;
return NT_STATUS_OK;
}
@@ -89,12 +89,12 @@ static NTSTATUS svfs_disconnect(struct ntvfs_module_context *ntvfs)
/*
find open file handle given fd
*/
-static struct svfs_file *find_fd(struct svfs_private *private, struct ntvfs_handle *handle)
+static struct svfs_file *find_fd(struct svfs_private *sp, struct ntvfs_handle *handle)
{
struct svfs_file *f;
void *p;
- p = ntvfs_handle_get_backend_data(handle, private->ntvfs);
+ p = ntvfs_handle_get_backend_data(handle, sp->ntvfs);
if (!p) return NULL;
f = talloc_get_type(p, struct svfs_file);
@@ -275,7 +275,7 @@ static NTSTATUS svfs_qpathinfo(struct ntvfs_module_context *ntvfs,
static NTSTATUS svfs_qfileinfo(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_fileinfo *info)
{
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct svfs_file *f;
struct stat st;
@@ -283,7 +283,7 @@ static NTSTATUS svfs_qfileinfo(struct ntvfs_module_context *ntvfs,
return ntvfs_map_qfileinfo(ntvfs, req, info);
}
- f = find_fd(private, info->generic.in.file.ntvfs);
+ f = find_fd(p, info->generic.in.file.ntvfs);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
@@ -302,7 +302,7 @@ static NTSTATUS svfs_qfileinfo(struct ntvfs_module_context *ntvfs,
static NTSTATUS svfs_open(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_open *io)
{
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
char *unix_path;
struct stat st;
int fd, flags;
@@ -391,7 +391,7 @@ do_open:
f->name = talloc_strdup(f, unix_path);
NT_STATUS_HAVE_NO_MEMORY(f->name);
- DLIST_ADD(private->open_files, f);
+ DLIST_ADD(p->open_files, f);
status = ntvfs_handle_set_backend_data(handle, ntvfs, f);
NT_STATUS_NOT_OK_RETURN(status);
@@ -492,7 +492,7 @@ static NTSTATUS svfs_copy(struct ntvfs_module_context *ntvfs,
static NTSTATUS svfs_read(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_read *rd)
{
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct svfs_file *f;
ssize_t ret;
@@ -500,7 +500,7 @@ static NTSTATUS svfs_read(struct ntvfs_module_context *ntvfs,
return NT_STATUS_NOT_SUPPORTED;
}
- f = find_fd(private, rd->readx.in.file.ntvfs);
+ f = find_fd(p, rd->readx.in.file.ntvfs);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
@@ -526,7 +526,7 @@ static NTSTATUS svfs_read(struct ntvfs_module_context *ntvfs,
static NTSTATUS svfs_write(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_write *wr)
{
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct svfs_file *f;
ssize_t ret;
@@ -536,7 +536,7 @@ static NTSTATUS svfs_write(struct ntvfs_module_context *ntvfs,
CHECK_READ_ONLY(req);
- f = find_fd(private, wr->writex.in.file.ntvfs);
+ f = find_fd(p, wr->writex.in.file.ntvfs);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
@@ -572,14 +572,14 @@ static NTSTATUS svfs_flush(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req,
union smb_flush *io)
{
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct svfs_file *f;
switch (io->generic.level) {
case RAW_FLUSH_FLUSH:
case RAW_FLUSH_SMB2:
/* ignore the additional unknown option in SMB2 */
- f = find_fd(private, io->generic.in.file.ntvfs);
+ f = find_fd(p, io->generic.in.file.ntvfs);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
@@ -587,7 +587,7 @@ static NTSTATUS svfs_flush(struct ntvfs_module_context *ntvfs,
return NT_STATUS_OK;
case RAW_FLUSH_ALL:
- for (f=private->open_files;f;f=f->next) {
+ for (f=p->open_files;f;f=f->next) {
fsync(f->fd);
}
return NT_STATUS_OK;
@@ -603,7 +603,7 @@ static NTSTATUS svfs_close(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req,
union smb_close *io)
{
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct svfs_file *f;
if (io->generic.level != RAW_CLOSE_CLOSE) {
@@ -611,7 +611,7 @@ static NTSTATUS svfs_close(struct ntvfs_module_context *ntvfs,
return NT_STATUS_INVALID_LEVEL;
}
- f = find_fd(private, io->close.in.file.ntvfs);
+ f = find_fd(p, io->close.in.file.ntvfs);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
@@ -620,7 +620,7 @@ static NTSTATUS svfs_close(struct ntvfs_module_context *ntvfs,
return map_nt_error_from_unix(errno);
}
- DLIST_REMOVE(private->open_files, f);
+ DLIST_REMOVE(p->open_files, f);
talloc_free(f->name);
talloc_free(f);
@@ -650,7 +650,7 @@ static NTSTATUS svfs_logoff(struct ntvfs_module_context *ntvfs,
*/
static NTSTATUS svfs_async_setup(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req,
- void *private)
+ void *private_data)
{
return NT_STATUS_OK;
}
@@ -691,13 +691,13 @@ static NTSTATUS svfs_setfileinfo(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req,
union smb_setfileinfo *info)
{
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct svfs_file *f;
struct utimbuf unix_times;
CHECK_READ_ONLY(req);
- f = find_fd(private, info->generic.in.file.ntvfs);
+ f = find_fd(p, info->generic.in.file.ntvfs);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
@@ -743,14 +743,14 @@ static NTSTATUS svfs_setfileinfo(struct ntvfs_module_context *ntvfs,
static NTSTATUS svfs_fsinfo(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_fsinfo *fs)
{
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct stat st;
if (fs->generic.level != RAW_QFS_GENERIC) {
return ntvfs_map_fsinfo(ntvfs, req, fs);
}
- if (sys_fsusage(private->connectpath,
+ if (sys_fsusage(p->connectpath,
&fs->generic.out.blocks_free,
&fs->generic.out.blocks_total) == -1) {
return map_nt_error_from_unix(errno);
@@ -758,7 +758,7 @@ static NTSTATUS svfs_fsinfo(struct ntvfs_module_context *ntvfs,
fs->generic.out.block_size = 512;
- if (stat(private->connectpath, &st) != 0) {
+ if (stat(p->connectpath, &st) != 0) {
return NT_STATUS_DISK_CORRUPT_ERROR;
}
@@ -786,13 +786,13 @@ static NTSTATUS svfs_fsattr(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_fsattr *fs)
{
struct stat st;
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
if (fs->generic.level != RAW_FSATTR_GENERIC) {
return ntvfs_map_fsattr(ntvfs, req, fs);
}
- if (stat(private->connectpath, &st) == -1) {
+ if (stat(p->connectpath, &st) == -1) {
return map_nt_error_from_unix(errno);
}
@@ -830,7 +830,7 @@ static NTSTATUS svfs_search_first(struct ntvfs_module_context *ntvfs,
{
struct svfs_dir *dir;
int i;
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct search_state *search;
union smb_search_data file;
uint_t max_count;
@@ -843,7 +843,7 @@ static NTSTATUS svfs_search_first(struct ntvfs_module_context *ntvfs,
return NT_STATUS_NOT_SUPPORTED;
}
- search = talloc_zero(private, struct search_state);
+ search = talloc_zero(p, struct search_state);
if (!search) {
return NT_STATUS_NO_MEMORY;
}
@@ -855,7 +855,7 @@ static NTSTATUS svfs_search_first(struct ntvfs_module_context *ntvfs,
return NT_STATUS_FOOBAR;
}
- search->handle = private->next_search_handle;
+ search->handle = p->next_search_handle;
search->dir = dir;
if (dir->count < max_count) {
@@ -889,8 +889,8 @@ static NTSTATUS svfs_search_first(struct ntvfs_module_context *ntvfs,
((io->t2ffirst.in.flags & FLAG_TRANS2_FIND_CLOSE_IF_END) && (i == dir->count))) {
talloc_free(search);
} else {
- private->next_search_handle++;
- DLIST_ADD(private->search, search);
+ p->next_search_handle++;
+ DLIST_ADD(p->search, search);
}
return NT_STATUS_OK;
@@ -904,7 +904,7 @@ static NTSTATUS svfs_search_next(struct ntvfs_module_context *ntvfs,
{
struct svfs_dir *dir;
int i;
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct search_state *search;
union smb_search_data file;
uint_t max_count;
@@ -917,7 +917,7 @@ static NTSTATUS svfs_search_next(struct ntvfs_module_context *ntvfs,
return NT_STATUS_NOT_SUPPORTED;
}
- for (search=private->search; search; search = search->next) {
+ for (search=p->search; search; search = search->next) {
if (search->handle == io->t2fnext.in.handle) break;
}
@@ -981,7 +981,7 @@ found:
/* work out if we are going to keep the search state */
if ((io->t2fnext.in.flags & FLAG_TRANS2_FIND_CLOSE) ||
((io->t2fnext.in.flags & FLAG_TRANS2_FIND_CLOSE_IF_END) && (i == dir->count))) {
- DLIST_REMOVE(private->search, search);
+ DLIST_REMOVE(p->search, search);
talloc_free(search);
}
@@ -992,10 +992,10 @@ found:
static NTSTATUS svfs_search_close(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_close *io)
{
- struct svfs_private *private = ntvfs->private_data;
+ struct svfs_private *p = ntvfs->private_data;
struct search_state *search;
- for (search=private->search; search; search = search->next) {
+ for (search=p->search; search; search = search->next) {
if (search->handle == io->findclose.in.handle) break;
}
@@ -1004,7 +1004,7 @@ static NTSTATUS svfs_search_close(struct ntvfs_module_context *ntvfs,
return NT_STATUS_FOOBAR;
}
- DLIST_REMOVE(private->search, search);
+ DLIST_REMOVE(p->search, search);
talloc_free(search);
return NT_STATUS_OK;