]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
bump to 1.3.16, document changes to xfs_db.
authorNathan Scott <nathans@sgi.com>
Sun, 16 Dec 2001 21:41:54 +0000 (21:41 +0000)
committerNathan Scott <nathans@sgi.com>
Sun, 16 Dec 2001 21:41:54 +0000 (21:41 +0000)
12 files changed:
VERSION
db/Makefile
db/init.c
db/init.h
db/main.c
db/text.c [new file with mode: 0644]
db/text.h [new file with mode: 0644]
db/type.c
db/type.h
debian/changelog
doc/CHANGES
man/man8/xfs_db.8

diff --git a/VERSION b/VERSION
index 2119de6b1b9fe6ff4c7b0092e594dfea1c822c92..a004d2e157033e58297e97356e8f7eded4945a9c 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=1
 PKG_MINOR=3
-PKG_REVISION=15
+PKG_REVISION=16
 PKG_BUILD=0
index 806d167c9f4efc35b66c1e7746bf479dd677672a..7b6ddc5969207356d509406ae683dd5a12264c65 100644 (file)
@@ -40,7 +40,7 @@ HFILES = addr.h agf.h agfl.h agi.h attr.h attrshort.h bit.h block.h bmap.h \
        dbread.h debug.h dir.h dir2.h dir2sf.h dirshort.h dquot.h echo.h \
        faddr.h field.h flist.h fprint.h frag.h freesp.h hash.h help.h \
        init.h inobt.h inode.h input.h io.h malloc.h mount.h output.h \
-       print.h quit.h sb.h uuid.h sig.h strvec.h type.h write.h
+       print.h quit.h sb.h sig.h strvec.h text.h type.h uuid.h write.h
 CFILES = $(HFILES:.h=.c) main.c
 LSRCFILES = xfs_admin.sh xfs_check.sh xfs_ncheck.sh
 LLDLIBS        = $(LIBXFS) $(LIBUUID)
index e4233dfc14e0646067d4af14d358a2f30fdf678e..7d679293391ac2ef5701bf2741877e32a19bc13a 100644 (file)
--- a/db/init.c
+++ b/db/init.c
 #include "mount.h"
 #include "sig.h"
 #include "output.h"
+#include "malloc.h"
 
 char   *fsdevice;
+char   **cmdline;
+int    ncmdline;
 
 static void
 usage(void)
