"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "sshfs.c" between
sshfs-3.7.1.tar.xz and sshfs-3.7.2.tar.xz

About: SSH Filesystem is based on the FUSE (Filesystem in Userspace) kernel module and uses the SSH File Transfer Protocol (SFTP) without requiring root privileges for mounting a remote filesystem.

sshfs.c  (sshfs-3.7.1.tar.xz):sshfs.c  (sshfs-3.7.2.tar.xz)
skipping to change at line 1400 skipping to change at line 1400
return -1; return -1;
buf_init(buf, len - 1); buf_init(buf, len - 1);
res = do_read(conn, buf); res = do_read(conn, buf);
} }
buf_free(&buf2); buf_free(&buf2);
return res; return res;
} }
static void request_free(struct request *req) static void request_free(struct request *req)
{ {
pthread_mutex_lock(&sshfs.lock); if (req->end_func)
req->end_func(req);
req->conn->req_count--; req->conn->req_count--;
pthread_mutex_unlock(&sshfs.lock);
buf_free(&req->reply); buf_free(&req->reply);
sem_destroy(&req->ready); sem_destroy(&req->ready);
g_free(req); g_free(req);
} }
static void chunk_free(struct read_chunk *chunk) static void chunk_free(struct read_chunk *chunk)
{ {
while (!list_empty(&chunk->reqs)) { while (!list_empty(&chunk->reqs)) {
struct read_req *rreq; struct read_req *rreq;
skipping to change at line 1448 skipping to change at line 1450
{ {
(void) key; (void) key;
struct conn* conn = (struct conn*) user_data; struct conn* conn = (struct conn*) user_data;
if (req->conn != conn) if (req->conn != conn)
return FALSE; return FALSE;
req->error = -EIO; req->error = -EIO;
if (req->want_reply) if (req->want_reply)
sem_post(&req->ready); sem_post(&req->ready);
else { else
if (req->end_func)
req->end_func(req);
request_free(req); request_free(req);
}
return TRUE; return TRUE;
} }
static int process_one_request(struct conn *conn) static int process_one_request(struct conn *conn)
{ {
int res; int res;
struct buffer buf; struct buffer buf;
uint8_t type; uint8_t type;
struct request *req; struct request *req;
uint32_t id; uint32_t id;
skipping to change at line 1514 skipping to change at line 1514
sshfs.total_rtt += difftime; sshfs.total_rtt += difftime;
sshfs.num_received++; sshfs.num_received++;
sshfs.bytes_received += msgsize; sshfs.bytes_received += msgsize;
} }
req->reply = buf; req->reply = buf;
req->reply_type = type; req->reply_type = type;
req->replied = 1; req->replied = 1;
if (req->want_reply) if (req->want_reply)
sem_post(&req->ready); sem_post(&req->ready);
else { else {
if (req->end_func) { pthread_mutex_lock(&sshfs.lock);
pthread_mutex_lock(&sshfs.lock);
req->end_func(req);
pthread_mutex_unlock(&sshfs.lock);
}
request_free(req); request_free(req);
pthread_mutex_unlock(&sshfs.lock);
} }
} else } else
buf_free(&buf); buf_free(&buf);
return 0; return 0;
} }
static void close_conn(struct conn *conn) static void close_conn(struct conn *conn)
{ {
close(conn->rfd); close(conn->rfd);
skipping to change at line 1969 skipping to change at line 1966
default: default:
err = -sftp_error_to_errno(serr); err = -sftp_error_to_errno(serr);
} }
} else { } else {
buf_init(outbuf, req->reply.size - req->reply.len); buf_init(outbuf, req->reply.size - req->reply.len);
buf_get_mem(&req->reply, outbuf->p, outbuf->size); buf_get_mem(&req->reply, outbuf->p, outbuf->size);
err = 0; err = 0;
} }
out: out:
if (req->end_func) { pthread_mutex_lock(&sshfs.lock);
pthread_mutex_lock(&sshfs.lock);
req->end_func(req);
pthread_mutex_unlock(&sshfs.lock);
}
request_free(req); request_free(req);
pthread_mutex_unlock(&sshfs.lock);
return err; return err;
} }
static int sftp_request_send(struct conn *conn, uint8_t type, struct iovec *iov, static int sftp_request_send(struct conn *conn, uint8_t type, struct iovec *iov,
size_t count, request_func begin_func, request_func end_func, size_t count, request_func begin_func, request_func end_func,
int want_reply, void *data, struct request **reqp) int want_reply, void *data, struct request **reqp)
{ {
int err; int err;
uint32_t id; uint32_t id;
struct request *req = g_new0(struct request, 1); struct request *req = g_new0(struct request, 1);
skipping to change at line 2375 skipping to change at line 2369
{ {
int err; int err;
struct buffer buf; struct buffer buf;
buf_init(&buf, 0); buf_init(&buf, 0);
buf_add_path(&buf, path); buf_add_path(&buf, path);
buf_add_uint32(&buf, SSH_FILEXFER_ATTR_PERMISSIONS); buf_add_uint32(&buf, SSH_FILEXFER_ATTR_PERMISSIONS);
buf_add_uint32(&buf, mode); buf_add_uint32(&buf, mode);
// Commutes with pending write(), so we can use any connection // Commutes with pending write(), so we can use any connection
err = sftp_request(get_conn(NULL, NULL), SSH_FXP_MKDIR, &buf, SSH_FXP_STA TUS, NULL); err = sftp_request(get_conn(NULL, NULL), SSH_FXP_MKDIR, &buf, SSH_FXP_STA TUS, NULL);
buf_free(&buf); buf_free(&buf);
if (err == -EPERM) {
if (sshfs.op->access(path, R_OK) == 0) {
return -EEXIST;
}
}
return err; return err;
} }
static int sshfs_mknod(const char *path, mode_t mode, dev_t rdev) static int sshfs_mknod(const char *path, mode_t mode, dev_t rdev)
{ {
int err; int err;
struct conn *conn; struct conn *conn;
struct buffer buf; struct buffer buf;
struct buffer handle; struct buffer handle;
(void) rdev; (void) rdev;
 End of changes. 9 change blocks. 
16 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)