Commit aa81900e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] smbfs: support the loop driver

From: Urban Widmark <urban@teststation.com>

Add the necessary bits for loop-over-smbfs.
parent 560362da
......@@ -257,6 +257,27 @@ smb_file_mmap(struct file * file, struct vm_area_struct * vma)
return status;
}
static ssize_t
smb_file_sendfile(struct file *file, loff_t *ppos,
size_t count, read_actor_t actor, void __user *target)
{
struct dentry *dentry = file->f_dentry;
ssize_t status;
VERBOSE("file %s/%s, pos=%Ld, count=%d\n",
DENTRY_PATH(dentry), *ppos, count);
status = smb_revalidate_inode(dentry);
if (status) {
PARANOIA("%s/%s validation failed, error=%d\n",
DENTRY_PATH(dentry), status);
goto out;
}
status = generic_file_sendfile(file, ppos, count, actor, target);
out:
return status;
}
/*
* This does the "real" work of the write. The generic routine has
* allocated the page, locked it, done all the page alignment stuff
......@@ -388,6 +409,7 @@ struct file_operations smb_file_operations =
.open = smb_file_open,
.release = smb_file_release,
.fsync = smb_fsync,
.sendfile = smb_file_sendfile,
};
struct inode_operations smb_file_inode_operations =
......
......@@ -1015,12 +1015,6 @@ smb_setup_header(struct smb_request *req, __u8 command, __u16 wct, __u16 bcc)
p += 19;
p += 8;
/* FIXME: the request will fail if the 'tid' is changed. This
should perhaps be set just before transmitting ... */
WSET(req->rq_header, smb_tid, server->opt.tid);
WSET(req->rq_header, smb_pid, 1);
WSET(req->rq_header, smb_uid, server->opt.server_uid);
if (server->opt.protocol > SMB_PROTOCOL_CORE) {
int flags = SMB_FLAGS_CASELESS_PATHNAMES;
int flags2 = SMB_FLAGS2_LONG_PATH_COMPONENTS |
......
......@@ -384,6 +384,12 @@ int smb_request_send_req(struct smb_request *req)
struct smb_sb_info *server = req->rq_server;
int result;
if (req->rq_bytes_sent == 0) {
WSET(req->rq_header, smb_tid, server->opt.tid);
WSET(req->rq_header, smb_pid, 1);
WSET(req->rq_header, smb_uid, server->opt.server_uid);
}
result = smb_send_request(req);
if (result < 0 && result != -EAGAIN)
goto out;
......
......@@ -161,6 +161,9 @@ int smbiod_retry(struct smb_sb_info *server)
while (head != &server->xmitq) {
req = list_entry(head, struct smb_request, rq_queue);
head = head->next;
WSET(req->rq_header, smb_uid, -1);
req->rq_bytes_sent = 0;
if (req->rq_flags & SMB_REQ_NORETRY) {
VERBOSE("aborting request %p on xmitq\n", req);
req->rq_errno = -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment