1N/A/*
1N/A * utils.h - Part of the Linux-NTFS project.
1N/A *
1N/A * Copyright (c) 2002-2005 Richard Russon
1N/A * Copyright (c) 2004 Anton Altaparmakov
1N/A *
1N/A * A set of shared functions for ntfs utilities
1N/A *
1N/A * This program is free software; you can redistribute it and/or modify
1N/A * it under the terms of the GNU General Public License as published by
1N/A * the Free Software Foundation; either version 2 of the License, or
1N/A * (at your option) any later version.
1N/A *
1N/A * This program is distributed in the hope that it will be useful,
1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A * GNU General Public License for more details.
1N/A *
1N/A * You should have received a copy of the GNU General Public License
1N/A * along with this program (in the main directory of the Linux-NTFS
1N/A * distribution in the file COPYING); if not, write to the Free Software
1N/A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1N/A */
1N/A
1N/A#ifndef _NTFS_UTILS_H_
1N/A#define _NTFS_UTILS_H_
1N/A
1N/A#include "config.h"
1N/A
1N/A#include "types.h"
1N/A#include "layout.h"
1N/A#include "volume.h"
1N/A
1N/A#ifdef HAVE_ERRNO_H
1N/A#include <errno.h>
1N/A#endif
1N/A#ifdef HAVE_STDARG_H
1N/A#include <stdarg.h>
1N/A#endif
1N/A
1N/Aextern const char *ntfs_bugs;
1N/Aextern const char *ntfs_home;
1N/Aextern const char *ntfs_gpl;
1N/A
1N/Aint utils_set_locale(void);
1N/Aint utils_parse_size(const char *value, s64 *size, BOOL scale);
1N/Aint utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale);
1N/Aint utils_inode_get_name(ntfs_inode *inode, char *buffer, int bufsize);
1N/Aint utils_attr_get_name(ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize);
1N/Aint utils_cluster_in_use(ntfs_volume *vol, long long lcn);
1N/Aint utils_mftrec_in_use(ntfs_volume *vol, MFT_REF mref);
1N/Aint utils_is_metadata(ntfs_inode *inode);
1N/Avoid utils_dump_mem(void *buf, int start, int length, int flags);
1N/A
1N/AATTR_RECORD * find_attribute(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx);
1N/AATTR_RECORD * find_first_attribute(const ATTR_TYPES type, MFT_RECORD *mft);
1N/A
1N/Aint utils_valid_device(const char *name, int force);
1N/Antfs_volume * utils_mount_volume(const char *device, ntfs_mount_flags flags);
1N/A
1N/A/**
1N/A * defines...
1N/A * if *not in use* then the other flags are ignored?
1N/A */
1N/A#define FEMR_IN_USE (1 << 0)
1N/A#define FEMR_NOT_IN_USE (1 << 1)
1N/A#define FEMR_FILE (1 << 2) // $DATA
1N/A#define FEMR_DIR (1 << 3) // $INDEX_ROOT, "$I30"
1N/A#define FEMR_METADATA (1 << 4)
1N/A#define FEMR_NOT_METADATA (1 << 5)
1N/A#define FEMR_BASE_RECORD (1 << 6)
1N/A#define FEMR_NOT_BASE_RECORD (1 << 7)
1N/A#define FEMR_ALL_RECORDS 0xFF
1N/A
1N/A/**
1N/A * struct mft_search_ctx
1N/A */
1N/Astruct mft_search_ctx {
1N/A int flags_search;
1N/A int flags_match;
1N/A ntfs_inode *inode;
1N/A ntfs_volume *vol;
1N/A u64 mft_num;
1N/A};
1N/A
1N/Astruct mft_search_ctx * mft_get_search_ctx(ntfs_volume *vol);
1N/Avoid mft_put_search_ctx(struct mft_search_ctx *ctx);
1N/Aint mft_next_record(struct mft_search_ctx *ctx);
1N/A
1N/A// Flags for dump mem
1N/A#define DM_DEFAULTS 0
1N/A#define DM_NO_ASCII (1 << 0)
1N/A#define DM_NO_DIVIDER (1 << 1)
1N/A#define DM_INDENT (1 << 2)
1N/A#define DM_RED (1 << 3)
1N/A#define DM_GREEN (1 << 4)
1N/A#define DM_BLUE (1 << 5)
1N/A#define DM_BOLD (1 << 6)
1N/A
1N/A#endif /* _NTFS_UTILS_H_ */