just whitespace

This commit is contained in:
Tim Riker 2006-01-25 00:08:53 +00:00
parent f64ff682a3
commit c1ef7bdd8d
254 changed files with 2002 additions and 2002 deletions

2
README
View File

@ -41,7 +41,7 @@ Using busybox:
The behavior of busybox is determined by the name it's called under: as
"cp" it behaves like cp, as "sed" it behaves like sed, and so on. Called
as "busybox" it takes the second argument as the name of the applet to
run (I.E. "./busybox ls -l /proc").
run (I.E. "./busybox ls -l /proc").
The "standalone shell" mode is an easy way to try out busybox; this is a
command shell that calls the builtin applets without needing them to be

View File

@ -108,7 +108,7 @@ int busybox_main(int argc, char **argv)
}
/* Deal with --help. (Also print help when called with no arguments) */
if (argc==1 || !strcmp(argv[1],"--help") ) {
if (argc>2) {
run_applet_by_name(bb_applet_name=argv[2], 2, argv);
@ -144,7 +144,7 @@ int busybox_main(int argc, char **argv)
exit(0);
}
} else run_applet_by_name(bb_applet_name=argv[1], argc-1, argv+1);
bb_error_msg_and_die("applet not found");
}

View File

@ -47,10 +47,10 @@ config CONFIG_BUNZIP2
is generally considerably better than that achieved by more
conventional LZ77/LZ78-based compressors, and approaches the
performance of the PPM family of statistical compressors.
The BusyBox bunzip2 applet is limited to de-compression only.
On an x86 system, this applet adds about 11K.
Unless you have a specific application which requires bunzip2, you
should probably say N here.
@ -73,7 +73,7 @@ config CONFIG_DPKG
default n
help
dpkg is a medium-level tool to install, build, remove and manage Debian packages.
This implementation of dpkg has a number of limitations, you should use the
official dpkg if possible.
@ -82,9 +82,9 @@ config CONFIG_DPKG_DEB
default n
help
dpkg-deb packs, unpacks and provides information about Debian archives.
This implementation of dpkg-deb cannot pack archives.
Unless you have a specific application which requires dpkg-deb, you should
probably say N here.
@ -228,10 +228,10 @@ config CONFIG_UNLZMA
compression algorithm, and range coding. Compression
is generally considerably better than that achieved by the bzip2
compressors.
The BusyBox unlzma applet is limited to de-compression only.
On an x86 system, this applet adds about 4K.
Unless you have a specific application which requires unlzma, you
should probably say N here.
@ -272,7 +272,7 @@ config CONFIG_FEATURE_DEB_TAR_GZ
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
help
This is the default compression method inside the debian ar file.
If you want compatibility with standard .deb's you should say yes here.
config CONFIG_FEATURE_DEB_TAR_BZ2
@ -282,7 +282,7 @@ config CONFIG_FEATURE_DEB_TAR_BZ2
help
This allows dpkg and dpkg-deb to extract deb's that are compressed internally
with bzip2 instead of gzip.
You only want this if you are creating your own custom debian packages that
use an internal control.tar.bz2 or data.tar.bz2.
@ -293,7 +293,7 @@ config CONFIG_FEATURE_DEB_TAR_LZMA
help
This allows dpkg and dpkg-deb to extract deb's that are compressed
internally with lzma instead of gzip.
You only want this if you are creating your own custom debian
packages that use an internal control.tar.lzma or data.tar.lzma.

View File

@ -61,12 +61,12 @@ extern int ar_main(int argc, char **argv)
{
archive_handle_t *archive_handle;
unsigned long opt;
static const char msg_unsupported_err[] =
static const char msg_unsupported_err[] =
"Archive %s not supported. Install binutils 'ar'.";
char magic[8];
archive_handle = init_handle();
/* Prepend '-' to the first argument if required */
bb_opt_complementally = "--:p:t:x:-1:?:p--tx:t--px:x--pt";
opt = bb_getopt_ulflags(argc, argv, "ptxovcr");

View File

@ -850,7 +850,7 @@ static void write_status_file(deb_file_t **deb_file)
}
tmp_string += 8;
tmp_string += strspn(tmp_string, " \n\t");
tmp_string += strspn(tmp_string, " \n\t");
package_name = bb_xstrndup(tmp_string, strcspn(tmp_string, "\n\0"));
write_flag = FALSE;
tmp_string = strstr(control_buffer, "Status:");
@ -989,8 +989,8 @@ static int package_satisfies_dependency(int package, int depend_type)
return 0;
switch (depend_type) {
case EDGE_PRE_DEPENDS: return get_status(status_num, 3) == search_name_hashtable("installed");
case EDGE_DEPENDS: return get_status(status_num, 1) == search_name_hashtable("install");
case EDGE_PRE_DEPENDS: return get_status(status_num, 3) == search_name_hashtable("installed");
case EDGE_DEPENDS: return get_status(status_num, 1) == search_name_hashtable("install");
}
return 0;
}
@ -1078,7 +1078,7 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
}
}
i++;
}
}
/* Check dependendcies */
@ -1114,8 +1114,8 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
* things which are broken but unrelated to the
* packages that are currently being installed
*/
if (state_status == search_name_hashtable("installed"))
continue;
if (state_status == search_name_hashtable("installed"))
continue;
#endif
/* This code is tested only for EDGE_DEPENDS, since I
@ -1125,13 +1125,13 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
for (j = 0; j < package_node->num_of_edges; j++) {
const edge_t *package_edge = package_node->edge[j];
unsigned int package_num;
if ( package_edge->type == EDGE_OR_PRE_DEPENDS ||
package_edge->type == EDGE_OR_DEPENDS ) { /* start an EDGE_OR_ list */
package_edge->type == EDGE_OR_DEPENDS ) { /* start an EDGE_OR_ list */
number_of_alternatives = package_edge->version;
root_of_alternatives = package_edge;
continue;
} else if ( number_of_alternatives == 0 ) { /* not in the middle of an EDGE_OR_ list */
} else if ( number_of_alternatives == 0 ) { /* not in the middle of an EDGE_OR_ list */
number_of_alternatives = 1;
root_of_alternatives = NULL;
}
@ -1329,7 +1329,7 @@ static void free_array(char **array)
*/
static void list_packages(void)
{
int i;
int i;
printf(" Name Version\n");
printf("+++-==============-==============\n");
@ -1715,7 +1715,7 @@ int dpkg_main(int argc, char **argv)
if (package_num == -1) {
bb_error_msg("Invalid control file in %s", argv[optind]);
optind++;
optind++;
continue;
}
deb_file[deb_count]->package = (unsigned int) package_num;

View File

@ -1031,7 +1031,7 @@ static void fill_window(void)
*/
#define FLUSH_BLOCK(eof) \
flush_block(block_start >= 0L ? (char*)&window[(unsigned)block_start] : \
(char*)NULL, (long)strstart - block_start, (eof))
(char*)NULL, (long)strstart - block_start, (eof))
/* ===========================================================================
* Same as above, but achieves better compression. We use a lazy

View File

@ -51,9 +51,9 @@
/* Constants for Huffman coding */
#define MAX_GROUPS 6
#define GROUP_SIZE 50 /* 64 would have been more efficient */
#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */
#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */
#define GROUP_SIZE 50 /* 64 would have been more efficient */
#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */
#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */
#define SYMBOL_RUNA 0
#define SYMBOL_RUNB 1

View File

@ -50,9 +50,9 @@ typedef struct {
#define LZMA_LEN_CHOICE_2 (LZMA_LEN_CHOICE + 1)
#define LZMA_LEN_LOW (LZMA_LEN_CHOICE_2 + 1)
#define LZMA_LEN_MID (LZMA_LEN_LOW \
+ (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS)))
+ (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS)))
#define LZMA_LEN_HIGH (LZMA_LEN_MID \
+(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS)))
+(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS)))
#define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + (1 << LZMA_LEN_NUM_HIGH_BITS))
#define LZMA_NUM_STATES 12
@ -76,11 +76,11 @@ typedef struct {
#define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES)
#define LZMA_IS_REP_0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES)
#define LZMA_POS_SLOT (LZMA_IS_REP_0_LONG \
+ (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX))
+ (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX))
#define LZMA_SPEC_POS (LZMA_POS_SLOT \
+(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS))
+(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS))
#define LZMA_ALIGN (LZMA_SPEC_POS \
+ LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX)
+ LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX)
#define LZMA_LEN_CODER (LZMA_ALIGN + (1 << LZMA_NUM_ALIGN_BITS))
#define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS)
#define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS)

View File

@ -26,15 +26,15 @@ extern char get_header_ar(archive_handle_t *archive_handle)
file_header_t *typed = archive_handle->file_header;
union {
char raw[60];
struct {
char name[16];
char date[12];
char uid[6];
char gid[6];
char mode[8];
char size[10];
char magic[2];
} formated;
struct {
char name[16];
char date[12];
char uid[6];
char gid[6];
char mode[8];
char size[10];
char magic[2];
} formated;
} ar;
#ifdef CONFIG_FEATURE_AR_LONG_FILENAMES
static char *ar_long_names;
@ -102,7 +102,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
#endif
} else {
/* short filenames */
typed->name = bb_xstrndup(ar.formated.name, 16);
typed->name = bb_xstrndup(ar.formated.name, 16);
}
typed->name[strcspn(typed->name, " /")] = '\0';

View File

@ -20,7 +20,7 @@
* References:
* GNU tar and star man pages,
* Opengroup's ustar interchange format,
* http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html
* http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html
*/
#include <stdio.h>

View File

@ -43,7 +43,7 @@
#define RPM_STRING_ARRAY_TYPE 8
#define RPM_I18NSTRING_TYPE 9
#define RPMTAG_NAME 1000
#define RPMTAG_NAME 1000
#define RPMTAG_VERSION 1001
#define RPMTAG_RELEASE 1002
#define RPMTAG_SUMMARY 1004

View File

@ -91,7 +91,7 @@ struct HardLinkInfo {
struct TarBallInfo {
char *fileName; /* File name of the tarball */
int tarFd; /* Open-for-write file descriptor
for the tarball */
for the tarball */
struct stat statBuf; /* Stat info for the tarball, letting
us know the inode and device that the
tarball lives, so we can avoid trying
@ -569,7 +569,7 @@ static char get_header_tar_Z(archive_handle_t *archive_handle)
/* do the decompression, and cleanup */
if (bb_xread_char(archive_handle->src_fd) != 0x1f ||
bb_xread_char(archive_handle->src_fd) != 0x9d)
bb_xread_char(archive_handle->src_fd) != 0x9d)
{
bb_error_msg_and_die("Invalid magic");
}
@ -699,7 +699,7 @@ static const struct option tar_long_options[] = {
# ifdef CONFIG_FEATURE_TAR_COMPRESS
{ "compress", 0, NULL, 'Z' },
# endif
{ 0, 0, 0, 0 }
{ 0, 0, 0, 0 }
};
#else
#define tar_long_options 0
@ -713,7 +713,7 @@ int tar_main(int argc, char **argv)
const char *tar_filename = "-";
unsigned long opt;
llist_t *excludes = NULL;
/* Initialise default values */
tar_handle = init_handle();
tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL;
@ -743,7 +743,7 @@ int tar_main(int argc, char **argv)
}
if((opt & CTX_EXTRACT) && tar_handle->action_data != data_extract_to_stdout)
tar_handle->action_data = data_extract_all;
if (opt & TAR_OPT_2STDOUT)
tar_handle->action_data = data_extract_to_stdout;
@ -843,9 +843,9 @@ int tar_main(int argc, char **argv)
int zipMode = 0;
if (ENABLE_FEATURE_TAR_GZIP && get_header_ptr == get_header_tar_gz)
zipMode = 1;
zipMode = 1;
if (ENABLE_FEATURE_TAR_BZIP2 && get_header_ptr == get_header_tar_bz2)
zipMode = 2;
zipMode = 2;
if ((tar_handle->action_header == header_list) ||
(tar_handle->action_header == header_verbose_list))

View File

