public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] use lpath_to_handle when restoring symlinks
@ 2009-10-22 16:52 Bill Kendall
  2009-10-23 18:13 ` Alex Elder
  2009-10-25  7:05 ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Bill Kendall @ 2009-10-22 16:52 UTC (permalink / raw)
  To: xfs

Update xfsrestore to use the new lpath_to_handle function
when dealing with symlinks.

Signed-off-by: Bill Kendall <wkendall@sgi.com>

diff --git a/restore/content.c b/restore/content.c
index eb6e78c..99549a8 100644
--- a/restore/content.c
+++ b/restore/content.c
@@ -797,7 +797,6 @@ static void partial_reg(ix_t d_index, xfs_ino_t ino, off64_t fsize,
                          off64_t offset, off64_t sz);
  static bool_t partial_check (xfs_ino_t ino, off64_t fsize);
  static bool_t partial_check2 (partial_rest_t *isptr, off64_t fsize);
-static int do_fssetdm_by_handle( char *path, fsdmidata_t *fdmp);
  static int quotafilecheck(char *type, char *dstdir, char *quotafile);

  /* definition of locally defined global variables ****************************/
@@ -7895,14 +7894,28 @@ restore_symlink( drive_t *drivep,
  		}

  		if ( persp->a.restoredmpr) {
-		fsdmidata_t fssetdm;
-		
-		/*	Restore DMAPI fields. */
+			fsdmidata_t fssetdm;
+			void *hanp;
+			size_t hlen=0;

-		fssetdm.fsd_dmevmask = bstatp->bs_dmevmask;
-		fssetdm.fsd_padding = 0;
-		fssetdm.fsd_dmstate = bstatp->bs_dmstate;
-		rval = do_fssetdm_by_handle(path, &fssetdm);
+			/*	Restore DMAPI fields. */
+			fssetdm.fsd_dmevmask = bstatp->bs_dmevmask;
+			fssetdm.fsd_padding = 0;
+			fssetdm.fsd_dmstate = bstatp->bs_dmstate;
+
+			if (lpath_to_handle(persp->a.dstdir, path, &hanp, &hlen)) {
+				mlog( MLOG_NORMAL | MLOG_WARNING, _(
+					"lpath_to_handle of %s failed: %s\n"),
+					path, strerror( errno ));
+			} else {
+				if (fssetdm_by_handle(hanp, hlen, &fssetdm)) {
+					mlog( MLOG_NORMAL | MLOG_WARNING,
+						_("fssetdm_by_handle of %s "
+						"failed: %s\n"),
+						path, strerror( errno ));
+				}
+				free_handle(hanp, hlen);
+			}
  		}
  	}

@@ -9525,32 +9538,6 @@ display_needed_objects( purp_t purp,
  }

  static int
-do_fssetdm_by_handle(
-	char		*path,
-	fsdmidata_t	*fdmp)
-{
-	void		*hanp;
-	size_t		hlen=0;
-	int		rc;
-
-	if (path_to_handle(path, &hanp, &hlen)) {
-		mlog( MLOG_NORMAL | MLOG_WARNING, _(
-			"path_to_handle of %s failed:%s\n"),
-			path, strerror( errno ));
-		return -1;
-	}
-
-	rc = fssetdm_by_handle(hanp, hlen, fdmp);
-	free_handle(hanp, hlen);
-	if (rc) {
-		mlog( MLOG_NORMAL | MLOG_WARNING, _(
-			"fssetdm_by_handle of %s failed %s\n"),
-			path, strerror( errno ));
-	}
-	return rc;
-}
-
-static int
  quotafilecheck(char *type, char *dstdir, char *quotafile)
  {
  	struct stat s;

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH 2/2] use lpath_to_handle when restoring symlinks
  2009-10-22 16:52 [PATCH 2/2] use lpath_to_handle when restoring symlinks Bill Kendall
@ 2009-10-23 18:13 ` Alex Elder
  2009-10-25  7:05 ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Elder @ 2009-10-23 18:13 UTC (permalink / raw)
  To: Bill Kendall; +Cc: xfs

Bill Kendall wrote:
> Update xfsrestore to use the new lpath_to_handle function
> when dealing with symlinks.

Looks good.		-Alex

> Signed-off-by: Bill Kendall <wkendall@sgi.com>

Reviewed-by: Alex Elder <aelder@sgi.com>

