linux/fs/jfs/jfs_dtree.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 *   Copyright (C) International Business Machines Corp., 2000-2002
 */
#ifndef _H_JFS_DTREE
#define _H_JFS_DTREE

/*
 *	jfs_dtree.h: directory B+-tree manager
 */

#include "jfs_btree.h"

ddata_t;


/*
 *	entry segment/slot
 *
 * an entry consists of type dependent head/only segment/slot and
 * additional segments/slots linked vi next field;
 * N.B. last/only segment of entry is terminated by next = -1;
 */
/*
 *	directory page slot
 */
struct dtslot {};				/* (32) */


#define DATASLOTSIZE
#define L2DATASLOTSIZE
#define DTSLOTSIZE
#define L2DTSLOTSIZE
#define DTSLOTHDRSIZE
#define DTSLOTDATASIZE
#define DTSLOTDATALEN

/*
 *	 internal node entry head/only segment
 */
struct idtentry {};				/* (32) */

#define DTIHDRSIZE
#define DTIHDRDATALEN

/* compute number of slots for entry */
#define NDTINTERNAL(klen)


/*
 *	leaf node entry head/only segment
 *
 *	For legacy filesystems, name contains 13 wchars -- no index field
 */
struct ldtentry {};				/* (32) */

#define DTLHDRSIZE
#define DTLHDRDATALEN_LEGACY
#define DTLHDRDATALEN

/*
 * dir_table used for directory traversal during readdir
 */

/*
 * Keep persistent index for directory entries
 */
#define DO_INDEX(INODE)

/*
 * Maximum entry in inline directory table
 */
#define MAX_INLINE_DIRTABLE_ENTRY

struct dir_table_slot {};				/* (8) */

/*
 * flag values
 */
#define DIR_INDEX_VALID
#define DIR_INDEX_FREE

#define DTSaddress(dir_table_slot, address64)

#define addressDTS(dts)

/* compute number of slots for entry */
#define NDTLEAF_LEGACY(klen)
#define NDTLEAF


/*
 *	directory root page (in-line in on-disk inode):
 *
 * cf. dtpage_t below.
 */
dtroot_t;

#define PARENT(IP)

#define DTROOTMAXSLOT

#define dtEmpty(IP)


/*
 *	directory regular page:
 *
 *	entry slot array of 32 byte slot
 *
 * sorted entry slot index table (stbl):
 * contiguous slots at slot specified by stblindex,
 * 1-byte per entry
 *   512 byte block:  16 entry tbl (1 slot)
 *  1024 byte block:  32 entry tbl (1 slot)
 *  2048 byte block:  64 entry tbl (2 slot)
 *  4096 byte block: 128 entry tbl (4 slot)
 *
 * data area:
 *   512 byte block:  16 - 2 =  14 slot
 *  1024 byte block:  32 - 2 =  30 slot
 *  2048 byte block:  64 - 3 =  61 slot
 *  4096 byte block: 128 - 5 = 123 slot
 *
 * N.B. index is 0-based; index fields refer to slot index
 * except nextindex which refers to entry index in stbl;
 * end of entry stot list or freelist is marked with -1.
 */
dtpage_t;

#define DTPAGEMAXSLOT

#define DT8THPGNODEBYTES
#define DT8THPGNODETSLOTS
#define DT8THPGNODESLOTS

#define DTQTRPGNODEBYTES
#define DTQTRPGNODETSLOTS
#define DTQTRPGNODESLOTS

#define DTHALFPGNODEBYTES
#define DTHALFPGNODETSLOTS
#define DTHALFPGNODESLOTS

#define DTFULLPGNODEBYTES
#define DTFULLPGNODETSLOTS
#define DTFULLPGNODESLOTS

#define DTENTRYSTART

/* get sorted entry table of the page */
#define DT_GETSTBL(p)

/*
 * Flags for dtSearch
 */
#define JFS_CREATE
#define JFS_LOOKUP
#define JFS_REMOVE
#define JFS_RENAME

/*
 * Maximum file offset for directories.
 */
#define DIREND

/*
 *	external declarations
 */
extern void dtInitRoot(tid_t tid, struct inode *ip, u32 idotdot);

extern int dtSearch(struct inode *ip, struct component_name * key,
		    ino_t * data, struct btstack * btstack, int flag);

extern int dtInsert(tid_t tid, struct inode *ip, struct component_name * key,
		    ino_t * ino, struct btstack * btstack);

extern int dtDelete(tid_t tid, struct inode *ip, struct component_name * key,
		    ino_t * data, int flag);

extern int dtModify(tid_t tid, struct inode *ip, struct component_name * key,
		    ino_t * orig_ino, ino_t new_ino, int flag);

extern int jfs_readdir(struct file *file, struct dir_context *ctx);
#endif				/* !_H_JFS_DTREE */