From 04f5f739056b535c71f0991b388f7f4b14c0b75e Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Tue, 3 Mar 2009 19:27:50 -0800 Subject: s3 OneFS: Use the public open_streams_for_delete --- source3/modules/onefs_open.c | 113 ------------------------------------------- 1 file changed, 113 deletions(-) (limited to 'source3') diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c index d3ba0ac979..c5030f4ab8 100644 --- a/source3/modules/onefs_open.c +++ b/source3/modules/onefs_open.c @@ -1648,119 +1648,6 @@ static NTSTATUS onefs_open_directory(connection_struct *conn, return NT_STATUS_OK; } -/* - * If a main file is opened for delete, all streams need to be checked for - * !FILE_SHARE_DELETE. Do this by opening with DELETE_ACCESS. - * If that works, delete them all by setting the delete on close and close. - */ - -static NTSTATUS open_streams_for_delete(connection_struct *conn, - const char *fname) -{ - struct stream_struct *stream_info; - files_struct **streams; - int i; - unsigned int num_streams; - TALLOC_CTX *frame = talloc_stackframe(); - NTSTATUS status; - - status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(), - &num_streams, &stream_info); - - if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED) - || NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { - DEBUG(10, ("no streams around\n")); - TALLOC_FREE(frame); - return NT_STATUS_OK; - } - - if (!NT_STATUS_IS_OK(status)) { - DEBUG(10, ("SMB_VFS_STREAMINFO failed: %s\n", - nt_errstr(status))); - goto fail; - } - - DEBUG(10, ("open_streams_for_delete found %d streams\n", - num_streams)); - - if (num_streams == 0) { - TALLOC_FREE(frame); - return NT_STATUS_OK; - } - - streams = TALLOC_ARRAY(talloc_tos(), files_struct *, num_streams); - if (streams == NULL) { - DEBUG(0, ("talloc failed\n")); - status = NT_STATUS_NO_MEMORY; - goto fail; - } - - /* Open the base file */ - - for (i=0; i= 0; i--) { - if (streams[i] == NULL) { - continue; - } - - DEBUG(10, ("Closing stream # %d, %s\n", i, - streams[i]->fsp_name)); - close_file(NULL, streams[i], NORMAL_CLOSE); - } - - fail: - TALLOC_FREE(frame); - return status; -} - /* * Wrapper around onefs_open_file_ntcreate and onefs_open_directory. */ -- cgit