file_plus.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_plus.h"
#include "file_plus.h"
/* Open the data fork of a file with its first eight extents and its CNID */
/* CNID and ext_desc must be in disc order, sect_nb in CPU order */
/* return null on failure */
{
file->start_cache = 0;
return file;
}
/* Close an HFS+ file */
void
{
}
/* warning : only works on data forks */
static int
{
+ sizeof (HfsPExtDataRec)];
(record + sizeof (HfsPExtentKey));
return 0;
return 0;
return 1;
}
/* find a sub extent contained in the desired area */
/* and with the same starting point */
/* return 0 in sector_count on error, or the physical area */
/* on the volume corresponding to the logical area in the file */
static HfsPPrivateExtent
unsigned int nb)
{
HfsPPrivateExtent ret = {0,0};
unsigned int sect_by_block = PED_BE32_TO_CPU (
/* in the 8 first extent */
for (s = 0, i = 0; i < HFSP_EXT_NB; i++) {
.start_block);
+ s - block;
goto plus_sector_found;
}
}
/* in the 8 cached extent */
.start_block);
+ s - block;
goto plus_sector_found;
}
}
/* update cache */
&(file->start_cache))) {
_("Could not update the extent cache for HFS+ file "
"with CNID %X."),
return ret; /* ret == {0,0} */
}
/* ret == {0,0} */
.start_block);
+ s - block;
goto plus_sector_found;
}
}
return ret;
return ret;
}
int
unsigned int nb)
{
char *b = buf;
_("Trying to read HFS+ file with CNID %X behind EOF."),
return 0;
}
while (nb) {
if (phy_area.sector_count == 0) {
_("Could not find sector %lli of HFS+ file "
"with CNID %X."),
return 0;
}
return 0;
}
return 1;
}
int
unsigned int nb)
{
char *b = buf;
_("Trying to write HFS+ file with CNID %X behind EOF."),
return 0;
}
while (nb) {
if (phy_area.sector_count == 0) {
_("Could not find sector %lli of HFS+ file "
"with CNID %X."),
return 0;
}
return 0;
}
return 1;
}
#endif /* !DISCOVER_ONLY */