From: Nathan Scott Date: Sun, 16 Dec 2001 21:41:54 +0000 (+0000) Subject: bump to 1.3.16, document changes to xfs_db. X-Git-Tag: v2.0.0~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6b24b3b0e8fde3eca9791df2a15ff18e8321475;p=thirdparty%2Fxfsprogs-dev.git bump to 1.3.16, document changes to xfs_db. --- diff --git a/VERSION b/VERSION index 2119de6b1..a004d2e15 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=1 PKG_MINOR=3 -PKG_REVISION=15 +PKG_REVISION=16 PKG_BUILD=0 diff --git a/db/Makefile b/db/Makefile index 806d167c9..7b6ddc596 100644 --- a/db/Makefile +++ b/db/Makefile @@ -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) diff --git a/db/init.c b/db/init.c index e4233dfc1..7d6792933 100644 --- a/db/init.c +++ b/db/init.c @@ -41,8 +41,11 @@ #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); - } } diff --git a/db/init.h b/db/init.h index 5cbbda009..189785f00 100644 --- 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); diff --git a/db/main.c b/db/main.c index e00046153..534c0e786 100644 --- a/db/main.c +++ b/db/main.c @@ -35,20 +35,31 @@ #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 index 000000000..a41058000 --- /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 +#include +#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 index 000000000..999d7df0b --- /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); diff --git a/db/type.c b/db/type.c index 50381c440..cb2a80a08 100644 --- 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); +} + diff --git a/db/type.h b/db/type.h index 9108c8d9c..1dce2ffc8 100644 --- 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); diff --git a/debian/changelog b/debian/changelog index fc84f5a97..55d35ee1b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Mon, 17 Dec 2001 12:17:54 +1100 + xfsprogs (1.3.15-1) unstable; urgency=low * Fix minor package version numbering issue (closes: #117545) diff --git a/doc/CHANGES b/doc/CHANGES index d323b80dc..5a9cea20b 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -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 diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8 index 4927ba364..839cd3c8e 100644 --- a/man/man8/xfs_db.8 +++ b/man/man8/xfs_db.8 @@ -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).