Lines Matching refs:info

91 static void remove_notification(struct mqueue_inode_info *info);
121 static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info) in msg_insert() argument
126 p = &info->msg_tree.rb_node; in msg_insert()
138 if (info->node_cache) { in msg_insert()
139 leaf = info->node_cache; in msg_insert()
140 info->node_cache = NULL; in msg_insert()
149 rb_insert_color(&leaf->rb_node, &info->msg_tree); in msg_insert()
151 info->attr.mq_curmsgs++; in msg_insert()
152 info->qsize += msg->m_ts; in msg_insert()
157 static inline struct msg_msg *msg_get(struct mqueue_inode_info *info) in msg_get() argument
164 p = &info->msg_tree.rb_node; in msg_get()
175 if (info->attr.mq_curmsgs) { in msg_get()
179 info->attr.mq_curmsgs = 0; in msg_get()
188 rb_erase(&leaf->rb_node, &info->msg_tree); in msg_get()
189 if (info->node_cache) { in msg_get()
192 info->node_cache = leaf; in msg_get()
200 rb_erase(&leaf->rb_node, &info->msg_tree); in msg_get()
201 if (info->node_cache) { in msg_get()
204 info->node_cache = leaf; in msg_get()
208 info->attr.mq_curmsgs--; in msg_get()
209 info->qsize -= msg->m_ts; in msg_get()
232 struct mqueue_inode_info *info; in mqueue_get_inode() local
238 info = MQUEUE_I(inode); in mqueue_get_inode()
239 spin_lock_init(&info->lock); in mqueue_get_inode()
240 init_waitqueue_head(&info->wait_q); in mqueue_get_inode()
241 INIT_LIST_HEAD(&info->e_wait_q[0].list); in mqueue_get_inode()
242 INIT_LIST_HEAD(&info->e_wait_q[1].list); in mqueue_get_inode()
243 info->notify_owner = NULL; in mqueue_get_inode()
244 info->notify_user_ns = NULL; in mqueue_get_inode()
245 info->qsize = 0; in mqueue_get_inode()
246 info->user = NULL; /* set when all is ok */ in mqueue_get_inode()
247 info->msg_tree = RB_ROOT; in mqueue_get_inode()
248 info->node_cache = NULL; in mqueue_get_inode()
249 memset(&info->attr, 0, sizeof(info->attr)); in mqueue_get_inode()
250 info->attr.mq_maxmsg = min(ipc_ns->mq_msg_max, in mqueue_get_inode()
252 info->attr.mq_msgsize = min(ipc_ns->mq_msgsize_max, in mqueue_get_inode()
255 info->attr.mq_maxmsg = attr->mq_maxmsg; in mqueue_get_inode()
256 info->attr.mq_msgsize = attr->mq_msgsize; in mqueue_get_inode()
271 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + in mqueue_get_inode()
272 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * in mqueue_get_inode()
275 mq_bytes = mq_treesize + (info->attr.mq_maxmsg * in mqueue_get_inode()
276 info->attr.mq_msgsize); in mqueue_get_inode()
290 info->user = get_uid(u); in mqueue_get_inode()
373 struct mqueue_inode_info *info; in mqueue_evict_inode() local
385 info = MQUEUE_I(inode); in mqueue_evict_inode()
386 spin_lock(&info->lock); in mqueue_evict_inode()
387 while ((msg = msg_get(info)) != NULL) in mqueue_evict_inode()
389 kfree(info->node_cache); in mqueue_evict_inode()
390 spin_unlock(&info->lock); in mqueue_evict_inode()
393 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + in mqueue_evict_inode()
394 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * in mqueue_evict_inode()
397 mq_bytes = mq_treesize + (info->attr.mq_maxmsg * in mqueue_evict_inode()
398 info->attr.mq_msgsize); in mqueue_evict_inode()
400 user = info->user; in mqueue_evict_inode()
485 struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); in mqueue_read_file() local
489 spin_lock(&info->lock); in mqueue_read_file()
492 info->qsize, in mqueue_read_file()
493 info->notify_owner ? info->notify.sigev_notify : 0, in mqueue_read_file()
494 (info->notify_owner && in mqueue_read_file()
495 info->notify.sigev_notify == SIGEV_SIGNAL) ? in mqueue_read_file()
496 info->notify.sigev_signo : 0, in mqueue_read_file()
497 pid_vnr(info->notify_owner)); in mqueue_read_file()
498 spin_unlock(&info->lock); in mqueue_read_file()
512 struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); in mqueue_flush_file() local
514 spin_lock(&info->lock); in mqueue_flush_file()
515 if (task_tgid(current) == info->notify_owner) in mqueue_flush_file()
516 remove_notification(info); in mqueue_flush_file()
518 spin_unlock(&info->lock); in mqueue_flush_file()
524 struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); in mqueue_poll_file() local
527 poll_wait(filp, &info->wait_q, poll_tab); in mqueue_poll_file()
529 spin_lock(&info->lock); in mqueue_poll_file()
530 if (info->attr.mq_curmsgs) in mqueue_poll_file()
533 if (info->attr.mq_curmsgs < info->attr.mq_maxmsg) in mqueue_poll_file()
535 spin_unlock(&info->lock); in mqueue_poll_file()
541 static void wq_add(struct mqueue_inode_info *info, int sr, in wq_add() argument
548 list_for_each_entry(walk, &info->e_wait_q[sr].list, list) { in wq_add()
554 list_add_tail(&ewp->list, &info->e_wait_q[sr].list); in wq_add()
562 static int wq_sleep(struct mqueue_inode_info *info, int sr, in wq_sleep() argument
568 wq_add(info, sr, ewp); in wq_sleep()
573 spin_unlock(&info->lock); in wq_sleep()
584 spin_lock(&info->lock); in wq_sleep()
600 spin_unlock(&info->lock); in wq_sleep()
609 struct mqueue_inode_info *info, int sr) in wq_get_first_waiter() argument
613 ptr = info->e_wait_q[sr].list.prev; in wq_get_first_waiter()
614 if (ptr == &info->e_wait_q[sr].list) in wq_get_first_waiter()
628 static void __do_notify(struct mqueue_inode_info *info) in __do_notify() argument
635 if (info->notify_owner && in __do_notify()
636 info->attr.mq_curmsgs == 1) { in __do_notify()
638 switch (info->notify.sigev_notify) { in __do_notify()
644 sig_i.si_signo = info->notify.sigev_signo; in __do_notify()
647 sig_i.si_value = info->notify.sigev_value; in __do_notify()
651 ns_of_pid(info->notify_owner)); in __do_notify()
652 sig_i.si_uid = from_kuid_munged(info->notify_user_ns, current_uid()); in __do_notify()
655 kill_pid_info(info->notify.sigev_signo, in __do_notify()
656 &sig_i, info->notify_owner); in __do_notify()
659 set_cookie(info->notify_cookie, NOTIFY_WOKENUP); in __do_notify()
660 netlink_sendskb(info->notify_sock, info->notify_cookie); in __do_notify()
664 put_pid(info->notify_owner); in __do_notify()
665 put_user_ns(info->notify_user_ns); in __do_notify()
666 info->notify_owner = NULL; in __do_notify()
667 info->notify_user_ns = NULL; in __do_notify()
669 wake_up(&info->wait_q); in __do_notify()
684 static void remove_notification(struct mqueue_inode_info *info) in remove_notification() argument
686 if (info->notify_owner != NULL && in remove_notification()
687 info->notify.sigev_notify == SIGEV_THREAD) { in remove_notification()
688 set_cookie(info->notify_cookie, NOTIFY_REMOVED); in remove_notification()
689 netlink_sendskb(info->notify_sock, info->notify_cookie); in remove_notification()
691 put_pid(info->notify_owner); in remove_notification()
692 put_user_ns(info->notify_user_ns); in remove_notification()
693 info->notify_owner = NULL; in remove_notification()
694 info->notify_user_ns = NULL; in remove_notification()
919 static inline void pipelined_send(struct mqueue_inode_info *info, in pipelined_send() argument
933 static inline void pipelined_receive(struct mqueue_inode_info *info) in pipelined_receive() argument
935 struct ext_wait_queue *sender = wq_get_first_waiter(info, SEND); in pipelined_receive()
939 wake_up_interruptible(&info->wait_q); in pipelined_receive()
942 if (msg_insert(sender->msg, info)) in pipelined_receive()
960 struct mqueue_inode_info *info; in SYSCALL_DEFINE5() local
989 info = MQUEUE_I(inode); in SYSCALL_DEFINE5()
997 if (unlikely(msg_len > info->attr.mq_msgsize)) { in SYSCALL_DEFINE5()
1017 if (!info->node_cache) in SYSCALL_DEFINE5()
1020 spin_lock(&info->lock); in SYSCALL_DEFINE5()
1022 if (!info->node_cache && new_leaf) { in SYSCALL_DEFINE5()
1025 info->node_cache = new_leaf; in SYSCALL_DEFINE5()
1031 if (info->attr.mq_curmsgs == info->attr.mq_maxmsg) { in SYSCALL_DEFINE5()
1038 ret = wq_sleep(info, SEND, timeout, &wait); in SYSCALL_DEFINE5()
1046 receiver = wq_get_first_waiter(info, RECV); in SYSCALL_DEFINE5()
1048 pipelined_send(info, msg_ptr, receiver); in SYSCALL_DEFINE5()
1051 ret = msg_insert(msg_ptr, info); in SYSCALL_DEFINE5()
1054 __do_notify(info); in SYSCALL_DEFINE5()
1060 spin_unlock(&info->lock); in SYSCALL_DEFINE5()
1078 struct mqueue_inode_info *info; in SYSCALL_DEFINE5() local
1104 info = MQUEUE_I(inode); in SYSCALL_DEFINE5()
1113 if (unlikely(msg_len < info->attr.mq_msgsize)) { in SYSCALL_DEFINE5()
1123 if (!info->node_cache) in SYSCALL_DEFINE5()
1126 spin_lock(&info->lock); in SYSCALL_DEFINE5()
1128 if (!info->node_cache && new_leaf) { in SYSCALL_DEFINE5()
1131 info->node_cache = new_leaf; in SYSCALL_DEFINE5()
1136 if (info->attr.mq_curmsgs == 0) { in SYSCALL_DEFINE5()
1138 spin_unlock(&info->lock); in SYSCALL_DEFINE5()
1143 ret = wq_sleep(info, RECV, timeout, &wait); in SYSCALL_DEFINE5()
1147 msg_ptr = msg_get(info); in SYSCALL_DEFINE5()
1153 pipelined_receive(info); in SYSCALL_DEFINE5()
1154 spin_unlock(&info->lock); in SYSCALL_DEFINE5()
1185 struct mqueue_inode_info *info; in SYSCALL_DEFINE2() local
1263 info = MQUEUE_I(inode); in SYSCALL_DEFINE2()
1266 spin_lock(&info->lock); in SYSCALL_DEFINE2()
1268 if (info->notify_owner == task_tgid(current)) { in SYSCALL_DEFINE2()
1269 remove_notification(info); in SYSCALL_DEFINE2()
1272 } else if (info->notify_owner != NULL) { in SYSCALL_DEFINE2()
1277 info->notify.sigev_notify = SIGEV_NONE; in SYSCALL_DEFINE2()
1280 info->notify_sock = sock; in SYSCALL_DEFINE2()
1281 info->notify_cookie = nc; in SYSCALL_DEFINE2()
1284 info->notify.sigev_notify = SIGEV_THREAD; in SYSCALL_DEFINE2()
1287 info->notify.sigev_signo = notification.sigev_signo; in SYSCALL_DEFINE2()
1288 info->notify.sigev_value = notification.sigev_value; in SYSCALL_DEFINE2()
1289 info->notify.sigev_notify = SIGEV_SIGNAL; in SYSCALL_DEFINE2()
1293 info->notify_owner = get_pid(task_tgid(current)); in SYSCALL_DEFINE2()
1294 info->notify_user_ns = get_user_ns(current_user_ns()); in SYSCALL_DEFINE2()
1297 spin_unlock(&info->lock); in SYSCALL_DEFINE2()
1317 struct mqueue_inode_info *info; in SYSCALL_DEFINE3() local
1337 info = MQUEUE_I(inode); in SYSCALL_DEFINE3()
1339 spin_lock(&info->lock); in SYSCALL_DEFINE3()
1341 omqstat = info->attr; in SYSCALL_DEFINE3()
1355 spin_unlock(&info->lock); in SYSCALL_DEFINE3()