> diff --git a/restore/content.c b/restore/content.c
> index eb6e78c..99549a8 100644
> --- a/restore/content.c
> +++ b/restore/content.c
> @@ -797,7 +797,6 @@ static void partial_reg(ix_t d_index, xfs_ino_t ino, off64_t fsize,
>                           off64_t offset, off64_t sz);
>   static bool_t partial_check (xfs_ino_t ino, off64_t fsize);
>   static bool_t partial_check2 (partial_rest_t *isptr, off64_t fsize);
> -static int do_fssetdm_by_handle( char *path, fsdmidata_t *fdmp);
>   static int quotafilecheck(char *type, char *dstdir, char *quotafile);
> 
>   /* definition of locally defined global variables ****************************/
> @@ -7895,14 +7894,28 @@ restore_symlink( drive_t *drivep,
>   		}
> 
>   		if ( persp->a.restoredmpr) {
> -		fsdmidata_t fssetdm;
> -
> -		/*	Restore DMAPI fields. */
> +			fsdmidata_t fssetdm;
> +			void *hanp;
> +			size_t hlen=0;
> 
> -		fssetdm.fsd_dmevmask = bstatp->bs_dmevmask;
> -		fssetdm.fsd_padding = 0;
> -		fssetdm.fsd_dmstate = bstatp->bs_dmstate;
> -		rval = do_fssetdm_by_handle(path, &fssetdm);
> +			/*	Restore DMAPI fields. */
> +			fssetdm.fsd_dmevmask = bstatp->bs_dmevmask;
> +			fssetdm.fsd_padding = 0;
> +			fssetdm.fsd_dmstate = bstatp->bs_dmstate;
> +
> +			if (lpath_to_handle(persp->a.dstdir, path, &hanp, &hlen)) {
> +				mlog( MLOG_NORMAL | MLOG_WARNING, _(
> +					"lpath_to_handle of %s failed: %s\n"),
> +					path, strerror( errno ));
> +			} else {
> +				if (fssetdm_by_handle(hanp, hlen, &fssetdm)) {
> +					mlog( MLOG_NORMAL | MLOG_WARNING,
> +						_("fssetdm_by_handle of %s "
> +						"failed: %s\n"),
> +						path, strerror( errno ));
> +				}
> +				free_handle(hanp, hlen);
> +			}
>   		}
>   	}
> 
> @@ -9525,32 +9538,6 @@ display_needed_objects( purp_t purp,
>   }
> 
>   static int
> -do_fssetdm_by_handle(
> -	char		*path,
> -	fsdmidata_t	*fdmp)
> -{
> -	void		*hanp;
> -	size_t		hlen=0;
> -	int		rc;
> -
> -	if (path_to_handle(path, &hanp, &hlen)) {
> -		mlog( MLOG_NORMAL | MLOG_WARNING, _(
> -			"path_to_handle of %s failed:%s\n"),
> -			path, strerror( errno ));
> -		return -1;
> -	}
> -
> -	rc = fssetdm_by_handle(hanp, hlen, fdmp);
> -	free_handle(hanp, hlen);
> -	if (rc) {
> -		mlog( MLOG_NORMAL | MLOG_WARNING, _(
> -			"fssetdm_by_handle of %s failed %s\n"),
> -			path, strerror( errno ));
> -	}
> -	return rc;
> -}
> -
> -static int
>   quotafilecheck(char *type, char *dstdir, char *quotafile)
>   {
>   	struct stat s;
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] use lpath_to_handle when restoring symlinks
  2009-10-22 16:52 [PATCH 2/2] use lpath_to_handle when restoring symlinks Bill Kendall
  2009-10-23 18:13 ` Alex Elder
@ 2009-10-25  7:05 ` Christoph Hellwig
  2009-10-27 15:36   ` Bill Kendall
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2009-10-25  7:05 UTC (permalink / raw)
  To: Bill Kendall; +Cc: xfs

On Thu, Oct 22, 2009 at 11:52:32AM -0500, Bill Kendall wrote:
> Update xfsrestore to use the new lpath_to_handle function
> when dealing with symlinks.

Requiring a simultanously released version of xfsprogs is a very bad
idea.  The right fix is to add an autoconf check for the new function
and use it when available, falling back to the inferior old version
if it is not available.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] use lpath_to_handle when restoring symlinks
  2009-10-25  7:05 ` Christoph Hellwig
@ 2009-10-27 15:36   ` Bill Kendall
  2009-10-28  3:34     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Bill Kendall @ 2009-10-27 15:36 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On 10/25/2009 02:05 AM, Christoph Hellwig wrote:
> On Thu, Oct 22, 2009 at 11:52:32AM -0500, Bill Kendall wrote:
>> Update xfsrestore to use the new lpath_to_handle function
>> when dealing with symlinks.
> 
> Requiring a simultanously released version of xfsprogs is a very bad
> idea.  The right fix is to add an autoconf check for the new function
> and use it when available, falling back to the inferior old version
> if it is not available.

Good thought. However, there's also a run-time dependency since
xfsrestore uses libhandle.so rather than the .a. I can rework something
using dlsym - sound okay?

Bill

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] use lpath_to_handle when restoring symlinks
  2009-10-27 15:36   ` Bill Kendall
@ 2009-10-28  3:34     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2009-10-28  3:34 UTC (permalink / raw)
  To: Bill Kendall; +Cc: Christoph Hellwig, xfs

On Tue, Oct 27, 2009 at 10:36:04AM -0500, Bill Kendall wrote:
> On 10/25/2009 02:05 AM, Christoph Hellwig wrote:
>> On Thu, Oct 22, 2009 at 11:52:32AM -0500, Bill Kendall wrote:
>>> Update xfsrestore to use the new lpath_to_handle function
>>> when dealing with symlinks.
>>
>> Requiring a simultanously released version of xfsprogs is a very bad
>> idea.  The right fix is to add an autoconf check for the new function
>> and use it when available, falling back to the inferior old version
>> if it is not available.
>
> Good thought. However, there's also a run-time dependency since
> xfsrestore uses libhandle.so rather than the .a. I can rework something
> using dlsym - sound okay?

That's why the minor version of a shared library needs to get bumped
when adding a new symbol, see one of my replies to Alex.  Of course
symbol versioning would be even better, I'll see if I can port it from
acl/attr which use the same build system as xfsprogs.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-10-28  3:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-22 16:52 [PATCH 2/2] use lpath_to_handle when restoring symlinks Bill Kendall
2009-10-23 18:13 ` Alex Elder
2009-10-25  7:05 ` Christoph Hellwig
2009-10-27 15:36   ` Bill Kendall
2009-10-28  3:34     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox