Changeset 20c071d in mainline
- Timestamp:
- 2013-07-25T12:28:48Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d18c404
- Parents:
- fadc76f
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/trace/trace.c
rfadc76f r20c071d 718 718 o = oper_new("rename", 0, arg_def, V_ERRNO, 0, resp_def); 719 719 proto_add_oper(p, VFS_IN_RENAME, o); 720 o = oper_new("walk", 3, arg_def, V_INT_ERRNO, 0, resp_def);720 o = oper_new("walk", 2, arg_def, V_INT_ERRNO, 0, resp_def); 721 721 proto_add_oper(p, VFS_IN_WALK, o); 722 722 o = oper_new("open2", 2, arg_def, V_ERRNO, 0, resp_def); 723 723 proto_add_oper(p, VFS_IN_OPEN2, o); 724 o = oper_new("unlink2", 3, arg_def, V_ERRNO, 0, resp_def); 725 proto_add_oper(p, VFS_IN_UNLINK2, o); 724 726 725 727 proto_register(SERVICE_VFS, p); -
uspace/lib/c/include/ipc/vfs.h
rfadc76f r20c071d 81 81 VFS_IN_WALK, 82 82 VFS_IN_OPEN2, 83 VFS_IN_UNLINK2, 83 84 } vfs_in_request_t; 84 85 -
uspace/srv/vfs/vfs.c
rfadc76f r20c071d 112 112 vfs_unlink(callid, &call); 113 113 break; 114 case VFS_IN_UNLINK2: 115 vfs_unlink2(callid, &call); 116 break; 114 117 case VFS_IN_RENAME: 115 118 vfs_rename(callid, &call); -
uspace/srv/vfs/vfs.h
rfadc76f r20c071d 219 219 extern void vfs_truncate(ipc_callid_t, ipc_call_t *); 220 220 extern void vfs_fstat(ipc_callid_t, ipc_call_t *); 221 extern void vfs_stat(ipc_callid_t, ipc_call_t *);222 extern void vfs_mkdir(ipc_callid_t, ipc_call_t *);223 221 extern void vfs_unlink(ipc_callid_t, ipc_call_t *); 224 222 extern void vfs_rename(ipc_callid_t, ipc_call_t *); … … 228 226 extern void vfs_walk(ipc_callid_t, ipc_call_t *); 229 227 extern void vfs_open2(ipc_callid_t, ipc_call_t *); 228 extern void vfs_unlink2(ipc_callid_t, ipc_call_t *); 230 229 231 230 #endif -
uspace/srv/vfs/vfs_ops.c
rfadc76f r20c071d 1099 1099 } 1100 1100 1101 void vfs_unlink2(ipc_callid_t rid, ipc_call_t *request) 1102 { 1103 int rc; 1104 char *path; 1105 vfs_file_t *parent = NULL; 1106 vfs_file_t *expect = NULL; 1107 vfs_pair_t *parent_node = NULL; 1108 1109 int parentfd = IPC_GET_ARG1(*request); 1110 int expectfd = IPC_GET_ARG2(*request); 1111 int wflag = IPC_GET_ARG3(*request); 1112 1113 rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL); 1114 if (rc != EOK) { 1115 async_answer_0(rid, rc); 1116 return; 1117 } 1118 1119 fibril_rwlock_write_lock(&namespace_rwlock); 1120 1121 int lflag = (wflag&WALK_DIRECTORY) ? L_DIRECTORY: 0; 1122 1123 if (parentfd >= 0) { 1124 parent = vfs_file_get(parentfd); 1125 if (!parent) { 1126 rc = ENOENT; 1127 goto exit; 1128 } 1129 parent_node = (vfs_pair_t *)parent->node; 1130 } 1131 1132 if (expectfd >= 0) { 1133 expect = vfs_file_get(expectfd); 1134 if (!expect) { 1135 rc = ENOENT; 1136 goto exit; 1137 } 1138 1139 vfs_lookup_res_t lr; 1140 rc = vfs_lookup_internal(path, lflag, &lr, parent_node); 1141 if (rc != EOK) { 1142 goto exit; 1143 } 1144 1145 if (__builtin_memcmp(&lr.triplet, expect->node, sizeof(vfs_triplet_t)) != 0) { 1146 rc = ENOENT; 1147 goto exit; 1148 } 1149 1150 vfs_file_put(expect); 1151 expect = NULL; 1152 } 1153 1154 vfs_lookup_res_t lr; 1155 rc = vfs_lookup_internal(path, lflag | L_UNLINK, &lr, parent_node); 1156 if (rc != EOK) { 1157 goto exit; 1158 } 1159 1160 /* 1161 * The name has already been unlinked by vfs_lookup_internal(). 1162 * We have to get and put the VFS node to ensure that it is 1163 * VFS_OUT_DESTROY'ed after the last reference to it is dropped. 1164 */ 1165 vfs_node_t *node = vfs_node_get(&lr); 1166 vfs_node_delref(node); 1167 vfs_node_put(node); 1168 1169 exit: 1170 if (path) { 1171 free(path); 1172 } 1173 if (parent) { 1174 vfs_file_put(parent); 1175 } 1176 if (expect) { 1177 vfs_file_put(expect); 1178 } 1179 fibril_rwlock_write_unlock(&namespace_rwlock); 1180 async_answer_0(rid, rc); 1181 } 1182 1101 1183 void vfs_rename(ipc_callid_t rid, ipc_call_t *request) 1102 1184 {
Note:
See TracChangeset
for help on using the changeset viewer.