/trunk/uspace/srv/vfs/vfs.h |
---|
147,6 → 147,9 |
* than one task, there will be a separate structure allocated for each task. |
*/ |
typedef struct { |
/** Serializes access to this open file. */ |
futex_t lock; |
vfs_node_t *node; |
/** Number of file handles referencing this file. */ |
/trunk/uspace/srv/vfs/vfs_rdwr.c |
---|
82,6 → 82,12 |
} |
/* |
* Lock the open file structure so that no other thread can manipulate |
* the same open file at a time. |
*/ |
futex_down(&file->lock); |
/* |
* Lock the file's node so that no other client can read/write to it at |
* the same time. |
*/ |
126,9 → 132,10 |
rwlock_writer_unlock(&file->node->contents_rwlock); |
/* |
* Update the position pointer. |
* Update the position pointer and unlock the open file. |
*/ |
file->pos += bytes; |
futex_up(&file->lock); |
/* |
* FS server's reply is the final result of the whole operation we |
/trunk/uspace/srv/vfs/vfs_file.c |
---|
86,6 → 86,7 |
if (!files[i]) |
return ENOMEM; |
memset(files[i], 0, sizeof(vfs_file_t)); |
futex_initialize(&files[i]->lock, 1); |
vfs_file_addref(files[i]); |
return i; |
} |