From aa4115a47c554a936fdf5e6679e72a9329fecf45 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 21 Oct 1999 19:33:18 +0000 Subject: Many files: pass4.c (e2fsck_pass4): If an inode is set in the inode_imagic_map bitmap, don't check to see if it is disconnected from the inode tree (because it almost certainly will be). Free inode_imagic_map at the end of pass 4. pass2.c (check_dir_block, check_filetype): If the FILETYPE feature is set, check the directory entry's filetype information field, and fix/set it if necessary. (e2fsck_pass2): Free the inode_reg_map bitmap at the end of pass 2. pass1.c (e2fsck_pass1, alloc_imagic_map): Allocate and fill in information for inode_reg_map and inode_imagic_map, which indicates which inodes are regular files and AFS inodes, respectively. Since only the master superblock is written during a restart, force that superblock to be used after a restart; otherwise changes to the block group descriptors end up getting ignored. problem.c, problemP.h: If e2fsck is run -n, make def_yn variable be 0 for "no". Add support for a new flag, PR_NO_NOMSG, which supresses the problem message if e2fsck is run with the -n option. problem.c, problem.h (PR_2_SET_FILETYPE, PR_2_BAD_FILETYPE): Add new problem codes. message.c (expand_dirent_expression): Add support for %dt which prints the dirent type information. e2fsck.c (e2fsck_reset_context): Free new bitmaps (inode_reg_map and inode_imagic_map). e2fsck.h (e2fsck_t): Add new inode_reg_map and inode_magic_map to the context structure. ChangeLog, nt_io.c: nt_io.c: New file which supports I/O under Windows NT. ChangeLog, gen_uuid_nt.c: gen_uuid_nt.c: New file which creates a UUID under Windows NT. Many files: Add support for non-Unix compiles --- include/nonunix/asm/types.h | 1 + include/nonunix/config.h | 18 ++++++ include/nonunix/dirent.h | 0 include/nonunix/getopt.h | 135 +++++++++++++++++++++++++++++++++++++++++ include/nonunix/grp.h | 17 ++++++ include/nonunix/linux/types.h | 28 +++++++++ include/nonunix/pwd.h | 22 +++++++ include/nonunix/sys/file.h | 0 include/nonunix/sys/ioctl.h | 0 include/nonunix/sys/param.h | 0 include/nonunix/sys/resource.h | 0 include/nonunix/sys/socket.h | 0 include/nonunix/sys/time.h | 1 + include/nonunix/sys/wait.h | 0 include/nonunix/termios.h | 0 include/nonunix/unistd.h | 49 +++++++++++++++ include/nonunix/utime.h | 1 + 17 files changed, 272 insertions(+) create mode 100644 include/nonunix/asm/types.h create mode 100644 include/nonunix/config.h create mode 100644 include/nonunix/dirent.h create mode 100644 include/nonunix/getopt.h create mode 100644 include/nonunix/grp.h create mode 100644 include/nonunix/linux/types.h create mode 100644 include/nonunix/pwd.h create mode 100644 include/nonunix/sys/file.h create mode 100644 include/nonunix/sys/ioctl.h create mode 100644 include/nonunix/sys/param.h create mode 100644 include/nonunix/sys/resource.h create mode 100644 include/nonunix/sys/socket.h create mode 100644 include/nonunix/sys/time.h create mode 100644 include/nonunix/sys/wait.h create mode 100644 include/nonunix/termios.h create mode 100644 include/nonunix/unistd.h create mode 100644 include/nonunix/utime.h (limited to 'include/nonunix') diff --git a/include/nonunix/asm/types.h b/include/nonunix/asm/types.h new file mode 100644 index 00000000..fccb4269 --- /dev/null +++ b/include/nonunix/asm/types.h @@ -0,0 +1 @@ +#include "../linux/types.h" \ No newline at end of file diff --git a/include/nonunix/config.h b/include/nonunix/config.h new file mode 100644 index 00000000..cc8ac193 --- /dev/null +++ b/include/nonunix/config.h @@ -0,0 +1,18 @@ + +#define _INO_T_DEFINED 1 + +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_GETOPT_H 1 +#define HAVE_ERRNO_H 1 +#define HAVE_SETJMP_H 1 + +#define HAVE_STRCASECMP 1 +#define HAVE_CONIO_H 1 + +#define HAVE_EXT2_INODE_VERSION 1 + +#define inline __forceinline + +#define _CTYPE_DISABLE_MACROS + diff --git a/include/nonunix/dirent.h b/include/nonunix/dirent.h new file mode 100644 index 00000000..e69de29b diff --git a/include/nonunix/getopt.h b/include/nonunix/getopt.h new file mode 100644 index 00000000..33ad46cf --- /dev/null +++ b/include/nonunix/getopt.h @@ -0,0 +1,135 @@ +/* Declarations for getopt. + Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef GETOPT_VARIABLE +#define GETOPT_VARIABLE +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern GETOPT_VARIABLE char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern GETOPT_VARIABLE int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern GETOPT_VARIABLE int opterr; + +/* Set to an option character which was unrecognized. */ + +extern GETOPT_VARIABLE int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/include/nonunix/grp.h b/include/nonunix/grp.h new file mode 100644 index 00000000..4130cb79 --- /dev/null +++ b/include/nonunix/grp.h @@ -0,0 +1,17 @@ + +#pragma once + +typedef unsigned short __gid_t; +__inline __gid_t getgid(void){return 0;} +__inline struct group * getgrnam(char* g){return 0;} + +struct group + { + char *gr_name; + char *gr_passwd; + __gid_t gr_gid; + char **gr_mem; + }; + +#define getgrgid(i) NULL + diff --git a/include/nonunix/linux/types.h b/include/nonunix/linux/types.h new file mode 100644 index 00000000..8e5bc90a --- /dev/null +++ b/include/nonunix/linux/types.h @@ -0,0 +1,28 @@ +#ifndef _LINUX_TYPES_H +#define _LINUX_TYPES_H + +#ifndef _MSC_VER +#error _MSC_VER not defined +#endif + + +typedef unsigned __int8 __u8; +typedef signed __int8 __s8; + +typedef signed __int64 __s64; +typedef unsigned __int64 __u64; + +typedef signed __int16 __s16; +typedef unsigned __int16 __u16; + +typedef signed __int32 __s32; +typedef unsigned __int32 __u32; + +typedef signed __int64 __s64; +typedef unsigned __int64 __u64; + + +typedef __u32 ino_t; + + +#endif /* LINUX_TYPES_H */ diff --git a/include/nonunix/pwd.h b/include/nonunix/pwd.h new file mode 100644 index 00000000..67e05eab --- /dev/null +++ b/include/nonunix/pwd.h @@ -0,0 +1,22 @@ + +#pragma once + +typedef unsigned short __uid_t; +__inline __uid_t getuid(void){return 0;} +__inline int geteuid(void){return 1;} +__inline struct passwd* getpwnam (char* g){return 0;} + + +struct passwd +{ + char *pw_name; + char *pw_passwd; + __uid_t pw_uid; + __gid_t pw_gid; + char *pw_gecos; + char *pw_dir; + char *pw_shell; +}; + +#define getpwuid(i) NULL + diff --git a/include/nonunix/sys/file.h b/include/nonunix/sys/file.h new file mode 100644 index 00000000..e69de29b diff --git a/include/nonunix/sys/ioctl.h b/include/nonunix/sys/ioctl.h new file mode 100644 index 00000000..e69de29b diff --git a/include/nonunix/sys/param.h b/include/nonunix/sys/param.h new file mode 100644 index 00000000..e69de29b diff --git a/include/nonunix/sys/resource.h b/include/nonunix/sys/resource.h new file mode 100644 index 00000000..e69de29b diff --git a/include/nonunix/sys/socket.h b/include/nonunix/sys/socket.h new file mode 100644 index 00000000..e69de29b diff --git a/include/nonunix/sys/time.h b/include/nonunix/sys/time.h new file mode 100644 index 00000000..91fd1871 --- /dev/null +++ b/include/nonunix/sys/time.h @@ -0,0 +1 @@ +#include diff --git a/include/nonunix/sys/wait.h b/include/nonunix/sys/wait.h new file mode 100644 index 00000000..e69de29b diff --git a/include/nonunix/termios.h b/include/nonunix/termios.h new file mode 100644 index 00000000..e69de29b diff --git a/include/nonunix/unistd.h b/include/nonunix/unistd.h new file mode 100644 index 00000000..5053587c --- /dev/null +++ b/include/nonunix/unistd.h @@ -0,0 +1,49 @@ + + +#pragma once + +#include +#include +#include + +#define EOPNOTSUPP 95 + +#define O_NONBLOCK 0 +#define O_RDONLY _O_RDONLY +#define O_RDWR _O_RDWR + +#define popen _popen +#define pclose _pclose +#define sleep _sleep +#define stat _stat +#define open _open +#define close _close +#define fstat _fstat +#define read _read +#define write _write +#define off_t _off_t +#define lseek _lseek +#define putenv _putenv +#define getpid _getpid +#define utimbuf _utimbuf +#define sys_nerr _sys_nerr +#define sys_errlist _sys_errlist +#define isatty _isatty +#define getch _getch + +#include +#include + + +// no-oped sync +__inline void sync(void){}; + + + +#define gettimeofday(p, v) ((p)->tv_sec = (p)->tv_usec = 0) + + +#define strcasecmp _stricmp + + + diff --git a/include/nonunix/utime.h b/include/nonunix/utime.h new file mode 100644 index 00000000..8285f38f --- /dev/null +++ b/include/nonunix/utime.h @@ -0,0 +1 @@ +#include -- cgit v1.2.3