[comp.unix.programmer] Porting dump & Brain dead file systems

longshot@ei.ecn.purdue.edu (Rebel Without a Clue) (06/04/91)

	I am having problems trying to extrapolate from the BSD file
  system structure to a less informative filesystem strucuture.  I am porting
  to a Stardent 3000 running Sys V and restricting dump to the Ardent Fast
  File System (AFFS) which lucky for me will be documented in the next 
  release (Yeah right!)  The BSD file system structure has many fields which
  have no counterpart in the AFFS and this is causing much confusion.

	Any pointers to a very verbose description of the BSD structure
  (found in fs(4)) or suggestions will be welcomed.  I will also attach the 
  AFFS structure.

	Thank you in advance...

--longshot

Copyright (C) 1988, by Ardent Computer Corp.
Copyright (C) 1986, by Dana Computer Inc.
        All Rights Reserved

/*  The file system structure defines the file system super block.  The
 *  super block itself is divided into two pieces: those fields that are
 *  read from disk, and those used only while the file system is actively
 *  mounted.  The superblock and the inode indirect block are replicated
 *  on the disk at the first and last cylinders on the top and bottom
 *  platters of the disk - these were choosen as phyically disjoint locations
 *  to protect the information necessary to salvage the file system from
 *  catastrophic loss.
 */

typedef struct {
	/*  Information stored on the disk media			*/

	ulong	ffs_magic;	/*  Magic number for file system	*/

	daddr_t	ffs_size;	/*  Size (in blocks) of the file system	*/
	ushort	ffs_tracksize;	/*  Size (in blocks) of a logical track	*/
	ushort	ffs_cylsize;	/*  Size (in tracks) of a log. cylinder	*/

	daddr_t	ffs_datablk;	/*  Disk address of the first data blk	*/

	char	ffs_fname[6];	/*  File system "name"			*/
	char	ffs_fpack[6];	/*  File system "pack name"		*/

	/*  Fields used while file system is actively mounted		*/

	ulong	ffs_flags;	/*  File system flags - see below	*/
	time_t	ffs_utime;	/*  Time of last superblock update	*/

	semaphore_t	ffs_isema;	/* Inode list modification lock */
	ushort		ffs_inoblks;	/*  Inode blocks allocated	*/
	ulong		ffs_ifree;	/*  Total free inodes		*/
	iblock_t	*ffs_iblock;	/*  Pointer to the iblock	*/

	semaphore_t	ffs_msema;	/*  Bit map usage lock		*/
	ulong		ffs_bfree;	/*  Total free blocks		*/
	ulong		ffs_bmapsize;	/*  Pages used by block map	*/
	unsigned	*ffs_bmap;	/*  The free block bit map	*/

	unsigned	*ffs_lastptr;	/*  Last overhead block alloc'd	*/
	ulong		ffs_version;	/*  FIle system version		*/
	ulong		ffs_state;	/*  Last state of file system	*/
	unsigned	ffs_dbnox;
	unsigned	ffs_pad[289];
	unsigned	ffs_trkmsk[1];
}
	filsys_t;

--
longshot@ecn.purdue.edu	   (Rich Long)

  To be "remembered with an affection and veneration that shall surge high
     above the waters of oblivion and glisten through the rust of time."