From 4b15f31f106f1dd69fdda721b5c3b787f5245a80 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 2 Aug 2007 08:53:24 +0000 Subject: r24120: add a file_id_create() hook into the VFS layer it's needed for some cluster filesystems to overload this function. metze (This used to be commit cdaa24e8047399002e4b287a31a8340a665e580f) --- source3/smbd/close.c | 2 +- source3/smbd/filename.c | 3 ++- source3/smbd/open.c | 10 +++++----- source3/smbd/reply.c | 3 ++- source3/smbd/trans2.c | 14 ++++++++++---- 5 files changed, 20 insertions(+), 12 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 7c3e1eef28..9718fef4ea 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -265,7 +265,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, goto done; } - id = file_id_sbuf(&sbuf); + id = vfs_file_id_from_sbuf(conn, &sbuf); if (!file_id_equal(&fsp->file_id, &id)) { DEBUG(5,("close_remove_share_mode: file %s. Delete on close " diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index a1b56736a0..d5c22e81c3 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -540,7 +540,8 @@ NTSTATUS unix_convert(connection_struct *conn, } /* end else */ #ifdef DEVELOPER - if (VALID_STAT(st) && get_delete_on_close_flag(file_id_sbuf(&st))) { + if (VALID_STAT(st) && + get_delete_on_close_flag(vfs_file_id_from_sbuf(conn, &st))) { result = NT_STATUS_DELETE_PENDING; goto fail; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 432f6b808a..bff445bf61 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -357,7 +357,7 @@ static NTSTATUS open_file(files_struct *fsp, } fsp->mode = psbuf->st_mode; - fsp->file_id = file_id_sbuf(psbuf); + fsp->file_id = vfs_file_id_from_sbuf(conn, psbuf); fsp->vuid = req ? req->vuid : UID_FIELD_INVALID; fsp->file_pid = req ? req->smbpid : 0; fsp->can_lock = True; @@ -1416,7 +1416,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, return status; } - fsp->file_id = file_id_sbuf(psbuf); + fsp->file_id = vfs_file_id_from_sbuf(conn, psbuf); fsp->share_access = share_access; fsp->fh->private_options = create_options; fsp->access_mask = open_access_mask; /* We change this to the @@ -1432,7 +1432,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, } if (file_existed) { - id = file_id_sbuf(psbuf); + id = vfs_file_id_from_sbuf(conn, psbuf); lck = get_share_mode_lock(NULL, id, conn->connectpath, @@ -2160,7 +2160,7 @@ NTSTATUS open_directory(connection_struct *conn, */ fsp->mode = psbuf->st_mode; - fsp->file_id = file_id_sbuf(psbuf); + fsp->file_id = vfs_file_id_from_sbuf(conn, psbuf); fsp->vuid = req ? req->vuid : UID_FIELD_INVALID; fsp->file_pid = req ? req->smbpid : 0; fsp->can_lock = False; @@ -2288,7 +2288,7 @@ NTSTATUS open_file_stat(connection_struct *conn, struct smb_request *req, */ fsp->mode = psbuf->st_mode; - fsp->file_id = file_id_sbuf(psbuf); + fsp->file_id = vfs_file_id_from_sbuf(conn, psbuf); fsp->vuid = req ? req->vuid : UID_FIELD_INVALID; fsp->file_pid = req ? req->smbpid : 0; fsp->can_lock = False; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index ec27450593..cebb905a9e 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -4563,7 +4563,8 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, files_struct *fsp, pstrin } if (dst_exists) { - files_struct *dst_fsp = file_find_di_first(file_id_sbuf(&sbuf1)); + struct file_id fileid = vfs_file_id_from_sbuf(conn, &sbuf1); + files_struct *dst_fsp = file_find_di_first(fileid); if (dst_fsp) { DEBUG(3, ("rename_internals_fsp: Target file open\n")); return NT_STATUS_ACCESS_DENIED; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 77a13ad186..2b0925d195 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3312,6 +3312,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char * time_t create_time, mtime, atime; struct timespec create_time_ts, mtime_ts, atime_ts; files_struct *fsp = NULL; + struct file_id fileid; TALLOC_CTX *data_ctx = NULL; struct ea_list *ea_list = NULL; uint32 access_mask = 0x12019F; /* Default - GENERIC_EXECUTE mapping from Windows */ @@ -3378,7 +3379,8 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char * return UNIXERROR(ERRDOS,ERRbadpath); } - delete_pending = get_delete_on_close_flag(file_id_sbuf(&sbuf)); + fileid = vfs_file_id_from_sbuf(conn, &sbuf); + delete_pending = get_delete_on_close_flag(fileid); } else { /* * Original code - this is an open file. @@ -3391,7 +3393,8 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char * return(UNIXERROR(ERRDOS,ERRbadfid)); } pos = fsp->fh->position_information; - delete_pending = get_delete_on_close_flag(file_id_sbuf(&sbuf)); + fileid = vfs_file_id_from_sbuf(conn, &sbuf); + delete_pending = get_delete_on_close_flag(fileid); access_mask = fsp->access_mask; } } else { @@ -3446,7 +3449,8 @@ static int call_trans2qfilepathinfo(connection_struct *conn, char *inbuf, char * return UNIXERROR(ERRDOS,ERRbadpath); } - delete_pending = get_delete_on_close_flag(file_id_sbuf(&sbuf)); + fileid = vfs_file_id_from_sbuf(conn, &sbuf); + delete_pending = get_delete_on_close_flag(fileid); if (delete_pending) { return ERROR_NT(NT_STATUS_DELETE_PENDING); } @@ -3572,8 +3576,10 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd mtime_ts = fsp->pending_modtime; } } else { + files_struct *fsp1; /* Do we have this path open ? */ - files_struct *fsp1 = file_find_di_first(file_id_sbuf(&sbuf)); + fileid = vfs_file_id_from_sbuf(conn, &sbuf); + fsp1 = file_find_di_first(fileid); if (fsp1 && !null_timespec(fsp1->pending_modtime)) { /* the pending modtime overrides the current modtime */ mtime_ts = fsp1->pending_modtime; -- cgit