Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
katevy
Team_Safdar
Commits
824620a9
Commit
824620a9
authored
Nov 09, 2016
by
Tigerly
Browse files
add freeze
parent
0f543980
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
9 deletions
+47
-9
debugfs.c
debugfs.c
+47
-9
No files found.
debugfs.c
View file @
824620a9
...
...
@@ -37,6 +37,9 @@ extern char *optarg;
#include "jfs_user.h"
#include "support/plausible.h"
#include <linux/fs.h>
#include <sys/ioctl.h>
#ifndef BUFSIZ
#define BUFSIZ 8192
#endif
...
...
@@ -53,6 +56,9 @@ ext2_filsys current_fs;
quota_ctx_t
current_qctx
;
ext2_ino_t
root
,
cwd
;
static
int
fdDev
=
0
;
static
int
g_open_flags
=
0
;
static
int
debugfs_setup_tdb
(
const
char
*
device_name
,
char
*
undo_file
,
io_manager
*
io_ptr
)
{
...
...
@@ -129,7 +135,8 @@ err:
static
void
open_filesystem
(
char
*
device
,
int
open_flags
,
blk64_t
superblock
,
blk64_t
blocksize
,
int
catastrophic
,
char
*
data_filename
,
char
*
undo_file
)
char
*
data_filename
,
char
*
undo_file
,
char
*
mnt_pt
)
{
int
retval
;
io_channel
data_io
=
0
;
...
...
@@ -170,7 +177,16 @@ static void open_filesystem(char *device, int open_flags, blk64_t superblock,
exit
(
1
);
}
printf
(
"1%s 2%d 3%llu 4%llu
\n
"
,
device
,
open_flags
,
superblock
,
blocksize
);
//printf("1%s 2%d 3%llu 4%llu \n", device, open_flags, superblock, blocksize);
if
(
mnt_pt
)
{
fdDev
=
open
(
mnt_pt
,
O_RDONLY
);
retval
=
ioctl
(
fdDev
,
FIFREEZE
,
0
);
if
(
retval
)
{
com_err
(
device
,
retval
,
"freezing filesystem failed"
);
return
;
}
}
g_open_flags
=
open_flags
;
retval
=
ext2fs_open
(
device
,
open_flags
,
superblock
,
blocksize
,
io_ptr
,
&
current_fs
);
...
...
@@ -211,6 +227,12 @@ static void open_filesystem(char *device, int open_flags, blk64_t superblock,
return
;
errout:
if
(
fdDev
)
{
retval
=
ioctl
(
fdDev
,
FITHAW
,
0
);
if
(
retval
)
com_err
(
device
,
retval
,
"thaw filesystem failed"
);
}
retval
=
ext2fs_close_free
(
&
current_fs
);
if
(
retval
)
com_err
(
device
,
retval
,
"while trying to close filesystem"
);
...
...
@@ -225,9 +247,10 @@ void do_open_filesys(int argc, char **argv)
int
open_flags
=
EXT2_FLAG_SOFTSUPP_FEATURES
|
EXT2_FLAG_64BITS
;
char
*
data_filename
=
0
;
char
*
undo_file
=
NULL
;
char
*
mnt_pt
=
NULL
;
reset_getopt
();
while
((
c
=
getopt
(
argc
,
argv
,
"iwfecb:s:d:Dz:"
))
!=
EOF
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"iwfecb:s:d:Dz:
m:
"
))
!=
EOF
)
{
switch
(
c
)
{
case
'i'
:
open_flags
|=
EXT2_FLAG_IMAGE_FILE
;
...
...
@@ -251,6 +274,9 @@ void do_open_filesys(int argc, char **argv)
case
'd'
:
data_filename
=
optarg
;
break
;
case
'm'
:
mnt_pt
=
optarg
;
break
;
case
'D'
:
open_flags
|=
EXT2_FLAG_DIRECT_IO
;
break
;
...
...
@@ -280,11 +306,11 @@ void do_open_filesys(int argc, char **argv)
return
;
open_filesystem
(
argv
[
optind
],
open_flags
,
superblock
,
blocksize
,
catastrophic
,
data_filename
,
undo_file
);
data_filename
,
undo_file
,
mnt_pt
);
return
;
print_usage:
fprintf
(
stderr
,
"%s: Usage: open [-s superblock] [-b blocksize] "
fprintf
(
stderr
,
"%s: Usage: open [-s superblock]
[-m mnt_point]
[-b blocksize] "
"[-d image_filename] [-c] [-i] [-f] [-e] [-D] "
#ifndef READ_ONLY
"[-w] "
...
...
@@ -297,6 +323,14 @@ print_usage:
static
void
close_filesystem
(
NOARGS
)
{
int
retval
;
g_open_flags
=
0
;
if
(
fdDev
)
{
retval
=
ioctl
(
fdDev
,
FITHAW
,
0
);
if
(
retval
)
com_err
(
"thaw filesystem failed"
,
retval
,
0
);
fdDev
=
0
;
}
if
(
current_fs
->
flags
&
EXT2_FLAG_IB_DIRTY
)
{
retval
=
ext2fs_write_inode_bitmap
(
current_fs
);
...
...
@@ -1845,7 +1879,7 @@ int main(int argc, char **argv)
{
int
retval
;
const
char
*
usage
=
"Usage: %s [-b blocksize] [-s superblock] [-f cmd_file] "
"Usage: %s [-b blocksize]
[-m mnt_point]
[-s superblock] [-f cmd_file] "
"[-R request] [-V] ["
#ifndef READ_ONLY
"[-w] [-z undo_file] "
...
...
@@ -1854,6 +1888,7 @@ int main(int argc, char **argv)
int
c
;
int
open_flags
=
EXT2_FLAG_SOFTSUPP_FEATURES
|
EXT2_FLAG_64BITS
;
char
*
request
=
0
;
char
*
mnt_pt
=
0
;
int
exit_status
=
0
;
char
*
cmd_file
=
0
;
blk64_t
superblock
=
0
;
...
...
@@ -1861,9 +1896,9 @@ int main(int argc, char **argv)
int
catastrophic
=
0
;
char
*
data_filename
=
0
;
#ifdef READ_ONLY
const
char
*
opt_string
=
"nicR:f:b:s:Vd:D"
;
const
char
*
opt_string
=
"nicR:f:b:s:Vd:D
m:
"
;
#else
const
char
*
opt_string
=
"niwcR:f:b:s:Vd:Dz:"
;
const
char
*
opt_string
=
"niwcR:f:b:s:Vd:Dz:
m:
"
;
char
*
undo_file
=
NULL
;
#endif
#ifdef CONFIG_JBD_DEBUG
...
...
@@ -1898,6 +1933,9 @@ int main(int argc, char **argv)
case
'R'
:
request
=
optarg
;
break
;
case
'm'
:
mnt_pt
=
optarg
;
break
;
case
'f'
:
cmd_file
=
optarg
;
break
;
...
...
@@ -1948,7 +1986,7 @@ int main(int argc, char **argv)
if
(
optind
<
argc
)
open_filesystem
(
argv
[
optind
],
open_flags
,
superblock
,
blocksize
,
catastrophic
,
data_filename
,
undo_file
);
data_filename
,
undo_file
,
mnt_pt
);
sci_idx
=
ss_create_invocation
(
debug_prog_name
,
"0.0"
,
(
char
*
)
NULL
,
&
debug_cmds
,
&
retval
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment