* fhandler.h: Rename FH_W95LSBUG flag to FH_LSEEKED.

(fhandler_base::set_did_lseek): Rename from set_check_win95_lseek_bug.
	(fhandler_base::get_did_lseek): Rename from get_check_win95_lseek_bug.
	(fhandler_base::set_fs_flags): New method.
	(fhandler_base::get_fs_flags): Ditto.
	* fhandler.cc (fhandler_base::write): Make 64 bit clean.  Convert file
	to a "sparse" file when writing after a long lseek (>64K) beyond EOF.
	(fhandler_base::lseek): Call set_did_lseek() instead of
	set_check_win95_lseek_bug().
	(fhandler_base::fhandler_base): Initialize fs_flags to 0.
	* fhandler_disk_file.cc (fhandler_disk_file::open): Don't create files
	as "sparse" unconditionally.  Set fs_flags member.
This commit is contained in:
Corinna Vinschen
2003-05-26 09:54:01 +00:00
parent 7b3a9e6e00
commit fac297d5f8
4 changed files with 91 additions and 53 deletions

View File

@ -28,9 +28,10 @@ enum
FH_SYMLINK = 0x00100000, /* is a symlink */
FH_EXECABL = 0x00200000, /* file looked like it would run:
* ends in .exe or .bat or begins with #! */
FH_W95LSBUG = 0x00400000, /* set when lseek is called as a flag that
FH_LSEEKED = 0x00400000, /* set when lseek is called as a flag that
* _write should check if we've moved beyond
* EOF, zero filling if so. */
* EOF, zero filling or making file sparse
if so. */
FH_NOHANDLE = 0x00800000, /* No handle associated with fhandler. */
FH_NOEINTR = 0x01000000, /* Set if I/O should be uninterruptible. */
FH_FFIXUP = 0x02000000, /* Set if need to fixup after fork. */
@ -167,6 +168,7 @@ class fhandler_base
const char *unix_path_name;
const char *win32_path_name;
DWORD open_status;
DWORD fs_flags;
HANDLE read_state;
public:
@ -234,8 +236,8 @@ class fhandler_base
return get_close_on_exec () ? &sec_none_nih : &sec_none;
}
void set_check_win95_lseek_bug (int b = 1) { FHCONDSETF (b, W95LSBUG); }
bool get_check_win95_lseek_bug () { return FHISSETF (W95LSBUG); }
void set_did_lseek (int b = 1) { FHCONDSETF (b, LSEEKED); }
bool get_did_lseek () { return FHISSETF (LSEEKED); }
bool get_need_fork_fixup () { return FHISSETF (FFIXUP); }
void set_need_fork_fixup () { FHSETF (FFIXUP); }
@ -268,6 +270,10 @@ class fhandler_base
void set_append_p (int val) { FHCONDSETF (val, APPEND); }
void set_append_p () { FHSETF (APPEND); }
void set_fs_flags (DWORD flags) { fs_flags = flags; }
bool get_fs_flags (DWORD flagval = 0xffffffffUL)
{ return (fs_flags & (flagval)); }
bool get_query_open () { return FHISSETF (QUERYOPEN); }
void set_query_open (bool val) { FHCONDSETF (val, QUERYOPEN); }