[Ocfs2-tools-commits] manish commits r1047 - in tags: .
ocfs2-tools-1.1.0-ALPHA/libo2cb
ocfs2-tools-1.1.0-ALPHA/libo2cb/include
ocfs2-tools-1.1.0-ALPHA/libocfs2/include
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Aug 12 20:45:30 CDT 2005
Author: manish
Date: 2005-08-12 20:45:28 -0500 (Fri, 12 Aug 2005)
New Revision: 1047
Added:
tags/ocfs2-tools-1.1.0-ALPHA/
tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/Makefile
tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/
tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/o2cb.h
tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/ocfs2_heartbeat.h
tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/sparse_endian_types.h
tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2.h
tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2_fs.h
Removed:
tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/Makefile
tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/
tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/o2cb.h
tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/ocfs2_heartbeat.h
tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2.h
tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2_fs.h
Log:
Tagging 1.1.0-ALPHA
Copied: tags/ocfs2-tools-1.1.0-ALPHA (from rev 1043, trunk)
Deleted: tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/Makefile
===================================================================
--- trunk/libo2cb/Makefile 2005-08-12 23:32:43 UTC (rev 1043)
+++ tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/Makefile 2005-08-13 01:45:28 UTC (rev 1047)
@@ -1,81 +0,0 @@
-TOPDIR = ..
-
-include $(TOPDIR)/Preamble.make
-
-WARNINGS = -Wall -Wstrict-prototypes -Wmissing-prototypes \
- -Wmissing-declarations
-
-ifdef OCFS2_DEBUG
-OPTS += -ggdb
-else
-OPTS += -O2
-endif
-
-INCLUDES = -Iinclude
-
-LIBRARIES = libo2cb.a
-
-CFLAGS = $(OPTS) $(WARNINGS) -fPIC
-CPPFLAGS += -DO2CB_FLAT_INCLUDES
-
-ifneq ($(OCFS2_DEBUG_EXE),)
-DEBUG_EXE_FILES = $(shell awk '/DEBUG_EXE/{if (k[FILENAME] == 0) {print FILENAME; k[FILENAME] = 1;}}' $(CFILES))
-DEBUG_EXE_PROGRAMS = $(addprefix debug_,$(subst .c,,$(DEBUG_EXE_FILES)))
-
-.SECONDARY:
-
-UNINST_PROGRAMS += $(DEBUG_EXE_PROGRAMS)
-
-debug_%.o : %.c
- $(CC) $(CFLAGS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(LOCAL_CPPFLAGS) \
- $(INCLUDES) $(DEFINES) \
- -DDEBUG_EXE -o $@ -c $<
-
-debug_%: debug_%.o libo2cb.a
- $(LINK) $(COM_ERR_LIBS)
-
-endif
-
-CFILES = \
- o2cb_abi.c \
- o2cb_crc32.c
-
-HFILES = \
- include/ocfs2_nodemanager.h \
- include/ocfs2_heartbeat.h \
- include/o2cb_abi.h \
- include/o2cb_crc32.h \
- include/o2cb.h
-
-HFILES_GEN = \
- include/o2cb_err.h
-
-OBJS = $(subst .c,.o,$(CFILES)) \
- o2cb_err.o
-
-$(OBJS): $(HFILES_GEN)
-
-include/o2cb_err.h: o2cb_err.h
- cp $< $@
-
-o2cb_err.c o2cb_err.h: o2cb_err.et
- compile_et o2cb_err.et
-
-libo2cb.a: $(OBJS)
- rm -f $@
- $(AR) r $@ $^
- $(RANLIB) $@
-
-DIST_FILES = $(CFILES) $(HFILES) o2cb_err.et
-
-DIST_RULES = dist-subdircreate
-
-dist-subdircreate:
- $(TOPDIR)/mkinstalldirs $(DIST_DIR)/include
-
-CLEAN_RULES = clean-err
-
-clean-err:
- rm -f o2cb_err.c o2cb_err.h include/o2cb_err.h
-
-include $(TOPDIR)/Postamble.make
Copied: tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/Makefile (from rev 1045, trunk/libo2cb/Makefile)
Copied: tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include (from rev 1044, trunk/libo2cb/include)
Deleted: tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/o2cb.h
===================================================================
--- trunk/libo2cb/include/o2cb.h 2005-08-12 23:39:34 UTC (rev 1044)
+++ tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/o2cb.h 2005-08-13 01:45:28 UTC (rev 1047)
@@ -1,104 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * o2cb.h
- *
- * Routines for accessing the o2cb configuration.
- *
- * Copyright (C) 2004 Oracle. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef _O2CB_H
-#define _O2CB_H
-
-#ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 600
-#endif
-#ifndef _LARGEFILE64_SOURCE
-# define _LARGEFILE64_SOURCE
-#endif
-
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/stat.h>
-#include <time.h>
-
-#include <linux/types.h>
-
-#include <et/com_err.h>
-
-#if O2CB_FLAT_INCLUDES
-#include "o2cb_err.h"
-#include "ocfs2_nodemanager.h"
-#include "ocfs2_heartbeat.h"
-#else
-#include <o2cb/o2cb_err.h>
-#include <o2cb/ocfs2_nodemanager.h>
-#include <o2cb/ocfs2_heartbeat.h>
-#endif
-
-errcode_t o2cb_init(void);
-
-errcode_t o2cb_create_cluster(const char *cluster_name);
-errcode_t o2cb_remove_cluster(const char *cluster_name);
-
-errcode_t o2cb_add_node(const char *cluster_name,
- const char *node_name, const char *node_num,
- const char *ip_address, const char *ip_port,
- const char *local);
-errcode_t o2cb_del_node(const char *cluster_name, const char *node_name);
-
-errcode_t o2cb_list_clusters(char ***clusters);
-void o2cb_free_cluster_list(char **clusters);
-
-errcode_t o2cb_list_nodes(char *cluster_name, char ***nodes);
-void o2cb_free_nodes_list(char **nodes);
-
-struct o2cb_region_desc {
- char *r_name;
- char *r_device_name;
- int r_block_bytes;
- uint64_t r_start_block;
- uint64_t r_blocks;
-};
-
-/* Expected use case for the region descriptor is to allocate it on
- * the stack and completely fill it before calling
- * start_heartbeat_region. */
-errcode_t o2cb_start_heartbeat_region(const char *cluster_name,
- struct o2cb_region_desc *desc);
-errcode_t o2cb_stop_heartbeat_region(const char *cluster_name,
- const char *region_name);
-errcode_t o2cb_start_heartbeat_region_perm(const char *cluster_name,
- struct o2cb_region_desc *desc);
-errcode_t o2cb_stop_heartbeat_region_perm(const char *cluster_name,
- const char *region_name);
-
-errcode_t o2cb_get_region_ref(const char *region_name,
- int undo);
-errcode_t o2cb_put_region_ref(const char *region_name,
- int undo);
-errcode_t o2cb_num_region_refs(const char *region_name,
- int *num_refs);
-
-errcode_t o2cb_get_node_num(const char *cluster_name,
- const char *node_name,
- uint16_t *node_num);
-
-errcode_t o2cb_get_hb_ctl_path(char *buf, int count);
-
-#endif /* _O2CB_H */
Copied: tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/o2cb.h (from rev 1045, trunk/libo2cb/include/o2cb.h)
Deleted: tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/ocfs2_heartbeat.h
===================================================================
--- trunk/libo2cb/include/ocfs2_heartbeat.h 2005-08-12 23:39:34 UTC (rev 1044)
+++ tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/ocfs2_heartbeat.h 2005-08-13 01:45:28 UTC (rev 1047)
@@ -1,37 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * ocfs2_heartbeat.h
- *
- * On-disk structures for ocfs2_heartbeat
- *
- * Copyright (C) 2002, 2004 Oracle. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef _OCFS2_HEARTBEAT_H
-#define _OCFS2_HEARTBEAT_H
-
-struct o2hb_disk_heartbeat_block {
- __u64 hb_seq;
- __u8 hb_node;
- __u8 hb_pad1[3];
- __u32 hb_cksum;
- __u64 hb_generation;
-};
-
-#endif /* _OCFS2_HEARTBEAT_H */
Copied: tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/ocfs2_heartbeat.h (from rev 1045, trunk/libo2cb/include/ocfs2_heartbeat.h)
Copied: tags/ocfs2-tools-1.1.0-ALPHA/libo2cb/include/sparse_endian_types.h (from rev 1045, trunk/libo2cb/include/sparse_endian_types.h)
Deleted: tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2.h
===================================================================
--- trunk/libocfs2/include/ocfs2.h 2005-08-12 23:32:43 UTC (rev 1043)
+++ tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2.h 2005-08-13 01:45:28 UTC (rev 1047)
@@ -1,679 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * ocfs2.h
- *
- * Filesystem object routines for the OCFS2 userspace library.
- *
- * Copyright (C) 2004 Oracle. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- *
- * Authors: Joel Becker
- */
-
-#ifndef _FILESYS_H
-#define _FILESYS_H
-
-#ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 600
-#endif
-#ifndef _LARGEFILE64_SOURCE
-# define _LARGEFILE64_SOURCE
-#endif
-
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/stat.h>
-#include <time.h>
-
-#include <limits.h>
-
-#include <linux/types.h>
-
-#include <et/com_err.h>
-
-#include "byteorder.h"
-
-#include <kernel-list.h>
-#include <kernel-rbtree.h>
-
-#if OCFS2_FLAT_INCLUDES
-#include "ocfs2_err.h"
-#include "ocfs2_fs.h"
-#include "jbd.h"
-#else
-#include <ocfs2/ocfs2_err.h>
-#include <ocfs2/ocfs2_fs.h>
-#include <ocfs2/jbd.h>
-#endif
-
-#include <o2dlm.h>
-#include <o2cb.h>
-
-#define OCFS2_LIB_FEATURE_INCOMPAT_SUPP (OCFS2_FEATURE_INCOMPAT_SUPP | OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV)
-#define OCFS2_LIB_FEATURE_RO_COMPAT_SUPP OCFS2_FEATURE_RO_COMPAT_SUPP
-
-/* Flags for the ocfs2_filesys structure */
-#define OCFS2_FLAG_RO 0x00
-#define OCFS2_FLAG_RW 0x01
-#define OCFS2_FLAG_CHANGED 0x02
-#define OCFS2_FLAG_DIRTY 0x04
-#define OCFS2_FLAG_SWAP_BYTES 0x08
-#define OCFS2_FLAG_BUFFERED 0x10
-#define OCFS2_FLAG_NO_REV_CHECK 0x20 /* Do not check the OCFS
- vol_header structure
- for revision info */
-#define OCFS2_FLAG_HEARTBEAT_DEV_OK 0x40
-
-/* Return flags for the extent iterator functions */
-#define OCFS2_EXTENT_CHANGED 0x01
-#define OCFS2_EXTENT_ABORT 0x02
-#define OCFS2_EXTENT_ERROR 0x04
-
-/*
- * Extent iterate flags
- *
- * OCFS2_EXTENT_FLAG_APPEND indicates that the iterator function should
- * be called on extents past the leaf next_free_rec. This is used by
- * ocfs2_expand_dir() to add a new extent to a directory (via
- * OCFS2_BLOCK_FLAG_APPEND and the block iteration functions).
- *
- * OCFS2_EXTENT_FLAG_DEPTH_TRAVERSE indicates that the iterator
- * function for tree_depth > 0 records (ocfs2_extent_blocks, iow)
- * should be called after all of the extents contained in the
- * extent_block are processed. This is useful if you are going to be
- * deallocating extents.
- *
- * OCFS2_EXTENT_FLAG_DATA_ONLY indicates that the iterator function
- * should be called for data extents (depth == 0) only.
- */
-#define OCFS2_EXTENT_FLAG_APPEND 0x01
-#define OCFS2_EXTENT_FLAG_DEPTH_TRAVERSE 0x02
-#define OCFS2_EXTENT_FLAG_DATA_ONLY 0x04
-
-
-/* Return flags for the block iterator functions */
-#define OCFS2_BLOCK_CHANGED 0x01
-#define OCFS2_BLOCK_ABORT 0x02
-#define OCFS2_BLOCK_ERROR 0x04
-
-/*
- * Block iterate flags
- *
- * In OCFS2, block iteration runs through the blocks contained in an
- * inode's data extents. As such, "DATA_ONLY" and "DEPTH_TRAVERSE"
- * can't really apply.
- *
- * OCFS2_BLOCK_FLAG_APPEND is as OCFS2_EXTENT_FLAG_APPEND, except on a
- * blocksize basis. This may mean that the underlying extent already
- * contains the space for a new block, and i_size is updated
- * accordingly.
- */
-#define OCFS2_BLOCK_FLAG_APPEND 0x01
-
-
-/* Return flags for the directory iterator functions */
-#define OCFS2_DIRENT_CHANGED 0x01
-#define OCFS2_DIRENT_ABORT 0x02
-#define OCFS2_DIRENT_ERROR 0x04
-
-/* Directory iterator flags */
-#define OCFS2_DIRENT_FLAG_INCLUDE_EMPTY 0x01
-#define OCFS2_DIRENT_FLAG_INCLUDE_REMOVED 0x02
-#define OCFS2_DIRENT_FLAG_EXCLUDE_DOTS 0x04
-
-/* Return flags for the chain iterator functions */
-#define OCFS2_CHAIN_CHANGED 0x01
-#define OCFS2_CHAIN_ABORT 0x02
-#define OCFS2_CHAIN_ERROR 0x04
-
-/* Directory constants */
-#define OCFS2_DIRENT_DOT_FILE 1
-#define OCFS2_DIRENT_DOT_DOT_FILE 2
-#define OCFS2_DIRENT_OTHER_FILE 3
-#define OCFS2_DIRENT_DELETED_FILE 4
-
-/* Directory scan flags */
-#define OCFS2_DIR_SCAN_FLAG_EXCLUDE_DOTS 0x01
-
-/* Check if mounted flags */
-#define OCFS2_MF_MOUNTED 1
-#define OCFS2_MF_ISROOT 2
-#define OCFS2_MF_READONLY 4
-#define OCFS2_MF_SWAP 8
-#define OCFS2_MF_BUSY 16
-#define OCFS2_MF_MOUNTED_CLUSTER 32
-
-/* check_heartbeats progress states */
-#define OCFS2_CHB_START 1
-#define OCFS2_CHB_WAITING 2
-#define OCFS2_CHB_COMPLETE 3
-
-typedef void (*ocfs2_chb_notify)(int state, char *progress, void *data);
-
-typedef struct _ocfs2_filesys ocfs2_filesys;
-typedef struct _ocfs2_cached_inode ocfs2_cached_inode;
-typedef struct _io_channel io_channel;
-typedef struct _ocfs2_extent_map ocfs2_extent_map;
-typedef struct _ocfs2_inode_scan ocfs2_inode_scan;
-typedef struct _ocfs2_dir_scan ocfs2_dir_scan;
-typedef struct _ocfs2_bitmap ocfs2_bitmap;
-typedef struct _ocfs2_devices ocfs2_devices;
-
-struct _ocfs2_filesys {
- char *fs_devname;
- uint32_t fs_flags;
- io_channel *fs_io;
- ocfs2_dinode *fs_super;
- ocfs2_dinode *fs_orig_super;
- unsigned int fs_blocksize;
- unsigned int fs_clustersize;
- uint32_t fs_clusters;
- uint64_t fs_blocks;
- uint32_t fs_umask;
- uint64_t fs_root_blkno;
- uint64_t fs_sysdir_blkno;
- uint64_t fs_first_cg_blkno;
- char uuid_str[OCFS2_VOL_UUID_LEN * 2 + 1];
-
- /* Allocators */
- ocfs2_cached_inode *fs_cluster_alloc;
- ocfs2_cached_inode **fs_inode_allocs;
- ocfs2_cached_inode *fs_system_inode_alloc;
- ocfs2_cached_inode **fs_eb_allocs;
- ocfs2_cached_inode *fs_system_eb_alloc;
-
- struct o2dlm_ctxt *fs_dlm_ctxt;
-
- /* Reserved for the use of the calling application. */
- void *fs_private;
-};
-
-struct _ocfs2_cached_inode {
- struct _ocfs2_filesys *ci_fs;
- uint64_t ci_blkno;
- ocfs2_dinode *ci_inode;
- ocfs2_extent_map *ci_map;
- ocfs2_bitmap *ci_chains;
-};
-
-struct _ocfs2_devices {
- struct list_head list;
- char dev_name[100];
- uint8_t label[64];
- uint8_t uuid[16];
- int mount_flags;
- int fs_type; /* 0=unknown, 1=ocfs, 2=ocfs2 */
- uint32_t maj_num; /* major number of the device */
- uint32_t min_num; /* minor number of the device */
- errcode_t errcode; /* error encountered reading device */
- void *private;
- uint16_t max_slots;
- uint8_t *node_nums; /* list of mounted nodes */
-};
-
-errcode_t ocfs2_malloc(unsigned long size, void *ptr);
-errcode_t ocfs2_malloc0(unsigned long size, void *ptr);
-errcode_t ocfs2_free(void *ptr);
-errcode_t ocfs2_realloc(unsigned long size, void *ptr);
-errcode_t ocfs2_realloc0(unsigned long size, void *ptr,
- unsigned long old_size);
-errcode_t ocfs2_malloc_blocks(io_channel *channel, int num_blocks,
- void *ptr);
-errcode_t ocfs2_malloc_block(io_channel *channel, void *ptr);
-
-errcode_t io_open(const char *name, int flags, io_channel **channel);
-errcode_t io_close(io_channel *channel);
-int io_get_error(io_channel *channel);
-errcode_t io_set_blksize(io_channel *channel, int blksize);
-int io_get_blksize(io_channel *channel);
-errcode_t io_read_block(io_channel *channel, int64_t blkno, int count,
- char *data);
-errcode_t io_write_block(io_channel *channel, int64_t blkno, int count,
- const char *data);
-
-errcode_t ocfs2_write_super(ocfs2_filesys *fs);
-errcode_t ocfs2_open(const char *name, int flags,
- unsigned int superblock, unsigned int blksize,
- ocfs2_filesys **ret_fs);
-errcode_t ocfs2_flush(ocfs2_filesys *fs);
-errcode_t ocfs2_close(ocfs2_filesys *fs);
-void ocfs2_freefs(ocfs2_filesys *fs);
-
-void ocfs2_swap_inode_from_cpu(ocfs2_dinode *di);
-void ocfs2_swap_inode_to_cpu(ocfs2_dinode *di);
-errcode_t ocfs2_read_inode(ocfs2_filesys *fs, uint64_t blkno,
- char *inode_buf);
-errcode_t ocfs2_write_inode(ocfs2_filesys *fs, uint64_t blkno,
- char *inode_buf);
-errcode_t ocfs2_check_directory(ocfs2_filesys *fs, uint64_t dir);
-
-errcode_t ocfs2_read_cached_inode(ocfs2_filesys *fs, uint64_t blkno,
- ocfs2_cached_inode **ret_ci);
-errcode_t ocfs2_write_cached_inode(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-errcode_t ocfs2_free_cached_inode(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-
-void ocfs2_swap_extent_list_from_cpu(ocfs2_extent_list *el);
-void ocfs2_swap_extent_list_to_cpu(ocfs2_extent_list *el);
-errcode_t ocfs2_extent_map_init(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-void ocfs2_extent_map_free(ocfs2_cached_inode *cinode);
-errcode_t ocfs2_extent_map_insert(ocfs2_cached_inode *cinode,
- ocfs2_extent_rec *rec,
- int tree_depth);
-errcode_t ocfs2_extent_map_drop(ocfs2_cached_inode *cinode,
- uint32_t new_clusters);
-errcode_t ocfs2_extent_map_trunc(ocfs2_cached_inode *cinode,
- uint32_t new_clusters);
-errcode_t ocfs2_extent_map_get_rec(ocfs2_cached_inode *cinode,
- uint32_t cpos,
- ocfs2_extent_rec **rec);
-errcode_t ocfs2_extent_map_get_clusters(ocfs2_cached_inode *cinode,
- uint32_t v_cpos, int count,
- uint32_t *p_cpos,
- int *ret_count);
-errcode_t ocfs2_extent_map_get_blocks(ocfs2_cached_inode *cinode,
- uint64_t v_blkno, int count,
- uint64_t *p_blkno,
- int *ret_count);
-errcode_t ocfs2_load_extent_map(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-
-void ocfs2_swap_journal_superblock(journal_superblock_t *jsb);
-errcode_t ocfs2_init_journal_superblock(ocfs2_filesys *fs, char *buf,
- int buflen, uint32_t jrnl_size);
-errcode_t ocfs2_create_journal_superblock(ocfs2_filesys *fs,
- uint32_t size, int flags,
- char **ret_jsb);
-errcode_t ocfs2_read_journal_superblock(ocfs2_filesys *fs, uint64_t blkno,
- char *jsb_buf);
-errcode_t ocfs2_write_journal_superblock(ocfs2_filesys *fs, uint64_t blkno,
- char *jsb_buf);
-
-errcode_t ocfs2_read_extent_block(ocfs2_filesys *fs, uint64_t blkno,
- char *eb_buf);
-errcode_t ocfs2_read_extent_block_nocheck(ocfs2_filesys *fs, uint64_t blkno,
- char *eb_buf);
-errcode_t ocfs2_write_extent_block(ocfs2_filesys *fs, uint64_t blkno,
- char *eb_buf);
-errcode_t ocfs2_extent_iterate(ocfs2_filesys *fs,
- uint64_t blkno,
- int flags,
- char *block_buf,
- int (*func)(ocfs2_filesys *fs,
- ocfs2_extent_rec *rec,
- int tree_depth,
- uint32_t ccount,
- uint64_t ref_blkno,
- int ref_recno,
- void *priv_data),
- void *priv_data);
-errcode_t ocfs2_extent_iterate_inode(ocfs2_filesys *fs,
- ocfs2_dinode *inode,
- int flags,
- char *block_buf,
- int (*func)(ocfs2_filesys *fs,
- ocfs2_extent_rec *rec,
- int tree_depth,
- uint32_t ccount,
- uint64_t ref_blkno,
- int ref_recno,
- void *priv_data),
- void *priv_data);
-errcode_t ocfs2_block_iterate(ocfs2_filesys *fs,
- uint64_t blkno,
- int flags,
- int (*func)(ocfs2_filesys *fs,
- uint64_t blkno,
- uint64_t bcount,
- void *priv_data),
- void *priv_data);
-errcode_t ocfs2_block_iterate_inode(ocfs2_filesys *fs,
- ocfs2_dinode *inode,
- int flags,
- int (*func)(ocfs2_filesys *fs,
- uint64_t blkno,
- uint64_t bcount,
- void *priv_data),
- void *priv_data);
-
-errcode_t ocfs2_swap_dir_entries_from_cpu(void *buf, uint64_t bytes);
-errcode_t ocfs2_swap_dir_entries_to_cpu(void *buf, uint64_t bytes);
-errcode_t ocfs2_read_dir_block(ocfs2_filesys *fs, uint64_t block,
- void *buf);
-errcode_t ocfs2_write_dir_block(ocfs2_filesys *fs, uint64_t block,
- void *buf);
-
-errcode_t ocfs2_dir_iterate2(ocfs2_filesys *fs,
- uint64_t dir,
- int flags,
- char *block_buf,
- int (*func)(uint64_t dir,
- int entry,
- struct ocfs2_dir_entry *dirent,
- int offset,
- int blocksize,
- char *buf,
- void *priv_data),
- void *priv_data);
-extern errcode_t ocfs2_dir_iterate(ocfs2_filesys *fs,
- uint64_t dir,
- int flags,
- char *block_buf,
- int (*func)(struct ocfs2_dir_entry *dirent,
- int offset,
- int blocksize,
- char *buf,
- void *priv_data),
- void *priv_data);
-
-errcode_t ocfs2_lookup(ocfs2_filesys *fs, uint64_t dir,
- const char *name, int namelen, char *buf,
- uint64_t *inode);
-
-errcode_t ocfs2_lookup_system_inode(ocfs2_filesys *fs, int type,
- int slot_num, uint64_t *blkno);
-
-errcode_t ocfs2_link(ocfs2_filesys *fs, uint64_t dir, const char *name,
- uint64_t ino, int flags);
-
-errcode_t ocfs2_unlink(ocfs2_filesys *fs, uint64_t dir,
- const char *name, uint64_t ino, int flags);
-
-errcode_t ocfs2_open_inode_scan(ocfs2_filesys *fs,
- ocfs2_inode_scan **ret_scan);
-void ocfs2_close_inode_scan(ocfs2_inode_scan *scan);
-errcode_t ocfs2_get_next_inode(ocfs2_inode_scan *scan,
- uint64_t *blkno, char *inode);
-
-errcode_t ocfs2_open_dir_scan(ocfs2_filesys *fs, uint64_t dir, int flags,
- ocfs2_dir_scan **ret_scan);
-void ocfs2_close_dir_scan(ocfs2_dir_scan *scan);
-errcode_t ocfs2_get_next_dir_entry(ocfs2_dir_scan *scan,
- struct ocfs2_dir_entry *dirent);
-
-errcode_t ocfs2_cluster_bitmap_new(ocfs2_filesys *fs,
- const char *description,
- ocfs2_bitmap **ret_bitmap);
-errcode_t ocfs2_block_bitmap_new(ocfs2_filesys *fs,
- const char *description,
- ocfs2_bitmap **ret_bitmap);
-void ocfs2_bitmap_free(ocfs2_bitmap *bitmap);
-errcode_t ocfs2_bitmap_set(ocfs2_bitmap *bitmap, uint64_t bitno,
- int *oldval);
-errcode_t ocfs2_bitmap_clear(ocfs2_bitmap *bitmap, uint64_t bitno,
- int *oldval);
-errcode_t ocfs2_bitmap_test(ocfs2_bitmap *bitmap, uint64_t bitno,
- int *val);
-errcode_t ocfs2_bitmap_find_next_set(ocfs2_bitmap *bitmap,
- uint64_t start, uint64_t *found);
-errcode_t ocfs2_bitmap_find_next_clear(ocfs2_bitmap *bitmap,
- uint64_t start, uint64_t *found);
-errcode_t ocfs2_bitmap_read(ocfs2_bitmap *bitmap);
-errcode_t ocfs2_bitmap_write(ocfs2_bitmap *bitmap);
-uint64_t ocfs2_bitmap_get_set_bits(ocfs2_bitmap *bitmap);
-errcode_t ocfs2_bitmap_alloc_range(ocfs2_bitmap *bitmap, uint64_t len,
- uint64_t *first_bit);
-errcode_t ocfs2_bitmap_clear_range(ocfs2_bitmap *bitmap, uint64_t len,
- uint64_t first_bit);
-
-errcode_t ocfs2_get_device_size(const char *file, int blocksize,
- uint32_t *retblocks);
-
-errcode_t ocfs2_get_device_sectsize(const char *file, int *sectsize);
-
-errcode_t ocfs2_check_if_mounted(const char *file, int *mount_flags);
-errcode_t ocfs2_check_mount_point(const char *device, int *mount_flags,
- char *mtpt, int mtlen);
-
-errcode_t ocfs2_read_whole_file(ocfs2_filesys *fs, uint64_t blkno,
- char **buf, int *len);
-
-void ocfs2_swap_disk_heartbeat_block(struct o2hb_disk_heartbeat_block *hb);
-errcode_t ocfs2_check_heartbeat(char *device, int *mount_flags,
- struct list_head *nodes_list);
-
-errcode_t ocfs2_check_heartbeats(struct list_head *dev_list);
-
-errcode_t ocfs2_get_ocfs1_label(char *device, uint8_t *label, uint16_t label_len,
- uint8_t *uuid, uint16_t uuid_len);
-
-void ocfs2_swap_group_desc(ocfs2_group_desc *gd);
-errcode_t ocfs2_read_group_desc(ocfs2_filesys *fs, uint64_t blkno,
- char *gd_buf);
-
-errcode_t ocfs2_write_group_desc(ocfs2_filesys *fs, uint64_t blkno,
- char *gd_buf);
-
-errcode_t ocfs2_chain_iterate(ocfs2_filesys *fs,
- uint64_t blkno,
- int (*func)(ocfs2_filesys *fs,
- uint64_t gd_blkno,
- int chain_num,
- void *priv_data),
- void *priv_data);
-
-errcode_t ocfs2_load_chain_allocator(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-errcode_t ocfs2_write_chain_allocator(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-errcode_t ocfs2_chain_alloc(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t *gd_blkno,
- uint64_t *bitno);
-errcode_t ocfs2_chain_free(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t bitno);
-errcode_t ocfs2_chain_alloc_range(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t requested,
- uint64_t *start_bit);
-errcode_t ocfs2_chain_free_range(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t len,
- uint64_t start_bit);
-errcode_t ocfs2_chain_test(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t bitno,
- int *oldval);
-errcode_t ocfs2_chain_force_val(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t blkno,
- int newval,
- int *oldval);
-errcode_t ocfs2_chain_add_group(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-
-errcode_t ocfs2_expand_dir(ocfs2_filesys *fs,
- uint64_t dir,
- uint64_t parent_dir);
-
-errcode_t ocfs2_test_inode_allocated(ocfs2_filesys *fs, uint64_t blkno,
- int *is_allocated);
-void ocfs2_init_group_desc(ocfs2_filesys *fs, ocfs2_group_desc *gd,
- uint64_t blkno, uint32_t generation,
- uint64_t parent_inode, uint16_t bits,
- uint16_t chain);
-
-errcode_t ocfs2_new_dir_block(ocfs2_filesys *fs, uint64_t dir_ino,
- uint64_t parent_ino, char **block);
-
-errcode_t ocfs2_insert_extent(ocfs2_filesys *fs, uint64_t ino,
- uint64_t c_blkno, uint32_t clusters);
-errcode_t ocfs2_extent_allocation(ocfs2_filesys *fs, uint64_t ino,
- uint32_t new_clusters);
-
-errcode_t ocfs2_new_inode(ocfs2_filesys *fs, uint64_t *ino, int mode);
-errcode_t ocfs2_new_system_inode(ocfs2_filesys *fs, uint64_t *ino, int mode, int flags);
-errcode_t ocfs2_delete_inode(ocfs2_filesys *fs, uint64_t ino);
-errcode_t ocfs2_new_extent_block(ocfs2_filesys *fs, uint64_t *blkno);
-errcode_t ocfs2_delete_extent_block(ocfs2_filesys *fs, uint64_t blkno);
-errcode_t ocfs2_extend_allocation(ocfs2_filesys *fs, uint64_t ino,
- uint32_t new_clusters);
-errcode_t ocfs2_truncate(ocfs2_filesys *fs, uint64_t ino, uint64_t new_i_size);
-errcode_t ocfs2_new_clusters(ocfs2_filesys *fs,
- uint32_t requested,
- uint64_t *start_blkno);
-errcode_t ocfs2_free_clusters(ocfs2_filesys *fs,
- uint32_t len,
- uint64_t start_blkno);
-
-errcode_t ocfs2_lookup(ocfs2_filesys *fs, uint64_t dir, const char *name,
- int namelen, char *buf, uint64_t *inode);
-
-errcode_t ocfs2_namei(ocfs2_filesys *fs, uint64_t root, uint64_t cwd,
- const char *name, uint64_t *inode);
-
-errcode_t ocfs2_namei_follow(ocfs2_filesys *fs, uint64_t root, uint64_t cwd,
- const char *name, uint64_t *inode);
-
-errcode_t ocfs2_follow_link(ocfs2_filesys *fs, uint64_t root, uint64_t cwd,
- uint64_t inode, uint64_t *res_inode);
-
-errcode_t ocfs2_file_read(ocfs2_cached_inode *ci, void *buf, uint32_t count,
- uint64_t offset, uint32_t *got);
-
-errcode_t ocfs2_file_write(ocfs2_cached_inode *ci, void *buf, uint32_t count,
- uint64_t offset, uint32_t *wrote);
-
-errcode_t ocfs2_fill_heartbeat_desc(ocfs2_filesys *fs,
- struct o2cb_region_desc *desc);
-
-errcode_t ocfs2_start_heartbeat(ocfs2_filesys *fs);
-
-errcode_t ocfs2_stop_heartbeat(ocfs2_filesys *fs);
-
-errcode_t ocfs2_lock_down_cluster(ocfs2_filesys *fs);
-
-errcode_t ocfs2_release_cluster(ocfs2_filesys *fs);
-
-errcode_t ocfs2_initialize_dlm(ocfs2_filesys *fs);
-
-errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs);
-
-errcode_t ocfs2_super_lock(ocfs2_filesys *fs);
-
-errcode_t ocfs2_super_unlock(ocfs2_filesys *fs);
-
-errcode_t ocfs2_meta_lock(ocfs2_filesys *fs, ocfs2_cached_inode *inode,
- enum o2dlm_lock_level level, int flags);
-
-errcode_t ocfs2_meta_unlock(ocfs2_filesys *fs, ocfs2_cached_inode *ci);
-
-void ocfs2_swap_slot_map(int16_t *map, loff_t num_slots);
-
-/*
- * ${foo}_to_${bar} is a floor function. blocks_to_clusters will
- * returns the cluster that contains a block, not the number of clusters
- * that hold a given number of blocks.
- *
- * ${foo}_in_${bar} is a ceiling function. clusters_in_blocks will give
- * the number of clusters needed to hold a given number of blocks.
- */
-
-static inline uint64_t ocfs2_clusters_to_blocks(ocfs2_filesys *fs,
- uint32_t clusters)
-{
- int c_to_b_bits =
- OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
- OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
-
- return (uint64_t)clusters << c_to_b_bits;
-}
-
-static inline uint32_t ocfs2_blocks_to_clusters(ocfs2_filesys *fs,
- uint64_t blocks)
-{
- int b_to_c_bits =
- OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
- OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
-
- return (uint32_t)(blocks >> b_to_c_bits);
-}
-
-static inline uint64_t ocfs2_blocks_in_bytes(ocfs2_filesys *fs, uint64_t bytes)
-{
- uint64_t ret = bytes + fs->fs_blocksize - 1;
-
- if (ret < bytes) /* deal with wrapping */
- return UINT64_MAX;
-
- return ret >> OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
-}
-
-static inline uint32_t ocfs2_clusters_in_blocks(ocfs2_filesys *fs,
- uint64_t blocks)
-{
- int c_to_b_bits = OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
- OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
- uint64_t ret = blocks + ((1 << c_to_b_bits) - 1);
-
- if (ret < blocks) /* deal with wrapping */
- ret = UINT64_MAX;
-
- return (uint32_t)(ret >> c_to_b_bits);
-}
-
-static inline int ocfs2_block_out_of_range(ocfs2_filesys *fs, uint64_t block)
-{
- return (block < OCFS2_SUPER_BLOCK_BLKNO) || (block > fs->fs_blocks);
-}
-
-struct ocfs2_cluster_group_sizes {
- uint16_t cgs_cpg;
- uint16_t cgs_tail_group_bits;
- uint32_t cgs_cluster_groups;
-};
-static inline void ocfs2_calc_cluster_groups(uint64_t clusters,
- uint64_t blocksize,
- struct ocfs2_cluster_group_sizes *cgs)
-{
- uint16_t max_bits = 8 * ocfs2_group_bitmap_size(blocksize);
-
- cgs->cgs_cpg = max_bits;
- if (max_bits > clusters)
- cgs->cgs_cpg = clusters;
-
- cgs->cgs_cluster_groups = (clusters + cgs->cgs_cpg - 1) /
- cgs->cgs_cpg;
-
- cgs->cgs_tail_group_bits = clusters % cgs->cgs_cpg;
- if (cgs->cgs_tail_group_bits == 0)
- cgs->cgs_tail_group_bits = cgs->cgs_cpg;
-}
-
-/*
- * shamelessly lifted from the kernel
- *
- * min()/max() macros that also do
- * strict type-checking.. See the
- * "unnecessary" pointer comparison.
- */
-#define ocfs2_min(x,y) ({ \
- const typeof(x) _x = (x); \
- const typeof(y) _y = (y); \
- (void) (&_x == &_y); \
- _x < _y ? _x : _y; })
-
-#define ocfs2_max(x,y) ({ \
- const typeof(x) _x = (x); \
- const typeof(y) _y = (y); \
- (void) (&_x == &_y); \
- _x > _y ? _x : _y; })
-
-#endif /* _FILESYS_H */
Copied: tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2.h (from rev 1045, trunk/libocfs2/include/ocfs2.h)
Deleted: tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2_fs.h
===================================================================
--- trunk/libocfs2/include/ocfs2_fs.h 2005-08-12 23:32:43 UTC (rev 1043)
+++ tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2_fs.h 2005-08-13 01:45:28 UTC (rev 1047)
@@ -1,639 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * ocfs2_fs.h
- *
- * On-disk structures for OCFS2.
- *
- * Copyright (C) 2002, 2004 Oracle. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef _OCFS2_FS_H
-#define _OCFS2_FS_H
-
-/* Version */
-#define OCFS2_MAJOR_REV_LEVEL 0
-#define OCFS2_MINOR_REV_LEVEL 90
-
-/*
- * An OCFS2 volume starts this way:
- * Sector 0: Valid ocfs1_vol_disk_hdr that cleanly fails to mount OCFS.
- * Sector 1: Valid ocfs1_vol_label that cleanly fails to mount OCFS.
- * Block OCFS2_SUPER_BLOCK_BLKNO: OCFS2 superblock.
- *
- * All other structures are found from the superblock information.
- *
- * OCFS2_SUPER_BLOCK_BLKNO is in blocks, not sectors. eg, for a
- * blocksize of 2K, it is 4096 bytes into disk.
- */
-#define OCFS2_SUPER_BLOCK_BLKNO 2
-
-/*
- * Cluster size limits. The maximum is kept arbitrarily at 1 MB, and could
- * grow if needed.
- */
-#define OCFS2_MIN_CLUSTERSIZE 4096
-#define OCFS2_MAX_CLUSTERSIZE 1048576
-
-/*
- * Blocks cannot be bigger than clusters, so the maximum blocksize is the
- * minimum cluster size.
- */
-#define OCFS2_MIN_BLOCKSIZE 512
-#define OCFS2_MAX_BLOCKSIZE OCFS2_MIN_CLUSTERSIZE
-
-/* Filesystem magic number */
-#define OCFS2_SUPER_MAGIC 0x7461636f
-
-/* Object signatures */
-#define OCFS2_SUPER_BLOCK_SIGNATURE "OCFSV2"
-#define OCFS2_INODE_SIGNATURE "INODE01"
-#define OCFS2_EXTENT_BLOCK_SIGNATURE "EXBLK01"
-#define OCFS2_GROUP_DESC_SIGNATURE "GROUP01"
-
-/* Compatibility flags */
-#define OCFS2_HAS_COMPAT_FEATURE(sb,mask) \
- ( OCFS2_SB(sb)->s_feature_compat & (mask) )
-#define OCFS2_HAS_RO_COMPAT_FEATURE(sb,mask) \
- ( OCFS2_SB(sb)->s_feature_ro_compat & (mask) )
-#define OCFS2_HAS_INCOMPAT_FEATURE(sb,mask) \
- ( OCFS2_SB(sb)->s_feature_incompat & (mask) )
-#define OCFS2_SET_COMPAT_FEATURE(sb,mask) \
- OCFS2_SB(sb)->s_feature_compat |= (mask)
-#define OCFS2_SET_RO_COMPAT_FEATURE(sb,mask) \
- OCFS2_SB(sb)->s_feature_ro_compat |= (mask)
-#define OCFS2_SET_INCOMPAT_FEATURE(sb,mask) \
- OCFS2_SB(sb)->s_feature_incompat |= (mask)
-#define OCFS2_CLEAR_COMPAT_FEATURE(sb,mask) \
- OCFS2_SB(sb)->s_feature_compat &= ~(mask)
-#define OCFS2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
- OCFS2_SB(sb)->s_feature_ro_compat &= ~(mask)
-#define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask) \
- OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
-
-#define OCFS2_FEATURE_COMPAT_SUPP 0
-#define OCFS2_FEATURE_INCOMPAT_SUPP 0
-#define OCFS2_FEATURE_RO_COMPAT_SUPP 0
-
-/*
- * Heartbeat-only devices are missing journals and other files. The
- * filesystem driver can't load them, but the library can. Never put
- * this in OCFS2_FEATURE_INCOMPAT_SUPP, *ever*.
- */
-#define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV 0x0002
-
-
-/*
- * Flags on ocfs2_dinode.i_flags
- */
-#define OCFS2_VALID_FL (0x00000001) /* Inode is valid */
-#define OCFS2_UNUSED2_FL (0x00000002)
-#define OCFS2_ORPHANED_FL (0x00000004) /* On the orphan list */
-#define OCFS2_UNUSED3_FL (0x00000008)
-/* System inode flags */
-#define OCFS2_SYSTEM_FL (0x00000010) /* System inode */
-#define OCFS2_SUPER_BLOCK_FL (0x00000020) /* Super block */
-#define OCFS2_LOCAL_ALLOC_FL (0x00000040) /* Slot local alloc bitmap */
-#define OCFS2_BITMAP_FL (0x00000080) /* Allocation bitmap */
-#define OCFS2_JOURNAL_FL (0x00000100) /* Slot local journal */
-#define OCFS2_HEARTBEAT_FL (0x00000200) /* Heartbeat area */
-#define OCFS2_CHAIN_FL (0x00000400) /* Chain allocator */
-#define OCFS2_DEALLOC_FL (0x00000800) /* Truncate log */
-
-/*
- * Journal Flags (ocfs2_dinode.id1.journal1.i_flags)
- */
-#define OCFS2_JOURNAL_DIRTY_FL (0x00000001) /* Journal needs recovery */
-
-/*
- * superblock s_state flags
- */
-#define OCFS2_ERROR_FS (0x00000001) /* FS saw errors */
-
-/* Limit of space in ocfs2_dir_entry */
-#define OCFS2_MAX_FILENAME_LEN 255
-
-/* Maximum slots on an ocfs2 file system */
-#define OCFS2_MAX_SLOTS 255
-
-/* Slot map indicator for an empty slot */
-#define OCFS2_INVALID_SLOT -1
-
-#define OCFS2_VOL_UUID_LEN 16
-#define OCFS2_MAX_VOL_LABEL_LEN 64
-
-/* Journal limits (in bytes) */
-#define OCFS2_MIN_JOURNAL_SIZE (4 * 1024 * 1024)
-#define OCFS2_MAX_JOURNAL_SIZE (500 * 1024 * 1024)
-
-struct ocfs2_system_inode_info {
- char *si_name;
- int si_iflags;
- int si_mode;
-};
-
-/* System file index */
-enum {
- BAD_BLOCK_SYSTEM_INODE = 0,
- GLOBAL_INODE_ALLOC_SYSTEM_INODE,
- SLOT_MAP_SYSTEM_INODE,
-#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
- HEARTBEAT_SYSTEM_INODE,
- GLOBAL_BITMAP_SYSTEM_INODE,
-#define OCFS2_LAST_GLOBAL_SYSTEM_INODE GLOBAL_BITMAP_SYSTEM_INODE
- ORPHAN_DIR_SYSTEM_INODE,
- EXTENT_ALLOC_SYSTEM_INODE,
- INODE_ALLOC_SYSTEM_INODE,
- JOURNAL_SYSTEM_INODE,
- LOCAL_ALLOC_SYSTEM_INODE,
- TRUNCATE_LOG_SYSTEM_INODE,
- NUM_SYSTEM_INODES
-};
-
-static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {
- /* Global system inodes (single copy) */
- /* The first two are only used from userspace mfks/tunefs */
- [BAD_BLOCK_SYSTEM_INODE] = { "bad_blocks", 0, S_IFREG | 0644 },
- [GLOBAL_INODE_ALLOC_SYSTEM_INODE] = { "global_inode_alloc", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
-
- /* These are used by the running filesystem */
- [SLOT_MAP_SYSTEM_INODE] = { "slot_map", 0, S_IFREG | 0644 },
- [HEARTBEAT_SYSTEM_INODE] = { "heartbeat", OCFS2_HEARTBEAT_FL, S_IFREG | 0644 },
- [GLOBAL_BITMAP_SYSTEM_INODE] = { "global_bitmap", 0, S_IFREG | 0644 },
-
- /* Slot-specific system inodes (one copy per slot) */
- [ORPHAN_DIR_SYSTEM_INODE] = { "orphan_dir:%04d", 0, S_IFDIR | 0755 },
- [EXTENT_ALLOC_SYSTEM_INODE] = { "extent_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
- [INODE_ALLOC_SYSTEM_INODE] = { "inode_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
- [JOURNAL_SYSTEM_INODE] = { "journal:%04d", OCFS2_JOURNAL_FL, S_IFREG | 0644 },
- [LOCAL_ALLOC_SYSTEM_INODE] = { "local_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_LOCAL_ALLOC_FL, S_IFREG | 0644 },
- [TRUNCATE_LOG_SYSTEM_INODE] = { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 }
-};
-
-/* Parameter passed from mount.ocfs2 to module */
-#define OCFS2_HB_OK "hbok"
-
-/*
- * OCFS2 directory file types. Only the low 3 bits are used. The
- * other bits are reserved for now.
- */
-#define OCFS2_FT_UNKNOWN 0
-#define OCFS2_FT_REG_FILE 1
-#define OCFS2_FT_DIR 2
-#define OCFS2_FT_CHRDEV 3
-#define OCFS2_FT_BLKDEV 4
-#define OCFS2_FT_FIFO 5
-#define OCFS2_FT_SOCK 6
-#define OCFS2_FT_SYMLINK 7
-
-#define OCFS2_FT_MAX 8
-
-/*
- * OCFS2_DIR_PAD defines the directory entries boundaries
- *
- * NOTE: It must be a multiple of 4
- */
-#define OCFS2_DIR_PAD 4
-#define OCFS2_DIR_ROUND (OCFS2_DIR_PAD - 1)
-#define OCFS2_DIR_MEMBER_LEN offsetof(struct ocfs2_dir_entry, name)
-#define OCFS2_DIR_REC_LEN(name_len) (((name_len) + OCFS2_DIR_MEMBER_LEN + \
- OCFS2_DIR_ROUND) & \
- ~OCFS2_DIR_ROUND)
-
-#define OCFS2_LINK_MAX 32000
-
-#define S_SHIFT 12
-static unsigned char ocfs2_type_by_mode[S_IFMT >> S_SHIFT] = {
- [S_IFREG >> S_SHIFT] = OCFS2_FT_REG_FILE,
- [S_IFDIR >> S_SHIFT] = OCFS2_FT_DIR,
- [S_IFCHR >> S_SHIFT] = OCFS2_FT_CHRDEV,
- [S_IFBLK >> S_SHIFT] = OCFS2_FT_BLKDEV,
- [S_IFIFO >> S_SHIFT] = OCFS2_FT_FIFO,
- [S_IFSOCK >> S_SHIFT] = OCFS2_FT_SOCK,
- [S_IFLNK >> S_SHIFT] = OCFS2_FT_SYMLINK,
-};
-
-
-/*
- * Convenience casts
- */
-#define OCFS2_RAW_SB(dinode) (&((dinode)->id2.i_super))
-#define OCFS2_LOCAL_ALLOC(dinode) (&((dinode)->id2.i_lab))
-
-
-/*
- * On disk extent record for OCFS2
- * It describes a range of clusters on disk.
- */
-typedef struct _ocfs2_extent_rec {
-/*00*/ __u32 e_cpos; /* Offset into the file, in clusters */
- __u32 e_clusters; /* Clusters covered by this extent */
- __u64 e_blkno; /* Physical disk offset, in blocks */
-/*10*/
-} ocfs2_extent_rec;
-
-typedef struct _ocfs2_chain_rec {
- __u32 c_free; /* Number of free bits in this chain. */
- __u32 c_total; /* Number of total bits in this chain */
- __u64 c_blkno; /* Physical disk offset (blocks) of 1st group */
-} ocfs2_chain_rec;
-
-typedef struct _ocfs2_truncate_rec {
- __u32 t_start; /* 1st cluster in this log */
- __u32 t_clusters; /* Number of total clusters covered */
-} ocfs2_truncate_rec;
-
-/*
- * On disk extent list for OCFS2 (node in the tree). Note that this
- * is contained inside ocfs2_dinode or ocfs2_extent_block, so the
- * offsets are relative to ocfs2_dinode.id2.i_list or
- * ocfs2_extent_block.h_list, respectively.
- */
-typedef struct _ocfs2_extent_list {
-/*00*/ __u16 l_tree_depth; /* Extent tree depth from this
- point. 0 means data extents
- hang directly off this
- header (a leaf) */
- __u16 l_count; /* Number of extent records */
- __u16 l_next_free_rec; /* Next unused extent slot */
- __u16 l_reserved1;
- __u64 l_reserved2; /* Pad to
- sizeof(ocfs2_extent_rec) */
-/*10*/ ocfs2_extent_rec l_recs[0]; /* Extent records */
-} ocfs2_extent_list;
-
-/*
- * On disk allocation chain list for OCFS2. Note that this is
- * contained inside ocfs2_dinode, so the offsets are relative to
- * ocfs2_dinode.id2.i_chain.
- */
-typedef struct _ocfs2_chain_list {
-/*00*/ __u16 cl_cpg; /* Clusters per Block Group */
- __u16 cl_bpc; /* Bits per cluster */
- __u16 cl_count; /* Total chains in this list */
- __u16 cl_next_free_rec; /* Next unused chain slot */
- __u64 cl_reserved1;
-/*10*/ ocfs2_chain_rec cl_recs[0]; /* Chain records */
-} ocfs2_chain_list;
-
-/*
- * On disk deallocation log for OCFS2. Note that this is
- * contained inside ocfs2_dinode, so the offsets are relative to
- * ocfs2_dinode.id2.i_dealloc.
- */
-typedef struct _ocfs2_truncate_log {
-/*00*/ __u16 tl_count; /* Total records in this log */
- __u16 tl_used; /* Number of records in use */
- __u32 tl_reserved1;
-/*08*/ ocfs2_truncate_rec tl_recs[0]; /* Truncate records */
-} ocfs2_truncate_log;
-
-/*
- * On disk extent block (indirect block) for OCFS2
- */
-typedef struct _ocfs2_extent_block
-{
-/*00*/ __u8 h_signature[8]; /* Signature for verification */
- __u64 h_reserved1;
-/*10*/ __s16 h_suballoc_slot; /* Slot suballocator this
- extent_header belongs to */
- __u16 h_suballoc_bit; /* Bit offset in suballocator
- block group */
- __u32 h_fs_generation; /* Must match super block */
- __u64 h_blkno; /* Offset on disk, in blocks */
-/*20*/ __u64 h_reserved3;
- __u64 h_next_leaf_blk; /* Offset on disk, in blocks,
- of next leaf header pointing
- to data */
-/*30*/ ocfs2_extent_list h_list; /* Extent record list */
-/* Actual on-disk size is one block */
-} ocfs2_extent_block;
-
-/*
- * On disk superblock for OCFS2
- * Note that it is contained inside an ocfs2_dinode, so all offsets
- * are relative to the start of ocfs2_dinode.id2.
- */
-typedef struct _ocfs2_super_block {
-/*00*/ __u16 s_major_rev_level;
- __u16 s_minor_rev_level;
- __u16 s_mnt_count;
- __s16 s_max_mnt_count;
- __u16 s_state; /* File system state */
- __u16 s_errors; /* Behaviour when detecting errors */
- __u32 s_checkinterval; /* Max time between checks */
-/*10*/ __u64 s_lastcheck; /* Time of last check */
- __u32 s_creator_os; /* OS */
- __u32 s_feature_compat; /* Compatible feature set */
-/*20*/ __u32 s_feature_incompat; /* Incompatible feature set */
- __u32 s_feature_ro_compat; /* Readonly-compatible feature set */
- __u64 s_root_blkno; /* Offset, in blocks, of root directory
- dinode */
-/*30*/ __u64 s_system_dir_blkno; /* Offset, in blocks, of system
- directory dinode */
- __u32 s_blocksize_bits; /* Blocksize for this fs */
- __u32 s_clustersize_bits; /* Clustersize for this fs */
-/*40*/ __u16 s_max_slots; /* Max number of simultaneous mounts
- before tunefs required */
- __u16 s_reserved1;
- __u32 s_reserved2;
- __u64 s_first_cluster_group; /* Block offset of 1st cluster
- * group header */
-/*50*/ __u8 s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */
-/*90*/ __u8 s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */
-/*A0*/
-} ocfs2_super_block;
-
-/*
- * Local allocation bitmap for OCFS2 slots
- * Note that it exists inside an ocfs2_dinode, so all offsets are
- * relative to the start of ocfs2_dinode.id2.
- */
-typedef struct _ocfs2_local_alloc
-{
-/*00*/ __u32 la_bm_off; /* Starting bit offset in main bitmap */
- __u16 la_size; /* Size of included bitmap, in bytes */
- __u16 la_reserved1;
- __u64 la_reserved2;
-/*10*/ __u8 la_bitmap[0];
-} ocfs2_local_alloc;
-
-/*
- * On disk inode for OCFS2
- */
-typedef struct _ocfs2_dinode {
-/*00*/ __u8 i_signature[8]; /* Signature for validation */
- __u32 i_generation; /* Generation number */
- __s16 i_suballoc_slot; /* Slot suballocator this inode
- belongs to */
- __u16 i_suballoc_bit; /* Bit offset in suballocator
- block group */
-/*10*/ __u32 i_reserved0;
- __u32 i_clusters; /* Cluster count */
- __u32 i_uid; /* Owner UID */
- __u32 i_gid; /* Owning GID */
-/*20*/ __u64 i_size; /* Size in bytes */
- __u16 i_mode; /* File mode */
- __u16 i_links_count; /* Links count */
- __u32 i_flags; /* File flags */
-/*30*/ __u64 i_atime; /* Access time */
- __u64 i_ctime; /* Creation time */
-/*40*/ __u64 i_mtime; /* Modification time */
- __u64 i_dtime; /* Deletion time */
-/*50*/ __u64 i_blkno; /* Offset on disk, in blocks */
- __u64 i_last_eb_blk; /* Pointer to last extent
- block */
-/*60*/ __u32 i_fs_generation; /* Generation per fs-instance */
- __u32 i_atime_nsec;
- __u32 i_ctime_nsec;
- __u32 i_mtime_nsec;
-/*70*/ __u64 i_reserved1[9];
-/*B8*/ union {
- __u64 i_pad1; /* Generic way to refer to this
- 64bit union */
- struct {
- __u64 i_rdev; /* Device number */
- } dev1;
- struct { /* Info for bitmap system
- inodes */
- __u32 i_used; /* Bits (ie, clusters) used */
- __u32 i_total; /* Total bits (clusters)
- available */
- } bitmap1;
- struct { /* Info for journal system
- inodes */
- __u32 ij_flags; /* Mounted, version, etc. */
- __u32 ij_pad;
- } journal1;
- } id1; /* Inode type dependant 1 */
-/*C0*/ union {
- ocfs2_super_block i_super;
- ocfs2_local_alloc i_lab;
- ocfs2_chain_list i_chain;
- ocfs2_extent_list i_list;
- ocfs2_truncate_log i_dealloc;
- __u8 i_symlink[0];
- } id2;
-/* Actual on-disk size is one block */
-} ocfs2_dinode;
-
-/*
- * On-disk directory entry structure for OCFS2
- *
- * Packed as this structure could be accessed unaligned on 64-bit platforms
- */
-struct ocfs2_dir_entry {
-/*00*/ __u64 inode; /* Inode number */
- __u16 rec_len; /* Directory entry length */
- __u8 name_len; /* Name length */
- __u8 file_type;
-/*0C*/ char name[OCFS2_MAX_FILENAME_LEN]; /* File name */
-/* Actual on-disk length specified by rec_len */
-} __attribute__ ((packed));
-
-/*
- * On disk allocator group structure for OCFS2
- */
-typedef struct _ocfs2_group_desc
-{
-/*00*/ __u8 bg_signature[8]; /* Signature for validation */
- __u16 bg_size; /* Size of included bitmap in
- bytes. */
- __u16 bg_bits; /* Bits represented by this
- group. */
- __u16 bg_free_bits_count; /* Free bits count */
- __u16 bg_chain; /* What chain I am in. */
-/*10*/ __u32 bg_generation;
- __u32 bg_reserved1;
- __u64 bg_next_group; /* Next group in my list, in
- blocks */
-/*20*/ __u64 bg_parent_dinode; /* dinode which owns me, in
- blocks */
- __u64 bg_blkno; /* Offset on disk, in blocks */
-/*30*/ __u64 bg_reserved2[2];
-/*40*/ __u8 bg_bitmap[0];
-} ocfs2_group_desc;
-
-#ifdef __KERNEL__
-static inline int ocfs2_fast_symlink_chars(struct super_block *sb)
-{
- return sb->s_blocksize -
- offsetof(struct _ocfs2_dinode, id2.i_symlink);
-}
-
-static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
-{
- int size;
-
- size = sb->s_blocksize -
- offsetof(struct _ocfs2_dinode, id2.i_list.l_recs);
-
- return size / sizeof(struct _ocfs2_extent_rec);
-}
-
-static inline int ocfs2_chain_recs_per_inode(struct super_block *sb)
-{
- int size;
-
- size = sb->s_blocksize -
- offsetof(struct _ocfs2_dinode, id2.i_chain.cl_recs);
-
- return size / sizeof(struct _ocfs2_chain_rec);
-}
-
-static inline int ocfs2_extent_recs_per_eb(struct super_block *sb)
-{
- int size;
-
- size = sb->s_blocksize -
- offsetof(struct _ocfs2_extent_block, h_list.l_recs);
-
- return size / sizeof(struct _ocfs2_extent_rec);
-}
-
-static inline int ocfs2_local_alloc_size(struct super_block *sb)
-{
- int size;
-
- size = sb->s_blocksize -
- offsetof(struct _ocfs2_dinode, id2.i_lab.la_bitmap);
-
- return size;
-}
-
-static inline int ocfs2_group_bitmap_size(struct super_block *sb)
-{
- int size;
-
- size = sb->s_blocksize -
- offsetof(struct _ocfs2_group_desc, bg_bitmap);
-
- return size;
-}
-
-static inline int ocfs2_truncate_recs_per_inode(struct super_block *sb)
-{
- int size;
-
- size = sb->s_blocksize -
- offsetof(struct _ocfs2_dinode, id2.i_dealloc.tl_recs);
-
- return size / sizeof(struct _ocfs2_truncate_rec);
-}
-#else
-static inline int ocfs2_fast_symlink_chars(int blocksize)
-{
- return blocksize - offsetof(struct _ocfs2_dinode, id2.i_symlink);
-}
-
-static inline int ocfs2_extent_recs_per_inode(int blocksize)
-{
- int size;
-
- size = blocksize -
- offsetof(struct _ocfs2_dinode, id2.i_list.l_recs);
-
- return size / sizeof(struct _ocfs2_extent_rec);
-}
-
-static inline int ocfs2_chain_recs_per_inode(int blocksize)
-{
- int size;
-
- size = blocksize -
- offsetof(struct _ocfs2_dinode, id2.i_chain.cl_recs);
-
- return size / sizeof(struct _ocfs2_chain_rec);
-}
-
-static inline int ocfs2_extent_recs_per_eb(int blocksize)
-{
- int size;
-
- size = blocksize -
- offsetof(struct _ocfs2_extent_block, h_list.l_recs);
-
- return size / sizeof(struct _ocfs2_extent_rec);
-}
-
-static inline int ocfs2_local_alloc_size(int blocksize)
-{
- int size;
-
- size = blocksize -
- offsetof(struct _ocfs2_dinode, id2.i_lab.la_bitmap);
-
- return size;
-}
-
-static inline int ocfs2_group_bitmap_size(int blocksize)
-{
- int size;
-
- size = blocksize -
- offsetof(struct _ocfs2_group_desc, bg_bitmap);
-
- return size;
-}
-
-static inline int ocfs2_truncate_recs_per_inode(int blocksize)
-{
- int size;
-
- size = blocksize -
- offsetof(struct _ocfs2_dinode, id2.i_dealloc.tl_recs);
-
- return size / sizeof(struct _ocfs2_truncate_rec);
-}
-#endif /* __KERNEL__ */
-
-
-static inline int ocfs2_system_inode_is_global(int type)
-{
- return ((type >= 0) &&
- (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE));
-}
-
-static inline int ocfs2_sprintf_system_inode_name(char *buf, int len,
- int type, int slot)
-{
- int chars;
-
- /*
- * Global system inodes can only have one copy. Everything
- * after OCFS2_LAST_GLOBAL_SYSTEM_INODE in the system inode
- * list has a copy per slot.
- */
- if (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE)
- chars = snprintf(buf, len,
- ocfs2_system_inodes[type].si_name);
- else
- chars = snprintf(buf, len,
- ocfs2_system_inodes[type].si_name,
- slot);
-
- return chars;
-}
-
-static inline void ocfs2_set_de_type(struct ocfs2_dir_entry *de,
- umode_t mode)
-{
- de->file_type = ocfs2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
-}
-
-#endif /* _OCFS2_FS_H */
-
Copied: tags/ocfs2-tools-1.1.0-ALPHA/libocfs2/include/ocfs2_fs.h (from rev 1045, trunk/libocfs2/include/ocfs2_fs.h)
More information about the Ocfs2-tools-commits
mailing list