@ -66,8 +66,8 @@ typedef union {
unsigned short method; /* 4-5 */
unsigned short modtime; /* 6-7 */
unsigned short moddate; /* 8-9 */
unsigned int crc32 ATTRIBUTE_PACKED; /* 10-13 */
unsigned int cmpsize ATTRIBUTE_PACKED; /* 14-17 */
unsigned int crc32 ATTRIBUTE_PACKED; /* 10-13 */
unsigned int cmpsize ATTRIBUTE_PACKED; /* 14-17 */
unsigned int ucmpsize ATTRIBUTE_PACKED; /* 18-21 */
unsigned short filename_len; /* 22-23 */
unsigned short extra_len; /* 24-25 */

View File

@ -39,7 +39,7 @@ int openvt_main(int argc, char **argv)
if (argc < 3)
bb_show_usage();
bb_show_usage();
/* check for Illegal vt number: < 1 or > 12 */
sprintf(vtname, VC_FORMAT,(int)bb_xgetlarg(argv[1], 10, 1, 12));
@ -56,7 +56,7 @@ int openvt_main(int argc, char **argv)
if (setsid() < 0) {
#endif
bb_perror_msg_and_die("Unable to set new session");
bb_perror_msg_and_die("Unable to set new session");
}
close(0); /* so that new vt becomes stdin */

View File

@ -45,7 +45,7 @@ setkeycodes_main(int argc, char** argv)
if (argc % 2 != 1 || argc < 2) {
bb_show_usage();
}
fd = get_console_fd();
while (argc > 2) {

View File

@ -457,8 +457,8 @@ config CONFIG_FEATURE_STAT_FORMAT
default n
depends on CONFIG_STAT
help
Without this, stat will not support the '-c format' option where
users can pass a custom format string for output. This adds about
Without this, stat will not support the '-c format' option where
users can pass a custom format string for output. This adds about
7k to a nonstatic build on amd64.
config CONFIG_STTY

View File

@ -45,10 +45,10 @@
#endif
#define THURSDAY 4 /* for reformation */
#define SATURDAY 6 /* 1 Jan 1 was a Saturday */
#define SATURDAY 6 /* 1 Jan 1 was a Saturday */
#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */
#define NUMBER_MISSING_DAYS 11 /* 11 day correction */
#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */
#define NUMBER_MISSING_DAYS 11 /* 11 day correction */
#define MAXDAYS 42 /* max slots in a month array */
#define SPACE -1 /* used in day array */

View File

@ -91,23 +91,23 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
&t.tm_min) == 2) {
/* no adjustments needed */
} else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon,
&t.tm_mday, &t.tm_hour,
&t.tm_mday, &t.tm_hour,
&t.tm_min, &t.tm_sec) == 5) {
/* Adjust dates from 1-12 to 0-11 */
t.tm_mon -= 1;
} else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon,
&t.tm_mday,
&t.tm_mday,
&t.tm_hour, &t.tm_min) == 4) {
/* Adjust dates from 1-12 to 0-11 */
t.tm_mon -= 1;
} else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year,
&t.tm_mon, &t.tm_mday,
&t.tm_mon, &t.tm_mday,
&t.tm_hour, &t.tm_min,
&t.tm_sec) == 6) {
t.tm_year -= 1900; /* Adjust years */
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
} else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year,
&t.tm_mon, &t.tm_mday,
&t.tm_mon, &t.tm_mday,
&t.tm_hour, &t.tm_min) == 5) {
t.tm_year -= 1900; /* Adjust years */
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
@ -119,9 +119,9 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
}
#define DATE_OPT_RFC2822 0x01
#define DATE_OPT_SET 0x02
#define DATE_OPT_UTC 0x04
#define DATE_OPT_DATE 0x08
#define DATE_OPT_SET 0x02
#define DATE_OPT_UTC 0x04
#define DATE_OPT_DATE 0x08
#define DATE_OPT_REFERENCE 0x10
#ifdef CONFIG_FEATURE_DATE_ISOFMT
# define DATE_OPT_TIMESPEC 0x20

View File

@ -365,7 +365,7 @@ static VALUE *eval6 (void)
else {
v = xmalloc (sizeof(VALUE));
v->type = string;
v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i);
v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i);
}
freev (l);
freev (i1);

View File

@ -44,7 +44,7 @@ static const struct option install_long_options[] = {
{ "preserve-timestamps", 0, NULL, 'p' },
{ "strip", 0, NULL, 's' },
{ "group", 0, NULL, 'g' },
{ "mode", 0, NULL, 'm' },
{ "mode", 0, NULL, 'm' },
{ "owner", 0, NULL, 'o' },
{ 0, 0, 0, 0 }
};

View File

@ -33,7 +33,7 @@ extern mode_t getopt_mk_fifo_nod(int argc, char **argv)
bb_getopt_ulflags(argc, argv, "m:", &smode);
if(smode) {
if (bb_parse_mode(smode, &mode))
if (bb_parse_mode(smode, &mode))
umask(0);
}
return mode;

View File

@ -173,7 +173,7 @@ static int show_color = 0;
static const struct option ls_color_opt[] =
{
{"color", optional_argument, NULL, 1},
{NULL, 0, NULL, 0}
{NULL, 0, NULL, 0}
};
#define COLOR(mode) ("\000\043\043\043\042\000\043\043"\
@ -318,7 +318,7 @@ static int count_dirs(struct dnode **dn, int nfiles, int notsubdirs)
dirs = 0;
for (i = 0; i < nfiles; i++) {
if (S_ISDIR(dn[i]->dstat.st_mode)
&& (notsubdirs ||
&& (notsubdirs ||
((dn[i]->name[0] != '.') || (dn[i]->name[1]
&& ((dn[i]->name[1] != '.')
|| dn[i]->name[2])))))
@ -747,7 +747,7 @@ static int list_single(struct dnode *dn)
{
char context[80];
int len;
if (dn->sid) {
/* I assume sid initilized with NULL */
len = strlen(dn->sid)+1;
@ -895,57 +895,57 @@ static const char ls_options[]="Cadil1gnsxAk" \
static const unsigned opt_flags[] = {
LIST_SHORT | STYLE_COLUMNS, /* C */
DISP_HIDDEN | DISP_DOT, /* a */
DISP_NOLIST, /* d */
LIST_INO, /* i */
LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */
LIST_SHORT | STYLE_SINGLE, /* 1 */
0, /* g - ingored */
LIST_ID_NUMERIC, /* n */
LIST_BLOCKS, /* s */
DISP_ROWS, /* x */
DISP_HIDDEN, /* A */
DISP_HIDDEN | DISP_DOT, /* a */
DISP_NOLIST, /* d */
LIST_INO, /* i */
LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */
LIST_SHORT | STYLE_SINGLE, /* 1 */
0, /* g - ingored */
LIST_ID_NUMERIC, /* n */
LIST_BLOCKS, /* s */
DISP_ROWS, /* x */
DISP_HIDDEN, /* A */
#ifdef CONFIG_SELINUX
LIST_CONTEXT, /* k */
LIST_CONTEXT, /* k */
#else
0, /* k - ingored */
0, /* k - ingored */
#endif
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
# ifdef CONFIG_FEATURE_LS_SORTFILES
TIME_CHANGE | SORT_CTIME, /* c */
# else
TIME_CHANGE, /* c */
TIME_CHANGE, /* c */
# endif
LIST_FULLTIME, /* e */
LIST_FULLTIME, /* e */
# ifdef CONFIG_FEATURE_LS_SORTFILES
SORT_MTIME, /* t */
SORT_MTIME, /* t */
# else
0, /* t - ignored -- is this correct? */
0, /* t - ignored -- is this correct? */
# endif
# ifdef CONFIG_FEATURE_LS_SORTFILES
TIME_ACCESS | SORT_ATIME, /* u */
# else
TIME_ACCESS, /* u */
TIME_ACCESS, /* u */
# endif
#endif
#ifdef CONFIG_FEATURE_LS_SORTFILES
SORT_SIZE, /* S */
SORT_EXT, /* X */
SORT_ORDER_REVERSE, /* r */
SORT_VERSION, /* v */
SORT_SIZE, /* S */
SORT_EXT, /* X */
SORT_ORDER_REVERSE, /* r */
SORT_VERSION, /* v */
#endif
#ifdef CONFIG_FEATURE_LS_FILETYPES
LIST_FILETYPE | LIST_EXEC, /* F */
LIST_FILETYPE, /* p */
LIST_FILETYPE, /* p */
#endif
#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
FOLLOW_LINKS, /* L */
FOLLOW_LINKS, /* L */
#endif
#ifdef CONFIG_FEATURE_LS_RECURSIVE
DISP_RECURSIVE, /* R */
DISP_RECURSIVE, /* R */
#endif
#ifdef CONFIG_FEATURE_HUMAN_READABLE
LS_DISP_HR, /* h */
LS_DISP_HR, /* h */
#endif
#ifdef CONFIG_SELINUX
LIST_MODEBITS|LIST_NLINKS|LIST_CONTEXT|LIST_SIZE|LIST_DATE_TIME, /* K */
@ -1025,7 +1025,7 @@ extern int ls_main(int argc, char **argv)
for (i = 0; opt_flags[i] != (1U<<31); i++) {
if (opt & (1 << i)) {
unsigned int flags = opt_flags[i];
if (flags & LIST_MASK_TRIGGER) {
all_fmt &= ~LIST_MASK;
}
@ -1064,11 +1064,11 @@ extern int ls_main(int argc, char **argv)
#if CONFIG_FEATURE_LS_COLOR_IS_DEFAULT
char *p;
if ((p = getenv ("LS_COLORS")) != NULL &&
if ((p = getenv ("LS_COLORS")) != NULL &&
(*p == '\0' || (strcmp(p, "none") == 0))) {
;
} else if (isatty(STDOUT_FILENO)) {
show_color = 1;
show_color = 1;
}
#endif

View File

@ -77,7 +77,7 @@ int nice_main(int argc, char **argv)
bb_perror_msg_and_die(Xetpriority_msg, 's');
}
}
execvp(*argv, argv); /* Now exec the desired program. */
/* The exec failed... */

View File

@ -63,12 +63,12 @@ void multiconvert(char *arg, void *result, converter convert)
}
if(convert(arg,result)) fprintf(stderr, "%s", arg);
}
static unsigned long xstrtoul(char *arg)
{
unsigned long result;
multiconvert(arg,&result, (converter)safe_strtoul);
multiconvert(arg,&result, (converter)safe_strtoul);
return result;
}

View File

@ -59,7 +59,7 @@ extern int rmdir_main(int argc, char **argv)
/* Path is now just the parent component. Note that dirname
* returns "." if there are no parents. We must distinguish
* this from the case of the original path starting with '.'.
*/
*/
if (do_dot || (*path != '.') || path[1]) {
continue;
}

View File

@ -156,7 +156,7 @@ static int compare_keys(const void *xarg, const void *yarg)
#ifdef CONFIG_FEATURE_SORT_BIG
struct sort_key *key;
for(key=key_list;!retval && key;key=key->next_key) {
flags=(key->flags) ? key->flags : global_flags;
/* Chop out and modify key chunks, handling -dfib */
@ -312,7 +312,7 @@ int sort_main(int argc, char **argv)
#ifdef CONFIG_FEATURE_SORT_BIG
/* if no key, perform alphabetic sort */
if(!key_list) add_key()->range[0]=1;
/* handle -c */
/* handle -c */
if(global_flags&FLAG_c) {
int j=(global_flags&FLAG_u) ? -1 : 0;
for(i=1;i<linecount;i++)

View File

@ -44,9 +44,9 @@ static long flags;
static char const *file_type(struct stat const *st)
{
/* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107
/* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107
* for some of these formats.
* To keep diagnostics grammatical in English, the
* To keep diagnostics grammatical in English, the
* returned string must start with a consonant.
*/
if (S_ISREG(st->st_mode)) return st->st_size == 0 ? "regular empty file" : "regular file";
@ -131,8 +131,8 @@ static char const *human_fstype(long f_type)
#ifdef CONFIG_FEATURE_STAT_FORMAT
/* print statfs info */
static void print_statfs(char *pformat, size_t buf_len, char m,
char const *filename, void const *data)
static void print_statfs(char *pformat, size_t buf_len, char m,
char const *filename, void const *data)
{
struct statfs const *statfsbuf = data;
@ -190,8 +190,8 @@ static void print_statfs(char *pformat, size_t buf_len, char m,
}
/* print stat info */
static void print_stat(char *pformat, size_t buf_len, char m,
char const *filename, void const *data)
static void print_stat(char *pformat, size_t buf_len, char m,
char const *filename, void const *data)
{
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
struct stat *statbuf = (struct stat *) data;
@ -326,9 +326,9 @@ static void print_stat(char *pformat, size_t buf_len, char m,
}
}
static void print_it(char const *masterformat, char const *filename,
void (*print_func) (char *, size_t, char, char const *, void const *),
void const *data)
static void print_it(char const *masterformat, char const *filename,
void (*print_func) (char *, size_t, char, char const *, void const *),
void const *data)
{
char *b;

View File

@ -4,14 +4,14 @@
*
* Copyright (c) by a whole pile of folks:
*
* test(1); version 7-like -- author Erik Baalbergen
* modified by Eric Gisin to be used as built-in.
* modified by Arnold Robbins to add SVR3 compatibility
* (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket).
* modified by J.T. Conklin for NetBSD.
* modified by Herbert Xu to be used as built-in in ash.
* modified by Erik Andersen <andersen@codepoet.org> to be used
* in busybox.
* test(1); version 7-like -- author Erik Baalbergen
* modified by Eric Gisin to be used as built-in.
* modified by Arnold Robbins to add SVR3 compatibility
* (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket).
* modified by J.T. Conklin for NetBSD.
* modified by Herbert Xu to be used as built-in in ash.
* modified by Erik Andersen <andersen@codepoet.org> to be used
* in busybox.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,7 +28,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Original copyright notice states:
* "This program is in the Public Domain."
* "This program is in the Public Domain."
*/
#include <sys/types.h>

View File

@ -93,7 +93,7 @@ int uname_main(int argc, char **argv)
}
#if defined(__sparc__) && defined(__linux__)
if ((fake_sparc != NULL)
if ((fake_sparc != NULL)
&& ((fake_sparc[0] == 'y')
|| (fake_sparc[0] == 'Y'))) {
strcpy(uname_info.name.machine, "sparc");

View File

@ -56,7 +56,7 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream)
bb_error_msg_and_die("Short file");
}
while (length > 0) {
while (length > 0) {
/* Merge four 6 bit chars to three 8 bit chars */
fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream);
line_ptr++;
@ -65,14 +65,14 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream)
break;
}
fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream);
fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream);
line_ptr++;
length--;
if (length == 0) {
break;
}
fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream);
fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream);
line_ptr += 2;
length -= 2;
}
@ -130,10 +130,10 @@ static int read_base64(FILE *src_stream, FILE *dst_stream)
/* Merge 6 bit chars to 8 bit */
fputc(translated[0] << 2 | translated[1] >> 4, dst_stream);
if (count > 2) {
fputc(translated[1] << 4 | translated[2] >> 2, dst_stream);
fputc(translated[1] << 4 | translated[2] >> 2, dst_stream);
}
if (count > 3) {
fputc(translated[2] << 6 | translated[3], dst_stream);
fputc(translated[2] << 6 | translated[3], dst_stream);
}
}
}

View File

