diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-04-11 07:53:10 -0400 |
---|---|---|
committer | Jens Axboe <axboe@suse.de> | 2006-04-11 07:53:10 -0400 |
commit | 9aeedfc4712ed58d9f7ae41596185c72b8dc97e8 (patch) | |
tree | b055bab09a86cfc6cb13506d2f25da6abd12e3c1 /fs/fifo.c | |
parent | 7480a90435673b4c717b6caf1350ec577d5f1adf (diff) |
[PATCH] get rid of the PIPE_*() macros
get rid of the PIPE_*() macros. Scripted transformation.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'fs/fifo.c')
-rw-r--r-- | fs/fifo.c | 48 |
1 files changed, 24 insertions, 24 deletions
@@ -28,14 +28,14 @@ static void wait_for_partner(struct inode* inode, unsigned int *cnt) | |||
28 | 28 | ||
29 | static void wake_up_partner(struct inode* inode) | 29 | static void wake_up_partner(struct inode* inode) |
30 | { | 30 | { |
31 | wake_up_interruptible(PIPE_WAIT(*inode)); | 31 | wake_up_interruptible(&inode->i_pipe->wait); |
32 | } | 32 | } |
33 | 33 | ||
34 | static int fifo_open(struct inode *inode, struct file *filp) | 34 | static int fifo_open(struct inode *inode, struct file *filp) |
35 | { | 35 | { |
36 | int ret; | 36 | int ret; |
37 | 37 | ||
38 | mutex_lock(PIPE_MUTEX(*inode)); | 38 | mutex_lock(&inode->i_mutex); |
39 | if (!inode->i_pipe) { | 39 | if (!inode->i_pipe) { |
40 | ret = -ENOMEM; | 40 | ret = -ENOMEM; |
41 | inode->i_pipe = alloc_pipe_info(inode); | 41 | inode->i_pipe = alloc_pipe_info(inode); |
@@ -55,18 +55,18 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
55 | * opened, even when there is no process writing the FIFO. | 55 | * opened, even when there is no process writing the FIFO. |
56 | */ | 56 | */ |
57 | filp->f_op = &read_fifo_fops; | 57 | filp->f_op = &read_fifo_fops; |
58 | PIPE_RCOUNTER(*inode)++; | 58 | inode->i_pipe->r_counter++; |
59 | if (PIPE_READERS(*inode)++ == 0) | 59 | if (inode->i_pipe->readers++ == 0) |
60 | wake_up_partner(inode); | 60 | wake_up_partner(inode); |
61 | 61 | ||
62 | if (!PIPE_WRITERS(*inode)) { | 62 | if (!inode->i_pipe->writers) { |
63 | if ((filp->f_flags & O_NONBLOCK)) { | 63 | if ((filp->f_flags & O_NONBLOCK)) { |
64 | /* suppress POLLHUP until we have | 64 | /* suppress POLLHUP until we have |
65 | * seen a writer */ | 65 | * seen a writer */ |
66 | filp->f_version = PIPE_WCOUNTER(*inode); | 66 | filp->f_version = inode->i_pipe->w_counter; |
67 | } else | 67 | } else |
68 | { | 68 | { |
69 | wait_for_partner(inode, &PIPE_WCOUNTER(*inode)); | 69 | wait_for_partner(inode, &inode->i_pipe->w_counter); |
70 | if(signal_pending(current)) | 70 | if(signal_pending(current)) |
71 | goto err_rd; | 71 | goto err_rd; |
72 | } | 72 | } |
@@ -80,16 +80,16 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
80 | * errno=ENXIO when there is no process reading the FIFO. | 80 | * errno=ENXIO when there is no process reading the FIFO. |
81 | */ | 81 | */ |
82 | ret = -ENXIO; | 82 | ret = -ENXIO; |
83 | if ((filp->f_flags & O_NONBLOCK) && !PIPE_READERS(*inode)) | 83 | if ((filp->f_flags & O_NONBLOCK) && !inode->i_pipe->readers) |
84 | goto err; | 84 | goto err; |
85 | 85 | ||
86 | filp->f_op = &write_fifo_fops; | 86 | filp->f_op = &write_fifo_fops; |
87 | PIPE_WCOUNTER(*inode)++; | 87 | inode->i_pipe->w_counter++; |
88 | if (!PIPE_WRITERS(*inode)++) | 88 | if (!inode->i_pipe->writers++) |
89 | wake_up_partner(inode); | 89 | wake_up_partner(inode); |
90 | 90 | ||
91 | if (!PIPE_READERS(*inode)) { | 91 | if (!inode->i_pipe->readers) { |
92 | wait_for_partner(inode, &PIPE_RCOUNTER(*inode)); | 92 | wait_for_partner(inode, &inode->i_pipe->r_counter); |
93 | if (signal_pending(current)) | 93 | if (signal_pending(current)) |
94 | goto err_wr; | 94 | goto err_wr; |
95 | } | 95 | } |
@@ -104,11 +104,11 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
104 | */ | 104 | */ |
105 | filp->f_op = &rdwr_fifo_fops; | 105 | filp->f_op = &rdwr_fifo_fops; |
106 | 106 | ||
107 | PIPE_READERS(*inode)++; | 107 | inode->i_pipe->readers++; |
108 | PIPE_WRITERS(*inode)++; | 108 | inode->i_pipe->writers++; |
109 | PIPE_RCOUNTER(*inode)++; | 109 | inode->i_pipe->r_counter++; |
110 | PIPE_WCOUNTER(*inode)++; | 110 | inode->i_pipe->w_counter++; |
111 | if (PIPE_READERS(*inode) == 1 || PIPE_WRITERS(*inode) == 1) | 111 | if (inode->i_pipe->readers == 1 || inode->i_pipe->writers == 1) |
112 | wake_up_partner(inode); | 112 | wake_up_partner(inode); |
113 | break; | 113 | break; |
114 | 114 | ||
@@ -118,27 +118,27 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
118 | } | 118 | } |
119 | 119 | ||
120 | /* Ok! */ | 120 | /* Ok! */ |
121 | mutex_unlock(PIPE_MUTEX(*inode)); | 121 | mutex_unlock(&inode->i_mutex); |
122 | return 0; | 122 | return 0; |
123 | 123 | ||
124 | err_rd: | 124 | err_rd: |
125 | if (!--PIPE_READERS(*inode)) | 125 | if (!--inode->i_pipe->readers) |
126 | wake_up_interruptible(PIPE_WAIT(*inode)); | 126 | wake_up_interruptible(&inode->i_pipe->wait); |
127 | ret = -ERESTARTSYS; | 127 | ret = -ERESTARTSYS; |
128 | goto err; | 128 | goto err; |
129 | 129 | ||
130 | err_wr: | 130 | err_wr: |
131 | if (!--PIPE_WRITERS(*inode)) | 131 | if (!--inode->i_pipe->writers) |
132 | wake_up_interruptible(PIPE_WAIT(*inode)); | 132 | wake_up_interruptible(&inode->i_pipe->wait); |
133 | ret = -ERESTARTSYS; | 133 | ret = -ERESTARTSYS; |
134 | goto err; | 134 | goto err; |
135 | 135 | ||
136 | err: | 136 | err: |
137 | if (!PIPE_READERS(*inode) && !PIPE_WRITERS(*inode)) | 137 | if (!inode->i_pipe->readers && !inode->i_pipe->writers) |
138 | free_pipe_info(inode); | 138 | free_pipe_info(inode); |
139 | 139 | ||
140 | err_nocleanup: | 140 | err_nocleanup: |
141 | mutex_unlock(PIPE_MUTEX(*inode)); | 141 | mutex_unlock(&inode->i_mutex); |
142 | return ret; | 142 | return ret; |
143 | } | 143 | } |
144 | 144 | ||