Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346014
b: refs/heads/master
c: ed43984
h: refs/heads/master
v: v3
  • Loading branch information
Lars Ellenberg authored and Philipp Reisner committed Nov 8, 2012
1 parent 42f453c commit ffa3d6a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 71932efc1cfccfe1cc8e48b21f8cea5fbbc80e24
refs/heads/master: ed439848ca6029c748b537e510a1ed5a506ea123
33 changes: 20 additions & 13 deletions trunk/drivers/block/drbd/drbd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -1484,46 +1484,53 @@ static inline void drbd_flush_workqueue(struct drbd_conf *mdev)
conn_flush_workqueue(mdev->tconn);
}

/* yes, there is kernel_setsockopt, but only since 2.6.18. we don't need to
* mess with get_fs/set_fs, we know we are KERNEL_DS always. */
/* Yes, there is kernel_setsockopt, but only since 2.6.18.
* So we have our own copy of it here. */
static inline int drbd_setsockopt(struct socket *sock, int level, int optname,
char __user *optval, int optlen)
char *optval, int optlen)
{
mm_segment_t oldfs = get_fs();
char __user *uoptval;
int err;

uoptval = (char __user __force *)optval;

set_fs(KERNEL_DS);
if (level == SOL_SOCKET)
err = sock_setsockopt(sock, level, optname, optval, optlen);
err = sock_setsockopt(sock, level, optname, uoptval, optlen);
else
err = sock->ops->setsockopt(sock, level, optname, optval,
err = sock->ops->setsockopt(sock, level, optname, uoptval,
optlen);
set_fs(oldfs);
return err;
}

static inline void drbd_tcp_cork(struct socket *sock)
{
int __user val = 1;
int val = 1;
(void) drbd_setsockopt(sock, SOL_TCP, TCP_CORK,
(char __user *)&val, sizeof(val));
(char*)&val, sizeof(val));
}

static inline void drbd_tcp_uncork(struct socket *sock)
{
int __user val = 0;
int val = 0;
(void) drbd_setsockopt(sock, SOL_TCP, TCP_CORK,
(char __user *)&val, sizeof(val));
(char*)&val, sizeof(val));
}

static inline void drbd_tcp_nodelay(struct socket *sock)
{
int __user val = 1;
int val = 1;
(void) drbd_setsockopt(sock, SOL_TCP, TCP_NODELAY,
(char __user *)&val, sizeof(val));
(char*)&val, sizeof(val));
}

static inline void drbd_tcp_quickack(struct socket *sock)
{
int __user val = 2;
int val = 2;
(void) drbd_setsockopt(sock, SOL_TCP, TCP_QUICKACK,
(char __user *)&val, sizeof(val));
(char*)&val, sizeof(val));
}

void drbd_bump_write_ordering(struct drbd_conf *mdev, enum write_ordering_e wo);
Expand Down

0 comments on commit ffa3d6a

Please sign in to comment.