From 307e43bb5628e8b53a930c2928279af994281ba5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 10 Mar 2006 20:49:20 +0000 Subject: r14173: change smb interface structures to always use a union smb_file, to abtract - const char *path fot qpathinfo and setpathinfo - uint16_t fnum for SMB - smb2_handle handle for SMB2 the idea is to later add a struct ntvfs_handle *ntvfs so that the ntvfs subsystem don't need to know the difference between SMB and SMB2 metze (This used to be commit 2ef3f5970901b5accdb50f0d0115b5d46b0c788f) --- source4/ntvfs/posix/pvfs_acl.c | 2 +- source4/ntvfs/posix/pvfs_flush.c | 7 ++++--- source4/ntvfs/posix/pvfs_ioctl.c | 5 +++-- source4/ntvfs/posix/pvfs_lock.c | 4 ++-- source4/ntvfs/posix/pvfs_open.c | 10 +++++----- source4/ntvfs/posix/pvfs_qfileinfo.c | 4 ++-- source4/ntvfs/posix/pvfs_read.c | 2 +- source4/ntvfs/posix/pvfs_seek.c | 15 ++++++++------- source4/ntvfs/posix/pvfs_unlink.c | 11 ++++++----- source4/ntvfs/posix/pvfs_write.c | 2 +- source4/ntvfs/posix/vfs_posix.c | 5 +++-- 11 files changed, 36 insertions(+), 31 deletions(-) (limited to 'source4/ntvfs/posix') diff --git a/source4/ntvfs/posix/pvfs_acl.c b/source4/ntvfs/posix/pvfs_acl.c index a03499b733..246290ae91 100644 --- a/source4/ntvfs/posix/pvfs_acl.c +++ b/source4/ntvfs/posix/pvfs_acl.c @@ -310,7 +310,7 @@ NTSTATUS pvfs_acl_query(struct pvfs_state *pvfs, return NT_STATUS_INVALID_ACL; } - normalise_sd_flags(sd, info->query_secdesc.secinfo_flags); + normalise_sd_flags(sd, info->query_secdesc.in.secinfo_flags); info->query_secdesc.out.sd = sd; diff --git a/source4/ntvfs/posix/pvfs_flush.c b/source4/ntvfs/posix/pvfs_flush.c index bf6e23d520..f0ab02f96b 100644 --- a/source4/ntvfs/posix/pvfs_flush.c +++ b/source4/ntvfs/posix/pvfs_flush.c @@ -40,13 +40,14 @@ static void pvfs_flush_file(struct pvfs_state *pvfs, struct pvfs_file *f) flush a fnum */ NTSTATUS pvfs_flush(struct ntvfs_module_context *ntvfs, - struct ntvfs_request *req, struct smb_flush *io) + struct ntvfs_request *req, + union smb_flush *io) { struct pvfs_state *pvfs = ntvfs->private_data; struct pvfs_file *f; - if (io->in.fnum != 0xFFFF) { - f = pvfs_find_fd(pvfs, req, io->in.fnum); + if (io->flush.file.fnum != 0xFFFF) { + f = pvfs_find_fd(pvfs, req, io->flush.file.fnum); if (!f) { return NT_STATUS_INVALID_HANDLE; } diff --git a/source4/ntvfs/posix/pvfs_ioctl.c b/source4/ntvfs/posix/pvfs_ioctl.c index aaa9db9986..032aec1d8d 100644 --- a/source4/ntvfs/posix/pvfs_ioctl.c +++ b/source4/ntvfs/posix/pvfs_ioctl.c @@ -42,7 +42,7 @@ static NTSTATUS pvfs_ntioctl(struct ntvfs_module_context *ntvfs, struct pvfs_state *pvfs = ntvfs->private_data; struct pvfs_file *f; - f = pvfs_find_fd(pvfs, req, io->ntioctl.in.fnum); + f = pvfs_find_fd(pvfs, req, io->ntioctl.file.fnum); if (!f) { return NT_STATUS_INVALID_HANDLE; } @@ -62,7 +62,8 @@ static NTSTATUS pvfs_ntioctl(struct ntvfs_module_context *ntvfs, ioctl interface */ NTSTATUS pvfs_ioctl(struct ntvfs_module_context *ntvfs, - struct ntvfs_request *req, union smb_ioctl *io) + struct ntvfs_request *req, + union smb_ioctl *io) { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; diff --git a/source4/ntvfs/posix/pvfs_lock.c b/source4/ntvfs/posix/pvfs_lock.c index d2317c1852..b9b9832d51 100644 --- a/source4/ntvfs/posix/pvfs_lock.c +++ b/source4/ntvfs/posix/pvfs_lock.c @@ -243,7 +243,7 @@ static NTSTATUS pvfs_lock_cancel(struct pvfs_state *pvfs, struct ntvfs_request * /* check if the lock request matches exactly - you can only cancel with exact matches */ if (p->lck->lockx.in.ulock_cnt == lck->lockx.in.ulock_cnt && p->lck->lockx.in.lock_cnt == lck->lockx.in.lock_cnt && - p->lck->lockx.in.fnum == lck->lockx.in.fnum && + p->lck->lockx.file.fnum == lck->lockx.file.fnum && p->lck->lockx.in.mode == (lck->lockx.in.mode & ~LOCKING_ANDX_CANCEL_LOCK)) { int i; @@ -285,7 +285,7 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs, return ntvfs_map_lock(ntvfs, req, lck); } - f = pvfs_find_fd(pvfs, req, lck->lockx.in.fnum); + f = pvfs_find_fd(pvfs, req, lck->lockx.file.fnum); if (!f) { return NT_STATUS_INVALID_HANDLE; } diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 618ddf141b..fcae5f8d61 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -390,7 +390,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, talloc_steal(pvfs, f); io->generic.out.oplock_level = OPLOCK_NONE; - io->generic.out.fnum = f->fnum; + io->generic.file.fnum = f->fnum; io->generic.out.create_action = create_action; io->generic.out.create_time = name->dos.create_time; io->generic.out.access_time = name->dos.access_time; @@ -712,7 +712,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, } else { io->generic.out.oplock_level = OPLOCK_NONE; } - io->generic.out.fnum = f->fnum; + io->generic.file.fnum = f->fnum; io->generic.out.create_action = NTCREATEX_ACTION_CREATED; io->generic.out.create_time = name->dos.create_time; io->generic.out.access_time = name->dos.access_time; @@ -880,7 +880,7 @@ static NTSTATUS pvfs_open_deny_dos(struct ntvfs_module_context *ntvfs, name = f->handle->name; io->generic.out.oplock_level = OPLOCK_NONE; - io->generic.out.fnum = f->fnum; + io->generic.file.fnum = f->fnum; io->generic.out.create_action = NTCREATEX_ACTION_EXISTED; io->generic.out.create_time = name->dos.create_time; io->generic.out.access_time = name->dos.access_time; @@ -1239,7 +1239,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, } else { io->generic.out.oplock_level = OPLOCK_NONE; } - io->generic.out.fnum = f->fnum; + io->generic.file.fnum = f->fnum; io->generic.out.create_action = stream_existed? NTCREATEX_ACTION_EXISTED:NTCREATEX_ACTION_CREATED; io->generic.out.create_time = name->dos.create_time; @@ -1278,7 +1278,7 @@ NTSTATUS pvfs_close(struct ntvfs_module_context *ntvfs, return ntvfs_map_close(ntvfs, req, io); } - f = pvfs_find_fd(pvfs, req, io->close.in.fnum); + f = pvfs_find_fd(pvfs, req, io->close.file.fnum); if (!f) { return NT_STATUS_INVALID_HANDLE; } diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c index 5d908cbee2..b01b7bb649 100644 --- a/source4/ntvfs/posix/pvfs_qfileinfo.c +++ b/source4/ntvfs/posix/pvfs_qfileinfo.c @@ -289,7 +289,7 @@ NTSTATUS pvfs_qpathinfo(struct ntvfs_module_context *ntvfs, NTSTATUS status; /* resolve the cifs name to a posix name */ - status = pvfs_resolve_name(pvfs, req, info->generic.in.fname, PVFS_RESOLVE_STREAMS, &name); + status = pvfs_resolve_name(pvfs, req, info->generic.file.path, PVFS_RESOLVE_STREAMS, &name); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -326,7 +326,7 @@ NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs, NTSTATUS status; uint32_t access_needed; - f = pvfs_find_fd(pvfs, req, info->generic.in.fnum); + f = pvfs_find_fd(pvfs, req, info->generic.file.fnum); if (!f) { return NT_STATUS_INVALID_HANDLE; } diff --git a/source4/ntvfs/posix/pvfs_read.c b/source4/ntvfs/posix/pvfs_read.c index 93a8060926..15c9111d61 100644 --- a/source4/ntvfs/posix/pvfs_read.c +++ b/source4/ntvfs/posix/pvfs_read.c @@ -41,7 +41,7 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs, return ntvfs_map_read(ntvfs, req, rd); } - f = pvfs_find_fd(pvfs, req, rd->readx.in.fnum); + f = pvfs_find_fd(pvfs, req, rd->readx.file.fnum); if (!f) { return NT_STATUS_INVALID_HANDLE; } diff --git a/source4/ntvfs/posix/pvfs_seek.c b/source4/ntvfs/posix/pvfs_seek.c index 33656e4004..1d43f2c855 100644 --- a/source4/ntvfs/posix/pvfs_seek.c +++ b/source4/ntvfs/posix/pvfs_seek.c @@ -27,14 +27,15 @@ seek in a file */ NTSTATUS pvfs_seek(struct ntvfs_module_context *ntvfs, - struct ntvfs_request *req, struct smb_seek *io) + struct ntvfs_request *req, + union smb_seek *io) { struct pvfs_state *pvfs = ntvfs->private_data; struct pvfs_file *f; struct pvfs_file_handle *h; NTSTATUS status; - f = pvfs_find_fd(pvfs, req, io->in.fnum); + f = pvfs_find_fd(pvfs, req, io->lseek.file.fnum); if (!f) { return NT_STATUS_INVALID_HANDLE; } @@ -42,22 +43,22 @@ NTSTATUS pvfs_seek(struct ntvfs_module_context *ntvfs, status = NT_STATUS_OK; - switch (io->in.mode) { + switch (io->lseek.in.mode) { case SEEK_MODE_START: - h->seek_offset = io->in.offset; + h->seek_offset = io->lseek.in.offset; break; case SEEK_MODE_CURRENT: - h->seek_offset += io->in.offset; + h->seek_offset += io->lseek.in.offset; break; case SEEK_MODE_END: status = pvfs_resolve_name_fd(pvfs, h->fd, h->name); - h->seek_offset = h->name->st.st_size + io->in.offset; + h->seek_offset = h->name->st.st_size + io->lseek.in.offset; break; } - io->out.offset = h->seek_offset; + io->lseek.out.offset = h->seek_offset; return status; } diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c index ee90adba45..76c9bc10a4 100644 --- a/source4/ntvfs/posix/pvfs_unlink.c +++ b/source4/ntvfs/posix/pvfs_unlink.c @@ -113,7 +113,8 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, The name can contain CIFS wildcards, but rarely does (except with OS/2 clients) */ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, - struct ntvfs_request *req, struct smb_unlink *unl) + struct ntvfs_request *req, + union smb_unlink *unl) { struct pvfs_state *pvfs = ntvfs->private_data; struct pvfs_dir *dir; @@ -124,7 +125,7 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, uint_t ofs; /* resolve the cifs name to a posix name */ - status = pvfs_resolve_name(pvfs, req, unl->in.pattern, + status = pvfs_resolve_name(pvfs, req, unl->unlink.in.pattern, PVFS_RESOLVE_WILDCARD | PVFS_RESOLVE_STREAMS, &name); if (!NT_STATUS_IS_OK(status)) { return status; @@ -140,7 +141,7 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, } if (name->stream_name) { - return pvfs_unlink_stream(pvfs, req, name, unl->in.attrib); + return pvfs_unlink_stream(pvfs, req, name, unl->unlink.in.attrib); } /* get list of matching files */ @@ -155,13 +156,13 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs, while ((fname = pvfs_list_next(dir, &ofs))) { /* this seems to be a special case */ - if ((unl->in.attrib & FILE_ATTRIBUTE_DIRECTORY) && + if ((unl->unlink.in.attrib & FILE_ATTRIBUTE_DIRECTORY) && (strcmp(fname, ".") == 0 || strcmp(fname, "..") == 0)) { return NT_STATUS_OBJECT_NAME_INVALID; } - status = pvfs_unlink_one(pvfs, req, pvfs_list_unix_path(dir), fname, unl->in.attrib); + status = pvfs_unlink_one(pvfs, req, pvfs_list_unix_path(dir), fname, unl->unlink.in.attrib); if (NT_STATUS_IS_OK(status)) { total_deleted++; } diff --git a/source4/ntvfs/posix/pvfs_write.c b/source4/ntvfs/posix/pvfs_write.c index d206e3b830..c16b66b7cc 100644 --- a/source4/ntvfs/posix/pvfs_write.c +++ b/source4/ntvfs/posix/pvfs_write.c @@ -40,7 +40,7 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs, return ntvfs_map_write(ntvfs, req, wr); } - f = pvfs_find_fd(pvfs, req, wr->writex.in.fnum); + f = pvfs_find_fd(pvfs, req, wr->writex.file.fnum); if (!f) { return NT_STATUS_INVALID_HANDLE; } diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index 66fbc4bb4c..ba53dc65e0 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -203,14 +203,15 @@ static NTSTATUS pvfs_disconnect(struct ntvfs_module_context *ntvfs) check if a directory exists */ static NTSTATUS pvfs_chkpath(struct ntvfs_module_context *ntvfs, - struct ntvfs_request *req, struct smb_chkpath *cp) + struct ntvfs_request *req, + union smb_chkpath *cp) { struct pvfs_state *pvfs = ntvfs->private_data; struct pvfs_filename *name; NTSTATUS status; /* resolve the cifs name to a posix name */ - status = pvfs_resolve_name(pvfs, req, cp->in.path, 0, &name); + status = pvfs_resolve_name(pvfs, req, cp->chkpath.in.path, 0, &name); NT_STATUS_NOT_OK_RETURN(status); if (!name->exists) { -- cgit