public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH 1/3] xfsdump: extend fs_info to gather fs feature flags
Date: Fri, 12 Oct 2012 16:35:02 -0500	[thread overview]
Message-ID: <50788D06.2030309@sandeen.net> (raw)
In-Reply-To: <50788C50.40600@redhat.com>

extend fs_info and fs_getid to return fs flags (features)
from GEOM call as well.  Not used yet in this patch.
Will be used in subsequent patch to detect 32-bit project
ID filesystems.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/common/fs.c b/common/fs.c
index 6f4cb6c..bf2f164 100644
--- a/common/fs.c
+++ b/common/fs.c
@@ -111,6 +111,7 @@ fs_info( char *typb,		/* out */
 	 char *mntb,		/* out */
 	 intgen_t mntbz,
 	 uuid_t *idb,		/* out */
+	 __u32 *flgb,		/* out */
 	 char *usrs )		/* in */
 {
 	struct stat64 statb;
@@ -164,10 +165,10 @@ fs_info( char *typb,		/* out */
 	ASSERT( ok != BOOL_UNKNOWN );
 
 	if ( ok == BOOL_TRUE ) {
-		intgen_t rval = fs_getid( mntb, idb );
+		intgen_t rval = fs_getinfo( mntb, idb, flgb );
 		if ( rval ) {
 			mlog( MLOG_NORMAL,
-			      _("unable to determine uuid of fs mounted at %s: "
+			      _("unable to determine info for fs mounted at %s: "
 			      "%s\n"),
 			      mntb,
 			      strerror( errno ));
@@ -176,9 +177,9 @@ fs_info( char *typb,		/* out */
 			char string_uuid[37];
 			uuid_unparse( *idb, string_uuid );
 			mlog( MLOG_DEBUG,
-			      "fs %s uuid [%s]\n",
+			      "fs %s uuid [%s] flags [0x%x]\n",
 			      mntb,
-			      string_uuid );
+			      string_uuid, *flgb );
 		}
 	}
 
@@ -197,23 +198,25 @@ fs_mounted( char *typs, char *chrs, char *mnts, uuid_t *idp )
 }
 
 intgen_t
-fs_getid( char *mnts, uuid_t *idb )
+fs_getinfo( char *mnts, uuid_t *idb, __u32 *flgb )
 {
 	xfs_fsop_geom_v1_t geo;
 	int fd;
 
+	uuid_clear( *idb );
+	*flgb = 0;
+
 	fd = open( mnts, O_RDONLY );
-	if ( fd < 0 ) {
-		uuid_clear( *idb );
+	if ( fd < 0 )
 		return -1;
-	}
+
 	if ( ioctl(fd, XFS_IOC_FSGEOMETRY_V1, &geo ) ) {
-		uuid_clear( *idb );
 		close(fd);
 		return -1;
 	}
 	close(fd);
 	uuid_copy( *idb, geo.uuid );
+	*flgb = geo.flags;
 
 	return 0;
 }
diff --git a/common/fs.h b/common/fs.h
index 9ad1636..878385b 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -39,6 +39,7 @@ extern bool_t fs_info( char *fstype,		/* out: fs type (fsid.h) */
 		       char *mntpt,		/* out: where fs mounted */
 		       intgen_t mntptsz,	/* in: buffer size */
 		       uuid_t *fsid,		/* out: fs uuid */
+		       __u32 *fsflags,		/* out: fs flags */
 		       char *srcname );		/* in: how user named the fs */
 
 /* fs_mounted - checks if a file system is mounted at its mount point
@@ -48,10 +49,10 @@ extern bool_t fs_mounted( char *fstype,
 		          char *mntpt,
 		          uuid_t *fsid );
 
-/* fs_getid - retrieves the uuid of the file system containing the named
- * file. returns -1 with errno set on error.
+/* fs_getinfo - retrieves the uuid & flags of the file system containing the
+ * named file. returns -1 with errno set on error.
  */
-extern intgen_t fs_getid( char *fullpathname, uuid_t *fsidp );
+extern intgen_t fs_getinfo( char *fullpathname, uuid_t *fsidp, __u32 *fsflgp );
 
 /* tells how many inos in use
  */
diff --git a/dump/content.c b/dump/content.c
index ec5e954..9ed8459 100644
--- a/dump/content.c
+++ b/dump/content.c
@@ -526,6 +526,7 @@ content_init( intgen_t argc,
 	char fstype[ CONTENT_HDR_FSTYPE_SZ ];
 	bool_t skip_unchanged_dirs = BOOL_FALSE;
 	uuid_t fsid;
+	__u32 fsflags;
 	bool_t underfoundpr;
 	ix_t underlevel = ( ix_t )( -1 );
 	time32_t undertime = 0;
@@ -770,6 +771,7 @@ content_init( intgen_t argc,
 			mntpnt,
 			sizeof( mntpnt ),
 			&fsid,
+			&fsflags,
 			srcname )) {
 
 		mlog( MLOG_NORMAL | MLOG_ERROR, _(
@@ -789,7 +791,6 @@ content_init( intgen_t argc,
 		      srcname );
 		return BOOL_FALSE;
 	}
-
 	/* place the fs info in the write hdr template
 	 */
 	( void )strncpyterm( cwhdrtemplatep->ch_mntpnt,
diff --git a/dump/var.c b/dump/var.c
index 8370fa4..7adcc7d 100644
--- a/dump/var.c
+++ b/dump/var.c
@@ -79,11 +79,12 @@ void
 var_skip( uuid_t *dumped_fsidp, void ( *cb )( xfs_ino_t ino ))
 {
 	uuid_t fsid;
+	__u32 fsflags;
 	intgen_t rval;
 
 	/* see if the fs uuid's match
 	 */
-	rval = fs_getid( XFSDUMP_DIRPATH, &fsid );
+	rval = fs_getinfo( XFSDUMP_DIRPATH, &fsid, &fsflags);
 	if ( rval ) {
 #ifdef HIDDEN
                 /* NOTE: this will happen for non-XFS file systems */

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2012-10-12 21:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12 21:32 [PATCH 0/3] xfsdump: more projid32bit fixes Eric Sandeen
2012-10-12 21:35 ` Eric Sandeen [this message]
2012-11-09 18:31   ` [PATCH 1/3] xfsdump: extend fs_info to gather fs feature flags Rich Johnston
2012-10-12 21:37 ` [PATCH 2/3] xfsdump: default to V3, use V4 if projid32bit is set Eric Sandeen
2012-11-09 18:31   ` Rich Johnston
2012-11-09 18:32     ` Eric Sandeen
2012-10-12 21:42 ` [PATCH 3/3] xfsdump: refuse restore of V4 format unless FS has projid32bit set Eric Sandeen
2012-11-09 18:32   ` Rich Johnston
2012-10-22 14:36 ` [PATCH 0/3] xfsdump: more projid32bit fixes Eric Sandeen
2012-10-22 15:56   ` Ben Myers
2012-10-22 16:22     ` Eric Sandeen
2012-10-22 20:24       ` Ben Myers
2012-10-22 20:30         ` Eric Sandeen
2012-10-22 20:11 ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50788D06.2030309@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox