Author: nieklinnenbank Date: Fri Jul 3 05:17:23 2009 New Revision: 187 Modified: trunk/srv/filesystem/ext2/Ext2Create.cpp trunk/srv/filesystem/ext2/Ext2Create.h Log: Added option '-v' for verbose output messages in Ext2Create. Per default, verbose messages are turned off. Modified: trunk/srv/filesystem/ext2/Ext2Create.cpp ============================================================================== --- trunk/srv/filesystem/ext2/Ext2Create.cpp (original) +++ trunk/srv/filesystem/ext2/Ext2Create.cpp Fri Jul 3 05:17:23 2009 @@ -36,9 +36,10 @@ Ext2Create::Ext2Create() { - prog = ZERO; - image = ZERO; - super = ZERO; + prog = ZERO; + image = ZERO; + super = ZERO; + verbose = false; blockSize = EXT2_MAX_BLOCK_SIZE; } @@ -84,6 +85,7 @@ exit(EXIT_FAILURE); } /* Debug out. */ + if (verbose) printf("%s mode=%x size=%llu userId=%u groupId=%u\r\n", inputFile, st.st_mode, (long long unsigned)st.st_size, st.st_uid, st.st_gid); @@ -297,6 +299,11 @@ this->excludes.insertTail(new String(pattern)); } +void Ext2Create::setVerbose(bool newVerbose) +{ + this->verbose = newVerbose; +} + void Ext2Create::initSuperBlock(Ext2SuperBlock *sb) { super = sb; @@ -364,7 +371,8 @@ "Creates a new Extended 2 FileSystem\r\n" "\r\n" "-h Show this help message.\r\n"- "-e PATTERN Exclude matching files from the created filesystem\r\n", + "-e PATTERN Exclude matching files from the created filesystem\r\n"
+ "-v Output verbose messages.\r\n", argv[0]); return EXIT_FAILURE; } @@ -382,6 +390,12 @@ fs.setExclude(argv[i + 4]); i++; } + /* Verbose output. */ + else if (!strcmp(argv[i + 3], "-v")) + { + fs.setVerbose(true); + } + /* Unknown argument. */ else printf("%s: unknown option `%s'\r\n", argv[0], argv[i + 3]); Modified: trunk/srv/filesystem/ext2/Ext2Create.h ============================================================================== --- trunk/srv/filesystem/ext2/Ext2Create.h (original) +++ trunk/srv/filesystem/ext2/Ext2Create.h Fri Jul 3 05:17:23 2009 @@ -129,6 +129,12 @@ */ void setExclude(char *pattern); + /** + * Output verbose messages during the construction. + * @param newVerbose True to turn on, false to turn off verbose messages. + */ + void setVerbose(bool newVerbose); + private: /** @@ -159,6 +165,12 @@ /** Path to the input directory. */ char *input; + + /** Output verbose messages. */ + bool verbose; + + /** List of file patterns to ignore. */ + List<String> excludes; /** Pointer to the superblock. */ Ext2SuperBlock *super; @@ -171,10 +183,7 @@ /** Array of blocks available in the filesystem. */ u8 *blocks; - - /** List of file patterns to ignore. */ - List<String> excludes; - + /** Size of each block. */ Size blockSize; };