@ -33,49 +33,49 @@ extern int who_main(int argc, char **argv)
time_t now, idle;
if (argc > 1)
bb_show_usage();
bb_show_usage();
setutent();
devlen = sizeof("/dev/") - 1;
printf("USER TTY IDLE FROM HOST\n");
while ((ut = getutent()) != NULL) {
char name[40];
char name[40];
if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
len = strlen(ut->ut_line);
if (ut->ut_line[0] == '/') {
strncpy(name, ut->ut_line, len);
name[len] = '\0';
strcpy(ut->ut_line, ut->ut_line + devlen);
} else {
strcpy(name, "/dev/");
strncpy(name+devlen, ut->ut_line, len);
name[devlen+len] = '\0';
}
if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
len = strlen(ut->ut_line);
if (ut->ut_line[0] == '/') {
strncpy(name, ut->ut_line, len);
name[len] = '\0';
strcpy(ut->ut_line, ut->ut_line + devlen);
} else {
strcpy(name, "/dev/");
strncpy(name+devlen, ut->ut_line, len);
name[devlen+len] = '\0';
}
printf("%-10s %-8s ", ut->ut_user, ut->ut_line);
printf("%-10s %-8s ", ut->ut_user, ut->ut_line);
if (stat(name, &st) == 0) {
now = time(NULL);
idle = now - st.st_atime;
if (stat(name, &st) == 0) {
now = time(NULL);
idle = now - st.st_atime;
if (idle < 60)
printf("00:00m ");
else if (idle < (60 * 60))
printf("00:%02dm ", (int)(idle / 60));
else if (idle < (24 * 60 * 60))
printf("%02d:%02dm ", (int)(idle / (60 * 60)),
(int)(idle % (60 * 60)) / 60);
else if (idle < (24 * 60 * 60 * 365))
printf("%03ddays ", (int)(idle / (24 * 60 * 60)));
else
printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365)));
} else
printf("%-8s ", "?");
if (idle < 60)
printf("00:00m ");
else if (idle < (60 * 60))
printf("00:%02dm ", (int)(idle / 60));
else if (idle < (24 * 60 * 60))
printf("%02d:%02dm ", (int)(idle / (60 * 60)),
(int)(idle % (60 * 60)) / 60);
else if (idle < (24 * 60 * 60 * 365))
printf("%03ddays ", (int)(idle / (24 * 60 * 60)));
else
printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365)));
} else
printf("%-8s ", "?");
printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
}
printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
}
}
endutent();

View File

