This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
free(s);
}
+static char *nbench_ntvfs_handle_string(struct ntvfs_request *req, struct ntvfs_handle *h)
+{
+ DATA_BLOB key;
+ uint16_t fnum = 0;
+
+ key = ntvfs_handle_get_wire_key(h, req);
+
+ switch (key.length) {
+ case 2: /* SMB fnum */
+ fnum = SVAL(key.data, 0);
+ break;
+ default:
+ DEBUG(0,("%s: invalid wire handle size: %u\n",
+ __FUNCTION__, (unsigned)key.length));
+ break;
+ }
+
+ return talloc_asprintf(req, "%u", fnum);
+}
+
/*
this pass through macro operates on request contexts, and disables
async calls.
{
union smb_fileinfo *info = req->async_states->private_data;
- nbench_log(req, "QUERY_FILE_INFORMATION %d %d %s\n",
- info->generic.in.file.fnum,
+ nbench_log(req, "QUERY_FILE_INFORMATION %s %d %s\n",
+ nbench_ntvfs_handle_string(req, info->generic.in.file.ntvfs),
info->generic.level,
get_nt_error_c_code(req->async_states->status));
if (!NT_STATUS_IS_OK(req->async_states->status)) {
ZERO_STRUCT(io->ntcreatex.out);
}
- nbench_log(req, "NTCreateX \"%s\" 0x%x 0x%x %d %s\n",
+ nbench_log(req, "NTCreateX \"%s\" 0x%x 0x%x %s %s\n",
io->ntcreatex.in.fname,
io->ntcreatex.in.create_options,
io->ntcreatex.in.open_disposition,
- io->ntcreatex.out.file.fnum,
+ nbench_ntvfs_handle_string(req, io->ntcreatex.out.file.ntvfs),
get_nt_error_c_code(req->async_states->status));
break;
if (!NT_STATUS_IS_OK(req->async_states->status)) {
ZERO_STRUCT(rd->readx.out);
}
- nbench_log(req, "ReadX %d %d %d %d %s\n",
- rd->readx.in.file.fnum,
+ nbench_log(req, "ReadX %s %d %d %d %s\n",
+ nbench_ntvfs_handle_string(req, rd->readx.in.file.ntvfs),
(int)rd->readx.in.offset,
rd->readx.in.maxcnt,
rd->readx.out.nread,
if (!NT_STATUS_IS_OK(req->async_states->status)) {
ZERO_STRUCT(wr->writex.out);
}
- nbench_log(req, "WriteX %d %d %d %d %s\n",
- wr->writex.in.file.fnum,
+ nbench_log(req, "WriteX %s %d %d %d %s\n",
+ nbench_ntvfs_handle_string(req, wr->writex.in.file.ntvfs),
(int)wr->writex.in.offset,
wr->writex.in.count,
wr->writex.out.nwritten,
if (!NT_STATUS_IS_OK(req->async_states->status)) {
ZERO_STRUCT(wr->write.out);
}
- nbench_log(req, "Write %d %d %d %d %s\n",
- wr->write.in.file.fnum,
+ nbench_log(req, "Write %s %d %d %d %s\n",
+ nbench_ntvfs_handle_string(req, wr->write.in.file.ntvfs),
wr->write.in.offset,
wr->write.in.count,
wr->write.out.nwritten,
static void nbench_flush_send(struct ntvfs_request *req)
{
union smb_flush *io = req->async_states->private_data;
- uint16_t fnum;
switch (io->generic.level) {
case RAW_FLUSH_FLUSH:
- fnum = io->flush.in.file.fnum;
+ nbench_log(req, "Flush %s %s\n",
+ nbench_ntvfs_handle_string(req, io->flush.in.file.ntvfs),
+ get_nt_error_c_code(req->async_states->status));
break;
case RAW_FLUSH_ALL:
- fnum = 0xFFFF;
+ nbench_log(req, "Flush %d %s\n",
+ 0xFFFF,
+ get_nt_error_c_code(req->async_states->status));
+ break;
+ default:
+ nbench_log(req, "Flush-%d - NOT HANDLED\n",
+ io->generic.level);
break;
}
- nbench_log(req, "Flush %d %s\n",
- fnum, get_nt_error_c_code(req->async_states->status));
-
PASS_THRU_REP_POST(req);
}
switch (io->generic.level) {
case RAW_CLOSE_CLOSE:
- nbench_log(req, "Close %d %s\n",
- io->close.in.file.fnum,
+ nbench_log(req, "Close %s %s\n",
+ nbench_ntvfs_handle_string(req, io->close.in.file.ntvfs),
get_nt_error_c_code(req->async_states->status));
break;
if (lck->generic.level == RAW_LOCK_LOCKX &&
lck->lockx.in.lock_cnt == 1 &&
lck->lockx.in.ulock_cnt == 0) {
- nbench_log(req, "LockX %d %d %d %s\n",
- lck->lockx.in.file.fnum,
+ nbench_log(req, "LockX %s %d %d %s\n",
+ nbench_ntvfs_handle_string(req, lck->lockx.in.file.ntvfs),
(int)lck->lockx.in.locks[0].offset,
(int)lck->lockx.in.locks[0].count,
get_nt_error_c_code(req->async_states->status));
} else if (lck->generic.level == RAW_LOCK_LOCKX &&
lck->lockx.in.ulock_cnt == 1) {
- nbench_log(req, "UnlockX %d %d %d %s\n",
- lck->lockx.in.file.fnum,
+ nbench_log(req, "UnlockX %s %d %d %s\n",
+ nbench_ntvfs_handle_string(req, lck->lockx.in.file.ntvfs),
(int)lck->lockx.in.locks[0].offset,
(int)lck->lockx.in.locks[0].count,
get_nt_error_c_code(req->async_states->status));
{
union smb_setfileinfo *info = req->async_states->private_data;
- nbench_log(req, "SET_FILE_INFORMATION %d %d %s\n",
- info->generic.in.file.fnum,
+ nbench_log(req, "SET_FILE_INFORMATION %s %d %s\n",
+ nbench_ntvfs_handle_string(req, info->generic.in.file.ntvfs),
info->generic.level,
get_nt_error_c_code(req->async_states->status));
union smb_search_first *io = req->async_states->private_data;
switch (io->generic.level) {
- case RAW_SEARCH_BOTH_DIRECTORY_INFO:
+ case RAW_SEARCH_TRANS2:
if (NT_STATUS_IS_ERR(req->async_states->status)) {
ZERO_STRUCT(io->t2ffirst.out);
}
nbench_log(req, "FIND_FIRST \"%s\" %d %d %d %s\n",
io->t2ffirst.in.pattern,
- io->generic.level,
+ io->t2ffirst.data_level,
io->t2ffirst.in.max_count,
io->t2ffirst.out.count,
get_nt_error_c_code(req->async_states->status));
static NTSTATUS nbench_search_first(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_first *io,
void *search_private,
- BOOL (*callback)(void *, union smb_search_data *))
+ BOOL (*callback)(void *, const union smb_search_data *))
{
NTSTATUS status;
static NTSTATUS nbench_search_next(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_next *io,
void *search_private,
- BOOL (*callback)(void *, union smb_search_data *))
+ BOOL (*callback)(void *, const union smb_search_data *))
{
NTSTATUS status;