1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

Remove redundant parameter fd from SMB_VFS_FSTAT().

Michael
(This used to be commit 0b86c420be94d295f6917a220b5d699f65b46711)
This commit is contained in:
Michael Adam 2008-01-07 13:21:26 +01:00
parent 8dcce0d236
commit 87a684f7fc
20 changed files with 43 additions and 41 deletions

View File

@ -181,9 +181,9 @@ static int skel_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_S
return vfswrap_stat(NULL, fname, sbuf);
}
static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
{
return vfswrap_fstat(NULL, fsp, fd, sbuf);
return vfswrap_fstat(NULL, fsp, sbuf);
}
static int skel_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)

View File

@ -174,9 +174,9 @@ static int skel_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_S
return SMB_VFS_NEXT_STAT(handle, fname, sbuf);
}
static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
{
return SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
}
static int skel_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)

View File

@ -83,6 +83,8 @@
/* Leave at 22 - not yet released. Remove parameter fd from pwrite. - obnox */
/* Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox */
/* Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox */
/* Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox */
#define SMB_VFS_INTERFACE_VERSION 22
@ -282,7 +284,7 @@ struct vfs_ops {
int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname);
int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp);
int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf);
int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
int (*unlink)(struct vfs_handle_struct *handle, const char *path);
int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);

View File

@ -58,7 +58,7 @@
#define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new)))
#define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp)))
#define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf)))
#define SMB_VFS_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp) ,(fd) ,(sbuf)))
#define SMB_VFS_FSTAT(fsp, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp), (sbuf)))
#define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf)))
#define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path)))
#define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode)))
@ -177,7 +177,7 @@
#define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new)))
#define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp)))
#define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf)))
#define SMB_VFS_OPAQUE_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp) ,(fd) ,(sbuf)))
#define SMB_VFS_OPAQUE_FSTAT(fsp, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp), (sbuf)))
#define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf)))
#define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path)))
#define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode)))
@ -297,7 +297,7 @@
#define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new)))
#define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp)))
#define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf)))
#define SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp) ,(fd) ,(sbuf)))
#define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp), (sbuf)))
#define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf)))
#define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path)))
#define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode)))

View File

@ -185,7 +185,7 @@ static int smbacl4_fGetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf)
if (fsp->is_directory || fsp->fh->fd == -1) {
return smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, psbuf);
}
if (SMB_VFS_FSTAT(fsp,fsp->fh->fd, psbuf) != 0)
if (SMB_VFS_FSTAT(fsp, psbuf) != 0)
{
DEBUG(8, ("SMB_VFS_FSTAT failed with error %s\n",
strerror(errno)));

View File

@ -684,7 +684,7 @@ static size_t afs_fto_nt_acl(struct afs_acl *afs_acl,
security_info, ppdesc);
}
if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) {
if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
return 0;
}

View File

