Example #1
0
 /**
  * Truncate a file
  *
  * @access public
  *
  * @param $path file path
  * @param $offset offset into the file
  */
 function truncate($path, $offset)
 {
     Log::in("TRUNCATE {$path}");
     /* Check for passthru */
     if (PassThru::check($path)) {
         $ret = PassThru::truncate($path, $offset);
     } else {
         $pi = Query::pathInfo($path);
         if ($pi[PI_LEVEL] != PL_FILENAME || !$pi[PI_TI] || !$pi[PI_FILENAME]) {
             Log::out("TRUNCATE - Invalid truncate - fail");
             return -FUSE_ENOENT;
         }
         Log::output("TRUNCATE - calling query");
         $ret = Query::truncate($pi);
     }
     Log::out("TRUNCATE");
     return $ret;
 }