diff options
author | Tim Prouty <tprouty@samba.org> | 2009-03-03 19:27:50 -0800 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2009-03-04 18:32:13 -0800 |
commit | 04f5f739056b535c71f0991b388f7f4b14c0b75e (patch) | |
tree | 0ffcde36b3b0e307c7b405df26addff0467244be /source3/modules | |
parent | f61f1690548edbd1c6e3badfe8d2e7b50485d03e (diff) | |
download | samba-04f5f739056b535c71f0991b388f7f4b14c0b75e.tar.gz samba-04f5f739056b535c71f0991b388f7f4b14c0b75e.tar.bz2 samba-04f5f739056b535c71f0991b388f7f4b14c0b75e.zip |
s3 OneFS: Use the public open_streams_for_delete
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/onefs_open.c | 113 |
1 files changed, 0 insertions, 113 deletions
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 @@ -1649,119 +1649,6 @@ static NTSTATUS onefs_open_directory(connection_struct *conn, } /* - * 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<num_streams; i++) { - char *streamname; - - if (strequal(stream_info[i].name, "::$DATA")) { - streams[i] = NULL; - continue; - } - - streamname = talloc_asprintf(talloc_tos(), "%s%s", fname, - stream_info[i].name); - - if (streamname == NULL) { - DEBUG(0, ("talloc_aprintf failed\n")); - status = NT_STATUS_NO_MEMORY; - goto fail; - } - - status = onefs_create_file_unixpath - (conn, /* conn */ - NULL, /* req */ - streamname, /* fname */ - DELETE_ACCESS, /* access_mask */ - FILE_SHARE_READ | FILE_SHARE_WRITE - | FILE_SHARE_DELETE, /* share_access */ - FILE_OPEN, /* create_disposition*/ - NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE, /* create_options */ - FILE_ATTRIBUTE_NORMAL, /* file_attributes */ - 0, /* oplock_request */ - 0, /* allocation_size */ - NULL, /* sd */ - NULL, /* ea_list */ - &streams[i], /* result */ - NULL, /* pinfo */ - NULL, /* fsp_data */ - NULL); /* psbuf */ - - TALLOC_FREE(streamname); - - if (!NT_STATUS_IS_OK(status)) { - DEBUG(10, ("Could not open stream %s: %s\n", - streamname, nt_errstr(status))); - break; - } - } - - /* - * don't touch the variable "status" beyond this point :-) - */ - - for (i -= 1 ; 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. */ static NTSTATUS onefs_create_file_unixpath(connection_struct *conn, |