[Ocfs2-tools-commits] smushran commits r504 - in trunk:
debugfs.ocfs2 libocfs2 tunefs.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Dec 21 19:18:02 CST 2004
Author: smushran
Date: 2004-12-21 19:18:00 -0600 (Tue, 21 Dec 2004)
New Revision: 504
Modified:
trunk/debugfs.ocfs2/commands.c
trunk/debugfs.ocfs2/utils.c
trunk/libocfs2/alloc.c
trunk/tunefs.ocfs2/tunefs.c
Log:
tunefs made uptodate
in debugfs, // now represents sysdir
Modified: trunk/debugfs.ocfs2/commands.c
===================================================================
--- trunk/debugfs.ocfs2/commands.c 2004-12-20 22:38:39 UTC (rev 503)
+++ trunk/debugfs.ocfs2/commands.c 2004-12-22 01:18:00 UTC (rev 504)
@@ -45,12 +45,6 @@
static void do_close (char **args);
static void do_cd (char **args);
static void do_ls (char **args);
-static void do_pwd (char **args);
-static void do_mkdir (char **args);
-static void do_rmdir (char **args);
-static void do_rm (char **args);
-static void do_read (char **args);
-static void do_write (char **args);
static void do_quit (char **args);
static void do_help (char **args);
static void do_dump (char **args);
@@ -60,7 +54,6 @@
static void do_curdev (char **args);
static void do_stats (char **args);
static void do_stat (char **args);
-static void do_hb (char **args);
static void do_logdump (char **args);
static void do_group (char **args);
static void do_extent (char **args);
@@ -71,50 +64,27 @@
dbgfs_gbls gbls;
-static Command commands[] =
-{
- { "open", do_open },
- { "close", do_close },
- { "cd", do_cd },
- { "ls", do_ls },
- { "pwd", do_pwd },
- { "chroot", do_chroot },
-
- { "mkdir", do_mkdir },
- { "rmdir", do_rmdir },
- { "rm", do_rm },
-
- { "lcd", do_lcd },
-
- { "read", do_read },
- { "write", do_write },
-
- { "help", do_help },
- { "?", do_help },
-
- { "quit", do_quit },
- { "q", do_quit },
-
- { "rdump", do_rdump },
- { "dump", do_dump },
- { "cat", do_cat },
-
- { "curdev", do_curdev },
-
- { "stats", do_stats },
-
- { "stat", do_stat },
-
- { "nodes", do_hb },
- { "publish", do_hb },
- { "vote", do_hb },
-
- { "logdump", do_logdump },
-
- { "group", do_group },
- { "extent", do_extent },
-
- { "slotmap", do_slotmap }
+static Command commands[] = {
+ { "open", do_open },
+ { "close", do_close },
+ { "cd", do_cd },
+ { "ls", do_ls },
+ { "chroot", do_chroot },
+ { "lcd", do_lcd },
+ { "help", do_help },
+ { "?", do_help },
+ { "quit", do_quit },
+ { "q", do_quit },
+ { "rdump", do_rdump },
+ { "dump", do_dump },
+ { "cat", do_cat },
+ { "curdev", do_curdev },
+ { "stats", do_stats },
+ { "stat", do_stat },
+ { "logdump", do_logdump },
+ { "group", do_group },
+ { "extent", do_extent },
+ { "slotmap", do_slotmap }
};
/*
@@ -235,7 +205,7 @@
return -1;
if (args[ind]) {
- if (!strncasecmp(args[1], "-l", 2)) {
+ if (!strcmp(args[1], "-l")) {
*long_opt = 1;
++ind;
}
@@ -246,7 +216,6 @@
else
opts = def;
-
ret = string_to_inode(gbls.fs, gbls.root_blkno, gbls.cwd_blkno,
opts, blkno);
if (ret) {
@@ -592,60 +561,6 @@
}
/*
- * do_pwd()
- *
- */
-static void do_pwd (char **args)
-{
- printf ("%s\n", __FUNCTION__);
-}
-
-/*
- * do_mkdir()
- *
- */
-static void do_mkdir (char **args)
-{
- printf ("%s\n", __FUNCTION__);
-}
-
-/*
- * do_rmdir()
- *
- */
-static void do_rmdir (char **args)
-{
- printf ("%s\n", __FUNCTION__);
-}
-
-/*
- * do_rm()
- *
- */
-static void do_rm (char **args)
-{
- printf ("%s\n", __FUNCTION__);
-}
-
-/*
- * do_read()
- *
- */
-static void do_read (char **args)
-{
-
-}
-
-/*
- * do_write()
- *
- */
-static void do_write (char **args)
-{
-
-}
-
-/*
* do_help()
*
*/
@@ -689,13 +604,18 @@
*/
static void do_lcd (char **args)
{
- char *usage = "usage: lcd <dir on a mounted fs>";
+ char buf[PATH_MAX];
if (check_device_open())
return ;
if (!args[1]) {
- fprintf(stderr, "%s\n", usage);
+ /* show cwd */
+ if (!getcwd(buf, sizeof(buf))) {
+ com_err(args[0], errno, " ");
+ return ;
+ }
+ fprintf(stdout, "%s\n", buf);
return ;
}
@@ -735,7 +655,7 @@
sb = OCFS2_RAW_SB(gbls.fs->fs_super);
dump_super_block(out, sb);
- if (!opts || strncmp(opts, "-h", 2))
+ if (!opts || strcmp(opts, "-h"))
dump_inode(out, in);
close_pager (out);
@@ -785,7 +705,7 @@
return ;
}
-
+#if 0
/*
* do_hb()
*
@@ -819,6 +739,7 @@
return ;
}
+#endif
/*
* do_dump()
@@ -1072,7 +993,7 @@
return ;
}
- if (!strncmp(args[1], "-v", 2)) {
+ if (!strcmp(args[1], "-v")) {
++ind;
++verbose;
}
@@ -1109,7 +1030,7 @@
/* I could traverse the dirs from the root and find the directory */
/* name... but this is debugfs, for crying out loud */
- if (!strncmp(p, ".", 1) || !strncmp(p, "..", 2) || !strncmp(p, "/", 1)) {
+ if (!strcmp(p, ".") || !strcmp(p, "..") || !strcmp(p, "/")) {
time_t tt;
struct tm *tm;
Modified: trunk/debugfs.ocfs2/utils.c
===================================================================
--- trunk/debugfs.ocfs2/utils.c 2004-12-20 22:38:39 UTC (rev 503)
+++ trunk/debugfs.ocfs2/utils.c 2004-12-22 01:18:00 UTC (rev 504)
@@ -278,6 +278,12 @@
if (!inodestr_to_inode(str, blkno))
return 0;
+ /* // is short for system directory */
+ if (!strcmp(str, "//")) {
+ *blkno = fs->fs_sysdir_blkno;
+ return 0;
+ }
+
return ocfs2_namei(fs, root_blkno, cwd_blkno, str, blkno);
}
@@ -563,7 +569,7 @@
rec->name[rec->name_len] = '\0';
- if (!strncmp(rec->name, ".", 1) || !strncmp(rec->name, "..", 2))
+ if (!strcmp(rec->name, ".") || !strcmp(rec->name, ".."))
goto bail;
ret = rdump_inode(rd->fs, rec->inode, rec->name, rd->fullname,
@@ -627,8 +633,8 @@
ret = dump_file(fs, blkno, fd, fullname, 1);
if (ret)
goto bail;
- } else if (S_ISDIR(di->i_mode) && strncmp(name, ".", 1) &&
- strncmp(name, "..", 2)) {
+ } else if (S_ISDIR(di->i_mode) && strcmp(name, ".") &&
+ strcmp(name, "..")) {
if (verbose)
fprintf(stdout, "%s\n", fullname);
Modified: trunk/libocfs2/alloc.c
===================================================================
--- trunk/libocfs2/alloc.c 2004-12-20 22:38:39 UTC (rev 503)
+++ trunk/libocfs2/alloc.c 2004-12-22 01:18:00 UTC (rev 504)
@@ -97,25 +97,32 @@
}
static void ocfs2_init_inode(ocfs2_filesys *fs, ocfs2_dinode *di, int16_t node,
- uint64_t gd_blkno, uint64_t blkno)
+ uint64_t gd_blkno, uint64_t blkno, uint16_t mode,
+ uint32_t flags)
{
ocfs2_extent_list *fel;
di->i_generation = fs->fs_super->i_generation;
- di->i_fs_generation = fs->fs_super->i_generation;
+ di->i_fs_generation = fs->fs_super->i_fs_generation;
di->i_blkno = blkno;
di->i_suballoc_node = node;
di->i_suballoc_bit = (uint16_t)(blkno - gd_blkno);
di->i_uid = di->i_gid = 0;
+ di->i_mode = mode;
if (S_ISDIR(di->i_mode))
di->i_links_count = 2;
else
di->i_links_count = 1;
strcpy(di->i_signature, OCFS2_INODE_SIGNATURE);
- di->i_flags |= OCFS2_VALID_FL;
di->i_atime = di->i_ctime = di->i_mtime = time(NULL);
di->i_dtime = 0;
+ di->i_flags = flags;
+ if (flags & (OCFS2_SUPER_BLOCK_FL |
+ OCFS2_LOCAL_ALLOC_FL |
+ OCFS2_CHAIN_FL))
+ return ;
+
fel = &di->id2.i_list;
fel->l_tree_depth = 0;
fel->l_next_free_rec = 0;
@@ -162,8 +169,7 @@
memset(buf, 0, fs->fs_blocksize);
di = (ocfs2_dinode *)buf;
- di->i_mode = mode;
- ocfs2_init_inode(fs, di, 0, gd_blkno, *ino);
+ ocfs2_init_inode(fs, di, 0, gd_blkno, *ino, mode, OCFS2_VALID_FL);
ret = ocfs2_write_inode(fs, *ino, buf);
if (ret)
@@ -199,11 +205,8 @@
memset(buf, 0, fs->fs_blocksize);
di = (ocfs2_dinode *)buf;
- di->i_mode = mode;
- di->i_flags = flags;
- ocfs2_init_inode(fs, di, -1, gd_blkno, *ino);
- di->i_flags |= OCFS2_SYSTEM_FL;
- di->i_fs_generation = fs->fs_super->i_fs_generation;
+ ocfs2_init_inode(fs, di, -1, gd_blkno, *ino, mode,
+ (flags | OCFS2_VALID_FL | OCFS2_SYSTEM_FL));
ret = ocfs2_write_inode(fs, *ino, buf);
Modified: trunk/tunefs.ocfs2/tunefs.c
===================================================================
--- trunk/tunefs.ocfs2/tunefs.c 2004-12-20 22:38:39 UTC (rev 503)
+++ trunk/tunefs.ocfs2/tunefs.c 2004-12-22 01:18:00 UTC (rev 504)
@@ -267,7 +267,6 @@
uint16_t old_num = OCFS2_RAW_SB(fs->fs_super)->s_max_nodes;
char fname[SYSTEM_FILE_NAME_MAX];
uint64_t blkno;
- int mode;
int i, j;
for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1; i < NUM_SYSTEM_INODES; ++i) {
@@ -276,8 +275,8 @@
printf("Adding %s... ", fname);
/* create inode for system file */
- mode = ocfs2_system_inodes[i].si_mode ? 0755 | S_IFDIR : 0644 | S_IFREG;
- ret = ocfs2_new_system_inode(fs, &blkno, mode, ocfs2_system_inodes[i].si_flags);
+ ret = ocfs2_new_system_inode(fs, &blkno, ocfs2_system_inodes[i].si_mode,
+ ocfs2_system_inodes[i].si_flags);
if (ret)
goto bail;
More information about the Ocfs2-tools-commits
mailing list