Changes in / [34832c3:cc7de50] in mainline
- Location:
- uspace
- Files:
-
- 5 edited
-
app/bdsh/cmds/modules/cp/cp.c (modified) (1 diff)
-
app/bdsh/cmds/modules/mkfile/mkfile.c (modified) (1 diff)
-
lib/cpp/src/__bits/runtime.cpp (modified) (2 diffs)
-
lib/ext4/src/ops.c (modified) (7 diffs)
-
lib/posix/src/unistd.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cp/cp.c
r34832c3 rcc7de50 45 45 46 46 #define CP_VERSION "0.0.1" 47 #define CP_DEFAULT_BUFLEN 102447 #define CP_DEFAULT_BUFLEN (1024 * 64) 48 48 49 49 static const char *cmdname = "cp"; -
uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
r34832c3 rcc7de50 48 48 49 49 /** Number of bytes to write at a time */ 50 #define BUFFER_SIZE 1638450 #define BUFFER_SIZE (1024 * 64) 51 51 52 52 static const char *cmdname = "mkfile"; -
uspace/lib/cpp/src/__bits/runtime.cpp
r34832c3 rcc7de50 1 1 /* 2 * Copyright (c) 2026 Jiri Svoboda 2 3 * Copyright (c) 2018 Jaroslav Jindrak 3 4 * All rights reserved. … … 71 72 } 72 73 74 /** 75 * Called when an object destructor exits due to an exception 76 * during stack unwinding. 77 */ 78 extern "C" void __cxa_call_terminate() 79 { 80 std::terminate(); 81 } 82 73 83 #ifdef __arm__ 74 84 extern "C" int __aeabi_atexit(void* p, void (*f)(void*), void* d) -
uspace/lib/ext4/src/ops.c
r34832c3 rcc7de50 64 64 static bool ext4_is_dots(const uint8_t *, size_t); 65 65 static errno_t ext4_instance_get(service_id_t, ext4_instance_t **); 66 static errno_t handle_sparse_or_unallocated_fblock(ext4_filesystem_t *, 67 ext4_inode_ref_t *, uint32_t, uint32_t, uint32_t *, int *, bool *); 66 68 67 69 /* Forward declarations of ext4 libfs operations. */ … … 158 160 } 159 161 160 /*161 * Ext4 libfs operations.162 */163 164 162 /** Get instance from internal table by service_id. 165 163 * … … 170 168 * 171 169 */ 172 errno_t ext4_instance_get(service_id_t service_id, ext4_instance_t **inst)170 static errno_t ext4_instance_get(service_id_t service_id, ext4_instance_t **inst) 173 171 { 174 172 fibril_mutex_lock(&instance_list_mutex); … … 190 188 return EINVAL; 191 189 } 190 191 /* 192 * Ext4 libfs operations. 193 */ 192 194 193 195 /** Get root node of filesystem specified by service_id. … … 1286 1288 fs_node_t *fn; 1287 1289 errno_t rc2; 1290 bool fblock_allocated = false; 1291 1288 1292 errno_t rc = ext4_node_get(&fn, service_id, index); 1289 1293 if (rc != EOK) … … 1322 1326 } 1323 1327 1324 /* Check for sparse file*/1328 /* Handle sparse or unallocated block */ 1325 1329 if (fblock == 0) { 1326 if ((ext4_superblock_has_feature_incompatible(fs->superblock, 1327 EXT4_FEATURE_INCOMPAT_EXTENTS)) && 1328 (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) { 1329 uint32_t last_iblock = 1330 ext4_inode_get_size(fs->superblock, inode_ref->inode) / 1331 block_size; 1332 1333 while (last_iblock < iblock) { 1334 rc = ext4_extent_append_block(inode_ref, &last_iblock, 1335 &fblock, true); 1336 if (rc != EOK) { 1337 async_answer_0(&call, rc); 1338 goto exit; 1339 } 1340 } 1341 1342 rc = ext4_extent_append_block(inode_ref, &last_iblock, 1343 &fblock, false); 1344 if (rc != EOK) { 1345 async_answer_0(&call, rc); 1346 goto exit; 1347 } 1348 } else { 1349 rc = ext4_balloc_alloc_block(inode_ref, &fblock); 1350 if (rc != EOK) { 1351 async_answer_0(&call, rc); 1352 goto exit; 1353 } 1354 1355 rc = ext4_filesystem_set_inode_data_block_index(inode_ref, 1356 iblock, fblock); 1357 if (rc != EOK) { 1358 ext4_balloc_free_block(inode_ref, fblock); 1359 async_answer_0(&call, rc); 1360 goto exit; 1361 } 1330 rc = handle_sparse_or_unallocated_fblock(fs, inode_ref, 1331 block_size, iblock, &fblock, &flags, &fblock_allocated); 1332 if (rc != EOK) { 1333 async_answer_0(&call, rc); 1334 goto exit; 1362 1335 } 1363 1364 flags = BLOCK_FLAGS_NOREAD;1365 inode_ref->dirty = true;1366 1336 } 1367 1337 … … 1402 1372 1403 1373 exit: 1374 if (rc != EOK && fblock_allocated) 1375 ext4_balloc_free_block(inode_ref, fblock); 1376 1404 1377 rc2 = ext4_node_put(fn); 1405 1378 return rc == EOK ? rc2 : rc; 1379 } 1380 1381 /** Handle sparse or unallocated block. 1382 * 1383 * @param fs Filesystem handle 1384 * @param inode_ref I-node reference 1385 * @param block_size Filesystem block size 1386 * @param iblock Logical block 1387 * @param fblock Place to store allocated block address 1388 * @param flags BLOCK_FLAGS to update 1389 * @param allocated Place to store whether new block was allocated 1390 * 1391 * @return Error code 1392 * 1393 */ 1394 static errno_t handle_sparse_or_unallocated_fblock(ext4_filesystem_t *fs, 1395 ext4_inode_ref_t *inode_ref, uint32_t block_size, uint32_t iblock, 1396 uint32_t *fblock, int *flags, bool *allocated) 1397 { 1398 errno_t rc; 1399 1400 /* Check for sparse file */ 1401 if ((ext4_superblock_has_feature_incompatible(fs->superblock, 1402 EXT4_FEATURE_INCOMPAT_EXTENTS)) && 1403 (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) { 1404 uint32_t last_iblock = 1405 ext4_inode_get_size(fs->superblock, inode_ref->inode) / 1406 block_size; 1407 1408 while (last_iblock < iblock) { 1409 rc = ext4_extent_append_block(inode_ref, &last_iblock, 1410 fblock, true); 1411 if (rc != EOK) 1412 return rc; 1413 } 1414 1415 rc = ext4_extent_append_block(inode_ref, &last_iblock, fblock, 1416 false); 1417 if (rc != EOK) 1418 return rc; 1419 1420 *allocated = false; 1421 } else { /* Allocate new block */ 1422 rc = ext4_balloc_alloc_block(inode_ref, fblock); 1423 if (rc != EOK) 1424 return rc; 1425 1426 rc = ext4_filesystem_set_inode_data_block_index(inode_ref, 1427 iblock, *fblock); 1428 if (rc != EOK) { 1429 ext4_balloc_free_block(inode_ref, *fblock); 1430 return rc; 1431 } 1432 1433 *allocated = true; 1434 } 1435 1436 *flags = BLOCK_FLAGS_NOREAD; 1437 inode_ref->dirty = true; 1438 1439 return EOK; 1406 1440 } 1407 1441 -
uspace/lib/posix/src/unistd.c
r34832c3 rcc7de50 1 1 /* 2 * Copyright (c) 202 5Jiri Svoboda2 * Copyright (c) 2026 Jiri Svoboda 3 3 * Copyright (c) 2011 Jiri Zarevucky 4 4 * Copyright (c) 2011 Petr Koupy … … 60 60 61 61 /* Array of environment variable strings (NAME=VALUE). */ 62 char **environ = NULL; 62 static char *environ_initial[] = { NULL }; 63 char **environ = environ_initial; 63 64 64 65 /**
Note:
See TracChangeset
for help on using the changeset viewer.
