2 Unix SMB/CIFS implementation.
4 CIFS-on-CIFS NTVFS filesystem backend
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) James J Myers 2003 <myersjj@samba.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 this implements a CIFS->CIFS NTVFS filesystem backend.
29 #include "libcli/raw/libcliraw.h"
30 #include "libcli/smb_composite/smb_composite.h"
31 #include "smb_server/smb_server.h"
32 #include "smbd/service_stream.h"
33 #include "auth/auth.h"
34 #include "ntvfs/ntvfs.h"
35 #include "include/dlinklist.h"
37 /* this is stored in ntvfs_private */
39 struct smbcli_tree *tree;
40 struct smbcli_transport *transport;
41 struct smbsrv_tcon *tcon;
42 struct async_info *pending;
47 /* a structure used to pass information to an async handler */
49 struct async_info *next, *prev;
50 struct cvfs_private *cvfs;
51 struct ntvfs_request *req;
52 struct smbcli_request *c_req;
56 #define SETUP_PID private->tree->session->pid = SVAL(req->in.hdr, HDR_PID)
59 a handler for oplock break events from the server - these need to be passed
62 static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private)
64 struct cvfs_private *private = p_private;
66 DEBUG(5,("vfs_cifs: sending oplock break level %d for fnum %d\n", level, fnum));
67 return req_send_oplock_break(private->tcon, fnum, level);
71 connect to a share - used when a tree_connect operation comes in.
73 static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
74 struct ntvfs_request *req, const char *sharename)
76 struct smbsrv_tcon *tcon = req->tcon;
78 struct cvfs_private *private;
79 const char *host, *user, *pass, *domain, *remote_share;
80 struct smb_composite_connect io;
81 struct composite_context *creq;
83 struct cli_credentials *credentials;
86 /* Here we need to determine which server to connect to.
87 * For now we use parametric options, type cifs.
88 * Later we will use security=server and auth_server.c.
90 host = lp_parm_string(req->tcon->service, "cifs", "server");
91 user = lp_parm_string(req->tcon->service, "cifs", "user");
92 pass = lp_parm_string(req->tcon->service, "cifs", "password");
93 domain = lp_parm_string(req->tcon->service, "cifs", "domain");
94 remote_share = lp_parm_string(req->tcon->service, "cifs", "share");
96 remote_share = sharename;
99 machine_account = lp_parm_bool(req->tcon->service, "cifs", "use_machine_account", False);
101 private = talloc_zero(ntvfs, struct cvfs_private);
103 return NT_STATUS_NO_MEMORY;
106 ntvfs->private_data = private;
109 DEBUG(1,("CIFS backend: You must supply server\n"));
110 return NT_STATUS_INVALID_PARAMETER;
114 DEBUG(5, ("CIFS backend: Using specified password\n"));
115 credentials = cli_credentials_init(private);
117 return NT_STATUS_NO_MEMORY;
119 cli_credentials_set_conf(credentials);
120 cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
122 cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
124 cli_credentials_set_password(credentials, pass, CRED_SPECIFIED);
125 } else if (machine_account) {
126 DEBUG(5, ("CIFS backend: Using machine account\n"));
127 credentials = cli_credentials_init(private);
128 cli_credentials_set_conf(credentials);
130 cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
132 status = cli_credentials_set_machine_account(credentials);
133 if (!NT_STATUS_IS_OK(status)) {
136 } else if (req->session->session_info->credentials) {
137 DEBUG(5, ("CIFS backend: Using delegated credentials\n"));
138 credentials = req->session->session_info->credentials;
140 DEBUG(1,("CIFS backend: You must supply server, user and password and or have delegated credentials\n"));
141 return NT_STATUS_INVALID_PARAMETER;
144 /* connect to the server, using the smbd event context */
145 io.in.dest_host = host;
147 io.in.called_name = host;
148 io.in.credentials = credentials;
149 io.in.fallback_to_anonymous = False;
150 io.in.workgroup = lp_workgroup();
151 io.in.service = remote_share;
152 io.in.service_type = "?????";
154 creq = smb_composite_connect_send(&io, private, tcon->smb_conn->connection->event.ctx);
155 status = smb_composite_connect_recv(creq, private);
156 NT_STATUS_NOT_OK_RETURN(status);
158 private->tree = io.out.tree;
160 private->transport = private->tree->session->transport;
162 private->tcon = req->tcon;
164 tcon->fs_type = talloc_strdup(tcon, "NTFS");
165 tcon->dev_type = talloc_strdup(tcon, "A:");
167 /* we need to receive oplock break requests from the server */
168 smbcli_oplock_handler(private->transport, oplock_handler, private);
170 private->map_generic = lp_parm_bool(req->tcon->service,
171 "cifs", "mapgeneric", False);
177 disconnect from a share
179 static NTSTATUS cvfs_disconnect(struct ntvfs_module_context *ntvfs)
181 struct cvfs_private *private = ntvfs->private_data;
183 talloc_free(private);
184 ntvfs->private_data = NULL;
190 destroy an async info structure
192 static int async_info_destructor(void *p)
194 struct async_info *async = talloc_get_type(p, struct async_info);
195 DLIST_REMOVE(async->cvfs->pending, async);
200 a handler for simple async replies
201 this handler can only be used for functions that don't return any
202 parameters (those that just return a status code)
204 static void async_simple(struct smbcli_request *c_req)
206 struct async_info *async = c_req->async.private;
207 struct ntvfs_request *req = async->req;
208 req->async_states->status = smbcli_request_simple_recv(c_req);
209 req->async_states->send_fn(req);
213 /* save some typing for the simple functions */
214 #define ASYNC_RECV_TAIL(io, async_fn) do { \
215 if (!c_req) return NT_STATUS_UNSUCCESSFUL; \
217 struct async_info *async; \
218 async = talloc(req, struct async_info); \
219 if (!async) return NT_STATUS_NO_MEMORY; \
222 async->cvfs = private; \
223 async->c_req = c_req; \
224 DLIST_ADD(private->pending, async); \
225 c_req->async.private = async; \
226 talloc_set_destructor(async, async_info_destructor); \
228 c_req->async.fn = async_fn; \
229 req->async_states->state |= NTVFS_ASYNC_STATE_ASYNC; \
230 return NT_STATUS_OK; \
233 #define SIMPLE_ASYNC_TAIL ASYNC_RECV_TAIL(NULL, async_simple)
236 delete a file - the dirtype specifies the file types to include in the search.
237 The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
239 static NTSTATUS cvfs_unlink(struct ntvfs_module_context *ntvfs,
240 struct ntvfs_request *req, union smb_unlink *unl)
242 struct cvfs_private *private = ntvfs->private_data;
243 struct smbcli_request *c_req;
247 /* see if the front end will allow us to perform this
248 function asynchronously. */
249 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
250 return smb_raw_unlink(private->tree, unl);
253 c_req = smb_raw_unlink_send(private->tree, unl);
259 a handler for async ioctl replies
261 static void async_ioctl(struct smbcli_request *c_req)
263 struct async_info *async = c_req->async.private;
264 struct ntvfs_request *req = async->req;
265 req->async_states->status = smb_raw_ioctl_recv(c_req, req, async->parms);
266 req->async_states->send_fn(req);
272 static NTSTATUS cvfs_ioctl(struct ntvfs_module_context *ntvfs,
273 struct ntvfs_request *req, union smb_ioctl *io)
275 struct cvfs_private *private = ntvfs->private_data;
276 struct smbcli_request *c_req;
280 /* see if the front end will allow us to perform this
281 function asynchronously. */
282 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
283 return smb_raw_ioctl(private->tree, req, io);
286 c_req = smb_raw_ioctl_send(private->tree, io);
288 ASYNC_RECV_TAIL(io, async_ioctl);
292 check if a directory exists
294 static NTSTATUS cvfs_chkpath(struct ntvfs_module_context *ntvfs,
295 struct ntvfs_request *req, union smb_chkpath *cp)
297 struct cvfs_private *private = ntvfs->private_data;
298 struct smbcli_request *c_req;
302 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
303 return smb_raw_chkpath(private->tree, cp);
306 c_req = smb_raw_chkpath_send(private->tree, cp);
312 a handler for async qpathinfo replies
314 static void async_qpathinfo(struct smbcli_request *c_req)
316 struct async_info *async = c_req->async.private;
317 struct ntvfs_request *req = async->req;
318 req->async_states->status = smb_raw_pathinfo_recv(c_req, req, async->parms);
319 req->async_states->send_fn(req);
323 return info on a pathname
325 static NTSTATUS cvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
326 struct ntvfs_request *req, union smb_fileinfo *info)
328 struct cvfs_private *private = ntvfs->private_data;
329 struct smbcli_request *c_req;
333 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
334 return smb_raw_pathinfo(private->tree, req, info);
337 c_req = smb_raw_pathinfo_send(private->tree, info);
339 ASYNC_RECV_TAIL(info, async_qpathinfo);
343 a handler for async qfileinfo replies
345 static void async_qfileinfo(struct smbcli_request *c_req)
347 struct async_info *async = c_req->async.private;
348 struct ntvfs_request *req = async->req;
349 req->async_states->status = smb_raw_fileinfo_recv(c_req, req, async->parms);
350 req->async_states->send_fn(req);
354 query info on a open file
356 static NTSTATUS cvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
357 struct ntvfs_request *req, union smb_fileinfo *info)
359 struct cvfs_private *private = ntvfs->private_data;
360 struct smbcli_request *c_req;
364 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
365 return smb_raw_fileinfo(private->tree, req, info);
368 c_req = smb_raw_fileinfo_send(private->tree, info);
370 ASYNC_RECV_TAIL(info, async_qfileinfo);
375 set info on a pathname
377 static NTSTATUS cvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
378 struct ntvfs_request *req, union smb_setfileinfo *st)
380 struct cvfs_private *private = ntvfs->private_data;
381 struct smbcli_request *c_req;
385 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
386 return smb_raw_setpathinfo(private->tree, st);
389 c_req = smb_raw_setpathinfo_send(private->tree, st);
396 a handler for async open replies
398 static void async_open(struct smbcli_request *c_req)
400 struct async_info *async = c_req->async.private;
401 struct ntvfs_request *req = async->req;
402 req->async_states->status = smb_raw_open_recv(c_req, req, async->parms);
403 req->async_states->send_fn(req);
409 static NTSTATUS cvfs_open(struct ntvfs_module_context *ntvfs,
410 struct ntvfs_request *req, union smb_open *io)
412 struct cvfs_private *private = ntvfs->private_data;
413 struct smbcli_request *c_req;
417 if (io->generic.level != RAW_OPEN_GENERIC &&
418 private->map_generic) {
419 return ntvfs_map_open(ntvfs, req, io);
422 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
423 return smb_raw_open(private->tree, req, io);
426 c_req = smb_raw_open_send(private->tree, io);
428 ASYNC_RECV_TAIL(io, async_open);
434 static NTSTATUS cvfs_mkdir(struct ntvfs_module_context *ntvfs,
435 struct ntvfs_request *req, union smb_mkdir *md)
437 struct cvfs_private *private = ntvfs->private_data;
438 struct smbcli_request *c_req;
442 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
443 return smb_raw_mkdir(private->tree, md);
446 c_req = smb_raw_mkdir_send(private->tree, md);
454 static NTSTATUS cvfs_rmdir(struct ntvfs_module_context *ntvfs,
455 struct ntvfs_request *req, struct smb_rmdir *rd)
457 struct cvfs_private *private = ntvfs->private_data;
458 struct smbcli_request *c_req;
462 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
463 return smb_raw_rmdir(private->tree, rd);
465 c_req = smb_raw_rmdir_send(private->tree, rd);
471 rename a set of files
473 static NTSTATUS cvfs_rename(struct ntvfs_module_context *ntvfs,
474 struct ntvfs_request *req, union smb_rename *ren)
476 struct cvfs_private *private = ntvfs->private_data;
477 struct smbcli_request *c_req;
481 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
482 return smb_raw_rename(private->tree, ren);
485 c_req = smb_raw_rename_send(private->tree, ren);
493 static NTSTATUS cvfs_copy(struct ntvfs_module_context *ntvfs,
494 struct ntvfs_request *req, struct smb_copy *cp)
496 return NT_STATUS_NOT_SUPPORTED;
500 a handler for async read replies
502 static void async_read(struct smbcli_request *c_req)
504 struct async_info *async = c_req->async.private;
505 struct ntvfs_request *req = async->req;
506 req->async_states->status = smb_raw_read_recv(c_req, async->parms);
507 req->async_states->send_fn(req);
513 static NTSTATUS cvfs_read(struct ntvfs_module_context *ntvfs,
514 struct ntvfs_request *req, union smb_read *rd)
516 struct cvfs_private *private = ntvfs->private_data;
517 struct smbcli_request *c_req;
521 if (rd->generic.level != RAW_READ_GENERIC &&
522 private->map_generic) {
523 return ntvfs_map_read(ntvfs, req, rd);
526 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
527 return smb_raw_read(private->tree, rd);
530 c_req = smb_raw_read_send(private->tree, rd);
532 ASYNC_RECV_TAIL(rd, async_read);
536 a handler for async write replies
538 static void async_write(struct smbcli_request *c_req)
540 struct async_info *async = c_req->async.private;
541 struct ntvfs_request *req = async->req;
542 req->async_states->status = smb_raw_write_recv(c_req, async->parms);
543 req->async_states->send_fn(req);
549 static NTSTATUS cvfs_write(struct ntvfs_module_context *ntvfs,
550 struct ntvfs_request *req, union smb_write *wr)
552 struct cvfs_private *private = ntvfs->private_data;
553 struct smbcli_request *c_req;
557 if (wr->generic.level != RAW_WRITE_GENERIC &&
558 private->map_generic) {
559 return ntvfs_map_write(ntvfs, req, wr);
562 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
563 return smb_raw_write(private->tree, wr);
566 c_req = smb_raw_write_send(private->tree, wr);
568 ASYNC_RECV_TAIL(wr, async_write);
572 a handler for async seek replies
574 static void async_seek(struct smbcli_request *c_req)
576 struct async_info *async = c_req->async.private;
577 struct ntvfs_request *req = async->req;
578 req->async_states->status = smb_raw_seek_recv(c_req, async->parms);
579 req->async_states->send_fn(req);
585 static NTSTATUS cvfs_seek(struct ntvfs_module_context *ntvfs,
586 struct ntvfs_request *req,
589 struct cvfs_private *private = ntvfs->private_data;
590 struct smbcli_request *c_req;
594 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
595 return smb_raw_seek(private->tree, io);
598 c_req = smb_raw_seek_send(private->tree, io);
600 ASYNC_RECV_TAIL(io, async_seek);
606 static NTSTATUS cvfs_flush(struct ntvfs_module_context *ntvfs,
607 struct ntvfs_request *req,
610 struct cvfs_private *private = ntvfs->private_data;
611 struct smbcli_request *c_req;
615 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
616 return smb_raw_flush(private->tree, io);
619 c_req = smb_raw_flush_send(private->tree, io);
627 static NTSTATUS cvfs_close(struct ntvfs_module_context *ntvfs,
628 struct ntvfs_request *req, union smb_close *io)
630 struct cvfs_private *private = ntvfs->private_data;
631 struct smbcli_request *c_req;
635 if (io->generic.level != RAW_CLOSE_GENERIC &&
636 private->map_generic) {
637 return ntvfs_map_close(ntvfs, req, io);
640 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
641 return smb_raw_close(private->tree, io);
644 c_req = smb_raw_close_send(private->tree, io);
650 exit - closing files open by the pid
652 static NTSTATUS cvfs_exit(struct ntvfs_module_context *ntvfs,
653 struct ntvfs_request *req)
655 struct cvfs_private *private = ntvfs->private_data;
656 struct smbcli_request *c_req;
660 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
661 return smb_raw_exit(private->tree->session);
664 c_req = smb_raw_exit_send(private->tree->session);
670 logoff - closing files open by the user
672 static NTSTATUS cvfs_logoff(struct ntvfs_module_context *ntvfs,
673 struct ntvfs_request *req)
675 /* we can't do this right in the cifs backend .... */
680 setup for an async call - nothing to do yet
682 static NTSTATUS cvfs_async_setup(struct ntvfs_module_context *ntvfs,
683 struct ntvfs_request *req,
692 static NTSTATUS cvfs_cancel(struct ntvfs_module_context *ntvfs,
693 struct ntvfs_request *req)
695 struct cvfs_private *private = ntvfs->private_data;
697 /* find the matching request */
698 struct async_info *a;
699 for (a=private->pending;a;a=a->next) {
700 if (SVAL(a->req->in.hdr, HDR_MID) == SVAL(req->in.hdr, HDR_MID)) {
706 return NT_STATUS_INVALID_PARAMETER;
709 return smb_raw_ntcancel(a->c_req);
715 static NTSTATUS cvfs_lock(struct ntvfs_module_context *ntvfs,
716 struct ntvfs_request *req, union smb_lock *lck)
718 struct cvfs_private *private = ntvfs->private_data;
719 struct smbcli_request *c_req;
723 if (lck->generic.level != RAW_LOCK_GENERIC &&
724 private->map_generic) {
725 return ntvfs_map_lock(ntvfs, req, lck);
728 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
729 return smb_raw_lock(private->tree, lck);
732 c_req = smb_raw_lock_send(private->tree, lck);
737 set info on a open file
739 static NTSTATUS cvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
740 struct ntvfs_request *req,
741 union smb_setfileinfo *info)
743 struct cvfs_private *private = ntvfs->private_data;
744 struct smbcli_request *c_req;
748 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
749 return smb_raw_setfileinfo(private->tree, info);
751 c_req = smb_raw_setfileinfo_send(private->tree, info);
758 a handler for async fsinfo replies
760 static void async_fsinfo(struct smbcli_request *c_req)
762 struct async_info *async = c_req->async.private;
763 struct ntvfs_request *req = async->req;
764 req->async_states->status = smb_raw_fsinfo_recv(c_req, req, async->parms);
765 req->async_states->send_fn(req);
769 return filesystem space info
771 static NTSTATUS cvfs_fsinfo(struct ntvfs_module_context *ntvfs,
772 struct ntvfs_request *req, union smb_fsinfo *fs)
774 struct cvfs_private *private = ntvfs->private_data;
775 struct smbcli_request *c_req;
779 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
780 return smb_raw_fsinfo(private->tree, req, fs);
783 c_req = smb_raw_fsinfo_send(private->tree, req, fs);
785 ASYNC_RECV_TAIL(fs, async_fsinfo);
789 return print queue info
791 static NTSTATUS cvfs_lpq(struct ntvfs_module_context *ntvfs,
792 struct ntvfs_request *req, union smb_lpq *lpq)
794 return NT_STATUS_NOT_SUPPORTED;
798 list files in a directory matching a wildcard pattern
800 static NTSTATUS cvfs_search_first(struct ntvfs_module_context *ntvfs,
801 struct ntvfs_request *req, union smb_search_first *io,
802 void *search_private,
803 BOOL (*callback)(void *, union smb_search_data *))
805 struct cvfs_private *private = ntvfs->private_data;
809 return smb_raw_search_first(private->tree, req, io, search_private, callback);
812 /* continue a search */
813 static NTSTATUS cvfs_search_next(struct ntvfs_module_context *ntvfs,
814 struct ntvfs_request *req, union smb_search_next *io,
815 void *search_private,
816 BOOL (*callback)(void *, union smb_search_data *))
818 struct cvfs_private *private = ntvfs->private_data;
822 return smb_raw_search_next(private->tree, req, io, search_private, callback);
826 static NTSTATUS cvfs_search_close(struct ntvfs_module_context *ntvfs,
827 struct ntvfs_request *req, union smb_search_close *io)
829 struct cvfs_private *private = ntvfs->private_data;
833 return smb_raw_search_close(private->tree, io);
837 a handler for async trans2 replies
839 static void async_trans2(struct smbcli_request *c_req)
841 struct async_info *async = c_req->async.private;
842 struct ntvfs_request *req = async->req;
843 req->async_states->status = smb_raw_trans2_recv(c_req, req, async->parms);
844 req->async_states->send_fn(req);
848 static NTSTATUS cvfs_trans2(struct ntvfs_module_context *ntvfs,
849 struct ntvfs_request *req,
850 struct smb_trans2 *trans2)
852 struct cvfs_private *private = ntvfs->private_data;
853 struct smbcli_request *c_req;
857 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
858 return smb_raw_trans2(private->tree, req, trans2);
861 c_req = smb_raw_trans2_send(private->tree, trans2);
863 ASYNC_RECV_TAIL(trans2, async_trans2);
867 /* SMBtrans - not used on file shares */
868 static NTSTATUS cvfs_trans(struct ntvfs_module_context *ntvfs,
869 struct ntvfs_request *req,
870 struct smb_trans2 *trans2)
872 return NT_STATUS_ACCESS_DENIED;
876 a handler for async change notify replies
878 static void async_changenotify(struct smbcli_request *c_req)
880 struct async_info *async = c_req->async.private;
881 struct ntvfs_request *req = async->req;
882 req->async_states->status = smb_raw_changenotify_recv(c_req, req, async->parms);
883 req->async_states->send_fn(req);
886 /* change notify request - always async */
887 static NTSTATUS cvfs_notify(struct ntvfs_module_context *ntvfs,
888 struct ntvfs_request *req,
889 union smb_notify *info)
891 struct cvfs_private *private = ntvfs->private_data;
892 struct smbcli_request *c_req;
896 /* this request doesn't make sense unless its async */
897 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
898 return NT_STATUS_INVALID_PARAMETER;
901 c_req = smb_raw_changenotify_send(private->tree, info);
903 ASYNC_RECV_TAIL(info, async_changenotify);
907 initialise the CIFS->CIFS backend, registering ourselves with the ntvfs subsystem
909 NTSTATUS ntvfs_cifs_init(void)
912 struct ntvfs_ops ops;
916 /* fill in the name and type */
918 ops.type = NTVFS_DISK;
920 /* fill in all the operations */
921 ops.connect = cvfs_connect;
922 ops.disconnect = cvfs_disconnect;
923 ops.unlink = cvfs_unlink;
924 ops.chkpath = cvfs_chkpath;
925 ops.qpathinfo = cvfs_qpathinfo;
926 ops.setpathinfo = cvfs_setpathinfo;
927 ops.open = cvfs_open;
928 ops.mkdir = cvfs_mkdir;
929 ops.rmdir = cvfs_rmdir;
930 ops.rename = cvfs_rename;
931 ops.copy = cvfs_copy;
932 ops.ioctl = cvfs_ioctl;
933 ops.read = cvfs_read;
934 ops.write = cvfs_write;
935 ops.seek = cvfs_seek;
936 ops.flush = cvfs_flush;
937 ops.close = cvfs_close;
938 ops.exit = cvfs_exit;
939 ops.lock = cvfs_lock;
940 ops.setfileinfo = cvfs_setfileinfo;
941 ops.qfileinfo = cvfs_qfileinfo;
942 ops.fsinfo = cvfs_fsinfo;
944 ops.search_first = cvfs_search_first;
945 ops.search_next = cvfs_search_next;
946 ops.search_close = cvfs_search_close;
947 ops.trans = cvfs_trans;
948 ops.logoff = cvfs_logoff;
949 ops.async_setup = cvfs_async_setup;
950 ops.cancel = cvfs_cancel;
951 ops.notify = cvfs_notify;
953 if (lp_parm_bool(-1, "cifs", "maptrans2", False)) {
954 ops.trans2 = cvfs_trans2;
957 /* register ourselves with the NTVFS subsystem. We register
958 under the name 'cifs'. */
959 ret = ntvfs_register(&ops);
961 if (!NT_STATUS_IS_OK(ret)) {
962 DEBUG(0,("Failed to register CIFS backend!\n"));