• Home
  • Raw
  • Download

Lines Matching refs:info

101 static void remove_notification(struct mqueue_inode_info *info);
131 static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info) in msg_insert() argument
137 p = &info->msg_tree.rb_node; in msg_insert()
150 if (info->node_cache) { in msg_insert()
151 leaf = info->node_cache; in msg_insert()
152 info->node_cache = NULL; in msg_insert()
162 info->msg_tree_rightmost = &leaf->rb_node; in msg_insert()
165 rb_insert_color(&leaf->rb_node, &info->msg_tree); in msg_insert()
167 info->attr.mq_curmsgs++; in msg_insert()
168 info->qsize += msg->m_ts; in msg_insert()
174 struct mqueue_inode_info *info) in msg_tree_erase() argument
178 if (info->msg_tree_rightmost == node) in msg_tree_erase()
179 info->msg_tree_rightmost = rb_prev(node); in msg_tree_erase()
181 rb_erase(node, &info->msg_tree); in msg_tree_erase()
182 if (info->node_cache) { in msg_tree_erase()
185 info->node_cache = leaf; in msg_tree_erase()
189 static inline struct msg_msg *msg_get(struct mqueue_inode_info *info) in msg_get() argument
201 parent = info->msg_tree_rightmost; in msg_get()
203 if (info->attr.mq_curmsgs) { in msg_get()
207 info->attr.mq_curmsgs = 0; in msg_get()
216 msg_tree_erase(leaf, info); in msg_get()
223 msg_tree_erase(leaf, info); in msg_get()
226 info->attr.mq_curmsgs--; in msg_get()
227 info->qsize -= msg->m_ts; in msg_get()
250 struct mqueue_inode_info *info; in mqueue_get_inode() local
256 info = MQUEUE_I(inode); in mqueue_get_inode()
257 spin_lock_init(&info->lock); in mqueue_get_inode()
258 init_waitqueue_head(&info->wait_q); in mqueue_get_inode()
259 INIT_LIST_HEAD(&info->e_wait_q[0].list); in mqueue_get_inode()
260 INIT_LIST_HEAD(&info->e_wait_q[1].list); in mqueue_get_inode()
261 info->notify_owner = NULL; in mqueue_get_inode()
262 info->notify_user_ns = NULL; in mqueue_get_inode()
263 info->qsize = 0; in mqueue_get_inode()
264 info->user = NULL; /* set when all is ok */ in mqueue_get_inode()
265 info->msg_tree = RB_ROOT; in mqueue_get_inode()
266 info->msg_tree_rightmost = NULL; in mqueue_get_inode()
267 info->node_cache = NULL; in mqueue_get_inode()
268 memset(&info->attr, 0, sizeof(info->attr)); in mqueue_get_inode()
269 info->attr.mq_maxmsg = min(ipc_ns->mq_msg_max, in mqueue_get_inode()
271 info->attr.mq_msgsize = min(ipc_ns->mq_msgsize_max, in mqueue_get_inode()
274 info->attr.mq_maxmsg = attr->mq_maxmsg; in mqueue_get_inode()
275 info->attr.mq_msgsize = attr->mq_msgsize; in mqueue_get_inode()
292 if (info->attr.mq_maxmsg <= 0 || info->attr.mq_msgsize <= 0) in mqueue_get_inode()
295 if (info->attr.mq_maxmsg > HARD_MSGMAX || in mqueue_get_inode()
296 info->attr.mq_msgsize > HARD_MSGSIZEMAX) in mqueue_get_inode()
299 if (info->attr.mq_maxmsg > ipc_ns->mq_msg_max || in mqueue_get_inode()
300 info->attr.mq_msgsize > ipc_ns->mq_msgsize_max) in mqueue_get_inode()
305 if (info->attr.mq_msgsize > ULONG_MAX/info->attr.mq_maxmsg) in mqueue_get_inode()
307 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + in mqueue_get_inode()
308 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * in mqueue_get_inode()
310 mq_bytes = info->attr.mq_maxmsg * info->attr.mq_msgsize; in mqueue_get_inode()
326 info->user = get_uid(u); in mqueue_get_inode()
439 struct mqueue_inode_info *info; in mqueue_evict_inode() local
451 info = MQUEUE_I(inode); in mqueue_evict_inode()
452 spin_lock(&info->lock); in mqueue_evict_inode()
453 while ((msg = msg_get(info)) != NULL) in mqueue_evict_inode()
455 kfree(info->node_cache); in mqueue_evict_inode()
456 spin_unlock(&info->lock); in mqueue_evict_inode()
463 user = info->user; in mqueue_evict_inode()
468 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + in mqueue_evict_inode()
469 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * in mqueue_evict_inode()
472 mq_bytes = mq_treesize + (info->attr.mq_maxmsg * in mqueue_evict_inode()
473 info->attr.mq_msgsize); in mqueue_evict_inode()
564 struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); in mqueue_read_file() local
568 spin_lock(&info->lock); in mqueue_read_file()
571 info->qsize, in mqueue_read_file()
572 info->notify_owner ? info->notify.sigev_notify : 0, in mqueue_read_file()
573 (info->notify_owner && in mqueue_read_file()
574 info->notify.sigev_notify == SIGEV_SIGNAL) ? in mqueue_read_file()
575 info->notify.sigev_signo : 0, in mqueue_read_file()
576 pid_vnr(info->notify_owner)); in mqueue_read_file()
577 spin_unlock(&info->lock); in mqueue_read_file()
591 struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); in mqueue_flush_file() local
593 spin_lock(&info->lock); in mqueue_flush_file()
594 if (task_tgid(current) == info->notify_owner) in mqueue_flush_file()
595 remove_notification(info); in mqueue_flush_file()
597 spin_unlock(&info->lock); in mqueue_flush_file()
603 struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); in mqueue_poll_file() local
606 poll_wait(filp, &info->wait_q, poll_tab); in mqueue_poll_file()
608 spin_lock(&info->lock); in mqueue_poll_file()
609 if (info->attr.mq_curmsgs) in mqueue_poll_file()
612 if (info->attr.mq_curmsgs < info->attr.mq_maxmsg) in mqueue_poll_file()
614 spin_unlock(&info->lock); in mqueue_poll_file()
620 static void wq_add(struct mqueue_inode_info *info, int sr, in wq_add() argument
625 list_for_each_entry(walk, &info->e_wait_q[sr].list, list) { in wq_add()
631 list_add_tail(&ewp->list, &info->e_wait_q[sr].list); in wq_add()
639 static int wq_sleep(struct mqueue_inode_info *info, int sr, in wq_sleep() argument
641 __releases(&info->lock) in wq_sleep()
646 wq_add(info, sr, ewp); in wq_sleep()
651 spin_unlock(&info->lock); in wq_sleep()
659 spin_lock(&info->lock); in wq_sleep()
675 spin_unlock(&info->lock); in wq_sleep()
684 struct mqueue_inode_info *info, int sr) in wq_get_first_waiter() argument
688 ptr = info->e_wait_q[sr].list.prev; in wq_get_first_waiter()
689 if (ptr == &info->e_wait_q[sr].list) in wq_get_first_waiter()
703 static void __do_notify(struct mqueue_inode_info *info) in __do_notify() argument
710 if (info->notify_owner && in __do_notify()
711 info->attr.mq_curmsgs == 1) { in __do_notify()
713 switch (info->notify.sigev_notify) { in __do_notify()
720 sig_i.si_signo = info->notify.sigev_signo; in __do_notify()
723 sig_i.si_value = info->notify.sigev_value; in __do_notify()
727 ns_of_pid(info->notify_owner)); in __do_notify()
728 sig_i.si_uid = from_kuid_munged(info->notify_user_ns, current_uid()); in __do_notify()
731 kill_pid_info(info->notify.sigev_signo, in __do_notify()
732 &sig_i, info->notify_owner); in __do_notify()
735 set_cookie(info->notify_cookie, NOTIFY_WOKENUP); in __do_notify()
736 netlink_sendskb(info->notify_sock, info->notify_cookie); in __do_notify()
740 put_pid(info->notify_owner); in __do_notify()
741 put_user_ns(info->notify_user_ns); in __do_notify()
742 info->notify_owner = NULL; in __do_notify()
743 info->notify_user_ns = NULL; in __do_notify()
745 wake_up(&info->wait_q); in __do_notify()
758 static void remove_notification(struct mqueue_inode_info *info) in remove_notification() argument
760 if (info->notify_owner != NULL && in remove_notification()
761 info->notify.sigev_notify == SIGEV_THREAD) { in remove_notification()
762 set_cookie(info->notify_cookie, NOTIFY_REMOVED); in remove_notification()
763 netlink_sendskb(info->notify_sock, info->notify_cookie); in remove_notification()
765 put_pid(info->notify_owner); in remove_notification()
766 put_user_ns(info->notify_user_ns); in remove_notification()
767 info->notify_owner = NULL; in remove_notification()
768 info->notify_user_ns = NULL; in remove_notification()
925 struct mqueue_inode_info *info, in pipelined_send() argument
946 struct mqueue_inode_info *info) in pipelined_receive() argument
948 struct ext_wait_queue *sender = wq_get_first_waiter(info, SEND); in pipelined_receive()
952 wake_up_interruptible(&info->wait_q); in pipelined_receive()
955 if (msg_insert(sender->msg, info)) in pipelined_receive()
972 struct mqueue_inode_info *info; in do_mq_timedsend() local
999 info = MQUEUE_I(inode); in do_mq_timedsend()
1007 if (unlikely(msg_len > info->attr.mq_msgsize)) { in do_mq_timedsend()
1027 if (!info->node_cache) in do_mq_timedsend()
1030 spin_lock(&info->lock); in do_mq_timedsend()
1032 if (!info->node_cache && new_leaf) { in do_mq_timedsend()
1035 info->node_cache = new_leaf; in do_mq_timedsend()
1041 if (info->attr.mq_curmsgs == info->attr.mq_maxmsg) { in do_mq_timedsend()
1048 ret = wq_sleep(info, SEND, timeout, &wait); in do_mq_timedsend()
1056 receiver = wq_get_first_waiter(info, RECV); in do_mq_timedsend()
1058 pipelined_send(&wake_q, info, msg_ptr, receiver); in do_mq_timedsend()
1061 ret = msg_insert(msg_ptr, info); in do_mq_timedsend()
1064 __do_notify(info); in do_mq_timedsend()
1070 spin_unlock(&info->lock); in do_mq_timedsend()
1089 struct mqueue_inode_info *info; in do_mq_timedreceive() local
1112 info = MQUEUE_I(inode); in do_mq_timedreceive()
1121 if (unlikely(msg_len < info->attr.mq_msgsize)) { in do_mq_timedreceive()
1131 if (!info->node_cache) in do_mq_timedreceive()
1134 spin_lock(&info->lock); in do_mq_timedreceive()
1136 if (!info->node_cache && new_leaf) { in do_mq_timedreceive()
1139 info->node_cache = new_leaf; in do_mq_timedreceive()
1144 if (info->attr.mq_curmsgs == 0) { in do_mq_timedreceive()
1146 spin_unlock(&info->lock); in do_mq_timedreceive()
1151 ret = wq_sleep(info, RECV, timeout, &wait); in do_mq_timedreceive()
1157 msg_ptr = msg_get(info); in do_mq_timedreceive()
1163 pipelined_receive(&wake_q, info); in do_mq_timedreceive()
1164 spin_unlock(&info->lock); in do_mq_timedreceive()
1222 struct mqueue_inode_info *info; in do_mq_notify() local
1291 info = MQUEUE_I(inode); in do_mq_notify()
1294 spin_lock(&info->lock); in do_mq_notify()
1296 if (info->notify_owner == task_tgid(current)) { in do_mq_notify()
1297 remove_notification(info); in do_mq_notify()
1300 } else if (info->notify_owner != NULL) { in do_mq_notify()
1305 info->notify.sigev_notify = SIGEV_NONE; in do_mq_notify()
1308 info->notify_sock = sock; in do_mq_notify()
1309 info->notify_cookie = nc; in do_mq_notify()
1312 info->notify.sigev_notify = SIGEV_THREAD; in do_mq_notify()
1315 info->notify.sigev_signo = notification->sigev_signo; in do_mq_notify()
1316 info->notify.sigev_value = notification->sigev_value; in do_mq_notify()
1317 info->notify.sigev_notify = SIGEV_SIGNAL; in do_mq_notify()
1321 info->notify_owner = get_pid(task_tgid(current)); in do_mq_notify()
1322 info->notify_user_ns = get_user_ns(current_user_ns()); in do_mq_notify()
1325 spin_unlock(&info->lock); in do_mq_notify()
1354 struct mqueue_inode_info *info; in do_mq_getsetattr() local
1369 info = MQUEUE_I(inode); in do_mq_getsetattr()
1371 spin_lock(&info->lock); in do_mq_getsetattr()
1374 *old = info->attr; in do_mq_getsetattr()
1389 spin_unlock(&info->lock); in do_mq_getsetattr()