@ -6,7 +6,7 @@
* Copyright (C) 2000 by Daniel Jacobowitz
* Written by Daniel Jacobowitz <dan@debian.org>
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <stdio.h>
@ -19,7 +19,7 @@
extern int mktemp_main(int argc, char **argv)
{
unsigned long flags = bb_getopt_ulflags(argc, argv, "dq");
if (optind + 1 != argc)
bb_show_usage();

View File

@ -36,10 +36,10 @@
* broken compatibility because the BusyBox policy doesn't allow them.
* The supported options are:
* -t test. Print the name of the files to be executed, without
* execute them.
* execute them.
* -a ARG argument. Pass ARG as an argument the program executed. It can
* be repeated to pass multiple arguments.
* -u MASK umask. Set the umask of the program executed to MASK. */
* be repeated to pass multiple arguments.
* -u MASK umask. Set the umask of the program executed to MASK. */
/* TODO
* done - convert calls to error in perror... and remove error()

View File

@ -238,7 +238,7 @@ start_stop_daemon_main(int argc, char **argv)
opt = bb_getopt_ulflags(argc, argv, "KSbqma:n:s:u:x:p:",
&startas, &cmdname, &signame, &userspec, &execname, &pidfile);
quiet = opt & SSD_OPT_QUIET;
if (signame) {

View File

@ -17,7 +17,7 @@ config CONFIG_E2FSCK
help
e2fsck is used to check Linux second extended file systems (ext2fs).
e2fsck also supports ext2 filesystems countaining a journal (ext3).
The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also
The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also
provided.
config CONFIG_FSCK
@ -25,7 +25,7 @@ config CONFIG_FSCK
default n
help
fsck is used to check and optionally repair one or more filesystems.
In actuality, fsck is simply a front-end for the various file system
In actuality, fsck is simply a front-end for the various file system
checkers (fsck.fstype) available under Linux.
config CONFIG_LSATTR
@ -38,14 +38,14 @@ config CONFIG_MKE2FS
bool "mke2fs"
default n
help
mke2fs is used to create an ext2/ext3 filesystem. The normal compat
mke2fs is used to create an ext2/ext3 filesystem. The normal compat
symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided.
config CONFIG_TUNE2FS
bool "tune2fs"
default n
help
tune2fs allows the system administrator to adjust various tunable
tune2fs allows the system administrator to adjust various tunable
filesystem parameters on Linux ext2/ext3 filesystems.
config CONFIG_E2LABEL
@ -53,7 +53,7 @@ config CONFIG_E2LABEL
default n
depends on CONFIG_TUNE2FS
help
e2label will display or change the filesystem label on the ext2
e2label will display or change the filesystem label on the ext2
filesystem located on device.
config CONFIG_FINDFS
@ -61,7 +61,7 @@ config CONFIG_FINDFS
default n
depends on CONFIG_TUNE2FS
help
findfs will search the disks in the system looking for a filesystem
findfs will search the disks in the system looking for a filesystem
which has a label matching label or a UUID equal to uuid.
endmenu

View File

@ -34,13 +34,13 @@ typedef struct blkid_struct_dev_iterate *blkid_dev_iterate;
* Flags for blkid_get_dev
*
* BLKID_DEV_CREATE Create an empty device structure if not found
* in the cache.
* in the cache.
* BLKID_DEV_VERIFY Make sure the device structure corresponds
* with reality.
* with reality.
* BLKID_DEV_FIND Just look up a device entry, and return NULL
* if it is not found.
* if it is not found.
* BLKID_DEV_NORMAL Get a valid device structure, either from the
* cache or by probing the device.
* cache or by probing the device.
*/
#define BLKID_DEV_FIND 0x0000
#define BLKID_DEV_CREATE 0x0001

View File

@ -70,7 +70,7 @@ blkid_loff_t blkid_get_dev_size(int fd)
{
int valid_blkgetsize64 = 1;
#ifdef __linux__
struct utsname ut;
struct utsname ut;
#endif
unsigned long long size64;
unsigned long size;

View File

@ -47,9 +47,9 @@ int blkid_get_cache(blkid_cache *ret_cache, const char *filename)
if (!filename)
filename = BLKID_CACHE_FILE;
cache->bic_filename = blkid_strdup(filename);
blkid_read_cache(cache);
*ret_cache = cache;
return 0;
}
@ -62,7 +62,7 @@ void blkid_put_cache(blkid_cache cache)
(void) blkid_flush_cache(cache);
DBG(DEBUG_CACHE, printf("freeing cache struct\n"));
/* DEB_DUMP_CACHE(cache); */
while (!list_empty(&cache->bic_devs)) {
@ -79,7 +79,7 @@ void blkid_put_cache(blkid_cache cache)
while (!list_empty(&tag->bit_names)) {
blkid_tag bad = list_entry(tag->bit_names.next,
struct blkid_struct_tag,
struct blkid_struct_tag,
bit_names);
DBG(DEBUG_CACHE, printf("warning: unfreed tag %s=%s\n",
@ -90,7 +90,7 @@ void blkid_put_cache(blkid_cache cache)
}
if (cache->bic_filename)
free(cache->bic_filename);
free(cache);
}

View File

@ -73,7 +73,7 @@ extern const char *blkid_dev_devname(blkid_dev dev)
* This series of functions iterate over all devices in a blkid cache
*/
#define DEV_ITERATE_MAGIC 0x01a5284c
struct blkid_struct_dev_iterate {
int magic;
blkid_cache cache;

View File

@ -54,7 +54,7 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
if (strcmp(tmp->bid_name, devname))
continue;
DBG(DEBUG_DEVNAME,
DBG(DEBUG_DEVNAME,
printf("found devname %s in cache\n", tmp->bid_name));
dev = tmp;
break;
@ -113,7 +113,7 @@ static void probe_one(blkid_cache cache, const char *ptname,
dev->bid_devno == devno)
goto set_pri;
if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) &&
if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) &&
st.st_rdev == devno) {
devname = blkid_strdup(device);
break;

View File

@ -171,13 +171,13 @@ char *blkid_devno_to_devname(dev_t devno)
if (!devname) {
DBG(DEBUG_DEVNO,
printf("blkid: couldn't find devno 0x%04lx\n",
printf("blkid: couldn't find devno 0x%04lx\n",
(unsigned long) devno));
} else {
DBG(DEBUG_DEVNO,
printf("found devno 0x%04Lx as %s\n", devno, devname));
}
return devname;
}

View File

@ -41,7 +41,7 @@ static int check_mdraid(int fd, unsigned char *ret_uuid)
struct mdp_superblock_s *md;
blkid_loff_t offset;
char buf[4096];
if (fd < 0)
return -BLKID_ERR_PARAM;
@ -83,7 +83,7 @@ static void get_ext2_info(blkid_dev dev, unsigned char *buf)
struct ext2_super_block *es = (struct ext2_super_block *) buf;
const char *label = 0;
DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n",
DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n",
blkid_le32(es->s_feature_compat),
blkid_le32(es->s_feature_incompat),
blkid_le32(es->s_feature_ro_compat)));
@ -95,8 +95,8 @@ static void get_ext2_info(blkid_dev dev, unsigned char *buf)
set_uuid(dev, es->s_uuid);
}
static int probe_ext3(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_ext3(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id, unsigned char *buf)
{
@ -105,7 +105,7 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)),
es = (struct ext2_super_block *)buf;
/* Distinguish between jbd and ext2/3 fs */
if (blkid_le32(es->s_feature_incompat) &
if (blkid_le32(es->s_feature_incompat) &
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
return -BLKID_ERR_PARAM;
@ -121,8 +121,8 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_ext2(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_ext2(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id, unsigned char *buf)
{
@ -132,7 +132,7 @@ static int probe_ext2(int fd __BLKID_ATTR((unused)),
es = (struct ext2_super_block *)buf;
/* Distinguish between jbd and ext2/3 fs */
if (blkid_le32(es->s_feature_incompat) &
if (blkid_le32(es->s_feature_incompat) &
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
return -BLKID_ERR_PARAM;
@ -141,10 +141,10 @@ static int probe_ext2(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_jbd(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
static int probe_jbd(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct ext2_super_block *es = (struct ext2_super_block *) buf;
@ -158,10 +158,10 @@ static int probe_jbd(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_vfat(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_vfat(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct vfat_super_block *vs;
@ -191,10 +191,10 @@ static int probe_vfat(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_msdos(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_msdos(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct msdos_super_block *ms = (struct msdos_super_block *) buf;
@ -223,10 +223,10 @@ static int probe_msdos(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_xfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_xfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct xfs_super_block *xs;
@ -241,8 +241,8 @@ static int probe_xfs(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_reiserfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_reiserfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id, unsigned char *buf)
{
@ -268,10 +268,10 @@ static int probe_reiserfs(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_jfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_jfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct jfs_super_block *js;
@ -286,10 +286,10 @@ static int probe_jfs(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_romfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_romfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct romfs_super_block *ros;
@ -340,7 +340,7 @@ static int probe_swap1(int fd,
/* arbitrary sanity check.. is there any garbage down there? */
if (sws->sws_pad[32] == 0 && sws->sws_pad[33] == 0) {
if (sws->sws_volume[0])
blkid_set_tag(dev, "LABEL", sws->sws_volume,
blkid_set_tag(dev, "LABEL", sws->sws_volume,
sizeof(sws->sws_volume));
if (sws->sws_uuid[0])
set_uuid(dev, sws->sws_uuid);
@ -354,9 +354,9 @@ static const char
* const udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02",
"NSR03", "TEA01", 0 };
static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)),
static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf __BLKID_ATTR((unused)))
{
int j, bs;
@ -396,10 +396,10 @@ static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)),
return 1;
}
static int probe_ocfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_ocfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct ocfs_volume_header ovh;
@ -414,17 +414,17 @@ static int probe_ocfs(int fd __BLKID_ATTR((unused)),
blkid_set_tag(dev,"SEC_TYPE","ocfs1",sizeof("ocfs1"));
else if (major >= 9)
blkid_set_tag(dev,"SEC_TYPE","ntocfs",sizeof("ntocfs"));
blkid_set_tag(dev, "LABEL", ovl.label, ocfslabellen(ovl));
blkid_set_tag(dev, "MOUNT", ovh.mount, ocfsmountlen(ovh));
set_uuid(dev, ovl.vol_id);
return 0;
}
static int probe_ocfs2(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_ocfs2(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct ocfs2_super_block *osb;
@ -436,10 +436,10 @@ static int probe_ocfs2(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_oracleasm(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
static int probe_oracleasm(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
const struct blkid_magic *id __BLKID_ATTR((unused)),
const struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct oracle_asm_disk_label *dl;
@ -548,13 +548,13 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
diff = now - dev->bid_time;
if ((now < dev->bid_time) ||
(diff < BLKID_PROBE_MIN) ||
(diff < BLKID_PROBE_MIN) ||
(dev->bid_flags & BLKID_BID_FL_VERIFIED &&
diff < BLKID_PROBE_INTERVAL))
return dev;
DBG(DEBUG_PROBE,
printf("need to revalidate %s (time since last check %lu)\n",
printf("need to revalidate %s (time since last check %lu)\n",
dev->bid_name, diff));
if (((fd = open(dev->bid_name, O_RDONLY)) < 0) ||
@ -571,12 +571,12 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
}
memset(bufs, 0, sizeof(bufs));
/*
* Iterate over the type array. If we already know the type,
* then try that first. If it doesn't work, then blow away
* the type information, and try again.
*
*
*/
try_again:
type = 0;
@ -637,7 +637,7 @@ try_again:
blkid_free_dev(dev);
return NULL;
}
found_type:
if (dev && type) {
dev->bid_devno = st.st_rdev;
@ -646,7 +646,7 @@ found_type:
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
blkid_set_tag(dev, "TYPE", type, 0);
DBG(DEBUG_PROBE, printf("%s: devno 0x%04Lx, type %s\n",
dev->bid_name, st.st_rdev, type));
}
@ -696,7 +696,7 @@ int main(int argc, char **argv)
printf("\tlabel is '%s'\n", dev->bid_label);
if (dev->bid_uuid)
printf("\tuuid is %s\n", dev->bid_uuid);
blkid_free_dev(dev);
return (0);
}

View File

@ -18,7 +18,7 @@
struct blkid_magic;
typedef int (*blkid_probe_t)(int fd, blkid_cache cache, blkid_dev dev,
typedef int (*blkid_probe_t)(int fd, blkid_cache cache, blkid_dev dev,
const struct blkid_magic *id, unsigned char *buf);
struct blkid_magic {
@ -222,16 +222,16 @@ struct ocfs_volume_header {
struct ocfs_volume_label {
unsigned char disk_lock[48];
unsigned char label[64];
unsigned char label[64];
unsigned char label_len[2];
unsigned char vol_id[16];
unsigned char vol_id_len[2];
};
#define ocfsmajor(o) ((__u32)o.major_version[0] \
+ (((__u32) o.major_version[1]) << 8) \
+ (((__u32) o.major_version[2]) << 16) \
+ (((__u32) o.major_version[3]) << 24))
+ (((__u32) o.major_version[1]) << 8) \
+ (((__u32) o.major_version[2]) << 16) \
+ (((__u32) o.major_version[3]) << 24))
#define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8))
#define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8))
@ -334,7 +334,7 @@ _INLINE_ __u64 blkid_swab64(__u64 val)
return (blkid_swab32(val >> 32) |
(((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32));
}
#endif
#endif

View File

@ -302,7 +302,7 @@ static int parse_tag(blkid_cache cache, blkid_dev dev, char **cp)
return ret;
/* Some tags are stored directly in the device struct */
if (!strcmp(name, "DEVNO"))
if (!strcmp(name, "DEVNO"))
dev->bid_devno = STRTOULL(value, 0, 0);
else if (!strcmp(name, "PRI"))
dev->bid_pri = strtol(value, 0, 0);
@ -389,7 +389,7 @@ void blkid_read_cache(blkid_cache cache)
cache->bic_filename));
goto errout;
}
DBG(DEBUG_CACHE, printf("reading cache file %s\n",
cache->bic_filename));

View File

@ -69,7 +69,7 @@ char *blkid_get_devname(blkid_cache cache, const char *token,
if (!token)
return NULL;
if (!cache) {
if (blkid_get_cache(&c, NULL) < 0)
return NULL;
@ -125,7 +125,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Couldn't get blkid cache\n");
exit(1);
}
if (argv[2]) {
value = blkid_get_tag_value(cache, argv[1], argv[2]);
printf("%s has tag %s=%s\n", argv[2], argv[1],

View File

@ -176,7 +176,7 @@ int main(int argc, char **argv)
exit(1);
}
cache->bic_filename = blkid_strdup(argv[1]);
if ((ret = blkid_flush_cache(cache)) < 0) {
fprintf(stderr, "error (%d) saving cache\n", ret);
exit(1);

View File

@ -96,7 +96,7 @@ static blkid_tag blkid_find_head_cache(blkid_cache cache, const char *type)
/*
* Set a tag on an existing device.
*
*
* If value is NULL, then delete the tagsfrom the device.
*/
int blkid_set_tag(blkid_dev dev, const char *name,
@ -131,7 +131,7 @@ int blkid_set_tag(blkid_dev dev, const char *name,
t->bit_dev = dev;
list_add_tail(&t->bit_tags, &dev->bid_tags);
if (dev->bid_cache) {
head = blkid_find_head_cache(dev->bid_cache,
t->bit_name);
@ -151,7 +151,7 @@ int blkid_set_tag(blkid_dev dev, const char *name,
list_add_tail(&t->bit_names, &head->bit_names);
}
}
/* Link common tags directly to the device struct */
if (!strcmp(name, "TYPE"))
dev->bid_type = val;
@ -159,7 +159,7 @@ int blkid_set_tag(blkid_dev dev, const char *name,
dev->bid_label = val;
else if (!strcmp(name, "UUID"))
dev->bid_uuid = val;
if (dev->bid_cache)
dev->bid_cache->bic_flags |= BLKID_BIC_FL_CHANGED;
return 0;
@ -235,7 +235,7 @@ errout:
* This series of functions iterate over all tags in a device
*/
#define TAG_ITERATE_MAGIC 0x01a5284c
struct blkid_struct_tag_iterate {
int magic;
blkid_dev dev;
@ -260,7 +260,7 @@ extern int blkid_tag_next(blkid_tag_iterate iter,
const char **type, const char **value)
{
blkid_tag tag;
*type = 0;
*value = 0;
if (!iter || iter->magic != TAG_ITERATE_MAGIC ||
@ -303,9 +303,9 @@ extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
return NULL;
blkid_read_cache(cache);
DBG(DEBUG_TAG, printf("looking for %s=%s in cache\n", type, value));
try_again:
pri = -1;
dev = 0;
@ -313,7 +313,7 @@ try_again:
if (head) {
list_for_each(p, &head->bit_names) {
blkid_tag tmp = list_entry(p, struct blkid_struct_tag,
blkid_tag tmp = list_entry(p, struct blkid_struct_tag,
bit_names);
if (!strcmp(tmp->bit_val, value) &&

View File

@ -161,8 +161,8 @@ skip_setflags:
iterate_on_dir(name, chattr_dir_proc, NULL);
}
static int chattr_dir_proc(const char *dir_name, struct dirent *de,
void *private EXT2FS_ATTR((unused)))
static int chattr_dir_proc(const char *dir_name, struct dirent *de,
void *private EXT2FS_ATTR((unused)))
{
/*if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {*/
if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || \

View File

@ -11797,8 +11797,8 @@ static int count_tags(struct buffer_head *bh, int size)
/* Make sure we wrap around the log correctly! */
#define wrap(journal, var) \
do { \
#define wrap(journal, var) \
do { \
if (var >= (journal)->j_last) \
var -= ((journal)->j_last - (journal)->j_first); \
} while (0)

View File

@ -1,11 +1,11 @@
/*
* feature.c --- convert between features and strings
*
*
* Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu>
*
*
* This file can be redistributed under the terms of the GNU Library General
* Public License
*
*
*/
#include <stdio.h>

View File

@ -33,11 +33,11 @@
#define OPEN_FLAGS (O_RDONLY|O_NONBLOCK)
#endif
/*
/*
To do fsetversion: unsigned long *ptr_version must be set to NULL.
and unsigned long version must be set to a value
and unsigned long version must be set to a value
To do fgetversion: unsigned long *ptr_version must NOT be set to NULL
and unsigned long version is ignored.
and unsigned long version is ignored.
TITO.
*/

View File

@ -1,11 +1,11 @@
/*
* feature.c --- convert between features and strings
*
*
* Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu>
*
*
* This file can be redistributed under the terms of the GNU Library General
* Public License
*
*
*/
#include <stdio.h>

View File

@ -6,7 +6,7 @@
* Universite Pierre et Marie Curie (Paris VI)
*
* Copyright (C) 1995, 1996, 1997 Theodore Ts'o <tytso@mit.edu>
*
*
* This file can be redistributed under the terms of the GNU Library General
* Public License
*/
@ -190,11 +190,11 @@ void list_super2(struct ext2_super_block * sb, FILE *f)
"Block size: %u\n"
"Fragment size: %u\n",
str, sb->s_inodes_count, sb->s_blocks_count, sb->s_r_blocks_count,
sb->s_free_blocks_count, sb->s_free_inodes_count,
sb->s_free_blocks_count, sb->s_free_inodes_count,
sb->s_first_data_block, EXT2_BLOCK_SIZE(sb), EXT2_FRAG_SIZE(sb));
free(str);
if (sb->s_reserved_gdt_blocks)
fprintf(f, "Reserved GDT blocks: %u\n",
fprintf(f, "Reserved GDT blocks: %u\n",
sb->s_reserved_gdt_blocks);
fprintf(f,
"Blocks per group: %u\n"

View File

@ -1,11 +1,11 @@
/*
* mountopts.c --- convert between default mount options and strings
*
*
* Copyright (C) 2002 Theodore Ts'o <tytso@mit.edu>
*
*
* This file can be redistributed under the terms of the GNU Library General
* Public License
*
*
*/
#include <stdio.h>

View File

@ -11,10 +11,10 @@
#include <string.h>
static const char * const os_tab[] =
{ "Linux",
"Hurd",
"Masix",
"FreeBSD",
{ "Linux",
"Hurd",
"Masix",
"FreeBSD",
"Lites",
0 };
@ -53,7 +53,7 @@ int e2p_string2os(char *str)
#ifdef TEST_PROGRAM
int main(int argc, char **argv)
{
char *s;
char *s;
int i, os;
for (i=0; i <= EXT2_OS_LITES; i++) {

View File

@ -1,8 +1,8 @@
/*
* parse_num.c - Parse the number of blocks
* parse_num.c - Parse the number of blocks
*
* Copyright (C) 2004,2005 Theodore Ts'o <tytso@mit.edu>
*
*
* This file can be redistributed under the terms of the GNU Library General
* Public License
*/
@ -18,25 +18,25 @@ unsigned long parse_num_blocks(const char *arg, int log_block_size)
num = strtoull(arg, &p, 0);
if (p[0] && p[1])
if (p[0] && p[1])
return 0;
switch (*p) { /* Using fall-through logic */
case 'T': case 't':
case 'T': case 't':
num <<= 10;
case 'G': case 'g':
case 'G': case 'g':
num <<= 10;
case 'M': case 'm':
case 'M': case 'm':
num <<= 10;
case 'K': case 'k':
num >>= log_block_size;
case 'K': case 'k':
num >>= log_block_size;
break;
case 's':
case 's':
num >>= 1;
break;
case '\0':
break;
default:
default:
return 0;
}
return num;

View File

@ -41,7 +41,7 @@ static const struct flags_name flags_array[] = {
{ EXT2_ECOMPR_FL, "E", "Compression_Error" },
#endif
{ EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" },
{ EXT2_INDEX_FL, "I", "Indexed_direcctory" },
{ EXT2_INDEX_FL, "I", "Indexed_direcctory" },
{ EXT2_NOTAIL_FL, "t", "No_Tailmerging" },
{ EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
{ 0, NULL, NULL }

View File

@ -19,7 +19,7 @@ struct uuid {
/* Returns 1 if the uuid is the NULL uuid */
int e2p_is_null_uuid(void *uu)
{
__u8 *cp;
__u8 *cp;
int i;
for (i=0, cp = uu; i < 16; i++)
@ -42,7 +42,7 @@ static void e2p_unpack_uuid(void *in, struct uuid *uu)
tmp = *ptr++;
tmp = (tmp << 8) | *ptr++;
uu->time_mid = tmp;
tmp = *ptr++;
tmp = (tmp << 8) | *ptr++;
uu->time_hi_and_version = tmp;

View File

@ -7,7 +7,7 @@
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*
*
*/
#include <stdio.h>
@ -32,7 +32,7 @@
*
* Should have a special policy for directories.
*/
errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir,
errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir,
int mode EXT2FS_ATTR((unused)),
ext2fs_inode_bitmap map, ext2_ino_t *ret)
{
@ -41,13 +41,13 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir,
ext2_ino_t start_inode;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
if (!map)
map = fs->inode_map;
if (!map)
return EXT2_ET_NO_INODE_BITMAP;
if (dir > 0)
if (dir > 0)
dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super);
start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1;
@ -62,7 +62,7 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir,
if (i > fs->super->s_inodes_count)
i = EXT2_FIRST_INODE(fs->super);
} while (i != start_inode);
if (ext2fs_test_inode_bitmap(map, i))
return EXT2_ET_INODE_ALLOC_FAIL;
*ret = i;
@ -131,7 +131,7 @@ errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
retval = io_channel_write_blk(fs->io, block, 1, block_buf);
if (retval)
goto fail;
ext2fs_block_alloc_stats(fs, block, +1);
*ret = block;
return 0;

View File

@ -1,5 +1,5 @@
/*
* alloc_sb.c --- Allocate the superblock and block group descriptors for a
* alloc_sb.c --- Allocate the superblock and block group descriptors for a
* newly initialized filesystem. Used by mke2fs when initializing a filesystem
*
* Copyright (C) 1994, 1995, 1996, 2003 Theodore Ts'o.
@ -27,20 +27,20 @@
#include "ext2_fs.h"
#include "ext2fs.h"
int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
dgrp_t group,
ext2fs_block_bitmap bmap)
{
blk_t super_blk, old_desc_blk, new_desc_blk;
int j, old_desc_blocks, num_blocks;
num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk,
num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk,
&old_desc_blk, &new_desc_blk, 0);
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
old_desc_blocks = fs->super->s_first_meta_bg;
else
old_desc_blocks =
old_desc_blocks =
fs->desc_blocks + fs->super->s_reserved_gdt_blocks;
if (super_blk || (group == 0))

View File

@ -7,7 +7,7 @@
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*
*
*/
#include <stdio.h>

View File

@ -36,14 +36,14 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
group_blk = fs->super->s_first_data_block +
(group * fs->super->s_blocks_per_group);
last_blk = group_blk + fs->super->s_blocks_per_group;
if (last_blk >= fs->super->s_blocks_count)
last_blk = fs->super->s_blocks_count - 1;
if (!bmap)
bmap = fs->block_map;
/*
* Allocate the block and inode bitmaps, if necessary
*/
@ -59,7 +59,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
if (!fs->group_desc[group].bg_block_bitmap) {
retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
1, bmap, &new_blk);
if (retval == EXT2_ET_BLOCK_ALLOC_FAIL)
if (retval == EXT2_ET_BLOCK_ALLOC_FAIL)
retval = ext2fs_get_free_blocks(fs, group_blk,
last_blk, 1, bmap, &new_blk);
if (retval)
@ -71,7 +71,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
if (!fs->group_desc[group].bg_inode_bitmap) {
retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
1, bmap, &new_blk);
if (retval == EXT2_ET_BLOCK_ALLOC_FAIL)
if (retval == EXT2_ET_BLOCK_ALLOC_FAIL)
retval = ext2fs_get_free_blocks(fs, group_blk,
last_blk, 1, bmap, &new_blk);
if (retval)
@ -96,11 +96,11 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
fs->group_desc[group].bg_inode_table = new_blk;
}
return 0;
}
errcode_t ext2fs_allocate_tables(ext2_filsys fs)
{

View File

@ -1,6 +1,6 @@
/*
* badblocks.c --- routines to manipulate the bad block structure
*
*
* Copyright (C) 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
@ -34,7 +34,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list,
{
ext2_u32_list bb;
errcode_t retval;
retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_list), &bb);
if (retval)
return retval;
@ -54,7 +54,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list,
*ret = bb;
return 0;
}
/*
* This procedure creates an empty u32 list.
@ -79,7 +79,7 @@ errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, int size)
errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest)
{
errcode_t retval;
retval = make_u32_list(src->size, src->num, src->list, dest);
if (retval)
return retval;
@ -271,11 +271,11 @@ int ext2fs_u32_list_iterate(ext2_u32_iterate iter, __u32 *blk)
if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST)
return 0;
if (iter->ptr < bb->num) {
*blk = bb->list[iter->ptr++];
return 1;
}
}
*blk = 0;
return 0;
}

View File

@ -1,6 +1,6 @@
/*
* bb_compat.c --- compatibility badblocks routines
*
*
* Copyright (C) 1997 Theodore Ts'o.
*
* %Begin-Header%

View File

@ -1,12 +1,12 @@
/*
* bb_inode.c --- routines to update the bad block inode.
*
*
* WARNING: This routine modifies a lot of state in the filesystem; if
* this routine returns an error, the bad block inode may be in an
* inconsistent state.
*
*
* Copyright (C) 1994, 1995 Theodore Ts'o.
*
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
@ -49,7 +49,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
e2_blkcnt_t blockcnt,
blk_t ref_block, int ref_offset,
void *priv_data);
/*
* Given a bad blocks bitmap, update the bad blocks inode to reflect
* the map.
@ -57,14 +57,14 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
{
errcode_t retval;
struct set_badblock_record rec;
struct set_badblock_record rec;
struct ext2_inode inode;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
if (!fs->block_map)
return EXT2_ET_NO_BLOCK_BITMAP;
rec.bad_block_count = 0;
rec.ind_blocks_size = rec.ind_blocks_ptr = 0;
rec.max_ind_blocks = 10;
@ -78,9 +78,9 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
goto cleanup;
memset(rec.block_buf, 0, fs->blocksize);
rec.err = 0;
/*
* First clear the old bad blocks (while saving the indirect blocks)
* First clear the old bad blocks (while saving the indirect blocks)
*/
retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO,
BLOCK_FLAG_DEPTH_TRAVERSE, 0,
@ -91,7 +91,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
retval = rec.err;
goto cleanup;
}
/*
* Now set the bad blocks!
*
@ -108,22 +108,22 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
BLOCK_FLAG_APPEND, 0,
set_bad_block_proc, &rec);
ext2fs_badblocks_list_iterate_end(rec.bb_iter);
if (retval)
if (retval)
goto cleanup;
if (rec.err) {
retval = rec.err;
goto cleanup;
}
}
/*
* Update the bad block inode's mod time and block count
* field.
* field.
*/
retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode);
if (retval)
goto cleanup;
inode.i_atime = inode.i_mtime = time(0);
if (!inode.i_ctime)
inode.i_ctime = time(0);
@ -133,7 +133,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
retval = ext2fs_write_inode(fs, EXT2_BAD_INO, &inode);
if (retval)
goto cleanup;
cleanup:
ext2fs_free_mem(&rec.ind_blocks);
ext2fs_free_mem(&rec.block_buf);
@ -158,7 +158,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
struct set_badblock_record *rec = (struct set_badblock_record *)
priv_data;
errcode_t retval;
unsigned long old_size;
unsigned long old_size;
if (!*block_nr)
return 0;
@ -176,7 +176,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
if (rec->ind_blocks_size >= rec->max_ind_blocks) {
old_size = rec->max_ind_blocks * sizeof(blk_t);
rec->max_ind_blocks += 10;
retval = ext2fs_resize_mem(old_size,
retval = ext2fs_resize_mem(old_size,
rec->max_ind_blocks * sizeof(blk_t),
&rec->ind_blocks);
if (retval) {
@ -192,12 +192,12 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
* Mark the block as unused, and update accounting information
*/
ext2fs_block_alloc_stats(fs, *block_nr, -1);
*block_nr = 0;
return BLOCK_CHANGED;
}
/*
* Helper function for update_bb_inode()
*
@ -250,12 +250,12 @@ static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
return BLOCK_ABORT;
}
}
/*
* Update block counts
*/
ext2fs_block_alloc_stats(fs, blk, +1);
*block_nr = blk;
return BLOCK_CHANGED;
}

View File

@ -35,7 +35,7 @@ static errcode_t make_bitmap(__u32 start, __u32 end, __u32 real_end,
errcode_t retval;
size_t size;
retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap),
retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap),
&bitmap);
if (retval)
return retval;
@ -106,7 +106,7 @@ void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map)
ext2fs_set_bit(j, map->bitmap);
return;
}
}
errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
const char *descr,
@ -128,11 +128,11 @@ errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
descr, &bitmap);
if (retval)
return retval;
bitmap->magic = EXT2_ET_MAGIC_INODE_BITMAP;
bitmap->fs = fs;
bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK;
*ret = bitmap;
return 0;
}
@ -151,9 +151,9 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
start = fs->super->s_first_data_block;
end = fs->super->s_blocks_count-1;
real_end = (EXT2_BLOCKS_PER_GROUP(fs->super)
real_end = (EXT2_BLOCKS_PER_GROUP(fs->super)
* fs->group_desc_count)-1 + start;
retval = ext2fs_allocate_generic_bitmap(start, end, real_end,
descr, &bitmap);
if (retval)
@ -162,7 +162,7 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
bitmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP;
bitmap->fs = fs;
bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK;
*ret = bitmap;
return 0;
}
@ -171,7 +171,7 @@ errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
ext2_ino_t end, ext2_ino_t *oend)
{
EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP);
if (end > bitmap->real_end)
return EXT2_ET_FUDGE_INODE_BITMAP_END;
if (oend)
@ -184,7 +184,7 @@ errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
blk_t end, blk_t *oend)
{
EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP);
if (end > bitmap->real_end)
return EXT2_ET_FUDGE_BLOCK_BITMAP_END;
if (oend)

View File

@ -1,7 +1,7 @@
/*
* bitops.c --- Bitmap frobbing code. See bitops.h for the inlined
* routines.
*
* routines.
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%

View File

@ -1,14 +1,14 @@
/*
* bitops.h --- Bitmap frobbing code. The byte swapping routines are
* also included here.
*
* also included here.
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*
*
* i386 bitops operations taken from <asm/bitops.h>, Copyright 1992,
* Linus Torvalds.
*/

View File

@ -1,6 +1,6 @@
/*
* block.c --- iterate over all blocks in an inode
*
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
@ -59,7 +59,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
ret |= BLOCK_ERROR;
return ret;
}
ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block,
ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block,
ctx->ind_buf);
if (ctx->errcode) {
ret |= BLOCK_ERROR;
@ -71,7 +71,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
if (ctx->flags & BLOCK_FLAG_APPEND) {
for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
*ind_block, offset,
*ind_block, offset,
ctx->priv_data);
changed |= flags;
if (flags & BLOCK_ABORT) {
@ -85,7 +85,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
if (*block_nr == 0)
continue;
flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
*ind_block, offset,
*ind_block, offset,
ctx->priv_data);
changed |= flags;
if (flags & BLOCK_ABORT) {
@ -109,7 +109,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
ref_offset, ctx->priv_data);
return ret;
}
static int block_iterate_dind(blk_t *dind_block, blk_t ref_block,
int ref_offset, struct block_context *ctx)
{
@ -133,7 +133,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block,
ret |= BLOCK_ERROR;
return ret;
}
ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block,
ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block,
ctx->dind_buf);
if (ctx->errcode) {
ret |= BLOCK_ERROR;
@ -185,7 +185,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block,
ref_offset, ctx->priv_data);
return ret;
}
static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
int ref_offset, struct block_context *ctx)
{
@ -209,7 +209,7 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
ret |= BLOCK_ERROR;
return ret;
}
ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block,
ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block,
ctx->tind_buf);
if (ctx->errcode) {
ret |= BLOCK_ERROR;
@ -259,10 +259,10 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
ret |= (*ctx->func)(ctx->fs, tind_block,
BLOCK_COUNT_TIND, ref_block,
ref_offset, ctx->priv_data);
return ret;
}
errcode_t ext2fs_block_iterate2(ext2_filsys fs,
ext2_ino_t ino,
int flags,
@ -338,7 +338,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
goto abort_exit;
}
}
/*
* Iterate over normal data blocks
*/
@ -427,7 +427,7 @@ errcode_t ext2fs_block_iterate(ext2_filsys fs,
void *priv_data)
{
struct xlate xl;
xl.real_private = priv_data;
xl.func = func;

View File

@ -25,14 +25,14 @@
#endif
extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
struct ext2_inode *inode,
char *block_buf, int bmap_flags,
blk_t block, blk_t *phys_blk);
#define inode_bmap(inode, nr) ((inode)->i_block[(nr)])
static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags,
blk_t ind, char *block_buf,
static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags,
blk_t ind, char *block_buf,
int *blocks_alloc,
blk_t nr, blk_t *ret_blk)
{
@ -95,17 +95,17 @@ static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags,
}
static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags,
blk_t dind, char *block_buf,
blk_t dind, char *block_buf,
int *blocks_alloc,
blk_t nr, blk_t *ret_blk)
{
blk_t b;
errcode_t retval;
blk_t addr_per_block;
addr_per_block = (blk_t) fs->blocksize >> 2;
retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf,
retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf,
blocks_alloc, nr / addr_per_block, &b);
if (retval)
return retval;
@ -115,17 +115,17 @@ static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags,
}
static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags,
blk_t tind, char *block_buf,
blk_t tind, char *block_buf,
int *blocks_alloc,
blk_t nr, blk_t *ret_blk)
{
blk_t b;
errcode_t retval;
blk_t addr_per_block;
addr_per_block = (blk_t) fs->blocksize >> 2;
retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf,
retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf,
blocks_alloc, nr / addr_per_block, &b);
if (retval)
return retval;
@ -179,7 +179,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
*phys_blk = inode_bmap(inode, block);
b = block ? inode_bmap(inode, block-1) : 0;
if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) {
retval = ext2fs_alloc_block(fs, b, block_buf, &b);
if (retval)
@ -190,7 +190,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
}
goto done;
}
/* Indirect block */
block -= EXT2_NDIR_BLOCKS;
if (block < addr_per_block) {
@ -203,17 +203,17 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
}
b = inode_bmap(inode, EXT2_IND_BLOCK-1);
retval = ext2fs_alloc_block(fs, b, block_buf, &b);
retval = ext2fs_alloc_block(fs, b, block_buf, &b);
if (retval)
goto done;
inode_bmap(inode, EXT2_IND_BLOCK) = b;
blocks_alloc++;
}
retval = block_ind_bmap(fs, bmap_flags, b, block_buf,
retval = block_ind_bmap(fs, bmap_flags, b, block_buf,
&blocks_alloc, block, phys_blk);
goto done;
}
/* Doubly indirect block */
block -= addr_per_block;
if (block < addr_per_block * addr_per_block) {
@ -226,13 +226,13 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
}
b = inode_bmap(inode, EXT2_IND_BLOCK);
retval = ext2fs_alloc_block(fs, b, block_buf, &b);
retval = ext2fs_alloc_block(fs, b, block_buf, &b);
if (retval)
goto done;
inode_bmap(inode, EXT2_DIND_BLOCK) = b;
blocks_alloc++;
}
retval = block_dind_bmap(fs, bmap_flags, b, block_buf,
retval = block_dind_bmap(fs, bmap_flags, b, block_buf,
&blocks_alloc, block, phys_blk);
goto done;
}
@ -254,7 +254,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
inode_bmap(inode, EXT2_TIND_BLOCK) = b;
blocks_alloc++;
}
retval = block_tind_bmap(fs, bmap_flags, b, block_buf,
retval = block_tind_bmap(fs, bmap_flags, b, block_buf,
&blocks_alloc, block, phys_blk);
done:
if (buf)

View File

@ -1,6 +1,6 @@
/*
* bmove.c --- Move blocks around to make way for a particular
* filesystem structure.
* filesystem structure.
*
* Copyright (C) 1997 Theodore Ts'o. This file may be redistributed
* under the terms of the GNU Public License.
@ -44,7 +44,7 @@ static int process_block(ext2_filsys fs, blk_t *block_nr,
pb = (struct process_block_struct *) priv_data;
block = orig = *block_nr;
ret = 0;
/*
* Let's see if this is one which we need to relocate
*/
@ -98,7 +98,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs,
struct process_block_struct pb;
ext2_inode_scan scan;
char *block_buf;
retval = ext2fs_open_inode_scan(fs, 0, &scan);
if (retval)
return retval;
@ -107,7 +107,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs,
pb.error = 0;
pb.alloc_map = alloc_map ? alloc_map : fs->block_map;
pb.flags = flags;
retval = ext2fs_get_mem(fs->blocksize * 4, &block_buf);
if (retval)
return retval;
@ -131,12 +131,12 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs,
retval = ext2fs_get_next_inode(scan, &ino, &inode);
if (retval)
return retval;
while (ino) {
if ((inode.i_links_count == 0) ||
!ext2fs_inode_has_valid_blocks(&inode))
goto next;
pb.ino = ino;
pb.inode = &inode;

View File

@ -1,6 +1,6 @@
/*
* brel.h
*
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
@ -47,7 +47,7 @@ struct ext2_block_relocation_table {
* Initialize for iterating over the block relocation entries.
*/
errcode_t (*start_iter)(ext2_brel brel);
/*
* The iterator function for the inode relocation entries.
* Returns an inode number of 0 when out of entries.

View File

@ -1,6 +1,6 @@
/*
* brel_ma.c
*
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* TODO: rewrite to not use a direct array!!! (Fortunately this
@ -48,7 +48,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block,
{
ext2_brel brel = 0;
errcode_t retval;
struct brel_ma *ma = 0;
struct brel_ma *ma = 0;
size_t size;
*new_brel = 0;
@ -61,18 +61,18 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block,
if (retval)
goto errout;
memset(brel, 0, sizeof(struct ext2_block_relocation_table));
retval = ext2fs_get_mem(strlen(name)+1, &brel->name);
if (retval)
goto errout;
strcpy(brel->name, name);
retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma);
if (retval)
goto errout;
memset(ma, 0, sizeof(struct brel_ma));
brel->priv_data = ma;
size = (size_t) (sizeof(struct ext2_block_relocate_entry) *
(max_block+1));
retval = ext2fs_get_mem(size, &ma->entries);
@ -91,7 +91,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block,
brel->move = bma_move;
brel->delete = bma_delete;
brel->free = bma_free;
*new_brel = brel;
return 0;
@ -103,7 +103,7 @@ errout:
static errcode_t bma_put(ext2_brel brel, blk_t old,
struct ext2_block_relocate_entry *ent)
{
struct brel_ma *ma;
struct brel_ma *ma;
ma = brel->priv_data;
if (old > ma->max_block)
@ -115,7 +115,7 @@ static errcode_t bma_put(ext2_brel brel, blk_t old,
static errcode_t bma_get(ext2_brel brel, blk_t old,
struct ext2_block_relocate_entry *ent)
{
struct brel_ma *ma;
struct brel_ma *ma;
ma = brel->priv_data;
if (old > ma->max_block)
@ -135,7 +135,7 @@ static errcode_t bma_start_iter(ext2_brel brel)
static errcode_t bma_next(ext2_brel brel, blk_t *old,
struct ext2_block_relocate_entry *ent)
{
struct brel_ma *ma;
struct brel_ma *ma;
ma = brel->priv_data;
while (++brel->current < ma->max_block) {
@ -151,7 +151,7 @@ static errcode_t bma_next(ext2_brel brel, blk_t *old,
static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new)
{
struct brel_ma *ma;
struct brel_ma *ma;
ma = brel->priv_data;
if ((old > ma->max_block) || (new > ma->max_block))
@ -165,7 +165,7 @@ static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new)
static errcode_t bma_delete(ext2_brel brel, blk_t old)
{
struct brel_ma *ma;
struct brel_ma *ma;
ma = brel->priv_data;
if (old > ma->max_block)
@ -178,7 +178,7 @@ static errcode_t bma_delete(ext2_brel brel, blk_t old)
static errcode_t bma_free(ext2_brel brel)
{
struct brel_ma *ma;
struct brel_ma *ma;
if (!brel)
return 0;

View File

@ -1,6 +1,6 @@
/*
* check_desc.c --- Check the group descriptors of an ext2 filesystem
*
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
@ -61,7 +61,7 @@ errcode_t ext2fs_check_desc(ext2_filsys fs)
((fs->group_desc[i].bg_inode_table +
fs->inode_blocks_per_group) >= next))
return EXT2_ET_GDESC_BAD_INODE_TABLE;
block = next;
}
return 0;

View File

@ -1,6 +1,6 @@
/*
* closefs.c --- close an ext2 filesystem
*
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
@ -45,7 +45,7 @@ int ext2fs_bg_has_super(ext2_filsys fs, int group_block)
return 0;
}
int ext2fs_super_and_bgd_loc(ext2_filsys fs,
int ext2fs_super_and_bgd_loc(ext2_filsys fs,
dgrp_t group,
blk_t *ret_super_blk,
blk_t *ret_old_desc_blk,
@ -63,7 +63,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs,
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
old_desc_blocks = fs->super->s_first_meta_bg;
else
old_desc_blocks =
old_desc_blocks =
fs->desc_blocks + fs->super->s_reserved_gdt_blocks;
if (group == fs->group_desc_count-1) {
@ -100,7 +100,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs,
numblocks--;
}
}
numblocks -= 2 + fs->inode_blocks_per_group;
if (ret_super_blk)
@ -188,7 +188,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group,
struct ext2_super_block *super_shadow)
{
dgrp_t sgrp = group;
if (sgrp > ((1 << 16) - 1))
sgrp = (1 << 16) - 1;
#ifdef EXT2FS_ENABLE_SWAPFS
@ -198,7 +198,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group,
#endif
fs->super->s_block_group_nr = sgrp;
return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE,
return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE,
super_shadow);
}
@ -217,7 +217,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
dgrp_t j;
struct ext2_group_desc *s, *t;
#endif
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
fs_state = fs->super->s_state;
@ -252,7 +252,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
super_shadow = fs->super;
group_shadow = fs->group_desc;
#endif
/*
* If this is an external journal device, don't write out the
* block group descriptors or any of the backup superblocks
@ -289,7 +289,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
blk_t super_blk, old_desc_blk, new_desc_blk;
int meta_bg;
ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk,
ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk,
&new_desc_blk, &meta_bg);
if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) {
@ -300,7 +300,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
}
if (fs->flags & EXT2_FLAG_SUPER_ONLY)
continue;
if ((old_desc_blk) &&
if ((old_desc_blk) &&
(!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) {
retval = io_channel_write_blk(fs->io,
old_desc_blk, old_desc_blocks, group_ptr);
@ -365,7 +365,7 @@ errout:
errcode_t ext2fs_close(ext2_filsys fs)
{
errcode_t retval;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
if (fs->flags & EXT2_FLAG_DIRTY) {

View File

@ -30,7 +30,7 @@ errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
ext2fs_block_bitmap bm2)
{
blk_t i;
EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_BLOCK_BITMAP);
EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_BLOCK_BITMAP);
@ -52,7 +52,7 @@ errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
ext2fs_inode_bitmap bm2)
{
ext2_ino_t i;
EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP);
EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP);

View File

@ -1,13 +1,13 @@
/*
* dblist.c -- directory block list functions
*
*
* Copyright 1997 by Theodore Ts'o
*
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*
*
*/
#include <stdio.h>
@ -33,7 +33,7 @@ errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs)
ext2_ino_t num_dirs, max_dirs;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
num_dirs = 0;
max_dirs = fs->super->s_inodes_per_group;
for (i = 0; i < fs->group_desc_count; i++) {
@ -88,7 +88,7 @@ static errcode_t make_dblist(ext2_filsys fs, ext2_ino_t size, ext2_ino_t count,
retval = ext2fs_get_mem(len, &dblist->list);
if (retval)
goto cleanup;
if (list)
memcpy(dblist->list, list, len);
else
@ -155,10 +155,10 @@ errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest)
errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk,
int blockcnt)
{
struct ext2_db_entry *new_entry;
struct ext2_db_entry *new_entry;
errcode_t retval;
unsigned long old_size;
EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
if (dblist->count >= dblist->size) {
@ -189,7 +189,7 @@ errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk,
int blockcnt)
{
dgrp_t i;
EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
for (i=0; i < dblist->count; i++) {
@ -225,7 +225,7 @@ errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
{
ext2_ino_t i;
int ret;
EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
if (!dblist->sorted)
@ -247,7 +247,7 @@ static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b)
if (db_a->blk != db_b->blk)
return (int) (db_a->blk - db_b->blk);
if (db_a->ino != db_b->ino)
return (int) (db_a->ino - db_b->ino);

View File

@ -2,12 +2,12 @@
* dblist_dir.c --- iterate by directory entry
*
* Copyright 1997 by Theodore Ts'o
*
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*
*
*/
#include <stdio.h>
@ -54,7 +54,7 @@ errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist,
ctx.errcode = 0;
retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx);
if (!block_buf)
ext2fs_free_mem(&ctx.buf);
if (retval)
@ -69,7 +69,7 @@ static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
ctx = (struct dir_context *) priv_data;
ctx->dir = db_info->ino;
return ext2fs_process_dir_block(fs, &db_info->blk,
db_info->blockcnt, 0, 0, priv_data);
}

View File

@ -1,6 +1,6 @@
/*
* dir_iterate.c --- ext2fs directory iteration operations
*
*
* Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
@ -32,7 +32,7 @@
static int ext2fs_validate_entry(char *buf, int offset, int final_offset)
{
struct ext2_dir_entry *dirent;
while (offset < final_offset) {
dirent = (struct ext2_dir_entry *)(buf + offset);
offset += dirent->rec_len;
@ -59,13 +59,13 @@ errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
{
struct dir_context ctx;
errcode_t retval;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
retval = ext2fs_check_directory(fs, dir);
if (retval)
return retval;
ctx.dir = dir;
ctx.flags = flags;
if (block_buf)
@ -106,7 +106,7 @@ static int xlate_func(ext2_ino_t dir EXT2FS_ATTR((unused)),
return (*xl->func)(dirent, offset, blocksize, buf, xl->real_private);
}
extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
ext2_ino_t dir,
int flags,
char *block_buf,
@ -118,7 +118,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
void *priv_data)
{
struct xlate xl;
xl.real_private = priv_data;
xl.func = func;
@ -151,7 +151,7 @@ int ext2fs_process_dir_block(ext2_filsys fs,
return 0;
entry = blockcnt ? DIRENT_OTHER_FILE : DIRENT_DOT_FILE;
ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf);
if (ctx->errcode)
return BLOCK_ABORT;
@ -177,18 +177,18 @@ int ext2fs_process_dir_block(ext2_filsys fs,
ctx->priv_data);
if (entry < DIRENT_OTHER_FILE)
entry++;
if (ret & DIRENT_CHANGED)
changed++;
if (ret & DIRENT_ABORT) {
do_abort++;
break;
}
next:
if (next_real_entry == offset)
next:
if (next_real_entry == offset)
next_real_entry += dirent->rec_len;
if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) {
if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) {
size = ((dirent->name_len & 0xFF) + 11) & ~3;
if (dirent->rec_len != size) {

View File

@ -1,6 +1,6 @@
/*
* dirblock.c --- directory block routines.
*
*
* Copyright (C) 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
@ -28,9 +28,9 @@ errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,
unsigned int name_len, rec_len;
#ifdef EXT2FS_ENABLE_SWAPFS
unsigned int do_swap;
#endif
#endif
retval = io_channel_read_blk(fs->io, block, 1, buf);
retval = io_channel_read_blk(fs->io, block, 1, buf);
if (retval)
return retval;
#ifdef EXT2FS_ENABLE_SWAPFS
@ -110,16 +110,16 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
dirent->rec_len = ext2fs_swab16(dirent->rec_len);
dirent->name_len = ext2fs_swab16(dirent->name_len);
}
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
if (flags & EXT2_DIRBLOCK_V2_STRUCT)
dirent->name_len = ext2fs_swab16(dirent->name_len);
#endif
}
retval = io_channel_write_blk(fs->io, block, 1, buf);
retval = io_channel_write_blk(fs->io, block, 1, buf);
ext2fs_free_mem(&buf);
return retval;
#else
return io_channel_write_blk(fs->io, block, 1, (char *) inbuf);
return io_channel_write_blk(fs->io, block, 1, (char *) inbuf);
#endif
}

View File

@ -2,7 +2,7 @@
* dirhash.c -- Calculate the hash of a directory entry
*
* Copyright (c) 2001 Daniel Phillips
*
*
* Copyright (c) 2002 Theodore Ts'o.
*
* %Begin-Header%
@ -25,7 +25,7 @@
* (see Applied Cryptography, 2nd edition, p448).
*
* Jeremy Fitzhardinge <jeremy@zip.com.au> 1998
*
*
* This code is made available under the terms of the GPL
*/
#define DELTA 0x9E3779B9
@ -37,10 +37,10 @@ static void TEA_transform(__u32 buf[4], __u32 const in[])
__u32 a = in[0], b = in[1], c = in[2], d = in[3];
int n = 16;
do {
sum += DELTA;
b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b);
b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d);
do {
sum += DELTA;
b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b);
b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d);
} while(--n);
buf[0] += b0;
@ -121,7 +121,7 @@ static ext2_dirhash_t dx_hack_hash (const char *name, int len)
__u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
while (len--) {
__u32 hash = hash1 + (hash0 ^ (*name++ * 7152373));
if (hash & 0x80000000) hash -= 0x7fffffff;
hash1 = hash0;
hash0 = hash;
@ -160,11 +160,11 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num)
* Returns the hash of a filename. If len is 0 and name is NULL, then
* this function can be used to test whether or not a hash version is
* supported.
*
*
* The seed is an 4 longword (32 bits) "secret" which can be used to
* uniquify a hash. If the seed is all zero's, then some default seed
* may be used.
*
*
* A particular hash version specifies whether or not the seed is
* represented, and whether or not the returned hash is 32 bits or 64
* bits. 32 bit hashes will return 0 for the minor hash.
@ -178,7 +178,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len,
__u32 minor_hash = 0;
const char *p;
int i;
__u32 in[8], buf[4];
__u32 in[8], buf[4];
/* Initialize the default seed for the hash checksum functions */
buf[0] = 0x67452301;
@ -195,7 +195,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len,
if (i < 4)
memcpy(buf, seed, sizeof(buf));
}
switch (version) {
case EXT2_HASH_LEGACY:
hash = dx_hack_hash(name, len);

View File

@ -1,6 +1,6 @@
/*
* dupfs.c --- duplicate a ext2 filesystem handle
*
*
* Copyright (C) 1997, 1998, 2001, 2003, 2005 by Theodore Ts'o.
*
* %Begin-Header%
@ -25,7 +25,7 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest)
errcode_t retval;
EXT2_CHECK_MAGIC(src, EXT2_ET_MAGIC_EXT2FS_FILSYS);
retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs);
if (retval)
return retval;
@ -91,6 +91,6 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest)
errout:
ext2fs_free(fs);
return retval;
}

View File

@ -1,10 +1,10 @@
/*
* e2image.h --- header file describing the ext2 image format
*
*
* Copyright (C) 2000 Theodore Ts'o.
*
* Note: this uses the POSIX IO interfaces, unlike most of the other
* functions in this library. So sue me.
* functions in this library. So sue me.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
@ -24,7 +24,7 @@ struct ext2_image_hdr {
char fs_uuid[16]; /* UUID of filesystem */
__u32 fs_blocksize; /* Block size of the filesystem */
__u32 fs_reserved[8];
__u32 image_device; /* Device number of image file */
__u32 image_inode; /* Inode number of image file */
__u32 image_time; /* Time of image creation */
@ -37,15 +37,15 @@ struct ext2_image_hdr {
__u32 offset_reserved[8];
};

View File

@ -1,6 +1,6 @@
/*
* expand.c --- expand an ext2fs directory
*
*
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999 Theodore Ts'o.
*
* %Begin-Header%
@ -36,7 +36,7 @@ static int expand_dir_proc(ext2_filsys fs,
static blk_t last_blk = 0;
char *block;
errcode_t retval;
if (*blocknr) {
last_blk = *blocknr;
return 0;
@ -62,7 +62,7 @@ static int expand_dir_proc(ext2_filsys fs,
}
memset(block, 0, fs->blocksize);
retval = io_channel_write_blk(fs->io, new_blk, 1, block);
}
}
if (retval) {
es->err = retval;
return BLOCK_ABORT;
@ -83,7 +83,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir)
errcode_t retval;
struct expand_dir_struct es;
struct ext2_inode inode;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
if (!(fs->flags & EXT2_FLAG_RW))
@ -95,11 +95,11 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir)
retval = ext2fs_check_directory(fs, dir);
if (retval)
return retval;
es.done = 0;
es.err = 0;
es.newblocks = 0;
retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND,
0, expand_dir_proc, &es);
@ -114,7 +114,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir)
retval = ext2fs_read_inode(fs, dir, &inode);
if (retval)
return retval;
inode.i_size += fs->blocksize;
inode.i_blocks += (fs->blocksize / 512) * es.newblocks;

View File

@ -231,9 +231,9 @@ struct ext2_dx_countlimit {
#define EXT2_IMAGIC_FL 0x00002000
#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */
#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */
#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */
#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */
#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */
#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
#define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
@ -501,12 +501,12 @@ struct ext2_super_block {
__u32 s_last_orphan; /* start of list of inodes to delete */
__u32 s_hash_seed[4]; /* HTREE hash seed */
__u8 s_def_hash_version; /* Default hash version to use */
__u8 s_jnl_backup_type; /* Default type of journal backup */
__u8 s_jnl_backup_type; /* Default type of journal backup */
__u16 s_reserved_word_pad;
__u32 s_default_mount_opts;
__u32 s_first_meta_bg; /* First metablock group */
__u32 s_mkfs_time; /* When the filesystem was created */
__u32 s_jnl_blocks[17]; /* Backup of the journal inode */
__u32 s_jnl_blocks[17]; /* Backup of the journal inode */
__u32 s_reserved[172]; /* Padding to the end of the block */
};
@ -585,7 +585,7 @@ struct ext2_super_block {
#define EXT2_DEFM_XATTR_USER 0x0004
#define EXT2_DEFM_ACL 0x0008
#define EXT2_DEFM_UID16 0x0010
#define EXT3_DEFM_JMODE 0x0060
#define EXT3_DEFM_JMODE 0x0060
#define EXT3_DEFM_JMODE_DATA 0x0020
#define EXT3_DEFM_JMODE_ORDERED 0x0040
#define EXT3_DEFM_JMODE_WBACK 0x0060

View File

@ -1,6 +1,6 @@
/*
* ext2fs.h --- ext2fs
*
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
@ -46,7 +46,7 @@ extern "C" {
* 1032 bytes long).
*/
#define SUPERBLOCK_OFFSET 1024
#define SUPERBLOCK_SIZE 1024
#define SUPERBLOCK_SIZE 1024
/*
* The last ext2fs revision level that this version of the library is
@ -87,7 +87,7 @@ typedef struct struct_ext2_filsys *ext2_filsys;
struct ext2fs_struct_generic_bitmap {
errcode_t magic;
ext2_filsys fs;
ext2_filsys fs;
__u32 start, end;
__u32 real_end;
char * description;
@ -96,8 +96,8 @@ struct ext2fs_struct_generic_bitmap {
__u32 reserved[7];
};
#define EXT2FS_MARK_ERROR 0
#define EXT2FS_UNMARK_ERROR 1
#define EXT2FS_MARK_ERROR 0
#define EXT2FS_UNMARK_ERROR 1
#define EXT2FS_TEST_ERROR 2
typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap;
@ -194,7 +194,7 @@ struct struct_ext2_filsys {
io_channel io;
int flags;
char * device_name;
struct ext2_super_block * super;
struct ext2_super_block * super;
unsigned int blocksize;
int fragsize;
dgrp_t group_desc_count;
@ -250,7 +250,7 @@ struct struct_ext2_filsys {
* This is used by ext2fs_expand_dir() to be able to add a new block
* to an inode. It can also be used for programs that want to be able
* to deal with files that contain "holes".
*
*
* BLOCK_FLAG_TRAVERSE indicates that the iterator function for the
* indirect, doubly indirect, etc. blocks should be called after all
* of the blocks containined in the indirect blocks are processed.
@ -282,7 +282,7 @@ struct struct_ext2_filsys {
/*
* Flags for ext2fs_move_blocks
*/
#define EXT2_BMOVE_GET_DBLIST 0x0001
#define EXT2_BMOVE_GET_DBLIST 0x0001
#define EXT2_BMOVE_DEBUG 0x0002
#endif
@ -457,7 +457,7 @@ extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
char *block_buf, blk_t *ret);
/* alloc_sb.c */
extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
dgrp_t group,
ext2fs_block_bitmap bmap);
@ -567,7 +567,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
/* bmap.c */
extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
struct ext2_inode *inode,
char *block_buf, int bmap_flags,
blk_t block, blk_t *phys_blk);
@ -587,7 +587,7 @@ extern errcode_t ext2fs_check_desc(ext2_filsys fs);
extern errcode_t ext2fs_close(ext2_filsys fs);
extern errcode_t ext2fs_flush(ext2_filsys fs);
extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block);
extern int ext2fs_super_and_bgd_loc(ext2_filsys fs,
extern int ext2fs_super_and_bgd_loc(ext2_filsys fs,
dgrp_t group,
blk_t *ret_super_blk,
blk_t *ret_old_desc_blk,
@ -652,7 +652,7 @@ extern errcode_t ext2fs_dirhash(int version, const char *name, int len,
/* dir_iterate.c */
extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
ext2_ino_t dir,
int flags,
char *block_buf,
@ -662,7 +662,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
char *buf,
void *priv_data),
void *priv_data);
extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
ext2_ino_t dir,
int flags,
char *block_buf,
@ -751,10 +751,10 @@ extern errcode_t ext2fs_initialize(const char *name, int flags,
/* icount.c */
extern void ext2fs_free_icount(ext2_icount_t icount);
extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags,
extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags,
unsigned int size,
ext2_icount_t hint, ext2_icount_t *ret);
extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,
extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,
unsigned int size,
ext2_icount_t *ret);
extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino,
@ -770,9 +770,9 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *);
/* inode.c */
extern errcode_t ext2fs_flush_icache(ext2_filsys fs);
extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan,
extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan,
ext2_ino_t *ino,
struct ext2_inode *inode,
struct ext2_inode *inode,
int bufsize);
extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
ext2_inode_scan *ret_scan);
@ -791,12 +791,12 @@ extern void ext2fs_set_inode_callback
extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags,
int clear_flags);
extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode,
struct ext2_inode * inode,
int bufsize);
extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode);
extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode,
struct ext2_inode * inode,
int bufsize);
extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode * inode);
@ -807,12 +807,12 @@ extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino);
/* inode_io.c */
extern io_manager inode_io_manager;
extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino,
extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino,
char **name);
extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
char **name);
/* ismounted.c */
extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
@ -852,11 +852,11 @@ extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size,
extern errcode_t ext2fs_open(const char *name, int flags, int superblock,
unsigned int block_size, io_manager manager,
ext2_filsys *ret_fs);
extern errcode_t ext2fs_open2(const char *name, const char *io_options,
int flags, int superblock,
extern errcode_t ext2fs_open2(const char *name, const char *io_options,
int flags, int superblock,
unsigned int block_size, io_manager manager,
ext2_filsys *ret_fs);
extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block,
extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block,
dgrp_t i);
errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io);
errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io);
@ -877,14 +877,14 @@ extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs,
ext2_badblocks_list *bb_list);
/* read_bb_file.c */
extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
ext2_badblocks_list *bb_list,
void *priv_data,
void (*invalid)(ext2_filsys fs,
blk_t blk,
char *badstr,
void *priv_data));
extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
ext2_badblocks_list *bb_list,
void (*invalid)(ext2_filsys fs,
blk_t blk));
@ -904,7 +904,7 @@ extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
ext2fs_generic_bitmap *dest);
/* swapfs.c */
extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize,
extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize,
int has_header);
extern void ext2fs_swap_super(struct ext2_super_block * super);
extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp);

