/*
* 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
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
#include <signal.h>
#include <setjmp.h>
#include <errno.h>
#include <inttypes.h>
#include <libgen.h>
#include <locale.h>
#include <sys/sysmacros.h>
#include "ud_lib.h"
#include "y.tab.h"
typedef unsigned short unicode_t;
void usage();
void init_buffers();
char *getblk(u_offset_t);
char *progname;
#define ARG_OVERRIDE 0
char *subopt_v[] = {
"o",
"p",
"w",
"?",
};
/*
* udp_flags
*/
extern int value;
{
#if !defined(TEXT_DOMAIN)
#endif
(void) textdomain(TEXT_DOMAIN);
switch (opt) {
case 'o' :
while (*subopts != '\0') {
case ARG_OVERRIDE :
override = 1;
gettext("error checking off\n"));
break;
case ARG_NEW_PROMPT :
usage();
}
gettext("prompt should be less"
"than 255 bytes\n"));
exit(1);
}
break;
case ARG_WR_ENABLED :
break;
case ARG_USAGE :
default :
usage();
}
}
break;
default :
usage();
}
}
usage();
}
gettext("udfs labelit: cannot initialize ud_lib\n"));
exit(1);
}
perror("open");
exit(1);
}
return (ret);
}
return (1);
}
l2d = 0;
l2d++;
}
init_buffers();
run_fsdb();
return (0);
}
/*
* usage - print usage and exit
*/
void
usage()
{
gettext("options:\n"));
gettext("\t-o\tSpecify udfs filesystem sepcific options\n"));
gettext("\t\tAvailable suboptions are:\n"));
gettext("\t\t?\tdisplay usage\n"));
gettext("\t\to\toverride some error conditions\n"));
gettext("\t\tp\t\"string\" set prompt to string\n"));
gettext("\t\tw\topen for write\n"));
exit(1);
}
static struct lbuf {
char *blkaddr;
{ \
}
void
{
int32_t i;
char *addr;
for (i = 0; i < NBUF; i++) {
}
}
char *
{
goto found;
}
}
errno = 0;
gettext("Seek failed fd %x off %llx errno %x\n"),
return (NULL);
}
errno = 0;
gettext("Read failed fd %x off %llx errno %x\n"),
return (NULL);
}
}
{
gettext("Not run with -w flag\n"));
return (1);
}
goto found;
}
}
gettext("Could not find the buffer\n"));
return (1);
return (0);
}
gettext("Write failed fd %x off %llx errno %x\n"),
} else {
gettext("Seek failed fd %x off %llx errno %x\n"),
}
return (1);
}
void
{
}
}
/*
* If addr == NULL then use id to print the desc
* other wise use addr to self identify the type of desc
*/
void
{
/*
* Read the block at addr
* find out the type of tag
* and print the descriptor
*/
gettext("Could not read block %x\n"),
}
/* LINTED */
} else {
switch (id) {
case AVD :
/* LINTED */
gettext("Could not read AVDP\n"));
}
break;
case MVDS :
case RVDS :
case INTS :
{
end = i +
end = i +
} else {
end = i +
}
for (; i < end; i++) {
print_desc(i << l2b, 0);
}
}
return;
case FSDS :
case ROOT :
{
end = i +
} else {
i = ricb_loc;
}
for (; i < end; i++) {
if ((block = ud_xlate_to_daddr(
gettext("Cannot xlate "
"prn %x loc %x\n"),
prn, i);
continue;
}
}
}
/* FALLTHROUGH */
default :
return;
}
}
case UD_PRI_VOL_DESC :
break;
case UD_ANCH_VOL_DESC :
break;
case UD_VOL_DESC_PTR :
break;
case UD_IMPL_USE_DESC :
break;
case UD_PART_DESC :
break;
case UD_LOG_VOL_DESC :
break;
case UD_UNALL_SPA_DESC :
break;
case UD_TERM_DESC :
break;
case UD_LOG_VOL_INT :
break;
case UD_FILE_SET_DESC :
break;
case UD_FILE_ID_DESC :
break;
case UD_ALLOC_EXT_DESC :
break;
case UD_INDIRECT_ENT :
break;
case UD_TERMINAL_ENT :
break;
case UD_FILE_ENTRY :
break;
case UD_EXT_ATTR_HDR :
case UD_UNALL_SPA_ENT :
case UD_SPA_BMAP_DESC :
case UD_PART_INT_DESC :
case UD_EXT_FILE_ENT :
break;
default :
gettext("unknown descriptor\n"));
break;
}
}
void
{
/* LINTED */
return;
}
return;
}
switch (id) {
case ATTZ :
break;
case ATYE :
break;
case ATMO :
break;
case ATDA :
break;
case ATHO :
break;
case ATMI :
break;
case ATSE :
break;
case ATCE :
break;
case ATHU :
break;
case ATMIC :
break;
case CTTZ :
break;
case CTYE :
break;
case CTMO :
break;
case CTDA :
break;
case CTHO :
break;
case CTMI :
break;
case CTSE :
break;
case CTCE :
break;
case CTHU :
break;
case CTMIC :
break;
case MTTZ :
break;
case MTYE :
break;
case MTMO :
break;
case MTDA :
break;
case MTHO :
break;
case MTMI :
break;
case MTSE :
break;
case MTCE :
break;
case MTHU :
break;
case MTMIC :
break;
case GID :
break;
case LN :
break;
case MD :
break;
case MAJ :
case MIO :
gettext("Not a device\n"));
break;
}
/* LINTED */
/* LINTED */
} else {
}
break;
}
}
}
gettext("does not have a Device Specification EA\n"));
break;
case NM :
break;
case SZ :
break;
case UID :
break;
case UNIQ :
break;
default :
gettext("Unknown set\n"));
}
}
{
/* LINTED */
gettext("Could not read block %x\n"),
} else {
gettext("Not a file entry(inode) at %x\n"),
} else {
gettext("CRC failed\n"));
} else {
if ((type == 0) ||
}
}
}
}
return (0);
}
void
{
print_desc(addr, 0);
}
}
{
/* LINTED */
gettext("Inode is not a directory\n"));
return (1);
}
return (0);
}
ent++;
}
gettext("Reached EOF\n"));
return (1);
}
void
{
/* LINTED */
return;
}
ent++;
}
}
}
struct ext {
{
/* LINTED */
if ((fe = (struct file_entry *)
gettext("Could not read block %x\n"),
return (1);
}
if (desc_type == ICB_FLAG_SHORT_AD) {
/* LINTED */
} else if (desc_type == ICB_FLAG_LONG_AD) {
/* LINTED */
} else if (desc_type == ICB_FLAG_ONE_AD) {
return (0);
} else {
/* This cannot happen return */
return (EINVAL);
}
gettext("could not allocate memeory\n"));
return (1);
}
for (d = 0, i = 0; i < nent; i++) {
if (desc_type == ICB_FLAG_SHORT_AD) {
prn = 0;
} else if (desc_type == ICB_FLAG_LONG_AD) {
}
if (flags == 0x3) {
gettext("Handle IE\n"));
} else {
d++;
}
}
}
b_off = 0;
for (i = 0; i < de_count; i++) {
if ((*blkno = ud_xlate_to_daddr(
return (1);
}
return (0);
}
}
return (1);
}
/*
* assume the buffer is big enough
* for the entire request
*/
{
while (count) {
return (1);
}
return (1);
}
/*
* embedded file
*/
/* LINTED */
return (1);
}
}
}
}
return (0);
}
{
/* LINTED */
return (1);
}
gettext("file_id tag does not verify off %llx\n"),
off);
return (1);
}
return (1);
}
return (0);
}
/*
* Path is absolute path
*/
{
return (1);
}
return (0);
}
return (1);
}
/*
* Check if dname is a directory
*/
}
/*
* Search for the fname in the directory now
*/
off = 0;
/* LINTED */
continue;
}
addr[0] = '.';
} else {
}
return (1);
}
/* LINTED */
gettext("Could not read block %x\n"),
*in);
return (1);
}
0, 0, 1) != 0) {
gettext("Not a file entry(inode)"
" at %x\n"), *in);
return (1);
}
gettext("CRC failed\n"));
return (1);
}
return (0);
}
}
return (err);
}
struct recu_dir {
char *nm;
};
void
{
gettext("Inode is not a directory\n"));
return;
}
if (fl & 2) {
(void) printf("\n");
if (fl & 1) {
}
}
off = 0;
/* LINTED */
continue;
}
if (fl & 1) {
}
gettext("..\n"));
} else {
int32_t i;
(fl & 2)) {
gettext("Could not allocate memory\n"));
} else {
(char *)addr,
}
} else {
}
}
}
}
}
} else {
}
}
}
}
void
{
gettext("Not run with -w flag\n"));
return;
}
if (count == 0) {
count = 1;
}
inval_bufs();
gettext("Seek failed fd %x off %llx errno %x\n"),
goto end;
}
gettext("Read failed fd %x off %llx errno %x\n"),
goto end;
}
while (count--) {
p += len;
}
gettext("Write failed fd %x off %llx errno %x\n"),
goto end;
}
end:
}
void
{
gettext("Invalid command\n"));
return;
}
if (count == 0) {
count = 1;
}
switch (*format) {
case 'b' :
/* FALLTHROUGH */
case 'c' :
/* FALLTHROUGH */
case 'd' :
/* FALLTHROUGH */
case 'o' :
len = 1;
prperline = 16;
break;
case 'x' :
len = 2;
prperline = 8;
break;
case 'D' :
/* FALLTHROUGH */
case 'O' :
/* FALLTHROUGH */
case 'X' :
len = 4;
prperline = 4;
break;
default :
gettext("Invalid format\n"));
return;
}
inval_bufs();
gettext("Seek failed fd %x off %llx errno %x\n"),
goto end;
}
gettext("Read failed fd %x off %llx errno %x\n"),
goto end;
}
/* LINTED */
/* LINTED */
n = 0;
while (n < count) {
switch (*format) {
case 'b' :
"%4x ", *((uint8_t *)p));
break;
case 'c' :
"%4c ", *((uint8_t *)p));
break;
case 'd' :
"%4d ", *((uint8_t *)p));
break;
case 'o' :
"%4o ", *((uint8_t *)p));
break;
case 'x' :
"%8x ", *p_16);
break;
case 'D' :
"%16d ", *p_32);
break;
case 'O' :
"%16o ", *p_32);
break;
case 'X' :
"%16x ", *p_32);
break;
}
p += len;
n++;
if ((n % prperline) == 0) {
}
}
if (n % prperline) {
}
end:
}
void
{
return;
}
return;
}
gettext("Inode is not a directory\n"));
return;
}
off = 0;
/* LINTED */
continue;
}
}
gettext("Could not allocate memory\n"));
} else {
} else {
"Could not allocate memory\n"));
}
} else {
}
}
}
}
}
}
}
}