@ -217,7 +217,7 @@ static int commit_open(
/* EOF commit modes require us to know the initial file size. */
if (c && (c->on_eof != EOF_NONE)) {
SMB_STRUCT_STAT st;
if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) {
if (SMB_VFS_FSTAT(fsp, &st) == -1) {
return -1;
}
c->eof = st.st_size;

View File

@ -491,12 +491,12 @@ static int vfswrap_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUC
return result;
}
static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
{
int result;
START_PROFILE(syscall_fstat);
result = sys_fstat(fd, sbuf);
result = sys_fstat(fsp->fh->fd, sbuf);
END_PROFILE(syscall_fstat);
return result;
}
@ -684,7 +684,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
if (currpos == -1)
return -1;
if (SMB_VFS_FSTAT(fsp, fd, &st) == -1)
if (SMB_VFS_FSTAT(fsp, &st) == -1)
return -1;
space_to_write = len - st.st_size;
@ -763,7 +763,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f
size in which case the ftruncate above should have
succeeded or shorter, in which case seek to len - 1 and
write 1 byte of zero */
if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) {
if (SMB_VFS_FSTAT(fsp, &st) == -1) {
goto done;
}

View File

@ -46,11 +46,11 @@ static int fake_perms_stat(vfs_handle_struct *handle, const char *fname, SMB_STR
return ret;
}
static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
{
int ret = -1;
ret = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
if (ret == 0) {
if (S_ISDIR(sbuf->st_mode)) {
sbuf->st_mode = S_IFDIR | S_IRWXU;

View File

@ -136,7 +136,7 @@ static int smb_full_audit_rename(vfs_handle_struct *handle,
static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp);
static int smb_full_audit_stat(vfs_handle_struct *handle,
const char *fname, SMB_STRUCT_STAT *sbuf);
static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd,
static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
SMB_STRUCT_STAT *sbuf);
static int smb_full_audit_lstat(vfs_handle_struct *handle,
const char *path, SMB_STRUCT_STAT *sbuf);
@ -1216,12 +1216,12 @@ static int smb_full_audit_stat(vfs_handle_struct *handle,
return result;
}
static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd,
static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
SMB_STRUCT_STAT *sbuf)
{
int result;
result = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s", fsp->fsp_name);

View File

@ -645,7 +645,7 @@ static int vfs_gpfs_chmod(vfs_handle_struct *handle, const char *path, mode_t mo
static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
{
SMB_STRUCT_STAT st;
if (SMB_VFS_NEXT_FSTAT(handle, fsp, fd, &st) != 0) {
if (SMB_VFS_NEXT_FSTAT(handle, fsp, &st) != 0) {
return -1;
}
/* avoid chmod() if possible, to preserve acls */

View File

@ -1360,7 +1360,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
DEBUG(6,("file_version_is_newer: Version info not found [%s], use mod time\n",
old_file));
use_version = false;
if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &st) == -1) {
if (SMB_VFS_FSTAT(fsp, &st) == -1) {
goto error_exit;
}
old_create_time = st.st_mtime;
@ -1400,7 +1400,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
DEBUG(6,("file_version_is_newer: Version info not found [%s], use mod time\n",
new_file));
use_version = false;
if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &st) == -1) {
if (SMB_VFS_FSTAT(fsp, &st) == -1) {
goto error_exit;
}
new_create_time = st.st_mtime;

View File

@ -83,7 +83,7 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
fsp->is_directory = False;
string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid));
fsp->wcp = NULL;
SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf);
SMB_VFS_FSTAT(fsp, &sbuf);
fsp->mode = sbuf.st_mode;
fsp->file_id = vfs_file_id_from_sbuf(conn, &sbuf);

View File

@ -229,7 +229,7 @@ ssize_t write_file(struct smb_request *req,
SMB_STRUCT_STAT st;
fsp->modified = True;
if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st) == 0) {
if (SMB_VFS_FSTAT(fsp, &st) == 0) {
int dosmode = dos_mode(fsp->conn,fsp->fsp_name,&st);
if ((lp_store_dos_attributes(SNUM(fsp->conn)) ||
MAP_ARCHIVE(fsp->conn)) &&
@ -896,6 +896,6 @@ int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst)
if (fsp->fh->fd == -1) {
return SMB_VFS_STAT(fsp->conn, fsp->fsp_name, pst);
} else {
return SMB_VFS_FSTAT(fsp,fsp->fh->fd, pst);
return SMB_VFS_FSTAT(fsp, pst);
}
}

View File

@ -342,7 +342,7 @@ static NTSTATUS open_file(files_struct *fsp,
if (fsp->fh->fd == -1) {
ret = SMB_VFS_STAT(conn, path, psbuf);
} else {
ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf);
ret = SMB_VFS_FSTAT(fsp, psbuf);
/* If we have an fd, this stat should succeed. */
if (ret == -1) {
DEBUG(0,("Error doing fstat on open file %s "
@ -1790,7 +1790,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
* struct..
*/
if ((SMB_VFS_FTRUNCATE(fsp,fsp->fh->fd,0) == -1) ||
(SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf)==-1)) {
(SMB_VFS_FSTAT(fsp, psbuf)==-1)) {
status = map_nt_error_from_unix(errno);
TALLOC_FREE(lck);
fd_close(fsp);
@ -2675,7 +2675,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
*psbuf = sbuf;
}
else {
SMB_VFS_FSTAT(fsp, fsp->fh->fd, psbuf);
SMB_VFS_FSTAT(fsp, psbuf);
}
}
return NT_STATUS_OK;

View File

@ -3080,7 +3080,7 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
}
/* Get the stat struct for the owner info. */
if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) {
if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
return map_nt_error_from_unix(errno);
}
@ -3429,7 +3429,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0)
return map_nt_error_from_unix(errno);
} else {
if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0)
if(SMB_VFS_FSTAT(fsp, &sbuf) != 0)
return map_nt_error_from_unix(errno);
}
@ -3479,7 +3479,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
if(fsp->fh->fd == -1)
ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf);
else
ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf);
ret = SMB_VFS_FSTAT(fsp, &sbuf);
if(ret != 0)
return map_nt_error_from_unix(errno);

View File

@ -2835,7 +2835,7 @@ void reply_readbraw(struct smb_request *req)
return;
}
if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st) == 0) {
if (SMB_VFS_FSTAT(fsp, &st) == 0) {
size = st.st_size;
}
@ -3096,7 +3096,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
SMB_STRUCT_STAT sbuf;
ssize_t nread = -1;
if(SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf) == -1) {
if(SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
reply_unixerror(req, ERRDOS, ERRnoaccess);
return;
}
@ -4096,7 +4096,7 @@ void reply_lseek(struct smb_request *req)
SMB_OFF_T current_pos = startpos;
SMB_STRUCT_STAT sbuf;
if(SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf) == -1) {
if(SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
reply_unixerror(req, ERRDOS,
ERRnoaccess);
END_PROFILE(SMBlseek);
@ -5485,7 +5485,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
/* Ensure we have a valid stat struct for the source. */
if (fsp->fh->fd != -1) {
if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) == -1) {
if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
return map_nt_error_from_unix(errno);
}
} else {

View File

@ -3663,7 +3663,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
return;
}
if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) {
if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
DEBUG(3,("fstat of fnum %d failed (%s)\n", fsp->fnum, strerror(errno)));
reply_unixerror(req, ERRDOS, ERRbadfid);
return;
@ -6346,7 +6346,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
return;
}
if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &sbuf) != 0) {
if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
DEBUG(3,("call_trans2setfilepathinfo: fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno)));
reply_unixerror(req, ERRDOS, ERRbadfid);
return;

View File

@ -525,7 +525,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len)
return -1;
}
ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st);
ret = SMB_VFS_FSTAT(fsp, &st);
if (ret == -1)
return ret;
@ -612,7 +612,7 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
ssize_t pwrite_ret;
release_level_2_oplocks_on_change(fsp);
ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st);
ret = SMB_VFS_FSTAT(fsp, &st);
if (ret == -1) {
return ret;
}

View File

@ -572,7 +572,7 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
if (SMB_VFS_FSTAT(vfs->files[fd], fd, &st) == -1) {
if (SMB_VFS_FSTAT(vfs->files[fd], &st) == -1) {
printf("fstat: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}