Subversion Repositories HelenOS

Rev

Rev 2680 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2680 Rev 2683
Line 80... Line 80...
80
        ipc_answer_0(rid, EINVAL);
80
        ipc_answer_0(rid, EINVAL);
81
        return;
81
        return;
82
    }
82
    }
83
 
83
 
84
    /*
84
    /*
-
 
85
     * Lock the open file structure so that no other thread can manipulate
-
 
86
     * the same open file at a time.
-
 
87
     */
-
 
88
    futex_down(&file->lock);
-
 
89
 
-
 
90
    /*
85
     * Lock the file's node so that no other client can read/write to it at
91
     * Lock the file's node so that no other client can read/write to it at
86
     * the same time.
92
     * the same time.
87
     */
93
     */
88
    if (read)
94
    if (read)
89
        rwlock_reader_lock(&file->node->contents_rwlock);
95
        rwlock_reader_lock(&file->node->contents_rwlock);
Line 124... Line 130...
124
        rwlock_reader_unlock(&file->node->contents_rwlock);
130
        rwlock_reader_unlock(&file->node->contents_rwlock);
125
    else
131
    else
126
        rwlock_writer_unlock(&file->node->contents_rwlock);
132
        rwlock_writer_unlock(&file->node->contents_rwlock);
127
 
133
 
128
    /*
134
    /*
129
     * Update the position pointer.
135
     * Update the position pointer and unlock the open file.
130
     */
136
     */
131
    file->pos += bytes;
137
    file->pos += bytes;
-
 
138
    futex_up(&file->lock);
132
 
139
 
133
    /*
140
    /*
134
     * FS server's reply is the final result of the whole operation we
141
     * FS server's reply is the final result of the whole operation we
135
     * return to the client.
142
     * return to the client.
136
     */
143
     */