Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:ipc\mqueue.c Create Date:2022-07-28 16:50:24
Last Modify:2020-03-17 23:00:47 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:mqueue_get_inode

Proto:static struct inode *mqueue_get_inode(struct super_block *sb, struct ipc_namespace *ipc_ns, umode_t mode, struct mq_attr *attr)

Type:struct inode

Parameter:

TypeParameterName
struct super_block *sb
struct ipc_namespace *ipc_ns
umode_tmode
struct mq_attr *attr
235  u = current_user()
237  ret = -ENOMEM
239  inode = obtain an inode
240  If Not inode Then Go to err
243  Stat data, not accessed from path walking = get_next_ino()
244  i_mode = mode
245  i_uid = current_fsuid()
246  i_gid = current_fsgid()
247  i_mtime = i_ctime = i_atime = current_time(inode)
249  If S_ISREG(mode) Then
253  rmer ->i_op->default_file_ops = mqueue_file_operations
254  i_size = FILENT_SIZE
256  info = MQUEUE_I(inode)
257  Process spin lock initialization( & lock)
258  init_waitqueue_head( & wait_q)
259  Initialization list head
260  Initialization list head
261  notify_owner = NULL
262  notify_user_ns = NULL
263  size of queue in memory (sum of all msgs) = 0
264  user who created, for accounting = NULL
265  msg_tree =
266  msg_tree_rightmost = NULL
267  node_cache = NULL
268  memset( & attr, 0, size of attr )
269  maximum number of messages = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(mq_msg_max, mq_msg_default)
271  maximum message size = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(mq_msgsize_max, mq_msgsize_default)
273  If attr Then
291  ret = -EINVAL
292  If maximum number of messages <= 0 || maximum message size <= 0 Then Go to out_inode
298  Else
303  ret = -EOVERFLOW
305  If maximum message size > ULONG_MAX / maximum number of messages Then Go to out_inode
307  mq_treesize = maximum number of messages * sizeof(structmsg_msg) + min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedint, maximum number of messages , MQ_PRIO_MAX) * sizeof(structposix_msg_tree_node)
310  mq_bytes = maximum number of messages * maximum message size
311  If mq_bytes + mq_treesize < mq_bytes Then Go to out_inode
313  mq_bytes += mq_treesize
314  spin_lock( & mq_lock)
317  spin_unlock( & mq_lock)
319  ret = -EMFILE
320  Go to out_inode
322  How many bytes can be allocated to mqueue? += mq_bytes
323  spin_unlock( & mq_lock)
326  user who created, for accounting = get_uid(u)
327  Else if S_ISDIR(mode) Then
328  inc_nlink(inode)
330  i_size = 2 * DIRENT_SIZE
331  i_op = mqueue_dir_inode_operations
332  rmer ->i_op->default_file_ops = simple_dir_operations
335  Return inode
336  out_inode :
337  put an inode
338  err :
339  Return ERR_PTR(ret)
Caller
NameDescribe
mqueue_fill_super
mqueue_create_attr