Changeset 9432
- Timestamp:
- 08/03/12 18:26:42 (10 months ago)
- Location:
- branches/asyncio/src/client/usrint
- Files:
-
- 3 modified
-
aiocommon.c (modified) (2 diffs)
-
aiocommon.h (modified) (3 diffs)
-
pxfs.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/asyncio/src/client/usrint/aiocommon.c
r9428 r9432 197 197 break; 198 198 } 199 case PVFS_AIO_TRUNC_OP: 200 { 201 rc = PVFS_isys_truncate(p_cb->u.trunc.pd->s->pvfs_ref, 202 p_cb->u.trunc.length, 203 cred, 204 &(p_cb->op_id), 205 p_cb->hints, 206 (void *)p_cb); 207 break; 208 } 199 209 case PVFS_AIO_STAT_OP: 200 210 { … … 309 319 free(p_cb->u.rename.newdir); 310 320 free(p_cb->u.rename.newname); 321 break; 322 } 323 case PVFS_AIO_TRUNC_OP: 324 { 311 325 break; 312 326 } -
branches/asyncio/src/client/usrint/aiocommon.h
r9428 r9432 36 36 PVFS_AIO_OPEN_OP, 37 37 PVFS_AIO_RENAME_OP, 38 PVFS_AIO_TRUNC_OP, 38 39 PVFS_AIO_STAT_OP, 39 40 PVFS_AIO_STAT64_OP, 40 41 } PVFS_aio_op_code; 41 42 42 43 43 /* the following structures contain operation dependent data for aio calls */ … … 80 80 }; 81 81 82 struct PINT_aio_trunc_cb 83 { 84 pvfs_descriptor *pd; /* in */ 85 off64_t length; /* in */ 86 }; 87 82 88 struct PINT_aio_stat_cb 83 89 { … … 108 114 struct PINT_aio_open_cb open; 109 115 struct PINT_aio_rename_cb rename; 116 struct PINT_aio_trunc_cb trunc; 110 117 struct PINT_aio_stat_cb stat; 111 118 } u; -
branches/asyncio/src/client/usrint/pxfs.c
r9428 r9432 533 533 */ 534 534 535 //extern int pxfs_ftruncate (int fd, off_t length, pxfs_cb cb, void *cdat); 536 537 //extern int pxfs_ftruncate64 (int fd, off64_t length, pxfs_cb cb, void *cdat); 535 /** 536 * pxfs_ftruncate 537 */ 538 extern int pxfs_ftruncate(int fd, off_t length, pxfs_cb cb, void *cdat) 539 { 540 return pxfs_ftruncate64(fd, (off64_t)length, cb, cdat); 541 } 542 543 /** 544 * pxfs_ftruncate64 545 */ 546 extern int pxfs_ftruncate64(int fd, off64_t length, pxfs_cb cb, void *cdat) 547 { 548 pvfs_descriptor *pd; 549 struct pvfs_aiocb *truncate_acb = NULL; 550 551 if (fd < 0) 552 { 553 errno = EBADF; 554 return -1; 555 } 556 557 pd = pvfs_find_descriptor(fd); 558 if (!pd) 559 { 560 errno = EBADF; 561 return -1; 562 } 563 564 truncate_acb = malloc(sizeof(struct pvfs_aiocb)); 565 if (!truncate_acb) 566 { 567 errno = ENOMEM; 568 return -1; 569 } 570 memset(truncate_acb, 0, sizeof(struct pvfs_aiocb)); 571 572 truncate_acb->hints = PVFS_HINT_NULL; 573 truncate_acb->op_code = PVFS_AIO_TRUNC_OP; 574 truncate_acb->u.trunc.pd = pd; 575 truncate_acb->u.trunc.length = length; 576 truncate_acb->call_back_fn = cb; 577 truncate_acb->call_back_dat = cdat; 578 579 aiocommon_submit_op(truncate_acb); 580 581 return 0; 582 } 538 583 539 584 /*
