Changeset b3c38750 in mainline
- Timestamp:
- 2008-01-06T13:08:32Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4db6eaf
- Parents:
- 9413c0d
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/include/rwlock.h
r9413c0d rb3c38750 45 45 typedef atomic_t rwlock_t; 46 46 47 #define RWLOCK_INITIALIZE(rwlock) \ 48 rwlock_t rwlock = FUTEX_INITIALIZER 49 47 50 #define rwlock_initialize(rwlock) futex_initialize((rwlock), 1) 48 51 #define rwlock_reader_lock(rwlock) futex_down((rwlock)) -
uspace/srv/vfs/vfs.h
r9413c0d rb3c38750 174 174 extern link_t plb_head; /**< List of active PLB entries. */ 175 175 176 /** Holding this futex prevents externchanges in file system namespace. */177 atomic_t namespace_futex;176 /** Holding this rwlock prevents changes in file system namespace. */ 177 extern rwlock_t namespace_rwlock; 178 178 179 179 extern int vfs_grab_phone(int); -
uspace/srv/vfs/vfs_mount.c
r9413c0d rb3c38750 183 183 * We already have the root FS. 184 184 */ 185 futex_down(&namespace_futex);185 rwlock_writer_lock(&namespace_rwlock); 186 186 rc = vfs_lookup_internal(buf, size, &mp, NULL); 187 187 if (rc != EOK) { … … 189 189 * The lookup failed for some reason. 190 190 */ 191 futex_up(&namespace_futex);191 rwlock_writer_unlock(&namespace_rwlock); 192 192 futex_up(&rootfs_futex); 193 193 vfs_node_put(mr_node); /* failed -> drop reference */ … … 198 198 mp_node = vfs_node_get(&mp); 199 199 if (!mp_node) { 200 futex_up(&namespace_futex);200 rwlock_writer_unlock(&namespace_rwlock); 201 201 futex_up(&rootfs_futex); 202 202 vfs_node_put(mr_node); /* failed -> drop reference */ … … 210 210 * This prevents the mount point from being deleted. 211 211 */ 212 futex_up(&namespace_futex);212 rwlock_writer_unlock(&namespace_rwlock); 213 213 } else { 214 214 /* -
uspace/srv/vfs/vfs_open.c
r9413c0d rb3c38750 39 39 #include <async.h> 40 40 #include <errno.h> 41 #include < futex.h>41 #include <rwlock.h> 42 42 #include <sys/types.h> 43 43 #include <stdlib.h> … … 94 94 * triplet. 95 95 */ 96 futex_down(&namespace_futex);96 rwlock_reader_lock(&namespace_rwlock); 97 97 98 98 /* … … 102 102 rc = vfs_lookup_internal(path, size, &triplet, NULL); 103 103 if (rc) { 104 futex_up(&namespace_futex);104 rwlock_reader_unlock(&namespace_rwlock); 105 105 ipc_answer_0(rid, rc); 106 106 free(path); … … 114 114 115 115 vfs_node_t *node = vfs_node_get(&triplet); 116 futex_up(&namespace_futex);116 rwlock_reader_unlock(&namespace_rwlock); 117 117 118 118 /* -
uspace/srv/vfs/vfs_unlink.c
r9413c0d rb3c38750 36 36 */ 37 37 38 #include <atomic.h> 39 #include <futex.h> 38 #include <rwlock.h> 40 39 41 40 /** 42 * This futexprevents the race between a triplet-to-VFS-node resolution and a41 * This rwlock prevents the race between a triplet-to-VFS-node resolution and a 43 42 * concurrent VFS operation which modifies the file system namespace. 44 43 */ 45 atomic_t namespace_futex = FUTEX_INITIALIZER;44 RWLOCK_INITIALIZE(namespace_rwlock); 46 45 47 46 /**
Note:
See TracChangeset
for help on using the changeset viewer.