summaryrefslogtreecommitdiff
path: root/source4/ntvfs/nbench
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-05-20 08:15:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:10 -0500
commit9ef33f5f5c786b83311ca088357fb2f0aa72fc9e (patch)
tree66335dced1641119f94e6c656dd1ccc673218d0c /source4/ntvfs/nbench
parent0dcecc314899b6f36e9215e0b3881220062ba4f9 (diff)
downloadsamba-9ef33f5f5c786b83311ca088357fb2f0aa72fc9e.tar.gz
samba-9ef33f5f5c786b83311ca088357fb2f0aa72fc9e.tar.bz2
samba-9ef33f5f5c786b83311ca088357fb2f0aa72fc9e.zip
r15734: This is a major change to the NTVFS subsystem:
- to use a struct ntvfs_handle instead of a uint16_t fnum. (to make it independend from the frontend protocol) - the allocation of handles now is provided by the frontend (smbsrv_*) via callbacks and not by each backend module - this also makes sure that file handles are only passed to the ntvfs subsystem when the tcon and session matches, so modules can rely on this and need to check this. - this allows multiple modules in the ntvfs module chain to allocate file handles. This can be used for virtual files like "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION"... - also this will make SMB2 with 128 bit file handles possible metze (This used to be commit 287fc1c22d670f6e568014b420f7f4cb31dc7958)
Diffstat (limited to 'source4/ntvfs/nbench')
-rw-r--r--source4/ntvfs/nbench/vfs_nbench.c68
1 files changed, 44 insertions, 24 deletions
diff --git a/source4/ntvfs/nbench/vfs_nbench.c b/source4/ntvfs/nbench/vfs_nbench.c
index 963d422cf0..2df3b95494 100644
--- a/source4/ntvfs/nbench/vfs_nbench.c
+++ b/source4/ntvfs/nbench/vfs_nbench.c
@@ -54,6 +54,26 @@ static void nbench_log(struct ntvfs_request *req,
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__, key.length));
+ break;
+ }
+
+ return talloc_asprintf(req, "%u", fnum);
+}
+
/*
this pass through macro operates on request contexts, and disables
async calls.
@@ -237,8 +257,8 @@ static void nbench_qfileinfo_send(struct ntvfs_request *req)
{
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));
@@ -292,11 +312,11 @@ static void nbench_open_send(struct ntvfs_request *req)
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;
@@ -430,8 +450,8 @@ static void nbench_read_send(struct ntvfs_request *req)
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,
@@ -468,8 +488,8 @@ static void nbench_write_send(struct ntvfs_request *req)
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,
@@ -480,8 +500,8 @@ static void nbench_write_send(struct ntvfs_request *req)
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,
@@ -534,20 +554,20 @@ static NTSTATUS nbench_seek(struct ntvfs_module_context *ntvfs,
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;
}
- nbench_log(req, "Flush %d %s\n",
- fnum, get_nt_error_c_code(req->async_states->status));
-
PASS_THRU_REP_POST(req);
}
@@ -571,8 +591,8 @@ static void nbench_close_send(struct ntvfs_request *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;
@@ -686,15 +706,15 @@ static void nbench_lock_send(struct ntvfs_request *req)
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));
@@ -722,8 +742,8 @@ static void nbench_setfileinfo_send(struct ntvfs_request *req)
{
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));