* fhandler.h (class fhandler_dev_raw): Move status bits into protected

bitfield struct type status_flags.  Drop unused has_written bit.
	Add accessor methods.
	(fhandler_dev_raw::clear): Remove.
	(fhandler_dev_raw::reset_devbuf): Remove.
	* fhandler_floppy.cc (fhandler_dev_floppy::lseek): Use accessor method
	for is_writing.
	* fhandler_raw.cc: Use status accessor methods throughout.
	(fhandler_dev_raw::clear): Remove.
	(fhandler_dev_raw::fhandler_dev_raw): Drop clear call.
	(fhandler_dev_raw::~fhandler_dev_raw): Ditto.
	* fhandler_tape.cc: Use mtinfo::status accessor methods throughout.
	(mtinfo_drive::close): Fix conditional to enable BSD semantics
	correctly.
	(mtinfo_drive::get_status): Rename from mtinfo_drive::status.
	* mtinfo.h (class mtinfo_drive): Move status bits into private bitfield
	struct type status_flags.  Add accessor methods.
	Rename status method to get_status.
This commit is contained in:
Corinna Vinschen
2004-04-09 20:39:19 +00:00
parent 535309a6e3
commit ff0843433a
6 changed files with 131 additions and 110 deletions

View File

@@ -67,12 +67,15 @@ class mtinfo_drive
lock_state lock;
TAPE_GET_DRIVE_PARAMETERS _dp;
TAPE_GET_MEDIA_PARAMETERS _mp;
bool buffer_writes;
bool two_fm;
bool fast_eom;
bool auto_lock;
bool sysv;
bool nowait;
struct status_flags
{
unsigned buffer_writes : 1;
unsigned two_fm : 1;
unsigned fast_eom : 1;
unsigned auto_lock : 1;
unsigned sysv : 1;
unsigned nowait : 1;
} status;
mtinfo_part _part[MAX_PARTITION_NUM];
inline int error (const char *str)
@@ -96,7 +99,7 @@ class mtinfo_drive
int prepare (HANDLE mt, int action, bool is_auto = false);
int set_compression (HANDLE mt, long count);
int set_blocksize (HANDLE mt, long count);
int status (HANDLE mt, struct mtget *get);
int get_status (HANDLE mt, struct mtget *get);
int set_options (HANDLE mt, long options);
public:
@@ -110,7 +113,18 @@ public:
int ioctl (HANDLE mt, unsigned int cmd, void *buf);
int set_pos (HANDLE mt, int mode, long count, bool sfm_func);
inline bool buffered_writes (void) { return buffer_writes; }
void buffer_writes (bool b) { status.buffer_writes = b; }
bool buffer_writes () { return status.buffer_writes; }
void two_fm (bool b) { status.two_fm = b; }
bool two_fm () { return status.two_fm; }
void fast_eom (bool b) { status.fast_eom = b; }
bool fast_eom () { return status.fast_eom; }
void auto_lock (bool b) { status.auto_lock = b; }
bool auto_lock () { return status.auto_lock; }
void sysv (bool b) { status.sysv = b; }
bool sysv () { return status.sysv; }
void nowait (bool b) { status.nowait = b; }
bool nowait () { return status.nowait; }
PTAPE_GET_DRIVE_PARAMETERS dp (void) { return &_dp; }
PTAPE_GET_MEDIA_PARAMETERS mp (void) { return &_mp; }
mtinfo_part *part (int num) { return &_part[num]; }