View File

@ -1,6 +1,6 @@
/*
* ext2fsP.h --- private header file for ext2 library
*
*
* Copyright (C) 1997 Theodore Ts'o.
*
* %Begin-Header%
@ -78,7 +78,7 @@ struct ext2_inode_cache_ent {
/* Function prototypes */
extern int ext2fs_process_dir_block(ext2_filsys fs,
extern int ext2fs_process_dir_block(ext2_filsys fs,
blk_t *blocknr,
e2_blkcnt_t blockcnt,
blk_t ref_block,

View File

@ -1,6 +1,6 @@
/*
* ext2fs.h --- ext2fs
*
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
@ -36,7 +36,7 @@ errcode_t ext2fs_free_mem(void *ptr)
*pp = 0;
return 0;
}
/*
* Resize memory
*/
@ -154,7 +154,7 @@ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
struct ext2_inode *inode)
{
return inode->i_blocks -
(inode->i_file_acl ? fs->blocksize >> 9 : 0);
(inode->i_file_acl ? fs->blocksize >> 9 : 0);
}
@ -179,7 +179,7 @@ __u32 ext2fs_swab32(__u32 val)
int ext2fs_find_first_bit_set(void * addr, unsigned size)
{
char *cp = (unsigned char *) addr;
int res = 0, d0;
int res = 0, d0;
if (!size)
return 0;
@ -191,7 +191,7 @@ int ext2fs_find_first_bit_set(void * addr, unsigned size)
d0 = ffs(*cp);
if (d0 == 0)
return size;
return res + d0 - 1;
}
@ -199,10 +199,10 @@ int ext2fs_find_next_bit_set (void * addr, int size, int offset)
{
unsigned char * p;
int set = 0, bit = offset & 7, res = 0, d0;
res = offset >> 3;
p = ((unsigned char *) addr) + res;
if (bit) {
set = ffs(*p & ~((1 << bit) - 1));
if (set)
@ -245,35 +245,35 @@ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
@ -286,7 +286,7 @@ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
bitmap->description);
return;
}
#endif
#endif
ext2fs_set_bit(block - bitmap->start, bitmap->bitmap);
}
@ -415,7 +415,7 @@ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
int i;
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
bitmap->description);
@ -429,14 +429,14 @@ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
int i;
#ifdef EXT2FS_DEBUG_FAST_OPS
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
bitmap->description);
return;
}
#endif
#endif
for (i=0; i < num; i++)
ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap);
}
@ -445,7 +445,7 @@ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
int i;
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
bitmap->description);
@ -459,14 +459,14 @@ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
int i;
#ifdef EXT2FS_DEBUG_FAST_OPS
if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
bitmap->description);
return;
}
#endif
#endif
for (i=0; i < num; i++)
ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap);
}

