Skip to content
This repository has been archived by the owner on Jul 3, 2018. It is now read-only.

Commit

Permalink
#9 fix seek and read
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Sep 5, 2014
1 parent 98593ae commit 741b9cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 11 additions & 4 deletions prods/src/RODSConn.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -981,8 +981,10 @@ public function closeFileDesc($l1desc) {
* @return the read string.
*/
public function fileRead($l1desc, $length) {
$dataObjReadInp_pk = new RP_dataObjReadInp($l1desc, $length);
$msg = new RODSMessage("RODS_API_REQ_T", $dataObjReadInp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_READ_AN']);

$openedDataObjInp = new RP_OpenedDataObjInp($l1desc, $length);
$msg = new RODSMessage("RODS_API_REQ_T", $openedDataObjInp, $GLOBALS['PRODS_API_NUMS']['OPENED_DATA_OBJ_READ_AN'], $string);

fwrite($this->conn, $msg->pack()); // send it
$msg = new RODSMessage();
$intInfo = (int) $msg->unpack($this->conn);
Expand Down Expand Up @@ -1028,8 +1030,13 @@ public function fileWrite($l1desc, $string, $length = NULL) {
* @return int the current offset
*/
public function fileSeek($l1desc, $offset, $whence = SEEK_SET) {
$dataObjReadInp_pk = new RP_fileLseekInp($l1desc, $offset, $whence);
$msg = new RODSMessage("RODS_API_REQ_T", $dataObjReadInp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_LSEEK_AN']);
// $dataObjReadInp_pk = new RP_fileLseekInp($l1desc, $offset, $whence);
// $msg = new RODSMessage("RODS_API_REQ_T", $dataObjReadInp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_LSEEK_AN']);


$openedDataObjInp = new RP_OpenedDataObjInp($l1desc, 0, $offset, $whence);
$msg = new RODSMessage("RODS_API_REQ_T", $openedDataObjInp, $GLOBALS['PRODS_API_NUMS']['OPENED_DATA_OBJ_SEEK_AN'], $string);

fwrite($this->conn, $msg->pack()); // send it
$msg = new RODSMessage();
$intInfo = (int) $msg->unpack($this->conn);
Expand Down
6 changes: 5 additions & 1 deletion prods/src/RodsAPINum.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
'COLL_REPL_AN' => '662',
'RM_COLL_AN' => '663',
'OPENED_DATA_OBJ_CLOSE_AN' => '673',
'OPENED_DATA_OBJ_SEEK_AN' => '674',
'OPENED_DATA_OBJ_READ_AN' => '675',
'OPENED_DATA_OBJ_WRITE_AN' => '676',
'GET_MISC_SVR_INFO_AN' => '700',
'GENERAL_ADMIN_AN' => '701',
Expand Down Expand Up @@ -198,8 +200,10 @@
'661' => 'CLOSE_COLLECTION_AN',
'662' => 'COLL_REPL_AN',
'663' => 'RM_COLL_AN',
'676' => 'OPENED_DATA_OBJ_WRITE_AN',
'673' => 'OPENED_DATA_OBJ_CLOSE_AN',
'674' => 'OPENED_DATA_OBJ_SEEK_AN',
'675' => 'OPENED_DATA_OBJ_READ_AN',
'676' => 'OPENED_DATA_OBJ_WRITE_AN',
'700' => 'GET_MISC_SVR_INFO_AN',
'701' => 'GENERAL_ADMIN_AN',
'702' => 'GEN_QUERY_AN',
Expand Down

0 comments on commit 741b9cb

Please sign in to comment.