Skip to content

Commit

Permalink
add direct-io option and set version 0.3.26
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Tsai committed Sep 25, 2023
1 parent 8f93125 commit a594e22
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
15 changes: 6 additions & 9 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the <mntent.h> header file. */
#undef HAVE_MNTENT_H

Expand Down Expand Up @@ -116,6 +113,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

Expand Down Expand Up @@ -170,17 +170,14 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS

/* Version number of package */
#undef VERSION

/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif

/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([Partclone],[0.3.25],[[email protected]])
AC_INIT([Partclone],[0.3.26],[[email protected]])
AM_INIT_AUTOMAKE([-Wall foreign])
AM_GNU_GETTEXT_VERSION([0.16.1])
AM_GNU_GETTEXT([external])
Expand Down
20 changes: 17 additions & 3 deletions src/partclone.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ SCREEN *ptclscr;
int log_y_line = 0;
#endif

#define OPT_OFFSET_DOMAIN 1000
#define OPT_DIRECT_IO 1001
//
//enum {
// OPT_OFFSET_DOMAIN = 1000
//};

/**
* return the cpu architecture for which partclone is compiled
*
Expand Down Expand Up @@ -253,6 +260,7 @@ void usage(void) {
#endif
#ifndef CHKIMG
" -I, --ignore_fschk Ignore filesystem check\n"
" --direct-io Writing data to TARGET disk or image without cache.\n"
#endif
" -i, --ignore_crc Ignore checksum error\n"
" -F, --force Force progress\n"
Expand Down Expand Up @@ -300,9 +308,6 @@ int convert_to_checksum_mode(unsigned long mode) {
}
}

enum {
OPT_OFFSET_DOMAIN = 1000
};

const char *exec_name = "unset_name";

Expand Down Expand Up @@ -347,6 +352,7 @@ void parse_options(int argc, char **argv, cmd_opt* opt) {
{ "force", no_argument, NULL, 'F' },
{ "no_block_detail", no_argument, NULL, 'B' },
{ "buffer_size", required_argument, NULL, 'z' },
{ "direct-io", no_argument, NULL, OPT_DIRECT_IO },
// not RESTORE and not CHKIMG
#ifndef CHKIMG
#ifndef RESTORE
Expand Down Expand Up @@ -403,6 +409,7 @@ void parse_options(int argc, char **argv, cmd_opt* opt) {
opt->reseed_checksum = 1;
opt->blocks_per_checksum = 0;
opt->blockfile = 0;
opt->direct_io = 0;


#ifdef DD
Expand Down Expand Up @@ -433,6 +440,9 @@ void parse_options(int argc, char **argv, cmd_opt* opt) {
case 'v':
print_version();
break;
case OPT_DIRECT_IO:
opt->direct_io = 1;
break;
case 'n':
memcpy(opt->note, optarg, NOTE_SIZE);
break;
Expand Down Expand Up @@ -1568,6 +1578,10 @@ int open_target(char* target, cmd_opt* opt) {
struct stat st_dev;
int ddd_block_device = -1;

if (opt->direct_io == 1){
flags = flags | O_DIRECT;
}

log_mesg(1, 0, 0, debug, "open target file/device %s\n", target);
if (opt->ddd) {
if (stat(target, &st_dev) != -1) {
Expand Down
1 change: 1 addition & 0 deletions src/partclone.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ struct cmd_opt
int no_block_detail;
int restore_raw_file;
int skip_write_error;
int direct_io;
unsigned int buffer_size;
off_t offset;
unsigned long fresh;
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* WHETHER THEY ARE BUILT BY OTHERS OR DURING DEVELOPMENT OR FOR THE
* OFFICIAL PARTCLONE RELEASES.
*/
#define git_version "c905de58e162d559138eeabc5c9152a41bfa2f9e"
#define git_version "8f931256b03cf919a0220ca35a91c3cd40b50bd9"

0 comments on commit a594e22

Please sign in to comment.