public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_db ring command
@ 2006-09-27  4:44 Utako Kusaka
  2006-09-28  0:40 ` Timothy Shimmin
  0 siblings, 1 reply; 2+ messages in thread
From: Utako Kusaka @ 2006-09-27  4:44 UTC (permalink / raw)
  To: xfs

This patch fixes the issue that
xfs_db ring [index] command don't move to specified index.

Signed-off-by: Utako Kusaka <utako@tnes.nec.co.jp>
---

--- xfsprogs-2.8.11-orgn/db/io.c	2006-06-26 14:01:14.000000000 +0900
+++ xfsprogs-2.8.11/db/io.c	2006-09-26 16:59:40.000000000 +0900
@@ -352,7 +352,7 @@ ring_f(
 		return 0;
 	}
 
-	index = (int)strtoul(argv[0], NULL, 0);
+	index = (int)strtoul(argv[1], NULL, 0);
 	if (index < 0 || index >= RING_ENTRIES)
 		dbprintf("invalid entry: %d\n", index); 

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

* Re: [PATCH] xfs_db ring command
  2006-09-27  4:44 [PATCH] xfs_db ring command Utako Kusaka
@ 2006-09-28  0:40 ` Timothy Shimmin
  0 siblings, 0 replies; 2+ messages in thread
From: Timothy Shimmin @ 2006-09-28  0:40 UTC (permalink / raw)
  To: Utako Kusaka; +Cc: xfs

Utako Kusaka wrote:
> This patch fixes the issue that
> xfs_db ring [index] command don't move to specified index.
> 
> Signed-off-by: Utako Kusaka <utako@tnes.nec.co.jp>
> ---
> 
> --- xfsprogs-2.8.11-orgn/db/io.c	2006-06-26 14:01:14.000000000 +0900
> +++ xfsprogs-2.8.11/db/io.c	2006-09-26 16:59:40.000000000 +0900
> @@ -352,7 +352,7 @@ ring_f(
>  		return 0;
>  	}
>  
> -	index = (int)strtoul(argv[0], NULL, 0);
> +	index = (int)strtoul(argv[1], NULL, 0);
>  	if (index < 0 || index >= RING_ENTRIES)
>  		dbprintf("invalid entry: %d\n", index); 
> 

Hi there,

Thanks for that.
I'll check it in shortly.

Aside:
I think I can see how this happened.
It must have been due to porting from IRIX to Linux.
On IRIX the db commands removed the command name,
and just passed in the arguments to the specific command
function; they did:

ON IRIX:
------------
command(
         int             argc,
         char            **argv)
{
         char            *cmd;
         const cmdinfo_t *ct;

         cmd = argv[0];
         ct = find_command(cmd);
         if (ct == NULL) {
                 dbprintf("command %s not found\n", cmd);
                 return 0;
         }
   -->   argc--;
   -->   argv++;
         if (argc < ct->argmin || (ct->argmax != -1 && argc > ct->argmax)) {
         ...
         return ct->cfunc(argc, argv);

-------------

But on Linux we pass through the command name as well:
--------------
int
command(
         int             argc,
         char            **argv)
{
         char            *cmd;
         const cmdinfo_t *ct;

         cmd = argv[0];
         ct = find_command(cmd);
         if (ct == NULL) {
                 dbprintf("command %s not found\n", cmd);
                 return 0;
         }
         if (argc-1 < ct->argmin || (ct->argmax != -1 && argc-1 > ct->argmax)) {
	...
	return ct->cfunc(argc, argv);
--------------

So I hope no more of these mistakes have happened because I'd
imagine many of the commands would have had to change.
I noticed that someone fixed up part of ring_f command but not the part
that you found/fixed.

Cheers,
Tim.

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

end of thread, other threads:[~2006-09-28  0:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-27  4:44 [PATCH] xfs_db ring command Utako Kusaka
2006-09-28  0:40 ` Timothy Shimmin

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