file.c revision 7e7bd3dccbfe8f79e25e5c1554b5bc3a9aaca321
/*
libparted - a library for manipulating disk partitions
Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DISCOVER_ONLY
#include <config.h>
#include <stdint.h>
#if ENABLE_NLS
# include <libintl.h>
#else
#endif /* ENABLE_NLS */
#include "hfs.h"
#include "advfs.h"
#include "file.h"
/* Open the data fork of a file with its first three extents and its CNID */
{
file->start_cache = 0;
return file;
}
/* Close an HFS file */
void
{
}
/* warning : only works on data forks */
static int
{
+ sizeof (HfsExtDataRec)];
(record + sizeof (HfsExtentKey));
return 0;
return 0;
return 1;
}
/* find and return the nth sector of a file */
/* return 0 on error */
static PedSector
{
unsigned int sect_by_block = PED_BE32_TO_CPU (
unsigned int i, s, vol_block;
/* in the three first extent */
for (s = 0, i = 0; i < HFS_EXT_NB; i++) {
goto sector_found;
}
}
/* in the three cached extent */
goto sector_found;
}
}
/* update cache */
&(file->start_cache))) {
_("Could not update the extent cache for HFS file with "
"CNID %X."),
return 0;
}
/* in the three cached extent */
goto sector_found;
}
}
return 0;
+ offset;
}
/* Read the nth sector of a file */
/* return 0 on error */
int
{
_("Trying to read HFS file with CNID %X behind EOF."),
return 0;
}
if (!abs_sector) {
_("Could not find sector %lli of HFS file with "
"CNID %X."),
return 0;
}
}
/* Write the nth sector of a file */
/* return 0 on error */
int
{
_("Trying to write HFS file with CNID %X behind EOF."),
return 0;
}
if (!abs_sector) {
_("Could not find sector %lli of HFS file with "
"CNID %X."),
return 0;
}
}
#endif /* !DISCOVER_ONLY */