View File

@ -1,6 +1,6 @@
/*
* ext_attr.c --- extended attribute blocks
*
*
* Copyright (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
*
* Copyright (C) 2002 Theodore Ts'o.
@ -27,7 +27,7 @@ errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf)
{
errcode_t retval;
retval = io_channel_read_blk(fs->io, block, 1, buf);
retval = io_channel_read_blk(fs->io, block, 1, buf);
if (retval)
return retval;
#ifdef EXT2FS_ENABLE_SWAPFS
@ -55,7 +55,7 @@ errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf)
} else
#endif
write_buf = (char *) inbuf;
retval = io_channel_write_blk(fs->io, block, 1, write_buf);
retval = io_channel_write_blk(fs->io, block, 1, write_buf);
if (buf)
ext2fs_free_mem(&buf);
if (!retval)

View File

@ -1,6 +1,6 @@
/*
* fileio.c --- Simple file I/O routines
*
*
* Copyright (C) 1997 Theodore Ts'o.
*
* %Begin-Header%
@ -20,14 +20,14 @@
struct ext2_file {
errcode_t magic;
ext2_filsys fs;
ext2_filsys fs;
ext2_ino_t ino;
struct ext2_inode inode;
int flags;
int flags;
__u64 pos;
blk_t blockno;
blk_t physblock;
char *buf;
char *buf;
};
#define BMAP_BUFFER (file->buf + fs->blocksize)
@ -36,7 +36,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
int flags, ext2_file_t *ret)
{
ext2_file_t file;
ext2_file_t file;
errcode_t retval;
/*
@ -50,7 +50,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
retval = ext2fs_get_mem(sizeof(struct ext2_file), &file);
if (retval)
return retval;
memset(file, 0, sizeof(struct ext2_file));
file->magic = EXT2_ET_MAGIC_EXT2_FILE;
file->fs = fs;
@ -64,14 +64,14 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
if (retval)
goto fail;
}
retval = ext2fs_get_mem(fs->blocksize * 3, &file->buf);
if (retval)
goto fail;
*ret = file;
return 0;
fail:
if (file->buf)
ext2fs_free_mem(&file->buf);
@ -103,7 +103,7 @@ errcode_t ext2fs_file_flush(ext2_file_t file)
{
errcode_t retval;
ext2_filsys fs;
EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
fs = file->fs;
@ -176,7 +176,7 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill)
if (!dontfill) {
if (file->physblock) {
retval = io_channel_read_blk(fs->io,
file->physblock,
file->physblock,
1, file->buf);
if (retval)
return retval;
@ -187,16 +187,16 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill)
}
return 0;
}
errcode_t ext2fs_file_close(ext2_file_t file)
{
errcode_t retval;
EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
retval = ext2fs_file_flush(file);
if (file->buf)
ext2fs_free_mem(&file->buf);
ext2fs_free_mem(&file);
@ -232,14 +232,14 @@ errcode_t ext2fs_file_read(ext2_file_t file, void *buf,
left = EXT2_I_SIZE(&file->inode) - file->pos ;
if (c > left)
c = left;
memcpy(ptr, file->buf+start, c);
file->pos += c;
ptr += c;
count += c;
wanted -= c;
}
fail:
if (got)
*got = count;
@ -265,7 +265,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
retval = sync_buffer_position(file);
if (retval)
goto fail;
start = file->pos % fs->blocksize;
c = fs->blocksize - start;
if (c > nbytes)
@ -286,7 +286,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
count += c;
nbytes -= c;
}
fail:
if (written)
*written = count;
@ -318,7 +318,7 @@ errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset,
{
__u64 loffset, ret_loffset;
errcode_t retval;
loffset = offset;
retval = ext2fs_file_llseek(file, loffset, whence, &ret_loffset);
if (ret_pos)
@ -354,14 +354,14 @@ ext2_off_t ext2fs_file_get_size(ext2_file_t file)
/*
* This function sets the size of the file, truncating it if necessary
*
*
* XXX still need to call truncate
*/
errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size)
{
errcode_t retval;
EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
file->inode.i_size = size;
file->inode.i_size_high = 0;
if (file->ino) {
@ -370,7 +370,7 @@ errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size)
return retval;
}
/*
/*
* XXX truncate inode if necessary
*/

