/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Miscellaneous support subroutines for High Sierra filesystem
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
#include <vm/seg_kmem.h>
extern int hsfs_lostpage;
#ifdef __STDC__
#else
static time_t hs_date_to_gmtime();
#endif
/*
* Table used in logging non-fatal errors which should be recorded
* once per mount. Indexed by HSFS_ERR values (defined in hsfs_node.h).
*/
struct hsfs_error {
/* must contain %s for mnt pt */
} hsfs_error[] = {
/* HSFS_ERR_TRAILING_JUNK */
"hsfs: Warning: the file system mounted on %s "
"does not conform to the ISO-9660 specification:",
"trailing blanks or null characters in file or directory name.\n",
1, 0,
/* HSFS_ERR_LOWER_CASE_NM */
"hsfs: Warning: the file system mounted on %s "
"does not conform to the ISO-9660 specification:",
"lower case characters in file or directory name.\n",
1, 0,
/* HSFS_ERR_BAD_ROOT_DIR */
"hsfs: Warning: the file system mounted on %s "
"does not conform to the ISO-9660 specification:",
"invalid root directory.\n",
0, 0,
/* HSFS_ERR_UNSUP_TYPE */
"hsfs: Warning: the file system mounted on %s "
"contains a file or directory with an unsupported type:",
" 0x%x.\n",
1, 1,
/* HSFS_ERR_BAD_FILE_LEN */
"hsfs: Warning: file system mounted on %s "
"does not conform to the ISO-9660 specification:",
"file name length greater than max allowed\n",
1, 0,
/* HSFS_ERR_BAD_JOLIET_FILE_LEN */
"hsfs: Warning: file system mounted on %s "
"does not conform to the Joliet specification:",
"file name length greater than max allowed\n",
1, 0,
/* HSFS_ERR_TRUNC_JOLIET_FILE_LEN */
"hsfs: Warning: file system mounted on %s "
"does not conform to the Joliet specification:",
"file name length greater than MAXNAMELEN (truncated)\n",
1, 0,
/* HSFS_ERR_BAD_DIR_ENTRY */
"hsfs: Warning: file system mounted on %s "
"has inconsistent data:",
"invalid directory or file name length (ignored)\n",
1, 0,
/* HSFS_ERR_NEG_SUA_LEN */
"hsfs: Warning: file system mounted on %s "
"has inconsistent Rock Ridge data:",
"negative SUA len\n",
1, 0,
/* HSFS_ERR_BAD_SUA_LEN */
"hsfs: Warning: file system mounted on %s "
"has inconsistent Rock Ridge data:",
"SUA len too big\n",
1, 0,
};
/*
* Local datatype for defining tables of (Offset, Name) pairs for
* kstats.
*/
typedef struct {
char *name;
{ 0, "mountpoint" },
{ 1, "pages_lost" },
{ 2, "physical_read_pages" },
{ 3, "cache_read_pages" },
{ 4, "readahead_pages" },
{ 5, "coalesced_pages" },
{ 6, "total_pages_requested" },
{-1, NULL }
};
/*
* hs_parse_dirdate
*
* Parse the short 'directory-format' date into a Unix timeval.
* This is the date format used in Directory Entries.
*
* If the date is not representable, make something up.
*/
void
{
} else {
}
}
return;
}
/*
* hs_parse_longdate
*
* Parse the long 'user-oriented' date into a Unix timeval.
* This is the date format used in the Volume Descriptor.
*
* If the date is not representable, make something up.
*/
void
{
} else {
}
}
}
/* cumulative number of seconds per month, non-leap and leap-year versions */
0x0, 0x28de80, 0x4dc880, 0x76a700, 0x9e3400, 0xc71280,
0xee9f80, 0x1177e00, 0x1405c80, 0x167e980, 0x190c800, 0x1b85500
};
0x0, 0x28de80, 0x4f1a00, 0x77f880, 0x9f8580, 0xc86400,
0xeff100, 0x118cf80, 0x141ae00, 0x1693b00, 0x1921980, 0x1b9a680
};
/*
* hs_date_to_gmtime
*
* Convert year(1970-2099)/month(1-12)/day(1-31) to seconds-since-1970/1/1.
*
* Returns -1 if the date is out of range.
*/
static time_t
int year;
int mon;
int day;
int gmtoff;
{
int y;
return (-1);
/*
* Figure seconds until this year and correct for leap years.
* Note: 2000 is a leap year but not 2100.
*/
sum = y * SEC_PER_YEAR;
/*
* Point to the correct table for this year and
* add in seconds until this month.
*/
/*
* Add in seconds until 0:00 of this day.
* (days-per-month validation is not done here)
*/
return (sum);
}
/*
* Indicate whether the directory is valid.
*/
int
struct hs_direntry *hd;
{
/*
* check to see if this directory is not marked as a directory.
* check to see if data length is zero.
*/
return (0);
return (0);
return (1);
}
/*
* If we haven't complained about this error type yet, do.
*/
void
int errtype;
{
return; /* already complained */
fsp->hsfs_fsmnt);
case 0:
break;
case 1:
break;
default:
/* don't currently handle more than 1 arg */
}
"Due to this error, the file system may not be correctly interpreted.\n");
"Other such errors in this file system will be silently ignored.\n\n");
else
}
/*
* Callback from kstat framework. Grab a snapshot of the current hsfs
* counters and populate the kstats.
*/
static int
{
if (flag != KSTAT_READ)
return (EACCES);
knp++;
return (0);
}
/*
* Initialize hsfs kstats, which are all name value pairs with
* values being various counters.
*/
static kstat_t *
{
char *np;
return (NULL);
knp++;
ksip++;
}
return (ksp);
}
void
{
}
void
{
void *data;
(sizeof (hsfs_kstats)) / (sizeof (hsfs_ksindex_t)));
}
}