[PATCH] add prototypes for ujfs_put_logsuper/ujfs_get_logsuper

Christoph Hellwig <[email protected]> Fri, 9 Aug 2002 18:44:11 +0100
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
Also makes all function in super.c return ints instead of int32_ts.

When I stepped through that code (again) I got to the conclusion (also
again) that the userpsace code needs some big overhaul..

Currently the interfaces exported from libfs, it's headers and the absuse
of fsck code in other utilities is just horrible, and so is the ever
changing coding style.  I don't really have the time for that, as it is
a lot of work, though.

Having a library that is useable by third-party tools instead of duplicating
code and headers (like in the evms jfs) must be one of our mid-term goals,
IMHO.



2002-08-10  Christoph Hellwig  <[email protected]>

	* jfs_logmgr.h: Provide alternative struct identifier for logsuper_t.
	* libfs/super.c (inrange): Return int instead of int32_t.
	(validate_sizes): Likewise.
	(ujfs_validate_super): Likewise.
	(ujfs_put_superblk): Likewise.
	(ujfs_get_superblk): Likewise.
	* libfs/super.h: Update prototypes for the above change, add missing
	prototypes for ujfs_put_logsuper and ujfs_get_logsuper, add needed
	struct forward declarations.
	* xpeek/fsckcbbl.c: Include <super.h>.


Index: include/jfs_logmgr.h
===================================================================
RCS file: /usr/cvs/jfs/jfsutils/include/jfs_logmgr.h,v
retrieving revision 1.6
diff -u -p -r1.6 jfs_logmgr.h
--- include/jfs_logmgr.h	12 Jul 2002 21:55:51 -0000	1.6
+++ include/jfs_logmgr.h	9 Aug 2002 17:14:31 -0000
@@ -64,7 +64,7 @@
 
 #define MAX_ACTIVE	128	/* Max active file systems sharing log */
 
-typedef struct {
+typedef struct logsuper {
 	uint32_t magic;		/* 4: log lv identifier */
 	int32_t version;	/* 4: version number */
 	int32_t serial;		/* 4: log open/mount counter */
Index: libfs/super.c
===================================================================
RCS file: /usr/cvs/jfs/jfsutils/libfs/super.c,v
retrieving revision 1.8
diff -u -p -r1.8 super.c
--- libfs/super.c	8 Aug 2002 16:02:49 -0000	1.8
+++ libfs/super.c	9 Aug 2002 17:14:35 -0000
@@ -47,9 +47,9 @@
  *
  * RETURNS: If it is, it returns 1, else 0
  */
-int32_t inrange( uint32_t  num,
-                 uint32_t  low,
-                 uint32_t  high )
+int inrange( uint32_t  num,
+             uint32_t  low,
+             uint32_t  high )
 {
     if( low ) {
         for( ; low <= high; low <<= 1 ) {
@@ -85,7 +85,7 @@ int32_t inrange( uint32_t  num,
  *      success: 0
  *      failure:  any other value
  */
-static int32_t validate_sizes( struct superblock *sb )
+static int validate_sizes( struct superblock *sb )
 {
     /*
      * Make sure AG size is at least 32M
@@ -120,7 +120,7 @@ static int32_t validate_sizes( struct su
  *      success: 0
  *      failure: LIBFS_CORRUPTSUPER, LIBFS_BADVERSION, LIBFS_BADMAGIC
  */
-int32_t ujfs_validate_super( struct superblock *sb )
+int ujfs_validate_super( struct superblock *sb )
 {
     if( memcmp(sb->s_magic, JFS_MAGIC, sizeof(sb->s_magic)) == 0 ) {
         if( sb->s_version > JFS_VERSION )
@@ -163,9 +163,9 @@ int32_t ujfs_validate_super( struct supe
  *      success: 0
  *      failure: any other value
  */
-int32_t ujfs_put_superblk( HFILE              fd,
-                           struct superblock  *sb,
-                           int16_t            is_primary )
+int ujfs_put_superblk( HFILE              fd,
+                       struct superblock  *sb,
+                       int16_t            is_primary )
 {
     char     buf[SIZE_OF_SUPER];
     int32_t  rc;
@@ -209,9 +209,9 @@ int32_t ujfs_put_superblk( HFILE        
  *      success: 0
  *      failure: any other value
  */
-int32_t ujfs_get_superblk( HFILE              fd,
-                           struct superblock  *sb,
-                           int32_t            is_primary )
+int ujfs_get_superblk( HFILE              fd,
+                       struct superblock  *sb,
+                       int32_t            is_primary )
 {
     int32_t  rc;
     char     buf[SIZE_OF_SUPER];
Index: libfs/super.h
===================================================================
RCS file: /usr/cvs/jfs/jfsutils/libfs/super.h,v
retrieving revision 1.4
diff -u -p -r1.4 super.h
--- libfs/super.h	12 Jul 2002 21:55:53 -0000	1.4
+++ libfs/super.h	9 Aug 2002 17:14:35 -0000
@@ -20,9 +20,14 @@
 
 #include "utilsubs.h"
 
-int32_t ujfs_validate_super(struct superblock *);
-int32_t ujfs_put_superblk(HFILE, struct superblock *, int16_t);
-int32_t ujfs_get_superblk(HFILE, struct superblock *, int32_t);
-int32_t inrange(uint32_t, uint32_t, uint32_t);
+struct superblock;
+struct logsuper;
+
+extern int ujfs_validate_super(struct superblock *);
+extern int ujfs_put_superblk(HFILE, struct superblock *, int16_t);
+extern int ujfs_get_superblk(HFILE, struct superblock *, int32_t);
+extern int ujfs_put_logsuper(HFILE, struct logsuper *);
+extern int ujfs_get_logsuper(HFILE, struct logsuper *);
+extern int inrange(uint32_t, uint32_t, uint32_t);
 
 #endif
Index: xpeek/fsckcbbl.c
===================================================================
RCS file: /usr/cvs/jfs/jfsutils/xpeek/fsckcbbl.c,v
retrieving revision 1.7
diff -u -p -r1.7 fsckcbbl.c
--- xpeek/fsckcbbl.c	8 Aug 2002 16:02:49 -0000	1.7
+++ xpeek/fsckcbbl.c	9 Aug 2002 17:14:35 -0000
@@ -26,6 +26,7 @@
 #include <fsckcbbl.h>
 #include <fsckwsp.h>
 #include <jfs_endian.h>
+#include <super.h>
 
 /* global data */
 extern int64_t fsckwsp_offset;	/* defined in xpeek.c    */