View File

@ -1,7 +1,7 @@
/*
* finddev.c -- this routine attempts to find a particular device in
* /dev
*
* /dev
*
* Copyright (C) 2000 Theodore Ts'o.
*
* %Begin-Header%
@ -124,7 +124,7 @@ char *ext2fs_find_block_device(dev_t device)
add_to_dirlist("/devices", &list);
add_to_dirlist("/devfs", &list);
add_to_dirlist("/dev", &list);
while (list) {
current = list;
list = list->next;
@ -150,7 +150,7 @@ char *ext2fs_find_block_device(dev_t device)
return ret_path;
}
#ifdef DEBUG
int main(int argc, char** argv)
{
@ -194,5 +194,5 @@ int main(int argc, char** argv)
}
return 0;
}
#endif

View File

@ -1,7 +1,7 @@
/*
* flushb.c --- Hides system-dependent information for both syncing a
* device to disk and to flush any buffers from disk cache.
*
* device to disk and to flush any buffers from disk cache.
*
* Copyright (C) 2000 Theodore Ts'o.
*
* %Begin-Header%
@ -29,7 +29,7 @@
#include "ext2fs.h"
/*
* For Linux, define BLKFLSBUF and FDFLUSH if necessary, since
* For Linux, define BLKFLSBUF and FDFLUSH if necessary, since
* not all portable header file does so for us. This really should be
* fixed in the glibc header files. (Recent glibcs appear to define
* BLKFLSBUF in sys/mount.h, but FDFLUSH still doesn't seem to be

View File

@ -1,6 +1,6 @@
/*
* freefs.c --- free an ext2 filesystem
*
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
@ -52,7 +52,7 @@ void ext2fs_free(ext2_filsys fs)
if (fs->icache)
ext2fs_free_inode_cache(fs->icache);
fs->magic = 0;
ext2fs_free_mem(&fs);

View File

@ -1,6 +1,6 @@
/*
* gen_bitmap.c --- Generic bitmap routines that used to be inlined.
*
*
* Copyright (C) 2001 Theodore Ts'o.
*
* %Begin-Header%

View File

@ -1,6 +1,6 @@
/*
* get_pathname.c --- do directry/inode -> name translation
*
*
* Copyright (C) 1993, 1994, 1995 Theodore Ts'o.
*
* %Begin-Header%
@ -8,14 +8,14 @@
* License.
* %End-Header%
*
* ext2fs_get_pathname(fs, dir, ino, name)
* ext2fs_get_pathname(fs, dir, ino, name)
*
* This function translates takes two inode numbers into a
* string, placing the result in <name>. <dir> is the containing
* directory inode, and <ino> is the inode number itself. If
* <ino> is zero, then ext2fs_get_pathname will return pathname
* of the the directory <dir>.
*
* This function translates takes two inode numbers into a
* string, placing the result in <name>. <dir> is the containing
* directory inode, and <ino> is the inode number itself. If
* <ino> is zero, then ext2fs_get_pathname will return pathname
* of the the directory <dir>.
*
*/
#include <stdio.h>
@ -65,8 +65,8 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent,
return 0;
}
static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
ext2_ino_t ino, int maxdepth,
static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
ext2_ino_t ino, int maxdepth,
char *buf, char **name)
{
struct get_pathname_struct gp;
@ -93,7 +93,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
gp.parent = 0;
gp.name = 0;
gp.errcode = 0;
retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp);
if (retval)
goto cleanup;
@ -110,15 +110,15 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
*name = parent_name;
return 0;
}
if (gp.name)
if (gp.name)
retval = ext2fs_get_mem(strlen(parent_name)+strlen(gp.name)+2,
&ret);
else
retval = ext2fs_get_mem(strlen(parent_name)+5, &ret);
if (retval)
goto cleanup;
ret[0] = 0;
if (parent_name[1])
strcat(ret, parent_name);
@ -130,7 +130,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
*name = ret;
ext2fs_free_mem(&parent_name);
retval = 0;
cleanup:
if (gp.name)
ext2fs_free_mem(&gp.name);
@ -153,5 +153,5 @@ errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name);
ext2fs_free_mem(&buf);
return retval;
}

View File

@ -1,6 +1,6 @@
/*
* getsectsize.c --- get the sector size of a device.
*
*
* Copyright (C) 1995, 1995 Theodore Ts'o.
* Copyright (C) 2003 VMware, Inc.
*

View File

@ -1,11 +1,11 @@
/*
* getsize.c --- get the size of a partition.
*
*
* Copyright (C) 1995, 1995 Theodore Ts'o.
* Copyright (C) 2003 VMware, Inc.
*
* Windows version of ext2fs_get_device_size by Chris Li, VMware.
*
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
@ -75,10 +75,10 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize,
DWORD filesize;
#endif /* HAVE_GET_FILE_SIZE_EX */
dev = CreateFile(file, GENERIC_READ,
dev = CreateFile(file, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (dev == INVALID_HANDLE_VALUE)
return EBADF;
if (DeviceIoControl(dev, IOCTL_DISK_GET_PARTITION_INFO,
@ -87,7 +87,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize,
&retbytes, NULL)) {
*retblocks = pi.PartitionLength.QuadPart / blocksize;
} else if (DeviceIoControl(dev, IOCTL_DISK_GET_DRIVE_GEOMETRY,
&gi, sizeof(DISK_GEOMETRY),
&gi, sizeof(DISK_GEOMETRY),
@ -137,7 +137,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize,
int fd;
int valid_blkgetsize64 = 1;
#ifdef __linux__
struct utsname ut;
struct utsname ut;
#endif
unsigned long long size64;
unsigned long size;
@ -272,7 +272,7 @@ int main(int argc, char **argv)
{
blk_t blocks;
int retval;
if (argc < 2) {
fprintf(stderr, "Usage: %s device\n", argv[0]);
exit(1);

View File

@ -81,19 +81,19 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size,
if (hint->size > size)
size = (size_t) hint->size;
}
retval = ext2fs_get_mem(sizeof(struct ext2_icount), &icount);
if (retval)
return retval;
memset(icount, 0, sizeof(struct ext2_icount));
retval = ext2fs_allocate_inode_bitmap(fs, 0,
retval = ext2fs_allocate_inode_bitmap(fs, 0,
&icount->single);
if (retval)
goto errout;
if (flags & EXT2_ICOUNT_OPT_INCREMENT) {
retval = ext2fs_allocate_inode_bitmap(fs, 0,
retval = ext2fs_allocate_inode_bitmap(fs, 0,
&icount->multiple);
if (retval)
goto errout;
@ -113,7 +113,7 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size,
goto errout;
icount->size += fs->super->s_inodes_count / 50;
}
bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el));
#if 0
printf("Icount allocated %d entries, %d bytes.\n",
@ -148,7 +148,7 @@ errout:
return(retval);
}
errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,
errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,
unsigned int size,
ext2_icount_t *ret)
{
@ -157,12 +157,12 @@ errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,
/*
* insert_icount_el() --- Insert a new entry into the sorted list at a
* specified position.
* specified position.
*/
static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount,
ext2_ino_t ino, int pos)
{
struct ext2_icount_el *el;
struct ext2_icount_el *el;
errcode_t retval;
ext2_ino_t new_size = 0;
int num;
@ -170,14 +170,14 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount,
if (icount->count >= icount->size) {
if (icount->count) {
new_size = icount->list[(unsigned)icount->count-1].ino;
new_size = (ext2_ino_t) (icount->count *
new_size = (ext2_ino_t) (icount->count *
((float) icount->num_inodes / new_size));
}
if (new_size < (icount->size + 100))
new_size = icount->size + 100;
#if 0
printf("Reallocating icount %d entries...\n", new_size);
#endif
#endif
retval = ext2fs_resize_mem((size_t) icount->size *
sizeof(struct ext2_icount_el),
(size_t) new_size *
@ -203,8 +203,8 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount,
/*
* get_icount_el() --- given an inode number, try to find icount
* information in the sorted list. If the create flag is set,
* and we can't find an entry, create one in the sorted list.
* information in the sorted list. If the create flag is set,
* and we can't find an entry, create one in the sorted list.
*/
static struct ext2_icount_el *get_icount_el(ext2_icount_t icount,
ext2_ino_t ino, int create)
@ -222,7 +222,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount,
}
if (icount->count == 0)
return 0;
if (icount->cursor >= icount->count)
icount->cursor = 0;
if (ino == icount->list[icount->cursor].ino)
@ -247,7 +247,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount,
range = 0;
else if (ino > highval)
range = 1;
else
else
range = ((float) (ino - lowval)) /
(highval - lowval);
mid = low + ((int) (range * (high-low)));
@ -276,7 +276,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out)
errcode_t ret = 0;
unsigned int i;
const char *bad = "bad icount";
EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT);
if (icount->count > icount->size) {
@ -297,7 +297,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out)
errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret)
{
struct ext2_icount_el *el;
EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT);
if (!ino || (ino > icount->num_inodes))
@ -413,7 +413,7 @@ errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino,
if (icount->multiple &&
!ext2fs_test_inode_bitmap(icount->multiple, ino))
return EXT2_ET_INVALID_ARGUMENT;
el = get_icount_el(icount, ino, 0);
if (!el || el->count == 0)
return EXT2_ET_INVALID_ARGUMENT;

View File

@ -1,11 +1,11 @@
/*
* image.c --- writes out the critical parts of the filesystem as a
* flat file.
* flat file.
*
* Copyright (C) 2000 Theodore Ts'o.
*
* Note: this uses the POSIX IO interfaces, unlike most of the other
* functions in this library. So sue me.
* functions in this library. So sue me.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
@ -67,7 +67,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags)
errcode_t retval;
buf = xmalloc(fs->blocksize * BUF_BLOCKS);
for (group = 0; group < fs->group_desc_count; group++) {
blk = fs->group_desc[(unsigned)group].bg_inode_table;
if (!blk)
@ -127,7 +127,7 @@ errout:
/*
* Read in the inode table and stuff it into place
*/
errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd,
errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd,
int flags EXT2FS_ATTR((unused)))
{
unsigned int group, c, left;
@ -137,7 +137,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd,
errcode_t retval;
buf = xmalloc(fs->blocksize * BUF_BLOCKS);
for (group = 0; group < fs->group_desc_count; group++) {
blk = fs->group_desc[(unsigned)group].bg_inode_table;
if (!blk) {
@ -161,7 +161,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd,
retval = io_channel_write_blk(fs->io, blk, c, buf);
if (retval)
goto errout;
blk += c;
left -= c;
}
@ -176,7 +176,7 @@ errout:
/*
* Write out superblock and group descriptors
*/
errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd,
errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd,
int flags EXT2FS_ATTR((unused)))
{
char *buf, *cp;
@ -213,7 +213,7 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd,
retval = EXT2_ET_SHORT_WRITE;
goto errout;
}
retval = 0;
errout:
@ -224,7 +224,7 @@ errout:
/*
* Read the superblock and group descriptors and overwrite them.
*/
errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd,
errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd,
int flags EXT2FS_ATTR((unused)))
{
char *buf;
@ -368,7 +368,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
goto errout;
}
memcpy(ptr, buf, size);
retval = 0;
errout:
if (buf)

View File

@ -1,8 +1,8 @@
/*
* ind_block.c --- indirect block I/O routines
*
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
* 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o.
*
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
* 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public

Some files were not shown because too many files have changed in this diff Show More