smbd: brl_lock does not need "blr" anymore
[Samba.git] / source4 / client / cifsdd.h
blob4e9cb9dd9a3bbe03886480ed2120f920f6f0f08c
1 /*
2 CIFSDD - dd for SMB.
3 Declarations and administrivia.
5 Copyright (C) James Peach 2005-2006
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 extern const char * const PROGNAME;
23 enum argtype
25 ARG_NUMERIC,
26 ARG_SIZE,
27 ARG_PATHNAME,
28 ARG_BOOL,
31 struct argdef
33 const char * arg_name;
34 enum argtype arg_type;
35 const char * arg_help;
37 union
39 bool bval;
40 uint64_t nval;
41 const char * pval;
42 } arg_val;
45 int set_arg_argv(const char * argv);
46 void set_arg_val(const char * name, ...);
48 bool check_arg_bool(const char * name);
49 uint64_t check_arg_numeric(const char * name);
50 const char * check_arg_pathname(const char * name);
52 typedef bool (*dd_seek_func)(void * handle, uint64_t offset);
53 typedef bool (*dd_read_func)(void * handle, uint8_t * buf,
54 uint64_t wanted, uint64_t * actual);
55 typedef bool (*dd_write_func)(void * handle, uint8_t * buf,
56 uint64_t wanted, uint64_t * actual);
58 struct dd_stats_record
60 struct
62 uint64_t fblocks; /* Full blocks. */
63 uint64_t pblocks; /* Partial blocks. */
64 uint64_t bytes; /* Total bytes read. */
65 } in;
66 struct
68 uint64_t fblocks; /* Full blocks. */
69 uint64_t pblocks; /* Partial blocks. */
70 uint64_t bytes; /* Total bytes written. */
71 } out;
74 extern struct dd_stats_record dd_stats;
76 struct dd_iohandle
78 dd_seek_func io_seek;
79 dd_read_func io_read;
80 dd_write_func io_write;
81 int io_flags;
84 #define DD_END_OF_FILE 0x10000000
86 #define DD_DIRECT_IO 0x00000001
87 #define DD_SYNC_IO 0x00000002
88 #define DD_WRITE 0x00000004
89 #define DD_OPLOCK 0x00000008
91 struct smbcli_options;
92 struct smbcli_session_options;
93 struct tevent_context;
95 struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
96 struct tevent_context *ev,
97 const char * path,
98 const char **ports,
99 uint64_t io_size, int options,
100 const char *socket_options,
101 struct smbcli_options *smb_options,
102 struct smbcli_session_options *smb_session_options,
103 struct gensec_settings *gensec_settings);
104 bool dd_fill_block(struct dd_iohandle * h, uint8_t * buf,
105 uint64_t * buf_size, uint64_t need_size, uint64_t block_size);
106 bool dd_flush_block(struct dd_iohandle * h, uint8_t * buf,
107 uint64_t * buf_size, uint64_t block_size);
109 /* vim: set sw=8 sts=8 ts=8 tw=79 : */