Function report |
Source Code:fs\pipe.c |
Create Date:2022-07-28 20:04:31 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:fifo_open
Proto:static int fifo_open(struct inode *inode, struct file *filp)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct inode * | inode | |
struct file * | filp |
1016 | is_pipe = s_magic == PIPEFS_MAGIC |
1019 | f_version = 0 |
1021 | spin_lock( & _blocks, i_bytes, maybe i_size ) |
1022 | If i_pipe Then |
1026 | Else |
1027 | spin_unlock( & _blocks, i_bytes, maybe i_size ) |
1028 | pipe = alloc_pipe_info() |
1031 | files = 1 |
1032 | spin_lock( & _blocks, i_bytes, maybe i_size ) |
1038 | Else |
1040 | spin_unlock( & _blocks, i_bytes, maybe i_size ) |
1046 | __pipe_lock(pipe) |
1052 | Case & == le is open for reading |
1058 | r_counter++ |
1059 | If readers++ == 0 Then wake_up_partner(pipe) |
1063 | If f_flags & O_NONBLOCK Then |
1067 | Else |
1068 | If wait_for_partner(pipe, & w_counter) Then Go to err_rd |
1072 | Break |
1074 | Case & == le is open for writing |
1081 | If Not is_pipe && f_flags & O_NONBLOCK && Not readers Then Go to err |
1084 | w_counter++ |
1085 | If Not writers ++ Then wake_up_partner(pipe) |
1089 | If wait_for_partner(pipe, & r_counter) Then Go to err_wr |
1092 | Break |
1094 | Case & == le is open for reading | le is open for writing |
1102 | readers++ |
1103 | writers++ |
1104 | r_counter++ |
1105 | w_counter++ |
1106 | If readers == 1 || writers == 1 Then wake_up_partner(pipe) |
1108 | Break |
1110 | Default |
1116 | __pipe_unlock(pipe) |
1117 | Return 0 |
1119 | err_rd : |
1120 | If Not --readers Then wake_up_interruptible( & wait) |
1123 | Go to err |
1125 | err_wr : |
1126 | If Not --writers Then wake_up_interruptible( & wait) |
1129 | Go to err |
1131 | err : |
1132 | __pipe_unlock(pipe) |
1134 | put_pipe_info(inode, pipe) |
1135 | Return ret |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |