+ const char *print_name() const; /* Name for display purposes */
+ void set_ateof(); /* in dev.c */
+ void set_ateot(); /* in dev.c */
+ void set_eot() { state |= ST_EOT; };
+ void set_eof() { state |= ST_EOF; };
+ void set_append() { state |= ST_APPEND; };
+ void set_labeled() { state |= ST_LABEL; };
+ inline void set_read() { state |= ST_READ; };
+ void set_offline() { state |= ST_OFFLINE; };
+ void set_mounted() { state |= ST_MOUNTED; };
+ void set_media() { state |= ST_MEDIA; };
+ void set_short_block() { state |= ST_SHORT; };
+ void set_freespace_ok() { state |= ST_FREESPACE_OK; }
+ void set_part_spooled(int val) { if (val) state |= ST_PART_SPOOLED; \
+ else state &= ~ST_PART_SPOOLED;
+ };
+ void set_unload() { m_unload = true; };
+ void set_load() { m_load = true; };
+ void inc_reserved() { m_num_reserved++; }
+ void set_mounted(int val) { if (val) state |= ST_MOUNTED; \
+ else state &= ~ST_MOUNTED; };
+ void dec_reserved() { m_num_reserved--; ASSERT(m_num_reserved>=0); };
+ void clear_append() { state &= ~ST_APPEND; };
+ void clear_read() { state &= ~ST_READ; };
+ void clear_labeled() { state &= ~ST_LABEL; };
+ void clear_offline() { state &= ~ST_OFFLINE; };
+ void clear_eot() { state &= ~ST_EOT; };
+ void clear_eof() { state &= ~ST_EOF; };
+ void clear_opened() { m_fd = -1; };
+ void clear_mounted() { state &= ~ST_MOUNTED; };
+ void clear_media() { state &= ~ST_MEDIA; };
+ void clear_short_block() { state &= ~ST_SHORT; };
+ void clear_freespace_ok() { state &= ~ST_FREESPACE_OK; };
+ void clear_unload() { m_unload = false; };
+ void clear_load() { m_load = false; };
+ char *bstrerror(void) { return errmsg; };
+ char *print_errmsg() { return errmsg; };
+ int32_t get_slot() const { return m_slot; };
+
+
+ void clear_volhdr(); /* in dev.c */
+ void close(); /* in dev.c */
+ void close_part(DCR *dcr); /* in dev.c */
+ bool truncate(DCR *dcr); /* in dev.c */
+ int open(DCR *dcr, int mode); /* in dev.c */
+ void term(void); /* in dev.c */
+ ssize_t read(void *buf, size_t len); /* in dev.c */
+ ssize_t write(const void *buf, size_t len); /* in dev.c */
+ bool rewind(DCR *dcr); /* in dev.c */
+ bool mount(int timeout); /* in dev.c */
+ bool unmount(int timeout); /* in dev.c */
+ void edit_mount_codes(POOL_MEM &omsg, const char *imsg); /* in dev.c */
+ bool offline_or_rewind(); /* in dev.c */
+ bool offline(); /* in dev.c */
+ bool bsf(int count); /* in dev.c */
+ bool eod(DCR *dcr); /* in dev.c */
+ bool fsr(int num); /* in dev.c */
+ bool fsf(int num); /* in dev.c */
+ bool bsr(int num); /* in dev.c */
+ bool weof(int num); /* in dev.c */
+ void lock_door(); /* in dev.c */
+ void unlock_door(); /* in dev.c */
+ int32_t get_os_tape_file(); /* in dev.c */
+ bool scan_dir_for_volume(DCR *dcr); /* in scan.c */
+ bool reposition(DCR *dcr, uint32_t rfile, uint32_t rblock); /* in dev.c */
+ void clrerror(int func); /* in dev.c */
+ boffset_t lseek(DCR *dcr, boffset_t offset, int whence); /* in dev.c */
+ bool update_pos(DCR *dcr); /* in dev.c */
+ void set_slot(int32_t slot); /* in dev.c */
+ void clear_slot(); /* in dev.c */
+
+
+ bool update_freespace(); /* in dvd.c */
+
+ uint32_t get_file() const { return file; };
+ uint32_t get_block_num() const { return block_num; };
+ int fd() const { return m_fd; };
+
+ /* low level operations */
+ void init_backend();
+ int (*d_open)(const char *pathname, int flags, ...);
+ int (*d_read)(int fd, void *buffer, unsigned int count);
+ int (*d_write)(int fd, const void *buffer, unsigned int count);
+ int (*d_close)(int fd);
+ int (*d_ioctl)(int fd, unsigned long int request, ...);
+
+ /*
+ * Locking and blocking calls
+ */
+#ifdef SD_DEBUG_LOCK
+ void _r_dlock(const char *, int); /* in lock.c */
+ void _r_dunlock(const char *, int); /* in lock.c */
+ void _dlock(const char *, int); /* in lock.c */
+ void _dunlock(const char *, int); /* in lock.c */
+#else
+ void r_dlock(); /* in lock.c */
+ void r_dunlock() { dunlock(); }
+ void dlock() { P(m_mutex); }
+ void dunlock() { V(m_mutex); }
+#endif
+ void dblock(int why); /* in lock.c */
+ void dunblock(bool locked=false); /* in lock.c */
+ void set_blocked(int block) { m_blocked = block; };
+ int blocked() const { return m_blocked; };
+ bool is_blocked() const { return m_blocked != BST_NOT_BLOCKED; };
+ const char *print_blocked() const; /* in dev.c */
+
+private:
+ bool do_mount(int mount, int timeout); /* in dev.c */
+ void set_mode(int omode); /* in dev.c */
+ void open_tape_device(DCR *dcr, int omode); /* in dev.c */
+ void open_file_device(DCR *dcr, int omode); /* in dev.c */
+ void open_dvd_device(DCR *dcr, int omode); /* in dev.c */