diff options
author | Kay Sievers <kay@vrfy.org> | 2014-07-30 09:46:35 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-07-30 09:46:35 -0400 |
commit | 65af29f3f7c43cdcc73fc224cfbf3e1ccbd9dd60 (patch) | |
tree | 3c7e0ca062f4e118378880cc857d071c9ab8920f /src/udev/udev-ctrl.c | |
parent | 471a5f341168cff3f07474b7c4a88779bdd8ca1d (diff) |
udev: place opening { at the same line as the function declaration
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev/udev-ctrl.c')
-rw-r--r-- | src/udev/udev-ctrl.c | 93 |
1 files changed, 31 insertions, 62 deletions
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index 8d07c993b7..76fb2cef17 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -71,8 +71,7 @@ struct udev_ctrl_connection { int sock; }; -struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) -{ +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) { struct udev_ctrl *uctrl; const int on = 1; @@ -101,13 +100,11 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) return uctrl; } -struct udev_ctrl *udev_ctrl_new(struct udev *udev) -{ +struct udev_ctrl *udev_ctrl_new(struct udev *udev) { return udev_ctrl_new_from_fd(udev, -1); } -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) -{ +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) { int err; if (!uctrl->bound) { @@ -136,21 +133,18 @@ int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) return 0; } -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) -{ +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) { return uctrl->udev; } -static struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) -{ +static struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) { if (uctrl == NULL) return NULL; uctrl->refcount++; return uctrl; } -struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) -{ +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) { if (uctrl == NULL) return NULL; uctrl->refcount--; @@ -162,8 +156,7 @@ struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) return NULL; } -int udev_ctrl_cleanup(struct udev_ctrl *uctrl) -{ +int udev_ctrl_cleanup(struct udev_ctrl *uctrl) { if (uctrl == NULL) return 0; if (uctrl->cleanup_socket) @@ -171,15 +164,13 @@ int udev_ctrl_cleanup(struct udev_ctrl *uctrl) return 0; } -int udev_ctrl_get_fd(struct udev_ctrl *uctrl) -{ +int udev_ctrl_get_fd(struct udev_ctrl *uctrl) { if (uctrl == NULL) return -EINVAL; return uctrl->sock; } -static inline int accept4_fallback(int sockfd) -{ +static inline int accept4_fallback(int sockfd) { int fd; if ((fd = accept(sockfd, NULL, NULL)) >= 0) { @@ -190,8 +181,7 @@ static inline int accept4_fallback(int sockfd) return fd; } -struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) -{ +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) { struct udev_ctrl_connection *conn; struct ucred ucred = {}; const int on = 1; @@ -241,16 +231,14 @@ err: return NULL; } -struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) -{ +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) { if (conn == NULL) return NULL; conn->refcount++; return conn; } -struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) -{ +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) { if (conn == NULL) return NULL; conn->refcount--; @@ -263,8 +251,7 @@ struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connect return NULL; } -static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) -{ +static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) { struct udev_ctrl_msg_wire ctrl_msg_wire; int err = 0; @@ -318,48 +305,39 @@ out: return err; } -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) -{ +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); } -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); } -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); } -int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_RELOAD, 0, NULL, timeout); } -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) -{ +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); } -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) -{ +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); } -int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); } -int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) -{ +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) { return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); } -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) -{ +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) { struct udev_ctrl_msg *uctrl_msg; ssize_t size; struct cmsghdr *cmsg; @@ -438,8 +416,7 @@ err: return NULL; } -struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) -{ +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg == NULL) return NULL; ctrl_msg->refcount--; @@ -450,57 +427,49 @@ struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) return NULL; } -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) return ctrl_msg->ctrl_msg_wire.intval; return -1; } -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) return 1; return -1; } -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) return 1; return -1; } -int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD) return 1; return -1; } -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) -{ +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) return ctrl_msg->ctrl_msg_wire.buf; return NULL; } -int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) return ctrl_msg->ctrl_msg_wire.intval; return -1; } -int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) return 1; return -1; } -int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) -{ +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) return 1; return -1; |