All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs-progs: Fix minor problems with btrfslabel.c
@ 2013-01-24 15:52 Gene Czarcinski
  2013-01-25  3:04 ` Anand Jain
  0 siblings, 1 reply; 2+ messages in thread
From: Gene Czarcinski @ 2013-01-24 15:52 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Gene Czarcinski, Danny Kukawka

Fixed indentation, replace spaces with tabs.
Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>

Rebased, also fixed compiler warnings
Signed-off-by: Gene Czarcinski <gene@czarc.net>
---
 btrfslabel.c | 57 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/btrfslabel.c b/btrfslabel.c
index 88a5196..bea1f89 100644
--- a/btrfslabel.c
+++ b/btrfslabel.c
@@ -48,42 +48,43 @@
 
 static int change_label_unmounted(char *dev, char *nLabel)
 {
-       struct btrfs_root *root;
-       struct btrfs_trans_handle *trans;
-
-       /* Open the super_block at the default location
-        * and as read-write.
-        */
-       root = open_ctree(dev, 0, 1);
-       if (!root) /* errors are printed by open_ctree() */
-         return;
-
-       trans = btrfs_start_transaction(root, 1);
-       strncpy(root->fs_info->super_copy.label, nLabel, BTRFS_LABEL_SIZE);
-       root->fs_info->super_copy.label[BTRFS_LABEL_SIZE-1] = 0;
-       btrfs_commit_transaction(trans, root);
-
-       /* Now we close it since we are done. */
-       close_ctree(root);
+	struct btrfs_root *root;
+	struct btrfs_trans_handle *trans;
+
+	/* Open the super_block at the default location
+	 * and as read-write.
+	 */
+	root = open_ctree(dev, 0, 1);
+	if (!root) /* errors are printed by open_ctree() */
+	  return -1;
+
+	trans = btrfs_start_transaction(root, 1);
+	strncpy(root->fs_info->super_copy.label, nLabel, BTRFS_LABEL_SIZE);
+	root->fs_info->super_copy.label[BTRFS_LABEL_SIZE-1] = 0;
+	btrfs_commit_transaction(trans, root);
+
+	/* Now we close it since we are done. */
+	close_ctree(root);
+	return 0;
 }
 
 int get_label_unmounted(char *dev)
 {
-       struct btrfs_root *root;
+	struct btrfs_root *root;
 
-       /* Open the super_block at the default location
-        * and as read-only.
-        */
-       root = open_ctree(dev, 0, 0);
+	/* Open the super_block at the default location
+	 * and as read-only.
+	 */
+	root = open_ctree(dev, 0, 0);
 
-       if(!root)
-         return -1;
+	if(!root)
+	  return -1;
 
-       fprintf(stdout, "%s\n", root->fs_info->super_copy.label);
+	fprintf(stdout, "%s\n", root->fs_info->super_copy.label);
 
-       /* Now we close it since we are done. */
-       close_ctree(root);
-       return 0;
+	/* Now we close it since we are done. */
+	close_ctree(root);
+	return 0;
 }
 
 int get_label(char *btrfs_dev)
-- 
1.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-

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

* Re: [PATCH] Btrfs-progs: Fix minor problems with btrfslabel.c
  2013-01-24 15:52 [PATCH] Btrfs-progs: Fix minor problems with btrfslabel.c Gene Czarcinski
@ 2013-01-25  3:04 ` Anand Jain
  0 siblings, 0 replies; 2+ messages in thread
From: Anand Jain @ 2013-01-25  3:04 UTC (permalink / raw)
  To: Gene Czarcinski; +Cc: linux-btrfs, Danny Kukawka


  Thanks. comments below.

On 01/24/2013 11:52 PM, Gene Czarcinski wrote:
> Fixed indentation, replace spaces with tabs.
> Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
>
> Rebased, also fixed compiler warnings
> Signed-off-by: Gene Czarcinski <gene@czarc.net>
> ---
>   btrfslabel.c | 57 +++++++++++++++++++++++++++++----------------------------
>   1 file changed, 29 insertions(+), 28 deletions(-)
>
> diff --git a/btrfslabel.c b/btrfslabel.c
> index 88a5196..bea1f89 100644
> --- a/btrfslabel.c
> +++ b/btrfslabel.c
> @@ -48,42 +48,43 @@
>
>   static int change_label_unmounted(char *dev, char *nLabel)
>   {
> -       struct btrfs_root *root;
> -       struct btrfs_trans_handle *trans;
> -
> -       /* Open the super_block at the default location
> -        * and as read-write.
> -        */
> -       root = open_ctree(dev, 0, 1);
> -       if (!root) /* errors are printed by open_ctree() */
> -         return;
> -
> -       trans = btrfs_start_transaction(root, 1);
> -       strncpy(root->fs_info->super_copy.label, nLabel, BTRFS_LABEL_SIZE);
> -       root->fs_info->super_copy.label[BTRFS_LABEL_SIZE-1] = 0;
> -       btrfs_commit_transaction(trans, root);
> -
> -       /* Now we close it since we are done. */
> -       close_ctree(root);
> +	struct btrfs_root *root;
> +	struct btrfs_trans_handle *trans;
> +
> +	/* Open the super_block at the default location
> +	 * and as read-write.
> +	 */
> +	root = open_ctree(dev, 0, 1);
> +	if (!root) /* errors are printed by open_ctree() */
> +	  return -1;
> +
> +	trans = btrfs_start_transaction(root, 1);
> +	strncpy(root->fs_info->super_copy.label, nLabel, BTRFS_LABEL_SIZE);
> +	root->fs_info->super_copy.label[BTRFS_LABEL_SIZE-1] = 0;
> +	btrfs_commit_transaction(trans, root);
> +
> +	/* Now we close it since we are done. */
> +	close_ctree(root);
> +	return 0;
>   }
>
>   int get_label_unmounted(char *dev)
>   {
> -       struct btrfs_root *root;
> +	struct btrfs_root *root;
>
> -       /* Open the super_block at the default location
> -        * and as read-only.
> -        */
> -       root = open_ctree(dev, 0, 0);
> +	/* Open the super_block at the default location
> +	 * and as read-only.
> +	 */
> +	root = open_ctree(dev, 0, 0);
>
> -       if(!root)
> -         return -1;
> +	if(!root)
> +	  return -1;

  minor: since you are here, should you add a space after if

> -       fprintf(stdout, "%s\n", root->fs_info->super_copy.label);
> +	fprintf(stdout, "%s\n", root->fs_info->super_copy.label);
>
> -       /* Now we close it since we are done. */
> -       close_ctree(root);
> -       return 0;
> +	/* Now we close it since we are done. */
> +	close_ctree(root);
> +	return 0;
>   }
>
>   int get_label(char *btrfs_dev)
>

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

end of thread, other threads:[~2013-01-25  2:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-24 15:52 [PATCH] Btrfs-progs: Fix minor problems with btrfslabel.c Gene Czarcinski
2013-01-25  3:04 ` Anand Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.