@@ -53,28 +56,17 @@ usage(void)
 
 void
 init(
-       int             argc,
-       char            **argv)
+       int     argc,
+       char    **argv)
 {
-       int             c;
-       FILE            *cfile = NULL;
+       int     c;
 
        progname = basename(argv[0]);
        while ((c = getopt(argc, argv, "c:fip:rxVl:")) != EOF) {
                switch (c) {
                case 'c':
-                       if (!cfile)
-                               cfile = tmpfile();
-                        if (!cfile) {
-                                perror("tmpfile");
-                                exit(1);
-                        }
-                       if (fprintf(cfile, "%s\n", optarg) < 0) {
-                                perror("fprintf(tmpfile)");
-                                dbprintf("%s: error writing temporary file\n",
-                                        progname);
-                                exit(1);
-                        }
+                       cmdline = xrealloc(cmdline, (ncmdline+1)*sizeof(char*));
+                       cmdline[ncmdline++] = optarg;
                        break;
                case 'f':
                        xfsargs.disfile = 1;
@@ -131,18 +123,4 @@ init(
        push_cur();
        init_commands();
        init_sig();
-       if (cfile) {
-               if (fprintf(cfile, "q\n")<0) {
-                    perror("fprintf(tmpfile)");
-                    dbprintf("%s: error writing temporary file\n", progname);
-                    exit(1);
-                }
-                if (fflush(cfile)<0) {
-                    perror("fflush(tmpfile)");
-                    dbprintf("%s: error writing temporary file\n", progname);
-                    exit(1);
-                }
-               rewind(cfile);
-               pushfile(cfile);
-       }
 }
index 5cbbda009b75e9adf184cab6d5b25caea2ef0465..189785f003659b0d83afce1e9d6a551862a1906e 100644 (file)
--- a/db/init.h
+++ b/db/init.h
@@ -31,4 +31,6 @@
  */
 
 extern char    *fsdevice;
+extern char    **cmdline;
+extern int     ncmdline;
 extern void    init(int argc, char **argv);
index e0004615393a0afe29487f1d26804e541ba281cc..534c0e786d6c05ec6cc62667c02a2ee991df73e9 100644 (file)
--- a/db/main.c
+++ b/db/main.c
 #include "data.h"
 #include "init.h"
 #include "input.h"
+#include "malloc.h"
 
 int
 main(
        int     argc,
        char    **argv)
 {
-       int     c;
-       int     done;
+       int     c, i, done = 0;
        char    *input;
        char    **v;
 
        pushfile(stdin);
        init(argc, argv);
-       done = 0;
+
+       for (i = 0; !done && i < ncmdline; i++) {
+               v = breakline(cmdline[i], &c);
+               if (c)
+                       done = command(c, v);
+               xfree(v);
+       }
+       if (cmdline) {
+               xfree(cmdline);
+               return exitcode;
+       }
+
        while (!done) {
                if ((input = fetchline()) == NULL)
                        break;
diff --git a/db/text.c b/db/text.c
new file mode 100644 (file)
index 0000000..a410580
--- /dev/null
+++ b/db/text.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ * 
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * 
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ * 
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ * 
+ * http://www.sgi.com 
+ * 
+ * For further information regarding this notice, see: 
+ * 
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include <libxfs.h>
+#include <ctype.h>
+#include "block.h"
+#include "bmap.h"
+#include "command.h"
+#include "data.h"
+#include "type.h"
+#include "faddr.h"
+#include "fprint.h"
+#include "field.h"
+#include "inode.h"
+#include "io.h"
+#include "output.h"
+#include "mount.h"
+
+static void     print_rawtext(void *data, int len);
+
+void
+print_text(
+        const field_t   *fields,
+        int             argc,
+        char            **argv)
+{
+        print_rawtext(iocur_top->data, iocur_top->len);
+}
+
+static void
+print_rawtext(
+        void    *data,
+        int     len)
+{
+        int     i;
+        int     j;
+        int     lastaddr;
+        int     offchars;
+        unsigned char   *p;
+
+        lastaddr = (len - 1) & ~(16 - 1);
+        if (lastaddr < 0x10)
+                offchars = 1;
+        else if (lastaddr < 0x100)
+                offchars = 2;
+        else if (lastaddr < 0x1000)
+                offchars = 3;
+        else
+                offchars = 4;
+
+        for (i = 0, p = data; i < len; i += 16) {
+                unsigned char *s = p;
+
+                dbprintf("%-0*.*x:  ", offchars, offchars, i);
+
+                for (j = 0; j < 16 && i + j < len; j++, p++) {
+                        dbprintf("%02x ", *p);
+                }
+
+                dbprintf(" ");
+
+                for (j = 0; j < 16 && i + j < len; j++, s++) {
+                        if (isalnum(*s))
+                                dbprintf("%c", *s);
+                        else
+                                dbprintf(".", *s);
+                }
+
+                dbprintf("\n");
+        }
+}
+
diff --git a/db/text.h b/db/text.h
new file mode 100644 (file)
index 0000000..999d7df
--- /dev/null
+++ b/db/text.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ * 
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * 
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ * 
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ * 
+ * http://www.sgi.com 
+ * 
+ * For further information regarding this notice, see: 
+ * 
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+extern void     print_text(const struct field *fields, int argc, char **argv);
index 50381c440caceb5788b98edf47f89f40dbf644ec..cb2a80a082e9deb88ead9f4379e101c5c3b4aad1 100644 (file)
--- a/db/type.c
+++ b/db/type.c
@@ -60,6 +60,7 @@
 #include "attr.h"
 #include "dquot.h"
 #include "dir2.h"
+#include "text.h"
 
 static const typ_t     *findtyp(char *name);
 static int             type_f(int argc, char **argv);
@@ -91,6 +92,7 @@ const typ_t   typtab[] = {
        { TYP_RTSUMMARY, "rtsummary", NULL, NULL },
        { TYP_SB, "sb", handle_struct, sb_hfld },
        { TYP_SYMLINK, "symlink", handle_string, NULL },
+       { TYP_TEXT, "text", handle_text, NULL },        
        { TYP_NONE, NULL }
 };
 
@@ -195,3 +197,15 @@ handle_block(
        else
                print_block(fields, argc, argv);
 }
+
+void
+handle_text(
+       int           action,
+       const field_t *fields,
+       int           argc,
+       char          **argv)
+{
+       if (action != DB_WRITE)
+               print_text(fields, argc, argv);
+}
+
index 9108c8d9c87841510984852776bb738ed33db43e..1dce2ffc8bd3a1e0d0e06404f405087bb55c2743 100644 (file)
--- a/db/type.h
+++ b/db/type.h
@@ -41,7 +41,7 @@ typedef enum typnm
        TYP_BMAPBTD, TYP_BNOBT, TYP_CNTBT, TYP_DATA, TYP_DIR,
        TYP_DIR2, TYP_DQBLK, TYP_INOBT, TYP_INODATA, TYP_INODE,
        TYP_LOG, TYP_RTBITMAP, TYP_RTSUMMARY, TYP_SB, TYP_SYMLINK,
-       TYP_NONE
+       TYP_TEXT, TYP_NONE
 } typnm_t;
 
 #define DB_WRITE 1
@@ -66,3 +66,5 @@ extern void   handle_string(int action, const struct field *fields, int argc,
                              char **argv);
 extern void    handle_struct(int action, const struct field *fields, int argc,
                              char **argv);
+extern void    handle_text(int action, const struct field *fields, int argc,
+                           char **argv);
index fc84f5a9799907ca16fe69c760593d51cd30117a..55d35ee1b1791b1a9e455bfaaaff1785d3e6c270 100644 (file)
@@ -1,3 +1,10 @@
+xfsprogs (1.3.16-1) unstable, urgency=low
+
+  * Remove temporary file use in xfs_db
+  * Add "type text" command into xfs_db
+
+ -- Nathan Scott <nathans@debian.org>  Mon, 17 Dec 2001 12:17:54 +1100
+
 xfsprogs (1.3.15-1) unstable; urgency=low
 
   * Fix minor package version numbering issue (closes: #117545)
index d323b80dca85f289f0d3e27efd2bd0ac3697ed81..5a9cea20b6afc4efd20a9531735d02ff7386c84f 100644 (file)
@@ -1,3 +1,9 @@
+xfsprogs-1.3.16 (17 December 2001)
+       - added text dump type to xfs_db (mkp)
+       - removed use of a temporary file in xfs_db when processing
+         commands on the command line - allows xfs_check to be run
+         on read-only root filesystems
+
 xfsprogs-1.3.15 (12 December 2001)
        - reenable the use of the BLKBSZSET ioctl, its baaack
        - sync recent XFS kernel source changes back into libxfs
index 4927ba364519aa2dada12f1a84e2310f6b400ee6..839cd3c8e9e8dd2070be6a69a751e88b6c6e620e 100644 (file)
@@ -420,7 +420,7 @@ The possible data types are:
 \f3agf\f1, \f3agfl\f1, \f3agi\f1, \f3attr\f1, \f3bmapbta\f1, \f3bmapbtd\f1,
 \f3bnobt\f1, \f3cntbt\f1, \f3data\f1, \f3dir\f1, \f3dir2\f1, \f3dqblk\f1,
 \f3inobt\f1, \f3inode\f1, \f3log\f1, \f3rtbitmap\f1, \f3rtsummary\f1,
-\f3sb\f1, and \f3symlink\f1.
+\f3sb\f1, \f3symlink\f1, and \f3text\f1.
 See the TYPES section below for more information on these data types.
 .TP
 \f3uuid\f1 [ \f2uuid\f1 or \f2generate\f1 or \f2rewrite\f1 ]
@@ -1202,6 +1202,12 @@ Symbolic link blocks are used only when the symbolic link value does
 not fit inside the inode.
 The block content is just the string value.
 Bytes past the logical end of the symbolic link value have arbitrary values.
+.TP
+\f3text\f1
+User file blocks, and other blocks whose type is unknown,
+have this type for display purposes in \f2xfs_db\f1.
+The block data is displayed in two columns: Hexadecimal format 
+and printable ASCII chars.
 .SH DIAGNOSTICS
 Many messages can come from the \f3check\f1 (\f3blockget\f1) command;
 these are documented in \f2xfs_check\f1(8).