con = kmalloc(sizeof(struct ceph_connection));
if (con == NULL) return 0;
memset(&con, 0, sizeof(con));
-
- spin_init(&con->con_lock);
- INIT_WORK(&con->rwork, ceph_reader); /* setup work structure */
-
atomic_inc(&con->nref);
return con;
}
static void put_connection(struct ceph_connection *con)
{
if (atomic_dec_and_test(&con->nref)) {
- /* FIXME close socket? */
+ sock_release(con->socket);
kfree(con);
}
}
/*
* call when socket is writeable
*/
-static int try_write(struct ceph_connection *con)
+static int try_write(struct work_struct *work)
{
int ret;
+ struct ceph_connection *con;
+
+ con = container_of(work, struct ceph_connection, swork);
-more:
/* data queued? */
if (con->out_partial.b_kvlen) {
ret = write_partial(con);
/*
* call when data is available on the socket
*/
-static int try_read(struct ceph_connection *con)
+static int try_read(struct work_struct *work)
{
int ret = -1;
+ struct ceph_connection *con;
+
+ con = container_of(work, struct ceph_connection, rwork);
more:
if (con->state == CLOSED) return -1;