Error Trace

[Home]

Bug # 144

Show/hide error trace
Error trace
Function bodies
Blocks
  • Others...
    Function bodies without model function calls
    Initialization function calls
    Initialization function bodies
    Entry point
    Entry point body
    Function calls
    Skipped function calls
    Formal parameter names
    Declarations
    Assumes
    Assume conditions
    Returns
    Return values
    DEG initialization
    DEG function calls
    Model function calls
    Model function bodies
    Model asserts
    Model state changes
    Model function function calls
    Model function function bodies
    Model returns
    Model others
    Identation
    Line numbers
    Expand signs
-__CPAchecker_initialize()
{
20 typedef unsigned char __u8;
23 typedef unsigned short __u16;
25 typedef int __s32;
26 typedef unsigned int __u32;
30 typedef unsigned long long __u64;
15 typedef signed char s8;
16 typedef unsigned char u8;
19 typedef unsigned short u16;
21 typedef int s32;
22 typedef unsigned int u32;
24 typedef long long s64;
25 typedef unsigned long long u64;
14 typedef long __kernel_long_t;
15 typedef unsigned long __kernel_ulong_t;
27 typedef int __kernel_pid_t;
44 typedef int __kernel_daddr_t;
48 typedef unsigned int __kernel_uid32_t;
49 typedef unsigned int __kernel_gid32_t;
71 typedef __kernel_ulong_t __kernel_size_t;
72 typedef __kernel_long_t __kernel_ssize_t;
87 typedef long long __kernel_loff_t;
88 typedef __kernel_long_t __kernel_time_t;
89 typedef __kernel_long_t __kernel_clock_t;
90 typedef int __kernel_timer_t;
91 typedef int __kernel_clockid_t;
32 typedef __u16 __le16;
33 typedef __u16 __be16;
34 typedef __u32 __le32;
35 typedef __u32 __be32;
36 typedef __u64 __le64;
259 struct kernel_symbol { unsigned long value; const char *name; } ;
33 struct module ;
12 typedef __u32 __kernel_dev_t;
15 typedef __kernel_dev_t dev_t;
18 typedef unsigned short umode_t;
21 typedef __kernel_pid_t pid_t;
26 typedef __kernel_clockid_t clockid_t;
29 typedef _Bool bool;
31 typedef __kernel_uid32_t uid_t;
32 typedef __kernel_gid32_t gid_t;
45 typedef __kernel_loff_t loff_t;
54 typedef __kernel_size_t size_t;
59 typedef __kernel_ssize_t ssize_t;
69 typedef __kernel_time_t time_t;
102 typedef __s32 int32_t;
108 typedef __u32 uint32_t;
133 typedef unsigned long sector_t;
134 typedef unsigned long blkcnt_t;
152 typedef u64 dma_addr_t;
157 typedef unsigned int gfp_t;
158 typedef unsigned int fmode_t;
161 typedef u64 phys_addr_t;
166 typedef phys_addr_t resource_size_t;
176 struct __anonstruct_atomic_t_6 { int counter; } ;
176 typedef struct __anonstruct_atomic_t_6 atomic_t;
181 struct __anonstruct_atomic64_t_7 { long counter; } ;
181 typedef struct __anonstruct_atomic64_t_7 atomic64_t;
182 struct list_head { struct list_head *next; struct list_head *prev; } ;
187 struct hlist_node ;
187 struct hlist_head { struct hlist_node *first; } ;
191 struct hlist_node { struct hlist_node *next; struct hlist_node **pprev; } ;
202 struct callback_head { struct callback_head *next; void (*func)(struct callback_head *); } ;
131 typedef void (*ctor_fn_t)();
48 struct device ;
432 struct file_operations ;
444 struct completion ;
445 struct pt_regs ;
555 struct bug_entry { int bug_addr_disp; int file_disp; unsigned short line; unsigned short flags; } ;
111 struct timespec ;
112 struct compat_timespec ;
113 struct __anonstruct_futex_25 { u32 *uaddr; u32 val; u32 flags; u32 bitset; u64 time; u32 *uaddr2; } ;
113 struct __anonstruct_nanosleep_26 { clockid_t clockid; struct timespec *rmtp; struct compat_timespec *compat_rmtp; u64 expires; } ;
113 struct pollfd ;
113 struct __anonstruct_poll_27 { struct pollfd *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } ;
113 union __anonunion____missing_field_name_24 { struct __anonstruct_futex_25 futex; struct __anonstruct_nanosleep_26 nanosleep; struct __anonstruct_poll_27 poll; } ;
113 struct restart_block { long int (*fn)(struct restart_block *); union __anonunion____missing_field_name_24 __annonCompField4; } ;
39 struct page ;
14 struct __anonstruct_pfn_t_28 { u64 val; } ;
14 typedef struct __anonstruct_pfn_t_28 pfn_t;
26 struct task_struct ;
27 struct mm_struct ;
288 struct pt_regs { unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; unsigned long bp; unsigned long bx; unsigned long r11; unsigned long r10; unsigned long r9; unsigned long r8; unsigned long ax; unsigned long cx; unsigned long dx; unsigned long si; unsigned long di; unsigned long orig_ax; unsigned long ip; unsigned long cs; unsigned long flags; unsigned long sp; unsigned long ss; } ;
66 struct __anonstruct____missing_field_name_30 { unsigned int a; unsigned int b; } ;
66 struct __anonstruct____missing_field_name_31 { u16 limit0; u16 base0; unsigned char base1; unsigned char type; unsigned char s; unsigned char dpl; unsigned char p; unsigned char limit; unsigned char avl; unsigned char l; unsigned char d; unsigned char g; unsigned char base2; } ;
66 union __anonunion____missing_field_name_29 { struct __anonstruct____missing_field_name_30 __annonCompField5; struct __anonstruct____missing_field_name_31 __annonCompField6; } ;
66 struct desc_struct { union __anonunion____missing_field_name_29 __annonCompField7; } ;
12 typedef unsigned long pteval_t;
13 typedef unsigned long pmdval_t;
15 typedef unsigned long pgdval_t;
16 typedef unsigned long pgprotval_t;
18 struct __anonstruct_pte_t_32 { pteval_t pte; } ;
18 typedef struct __anonstruct_pte_t_32 pte_t;
20 struct pgprot { pgprotval_t pgprot; } ;
250 typedef struct pgprot pgprot_t;
252 struct __anonstruct_pgd_t_33 { pgdval_t pgd; } ;
252 typedef struct __anonstruct_pgd_t_33 pgd_t;
291 struct __anonstruct_pmd_t_35 { pmdval_t pmd; } ;
291 typedef struct __anonstruct_pmd_t_35 pmd_t;
417 typedef struct page *pgtable_t;
428 struct file ;
441 struct seq_file ;
479 struct thread_struct ;
481 struct cpumask ;
20 struct qspinlock { atomic_t val; } ;
33 typedef struct qspinlock arch_spinlock_t;
34 struct qrwlock { atomic_t cnts; arch_spinlock_t wait_lock; } ;
14 typedef struct qrwlock arch_rwlock_t;
253 struct math_emu_info { long ___orig_eip; struct pt_regs *regs; } ;
338 struct cpumask { unsigned long bits[128U]; } ;
15 typedef struct cpumask cpumask_t;
654 typedef struct cpumask *cpumask_var_t;
23 typedef atomic64_t atomic_long_t;
82 struct static_key { atomic_t enabled; } ;
22 struct tracepoint_func { void *func; void *data; int prio; } ;
28 struct tracepoint { const char *name; struct static_key key; void (*regfunc)(); void (*unregfunc)(); struct tracepoint_func *funcs; } ;
298 struct fregs_state { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20U]; u32 status; } ;
26 struct __anonstruct____missing_field_name_59 { u64 rip; u64 rdp; } ;
26 struct __anonstruct____missing_field_name_60 { u32 fip; u32 fcs; u32 foo; u32 fos; } ;
26 union __anonunion____missing_field_name_58 { struct __anonstruct____missing_field_name_59 __annonCompField13; struct __anonstruct____missing_field_name_60 __annonCompField14; } ;
26 union __anonunion____missing_field_name_61 { u32 padding1[12U]; u32 sw_reserved[12U]; } ;
26 struct fxregs_state { u16 cwd; u16 swd; u16 twd; u16 fop; union __anonunion____missing_field_name_58 __annonCompField15; u32 mxcsr; u32 mxcsr_mask; u32 st_space[32U]; u32 xmm_space[64U]; u32 padding[12U]; union __anonunion____missing_field_name_61 __annonCompField16; } ;
66 struct swregs_state { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20U]; u8 ftop; u8 changed; u8 lookahead; u8 no_update; u8 rm; u8 alimit; struct math_emu_info *info; u32 entry_eip; } ;
226 struct xstate_header { u64 xfeatures; u64 xcomp_bv; u64 reserved[6U]; } ;
232 struct xregs_state { struct fxregs_state i387; struct xstate_header header; u8 extended_state_area[0U]; } ;
247 union fpregs_state { struct fregs_state fsave; struct fxregs_state fxsave; struct swregs_state soft; struct xregs_state xsave; u8 __padding[4096U]; } ;
264 struct fpu { unsigned int last_cpu; unsigned char fpstate_active; unsigned char fpregs_active; unsigned char counter; union fpregs_state state; } ;
169 struct seq_operations ;
371 struct perf_event ;
372 struct thread_struct { struct desc_struct tls_array[3U]; unsigned long sp0; unsigned long sp; unsigned short es; unsigned short ds; unsigned short fsindex; unsigned short gsindex; unsigned long fsbase; unsigned long gsbase; struct perf_event *ptrace_bps[4U]; unsigned long debugreg6; unsigned long ptrace_dr7; unsigned long cr2; unsigned long trap_nr; unsigned long error_code; unsigned long *io_bitmap_ptr; unsigned long iopl; unsigned int io_bitmap_max; struct fpu fpu; } ;
33 struct lockdep_map ;
55 struct stack_trace { unsigned int nr_entries; unsigned int max_entries; unsigned long *entries; int skip; } ;
28 struct lockdep_subclass_key { char __one_byte; } ;
53 struct lock_class_key { struct lockdep_subclass_key subkeys[8U]; } ;
59 struct lock_class { struct hlist_node hash_entry; struct list_head lock_entry; struct lockdep_subclass_key *key; unsigned int subclass; unsigned int dep_gen_id; unsigned long usage_mask; struct stack_trace usage_traces[13U]; struct list_head locks_after; struct list_head locks_before; unsigned int version; unsigned long ops; const char *name; int name_version; unsigned long contention_point[4U]; unsigned long contending_point[4U]; } ;
144 struct lockdep_map { struct lock_class_key *key; struct lock_class *class_cache[2U]; const char *name; int cpu; unsigned long ip; } ;
207 struct held_lock { u64 prev_chain_key; unsigned long acquire_ip; struct lockdep_map *instance; struct lockdep_map *nest_lock; u64 waittime_stamp; u64 holdtime_stamp; unsigned short class_idx; unsigned char irq_context; unsigned char trylock; unsigned char read; unsigned char check; unsigned char hardirqs_off; unsigned short references; unsigned int pin_count; } ;
572 struct raw_spinlock { arch_spinlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ;
32 typedef struct raw_spinlock raw_spinlock_t;
33 struct __anonstruct____missing_field_name_75 { u8 __padding[24U]; struct lockdep_map dep_map; } ;
33 union __anonunion____missing_field_name_74 { struct raw_spinlock rlock; struct __anonstruct____missing_field_name_75 __annonCompField19; } ;
33 struct spinlock { union __anonunion____missing_field_name_74 __annonCompField20; } ;
76 typedef struct spinlock spinlock_t;
23 struct __anonstruct_rwlock_t_76 { arch_rwlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ;
23 typedef struct __anonstruct_rwlock_t_76 rwlock_t;
416 struct seqcount { unsigned int sequence; struct lockdep_map dep_map; } ;
52 typedef struct seqcount seqcount_t;
404 struct __anonstruct_seqlock_t_89 { struct seqcount seqcount; spinlock_t lock; } ;
404 typedef struct __anonstruct_seqlock_t_89 seqlock_t;
598 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ;
83 struct user_namespace ;
22 struct __anonstruct_kuid_t_90 { uid_t val; } ;
22 typedef struct __anonstruct_kuid_t_90 kuid_t;
27 struct __anonstruct_kgid_t_91 { gid_t val; } ;
27 typedef struct __anonstruct_kgid_t_91 kgid_t;
139 struct kstat { u64 ino; dev_t dev; umode_t mode; unsigned int nlink; kuid_t uid; kgid_t gid; dev_t rdev; loff_t size; struct timespec atime; struct timespec mtime; struct timespec ctime; unsigned long blksize; unsigned long long blocks; } ;
36 struct vm_area_struct ;
38 struct __wait_queue_head { spinlock_t lock; struct list_head task_list; } ;
43 typedef struct __wait_queue_head wait_queue_head_t;
97 struct __anonstruct_nodemask_t_92 { unsigned long bits[16U]; } ;
97 typedef struct __anonstruct_nodemask_t_92 nodemask_t;
13 struct optimistic_spin_queue { atomic_t tail; } ;
39 struct mutex { atomic_t count; spinlock_t wait_lock; struct list_head wait_list; struct task_struct *owner; void *magic; struct lockdep_map dep_map; } ;
67 struct mutex_waiter { struct list_head list; struct task_struct *task; void *magic; } ;
177 struct rw_semaphore ;
178 struct rw_semaphore { long count; struct list_head wait_list; raw_spinlock_t wait_lock; struct optimistic_spin_queue osq; struct task_struct *owner; struct lockdep_map dep_map; } ;
176 struct completion { unsigned int done; wait_queue_head_t wait; } ;
446 union ktime { s64 tv64; } ;
41 typedef union ktime ktime_t;
1129 struct timer_list { struct hlist_node entry; unsigned long expires; void (*function)(unsigned long); unsigned long data; u32 flags; int slack; int start_pid; void *start_site; char start_comm[16U]; struct lockdep_map lockdep_map; } ;
240 struct hrtimer ;
241 enum hrtimer_restart ;
242 struct rb_node { unsigned long __rb_parent_color; struct rb_node *rb_right; struct rb_node *rb_left; } ;
41 struct rb_root { struct rb_node *rb_node; } ;
838 struct nsproxy ;
261 struct workqueue_struct ;
262 struct work_struct ;
54 struct work_struct { atomic_long_t data; struct list_head entry; void (*func)(struct work_struct *); struct lockdep_map lockdep_map; } ;
107 struct delayed_work { struct work_struct work; struct timer_list timer; struct workqueue_struct *wq; int cpu; } ;
217 struct resource ;
64 struct resource { resource_size_t start; resource_size_t end; const char *name; unsigned long flags; unsigned long desc; struct resource *parent; struct resource *sibling; struct resource *child; } ;
217 struct pci_dev ;
58 struct pm_message { int event; } ;
64 typedef struct pm_message pm_message_t;
65 struct dev_pm_ops { int (*prepare)(struct device *); void (*complete)(struct device *); int (*suspend)(struct device *); int (*resume)(struct device *); int (*freeze)(struct device *); int (*thaw)(struct device *); int (*poweroff)(struct device *); int (*restore)(struct device *); int (*suspend_late)(struct device *); int (*resume_early)(struct device *); int (*freeze_late)(struct device *); int (*thaw_early)(struct device *); int (*poweroff_late)(struct device *); int (*restore_early)(struct device *); int (*suspend_noirq)(struct device *); int (*resume_noirq)(struct device *); int (*freeze_noirq)(struct device *); int (*thaw_noirq)(struct device *); int (*poweroff_noirq)(struct device *); int (*restore_noirq)(struct device *); int (*runtime_suspend)(struct device *); int (*runtime_resume)(struct device *); int (*runtime_idle)(struct device *); } ;
320 enum rpm_status { RPM_ACTIVE = 0, RPM_RESUMING = 1, RPM_SUSPENDED = 2, RPM_SUSPENDING = 3 } ;
327 enum rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE = 1, RPM_REQ_SUSPEND = 2, RPM_REQ_AUTOSUSPEND = 3, RPM_REQ_RESUME = 4 } ;
335 struct wakeup_source ;
336 struct wake_irq ;
337 struct pm_domain_data ;
338 struct pm_subsys_data { spinlock_t lock; unsigned int refcount; struct list_head clock_list; struct pm_domain_data *domain_data; } ;
556 struct dev_pm_qos ;
556 struct dev_pm_info { pm_message_t power_state; unsigned char can_wakeup; unsigned char async_suspend; bool is_prepared; bool is_suspended; bool is_noirq_suspended; bool is_late_suspended; bool early_init; bool direct_complete; spinlock_t lock; struct list_head entry; struct completion completion; struct wakeup_source *wakeup; bool wakeup_path; bool syscore; bool no_pm_callbacks; struct timer_list suspend_timer; unsigned long timer_expires; struct work_struct work; wait_queue_head_t wait_queue; struct wake_irq *wakeirq; atomic_t usage_count; atomic_t child_count; unsigned char disable_depth; unsigned char idle_notification; unsigned char request_pending; unsigned char deferred_resume; unsigned char run_wake; unsigned char runtime_auto; bool ignore_children; unsigned char no_callbacks; unsigned char irq_safe; unsigned char use_autosuspend; unsigned char timer_autosuspends; unsigned char memalloc_noio; enum rpm_request request; enum rpm_status runtime_status; int runtime_error; int autosuspend_delay; unsigned long last_busy; unsigned long active_jiffies; unsigned long suspended_jiffies; unsigned long accounting_timestamp; struct pm_subsys_data *subsys_data; void (*set_latency_tolerance)(struct device *, s32 ); struct dev_pm_qos *qos; } ;
616 struct dev_pm_domain { struct dev_pm_ops ops; void (*detach)(struct device *, bool ); int (*activate)(struct device *); void (*sync)(struct device *); void (*dismiss)(struct device *); } ;
144 struct pci_bus ;
26 struct ldt_struct ;
26 struct vdso_image ;
26 struct __anonstruct_mm_context_t_161 { struct ldt_struct *ldt; unsigned short ia32_compat; struct mutex lock; void *vdso; const struct vdso_image *vdso_image; atomic_t perf_rdpmc_allowed; } ;
26 typedef struct __anonstruct_mm_context_t_161 mm_context_t;
22 struct bio_vec ;
1238 struct llist_node ;
64 struct llist_node { struct llist_node *next; } ;
17 struct call_single_data { struct llist_node llist; void (*func)(void *); void *info; unsigned int flags; } ;
37 struct cred ;
19 struct inode ;
58 struct arch_uprobe_task { unsigned long saved_scratch_register; unsigned int saved_trap_nr; unsigned int saved_tf; } ;
66 enum uprobe_task_state { UTASK_RUNNING = 0, UTASK_SSTEP = 1, UTASK_SSTEP_ACK = 2, UTASK_SSTEP_TRAPPED = 3 } ;
73 struct __anonstruct____missing_field_name_197 { struct arch_uprobe_task autask; unsigned long vaddr; } ;
73 struct __anonstruct____missing_field_name_198 { struct callback_head dup_xol_work; unsigned long dup_xol_addr; } ;
73 union __anonunion____missing_field_name_196 { struct __anonstruct____missing_field_name_197 __annonCompField35; struct __anonstruct____missing_field_name_198 __annonCompField36; } ;
73 struct uprobe ;
73 struct return_instance ;
73 struct uprobe_task { enum uprobe_task_state state; union __anonunion____missing_field_name_196 __annonCompField37; struct uprobe *active_uprobe; unsigned long xol_vaddr; struct return_instance *return_instances; unsigned int depth; } ;
94 struct return_instance { struct uprobe *uprobe; unsigned long func; unsigned long stack; unsigned long orig_ret_vaddr; bool chained; struct return_instance *next; } ;
110 struct xol_area ;
111 struct uprobes_state { struct xol_area *xol_area; } ;
150 struct address_space ;
151 struct mem_cgroup ;
152 union __anonunion____missing_field_name_199 { struct address_space *mapping; void *s_mem; atomic_t compound_mapcount; } ;
152 union __anonunion____missing_field_name_201 { unsigned long index; void *freelist; } ;
152 struct __anonstruct____missing_field_name_205 { unsigned short inuse; unsigned short objects; unsigned char frozen; } ;
152 union __anonunion____missing_field_name_204 { atomic_t _mapcount; struct __anonstruct____missing_field_name_205 __annonCompField40; int units; } ;
152 struct __anonstruct____missing_field_name_203 { union __anonunion____missing_field_name_204 __annonCompField41; atomic_t _refcount; } ;
152 union __anonunion____missing_field_name_202 { unsigned long counters; struct __anonstruct____missing_field_name_203 __annonCompField42; unsigned int active; } ;
152 struct __anonstruct____missing_field_name_200 { union __anonunion____missing_field_name_201 __annonCompField39; union __anonunion____missing_field_name_202 __annonCompField43; } ;
152 struct dev_pagemap ;
152 struct __anonstruct____missing_field_name_207 { struct page *next; int pages; int pobjects; } ;
152 struct __anonstruct____missing_field_name_208 { unsigned long compound_head; unsigned int compound_dtor; unsigned int compound_order; } ;
152 struct __anonstruct____missing_field_name_209 { unsigned long __pad; pgtable_t pmd_huge_pte; } ;
152 union __anonunion____missing_field_name_206 { struct list_head lru; struct dev_pagemap *pgmap; struct __anonstruct____missing_field_name_207 __annonCompField45; struct callback_head callback_head; struct __anonstruct____missing_field_name_208 __annonCompField46; struct __anonstruct____missing_field_name_209 __annonCompField47; } ;
152 struct kmem_cache ;
152 union __anonunion____missing_field_name_210 { unsigned long private; spinlock_t *ptl; struct kmem_cache *slab_cache; } ;
152 struct page { unsigned long flags; union __anonunion____missing_field_name_199 __annonCompField38; struct __anonstruct____missing_field_name_200 __annonCompField44; union __anonunion____missing_field_name_206 __annonCompField48; union __anonunion____missing_field_name_210 __annonCompField49; struct mem_cgroup *mem_cgroup; } ;
196 struct page_frag { struct page *page; __u32 offset; __u32 size; } ;
281 struct userfaultfd_ctx ;
281 struct vm_userfaultfd_ctx { struct userfaultfd_ctx *ctx; } ;
288 struct __anonstruct_shared_211 { struct rb_node rb; unsigned long rb_subtree_last; } ;
288 struct anon_vma ;
288 struct vm_operations_struct ;
288 struct mempolicy ;
288 struct vm_area_struct { unsigned long vm_start; unsigned long vm_end; struct vm_area_struct *vm_next; struct vm_area_struct *vm_prev; struct rb_node vm_rb; unsigned long rb_subtree_gap; struct mm_struct *vm_mm; pgprot_t vm_page_prot; unsigned long vm_flags; struct __anonstruct_shared_211 shared; struct list_head anon_vma_chain; struct anon_vma *anon_vma; const struct vm_operations_struct *vm_ops; unsigned long vm_pgoff; struct file *vm_file; void *vm_private_data; struct mempolicy *vm_policy; struct vm_userfaultfd_ctx vm_userfaultfd_ctx; } ;
361 struct core_thread { struct task_struct *task; struct core_thread *next; } ;
366 struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; } ;
380 struct task_rss_stat { int events; int count[4U]; } ;
388 struct mm_rss_stat { atomic_long_t count[4U]; } ;
393 struct kioctx_table ;
394 struct linux_binfmt ;
394 struct mmu_notifier_mm ;
394 struct mm_struct { struct vm_area_struct *mmap; struct rb_root mm_rb; u32 vmacache_seqnum; unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); unsigned long mmap_base; unsigned long mmap_legacy_base; unsigned long task_size; unsigned long highest_vm_end; pgd_t *pgd; atomic_t mm_users; atomic_t mm_count; atomic_long_t nr_ptes; atomic_long_t nr_pmds; int map_count; spinlock_t page_table_lock; struct rw_semaphore mmap_sem; struct list_head mmlist; unsigned long hiwater_rss; unsigned long hiwater_vm; unsigned long total_vm; unsigned long locked_vm; unsigned long pinned_vm; unsigned long data_vm; unsigned long exec_vm; unsigned long stack_vm; unsigned long def_flags; unsigned long start_code; unsigned long end_code; unsigned long start_data; unsigned long end_data; unsigned long start_brk; unsigned long brk; unsigned long start_stack; unsigned long arg_start; unsigned long arg_end; unsigned long env_start; unsigned long env_end; unsigned long saved_auxv[46U]; struct mm_rss_stat rss_stat; struct linux_binfmt *binfmt; cpumask_var_t cpu_vm_mask_var; mm_context_t context; unsigned long flags; struct core_state *core_state; spinlock_t ioctx_lock; struct kioctx_table *ioctx_table; struct task_struct *owner; struct file *exe_file; struct mmu_notifier_mm *mmu_notifier_mm; struct cpumask cpumask_allocation; unsigned long numa_next_scan; unsigned long numa_scan_offset; int numa_scan_seq; bool tlb_flush_pending; struct uprobes_state uprobes_state; void *bd_addr; atomic_long_t hugetlb_usage; struct work_struct async_put_work; } ;
564 struct vm_fault ;
615 struct vdso_image { void *data; unsigned long size; unsigned long alt; unsigned long alt_len; long sym_vvar_start; long sym_vvar_page; long sym_hpet_page; long sym_pvclock_page; long sym_VDSO32_NOTE_MASK; long sym___kernel_sigreturn; long sym___kernel_rt_sigreturn; long sym___kernel_vsyscall; long sym_int80_landing_pad; } ;
15 typedef __u64 Elf64_Addr;
16 typedef __u16 Elf64_Half;
18 typedef __u64 Elf64_Off;
20 typedef __u32 Elf64_Word;
21 typedef __u64 Elf64_Xword;
190 struct elf64_sym { Elf64_Word st_name; unsigned char st_info; unsigned char st_other; Elf64_Half st_shndx; Elf64_Addr st_value; Elf64_Xword st_size; } ;
198 typedef struct elf64_sym Elf64_Sym;
219 struct elf64_hdr { unsigned char e_ident[16U]; Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; Elf64_Off e_phoff; Elf64_Off e_shoff; Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } ;
235 typedef struct elf64_hdr Elf64_Ehdr;
313 struct elf64_shdr { Elf64_Word sh_name; Elf64_Word sh_type; Elf64_Xword sh_flags; Elf64_Addr sh_addr; Elf64_Off sh_offset; Elf64_Xword sh_size; Elf64_Word sh_link; Elf64_Word sh_info; Elf64_Xword sh_addralign; Elf64_Xword sh_entsize; } ;
325 typedef struct elf64_shdr Elf64_Shdr;
53 union __anonunion____missing_field_name_216 { unsigned long bitmap[4U]; struct callback_head callback_head; } ;
53 struct idr_layer { int prefix; int layer; struct idr_layer *ary[256U]; int count; union __anonunion____missing_field_name_216 __annonCompField50; } ;
41 struct idr { struct idr_layer *hint; struct idr_layer *top; int layers; int cur; spinlock_t lock; int id_free_cnt; struct idr_layer *id_free; } ;
124 struct ida_bitmap { long nr_busy; unsigned long bitmap[15U]; } ;
167 struct ida { struct idr idr; struct ida_bitmap *free_bitmap; } ;
199 struct dentry ;
200 struct iattr ;
201 struct super_block ;
202 struct file_system_type ;
203 struct kernfs_open_node ;
204 struct kernfs_iattrs ;
227 struct kernfs_root ;
227 struct kernfs_elem_dir { unsigned long subdirs; struct rb_root children; struct kernfs_root *root; } ;
85 struct kernfs_node ;
85 struct kernfs_elem_symlink { struct kernfs_node *target_kn; } ;
89 struct kernfs_ops ;
89 struct kernfs_elem_attr { const struct kernfs_ops *ops; struct kernfs_open_node *open; loff_t size; struct kernfs_node *notify_next; } ;
96 union __anonunion____missing_field_name_221 { struct kernfs_elem_dir dir; struct kernfs_elem_symlink symlink; struct kernfs_elem_attr attr; } ;
96 struct kernfs_node { atomic_t count; atomic_t active; struct lockdep_map dep_map; struct kernfs_node *parent; const char *name; struct rb_node rb; const void *ns; unsigned int hash; union __anonunion____missing_field_name_221 __annonCompField51; void *priv; unsigned short flags; umode_t mode; unsigned int ino; struct kernfs_iattrs *iattr; } ;
138 struct kernfs_syscall_ops { int (*remount_fs)(struct kernfs_root *, int *, char *); int (*show_options)(struct seq_file *, struct kernfs_root *); int (*mkdir)(struct kernfs_node *, const char *, umode_t ); int (*rmdir)(struct kernfs_node *); int (*rename)(struct kernfs_node *, struct kernfs_node *, const char *); int (*show_path)(struct seq_file *, struct kernfs_node *, struct kernfs_root *); } ;
157 struct kernfs_root { struct kernfs_node *kn; unsigned int flags; struct ida ino_ida; struct kernfs_syscall_ops *syscall_ops; struct list_head supers; wait_queue_head_t deactivate_waitq; } ;
173 struct kernfs_open_file { struct kernfs_node *kn; struct file *file; void *priv; struct mutex mutex; struct mutex prealloc_mutex; int event; struct list_head list; char *prealloc_buf; size_t atomic_write_len; bool mmapped; const struct vm_operations_struct *vm_ops; } ;
191 struct kernfs_ops { int (*seq_show)(struct seq_file *, void *); void * (*seq_start)(struct seq_file *, loff_t *); void * (*seq_next)(struct seq_file *, void *, loff_t *); void (*seq_stop)(struct seq_file *, void *); ssize_t (*read)(struct kernfs_open_file *, char *, size_t , loff_t ); size_t atomic_write_len; bool prealloc; ssize_t (*write)(struct kernfs_open_file *, char *, size_t , loff_t ); int (*mmap)(struct kernfs_open_file *, struct vm_area_struct *); struct lock_class_key lockdep_key; } ;
499 struct sock ;
500 struct kobject ;
501 enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET = 1, KOBJ_NS_TYPES = 2 } ;
507 struct kobj_ns_type_operations { enum kobj_ns_type type; bool (*current_may_mount)(); void * (*grab_current_ns)(); const void * (*netlink_ns)(struct sock *); const void * (*initial_ns)(); void (*drop_ns)(void *); } ;
59 struct bin_attribute ;
60 struct attribute { const char *name; umode_t mode; bool ignore_lockdep; struct lock_class_key *key; struct lock_class_key skey; } ;
37 struct attribute_group { const char *name; umode_t (*is_visible)(struct kobject *, struct attribute *, int); umode_t (*is_bin_visible)(struct kobject *, struct bin_attribute *, int); struct attribute **attrs; struct bin_attribute **bin_attrs; } ;
92 struct bin_attribute { struct attribute attr; size_t size; void *private; ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); int (*mmap)(struct file *, struct kobject *, struct bin_attribute *, struct vm_area_struct *); } ;
165 struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t ); } ;
530 struct kref { atomic_t refcount; } ;
52 struct kset ;
52 struct kobj_type ;
52 struct kobject { const char *name; struct list_head entry; struct kobject *parent; struct kset *kset; struct kobj_type *ktype; struct kernfs_node *sd; struct kref kref; struct delayed_work release; unsigned char state_initialized; unsigned char state_in_sysfs; unsigned char state_add_uevent_sent; unsigned char state_remove_uevent_sent; unsigned char uevent_suppress; } ;
115 struct kobj_type { void (*release)(struct kobject *); const struct sysfs_ops *sysfs_ops; struct attribute **default_attrs; const struct kobj_ns_type_operations * (*child_ns_type)(struct kobject *); const void * (*namespace)(struct kobject *); } ;
123 struct kobj_uevent_env { char *argv[3U]; char *envp[32U]; int envp_idx; char buf[2048U]; int buflen; } ;
131 struct kset_uevent_ops { const int (*filter)(struct kset *, struct kobject *); const const char * (*name)(struct kset *, struct kobject *); const int (*uevent)(struct kset *, struct kobject *, struct kobj_uevent_env *); } ;
148 struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; } ;
223 struct kernel_param ;
228 struct kernel_param_ops { unsigned int flags; int (*set)(const char *, const struct kernel_param *); int (*get)(char *, const struct kernel_param *); void (*free)(void *); } ;
62 struct kparam_string ;
62 struct kparam_array ;
62 union __anonunion____missing_field_name_224 { void *arg; const struct kparam_string *str; const struct kparam_array *arr; } ;
62 struct kernel_param { const char *name; struct module *mod; const struct kernel_param_ops *ops; const u16 perm; s8 level; u8 flags; union __anonunion____missing_field_name_224 __annonCompField52; } ;
83 struct kparam_string { unsigned int maxlen; char *string; } ;
89 struct kparam_array { unsigned int max; unsigned int elemsize; unsigned int *num; const struct kernel_param_ops *ops; void *elem; } ;
470 struct latch_tree_node { struct rb_node node[2U]; } ;
211 struct mod_arch_specific { } ;
38 struct module_param_attrs ;
38 struct module_kobject { struct kobject kobj; struct module *mod; struct kobject *drivers_dir; struct module_param_attrs *mp; struct completion *kobj_completion; } ;
48 struct module_attribute { struct attribute attr; ssize_t (*show)(struct module_attribute *, struct module_kobject *, char *); ssize_t (*store)(struct module_attribute *, struct module_kobject *, const char *, size_t ); void (*setup)(struct module *, const char *); int (*test)(struct module *); void (*free)(struct module *); } ;
74 struct exception_table_entry ;
290 enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2, MODULE_STATE_UNFORMED = 3 } ;
297 struct mod_tree_node { struct module *mod; struct latch_tree_node node; } ;
304 struct module_layout { void *base; unsigned int size; unsigned int text_size; unsigned int ro_size; struct mod_tree_node mtn; } ;
318 struct mod_kallsyms { Elf64_Sym *symtab; unsigned int num_symtab; char *strtab; } ;
332 struct klp_modinfo { Elf64_Ehdr hdr; Elf64_Shdr *sechdrs; char *secstrings; unsigned int symndx; } ;
340 struct module_sect_attrs ;
340 struct module_notes_attrs ;
340 struct trace_event_call ;
340 struct trace_enum_map ;
340 struct module { enum module_state state; struct list_head list; char name[56U]; struct module_kobject mkobj; struct module_attribute *modinfo_attrs; const char *version; const char *srcversion; struct kobject *holders_dir; const struct kernel_symbol *syms; const unsigned long *crcs; unsigned int num_syms; struct mutex param_lock; struct kernel_param *kp; unsigned int num_kp; unsigned int num_gpl_syms; const struct kernel_symbol *gpl_syms; const unsigned long *gpl_crcs; const struct kernel_symbol *unused_syms; const unsigned long *unused_crcs; unsigned int num_unused_syms; unsigned int num_unused_gpl_syms; const struct kernel_symbol *unused_gpl_syms; const unsigned long *unused_gpl_crcs; bool sig_ok; bool async_probe_requested; const struct kernel_symbol *gpl_future_syms; const unsigned long *gpl_future_crcs; unsigned int num_gpl_future_syms; unsigned int num_exentries; struct exception_table_entry *extable; int (*init)(); struct module_layout core_layout; struct module_layout init_layout; struct mod_arch_specific arch; unsigned int taints; unsigned int num_bugs; struct list_head bug_list; struct bug_entry *bug_table; struct mod_kallsyms *kallsyms; struct mod_kallsyms core_kallsyms; struct module_sect_attrs *sect_attrs; struct module_notes_attrs *notes_attrs; char *args; void *percpu; unsigned int percpu_size; unsigned int num_tracepoints; const struct tracepoint **tracepoints_ptrs; unsigned int num_trace_bprintk_fmt; const char **trace_bprintk_fmt_start; struct trace_event_call **trace_events; unsigned int num_trace_events; struct trace_enum_map **trace_enums; unsigned int num_trace_enums; bool klp; bool klp_alive; struct klp_modinfo *klp_info; struct list_head source_list; struct list_head target_list; void (*exit)(); atomic_t refcnt; ctor_fn_t (**ctors)(); unsigned int num_ctors; } ;
54 struct percpu_ref ;
55 typedef void percpu_ref_func_t(struct percpu_ref *);
68 struct percpu_ref { atomic_long_t count; unsigned long percpu_count_ptr; percpu_ref_func_t *release; percpu_ref_func_t *confirm_switch; bool force_atomic; struct callback_head rcu; } ;
93 struct shrink_control { gfp_t gfp_mask; unsigned long nr_to_scan; int nid; struct mem_cgroup *memcg; } ;
27 struct shrinker { unsigned long int (*count_objects)(struct shrinker *, struct shrink_control *); unsigned long int (*scan_objects)(struct shrinker *, struct shrink_control *); int seeks; long batch; unsigned long flags; struct list_head list; atomic_long_t *nr_deferred; } ;
41 struct rlimit { __kernel_ulong_t rlim_cur; __kernel_ulong_t rlim_max; } ;
173 struct file_ra_state ;
174 struct user_struct ;
175 struct writeback_control ;
176 struct bdi_writeback ;
273 struct vm_fault { unsigned int flags; gfp_t gfp_mask; unsigned long pgoff; void *virtual_address; struct page *cow_page; struct page *page; void *entry; unsigned long max_pgoff; pte_t *pte; } ;
317 struct vm_operations_struct { void (*open)(struct vm_area_struct *); void (*close)(struct vm_area_struct *); int (*mremap)(struct vm_area_struct *); int (*fault)(struct vm_area_struct *, struct vm_fault *); int (*pmd_fault)(struct vm_area_struct *, unsigned long, pmd_t *, unsigned int); void (*map_pages)(struct vm_area_struct *, struct vm_fault *); int (*page_mkwrite)(struct vm_area_struct *, struct vm_fault *); int (*pfn_mkwrite)(struct vm_area_struct *, struct vm_fault *); int (*access)(struct vm_area_struct *, unsigned long, void *, int, int); const char * (*name)(struct vm_area_struct *); int (*set_policy)(struct vm_area_struct *, struct mempolicy *); struct mempolicy * (*get_policy)(struct vm_area_struct *, unsigned long); struct page * (*find_special_page)(struct vm_area_struct *, unsigned long); } ;
2409 enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED = 1, IRQ_WAKE_THREAD = 2 } ;
16 typedef enum irqreturn irqreturn_t;
64 struct irq_domain ;
414 struct proc_dir_entry ;
63 struct exception_table_entry { int insn; int fixup; int handler; } ;
61 struct timerqueue_node { struct rb_node node; ktime_t expires; } ;
12 struct timerqueue_head { struct rb_root head; struct timerqueue_node *next; } ;
50 struct hrtimer_clock_base ;
51 struct hrtimer_cpu_base ;
60 enum hrtimer_restart { HRTIMER_NORESTART = 0, HRTIMER_RESTART = 1 } ;
65 struct hrtimer { struct timerqueue_node node; ktime_t _softexpires; enum hrtimer_restart (*function)(struct hrtimer *); struct hrtimer_clock_base *base; u8 state; u8 is_rel; int start_pid; void *start_site; char start_comm[16U]; } ;
125 struct hrtimer_clock_base { struct hrtimer_cpu_base *cpu_base; int index; clockid_t clockid; struct timerqueue_head active; ktime_t (*get_time)(); ktime_t offset; } ;
158 struct hrtimer_cpu_base { raw_spinlock_t lock; seqcount_t seq; struct hrtimer *running; unsigned int cpu; unsigned int active_bases; unsigned int clock_was_set_seq; bool migration_enabled; bool nohz_active; unsigned char in_hrtirq; unsigned char hres_active; unsigned char hang_detected; ktime_t expires_next; struct hrtimer *next_timer; unsigned int nr_events; unsigned int nr_retries; unsigned int nr_hangs; unsigned int max_hang_time; struct hrtimer_clock_base clock_base[4U]; } ;
22 struct kernel_cap_struct { __u32 cap[2U]; } ;
25 typedef struct kernel_cap_struct kernel_cap_t;
84 struct plist_node { int prio; struct list_head prio_list; struct list_head node_list; } ;
4 typedef unsigned long cputime_t;
25 struct sem_undo_list ;
25 struct sysv_sem { struct sem_undo_list *undo_list; } ;
26 struct sysv_shm { struct list_head shm_clist; } ;
24 struct __anonstruct_sigset_t_251 { unsigned long sig[1U]; } ;
24 typedef struct __anonstruct_sigset_t_251 sigset_t;
25 struct siginfo ;
17 typedef void __signalfn_t(int);
18 typedef __signalfn_t *__sighandler_t;
20 typedef void __restorefn_t();
21 typedef __restorefn_t *__sigrestore_t;
34 union sigval { int sival_int; void *sival_ptr; } ;
10 typedef union sigval sigval_t;
11 struct __anonstruct__kill_253 { __kernel_pid_t _pid; __kernel_uid32_t _uid; } ;
11 struct __anonstruct__timer_254 { __kernel_timer_t _tid; int _overrun; char _pad[0U]; sigval_t _sigval; int _sys_private; } ;
11 struct __anonstruct__rt_255 { __kernel_pid_t _pid; __kernel_uid32_t _uid; sigval_t _sigval; } ;
11 struct __anonstruct__sigchld_256 { __kernel_pid_t _pid; __kernel_uid32_t _uid; int _status; __kernel_clock_t _utime; __kernel_clock_t _stime; } ;
11 struct __anonstruct__addr_bnd_259 { void *_lower; void *_upper; } ;
11 union __anonunion____missing_field_name_258 { struct __anonstruct__addr_bnd_259 _addr_bnd; __u32 _pkey; } ;
11 struct __anonstruct__sigfault_257 { void *_addr; short _addr_lsb; union __anonunion____missing_field_name_258 __annonCompField61; } ;
11 struct __anonstruct__sigpoll_260 { long _band; int _fd; } ;
11 struct __anonstruct__sigsys_261 { void *_call_addr; int _syscall; unsigned int _arch; } ;
11 union __anonunion__sifields_252 { int _pad[28U]; struct __anonstruct__kill_253 _kill; struct __anonstruct__timer_254 _timer; struct __anonstruct__rt_255 _rt; struct __anonstruct__sigchld_256 _sigchld; struct __anonstruct__sigfault_257 _sigfault; struct __anonstruct__sigpoll_260 _sigpoll; struct __anonstruct__sigsys_261 _sigsys; } ;
11 struct siginfo { int si_signo; int si_errno; int si_code; union __anonunion__sifields_252 _sifields; } ;
118 typedef struct siginfo siginfo_t;
22 struct sigpending { struct list_head list; sigset_t signal; } ;
257 struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; __sigrestore_t sa_restorer; sigset_t sa_mask; } ;
271 struct k_sigaction { struct sigaction sa; } ;
457 enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ;
464 struct pid_namespace ;
464 struct upid { int nr; struct pid_namespace *ns; struct hlist_node pid_chain; } ;
56 struct pid { atomic_t count; unsigned int level; struct hlist_head tasks[3U]; struct callback_head rcu; struct upid numbers[1U]; } ;
68 struct pid_link { struct hlist_node node; struct pid *pid; } ;
43 struct seccomp_filter ;
44 struct seccomp { int mode; struct seccomp_filter *filter; } ;
40 struct rt_mutex_waiter ;
12 enum kcov_mode { KCOV_MODE_DISABLED = 0, KCOV_MODE_TRACE = 1 } ;
17 struct task_io_accounting { u64 rchar; u64 wchar; u64 syscr; u64 syscw; u64 read_bytes; u64 write_bytes; u64 cancelled_write_bytes; } ;
45 struct latency_record { unsigned long backtrace[12U]; unsigned int count; unsigned long time; unsigned long max; } ;
41 struct assoc_array_ptr ;
41 struct assoc_array { struct assoc_array_ptr *root; unsigned long nr_leaves_on_tree; } ;
31 typedef int32_t key_serial_t;
34 typedef uint32_t key_perm_t;
35 struct key ;
36 struct signal_struct ;
37 struct key_type ;
41 struct keyring_index_key { struct key_type *type; const char *description; size_t desc_len; } ;
91 union key_payload { void *rcu_data0; void *data[4U]; } ;
128 union __anonunion____missing_field_name_282 { struct list_head graveyard_link; struct rb_node serial_node; } ;
128 struct key_user ;
128 union __anonunion____missing_field_name_283 { time_t expiry; time_t revoked_at; } ;
128 struct __anonstruct____missing_field_name_285 { struct key_type *type; char *description; } ;
128 union __anonunion____missing_field_name_284 { struct keyring_index_key index_key; struct __anonstruct____missing_field_name_285 __annonCompField64; } ;
128 struct __anonstruct____missing_field_name_287 { struct list_head name_link; struct assoc_array keys; } ;
128 union __anonunion____missing_field_name_286 { union key_payload payload; struct __anonstruct____missing_field_name_287 __annonCompField66; int reject_error; } ;
128 struct key { atomic_t usage; key_serial_t serial; union __anonunion____missing_field_name_282 __annonCompField62; struct rw_semaphore sem; struct key_user *user; void *security; union __anonunion____missing_field_name_283 __annonCompField63; time_t last_used_at; kuid_t uid; kgid_t gid; key_perm_t perm; unsigned short quotalen; unsigned short datalen; unsigned long flags; union __anonunion____missing_field_name_284 __annonCompField65; union __anonunion____missing_field_name_286 __annonCompField67; int (*restrict_link)(struct key *, const struct key_type *, const union key_payload *); } ;
377 struct audit_context ;
27 struct group_info { atomic_t usage; int ngroups; int nblocks; kgid_t small_block[32U]; kgid_t *blocks[0U]; } ;
90 struct cred { atomic_t usage; atomic_t subscribers; void *put_addr; unsigned int magic; kuid_t uid; kgid_t gid; kuid_t suid; kgid_t sgid; kuid_t euid; kgid_t egid; kuid_t fsuid; kgid_t fsgid; unsigned int securebits; kernel_cap_t cap_inheritable; kernel_cap_t cap_permitted; kernel_cap_t cap_effective; kernel_cap_t cap_bset; kernel_cap_t cap_ambient; unsigned char jit_keyring; struct key *session_keyring; struct key *process_keyring; struct key *thread_keyring; struct key *request_key_auth; void *security; struct user_struct *user; struct user_namespace *user_ns; struct group_info *group_info; struct callback_head rcu; } ;
377 enum rcu_sync_type { RCU_SYNC = 0, RCU_SCHED_SYNC = 1, RCU_BH_SYNC = 2 } ;
383 struct rcu_sync { int gp_state; int gp_count; wait_queue_head_t gp_wait; int cb_state; struct callback_head cb_head; enum rcu_sync_type gp_type; } ;
65 struct percpu_rw_semaphore { struct rcu_sync rss; unsigned int *fast_read_ctr; struct rw_semaphore rw_sem; atomic_t slow_read_ctr; wait_queue_head_t write_waitq; } ;
54 struct cgroup ;
55 struct cgroup_root ;
56 struct cgroup_subsys ;
57 struct cgroup_taskset ;
101 struct cgroup_file { struct kernfs_node *kn; } ;
90 struct cgroup_subsys_state { struct cgroup *cgroup; struct cgroup_subsys *ss; struct percpu_ref refcnt; struct cgroup_subsys_state *parent; struct list_head sibling; struct list_head children; int id; unsigned int flags; u64 serial_nr; atomic_t online_cnt; struct callback_head callback_head; struct work_struct destroy_work; } ;
141 struct css_set { atomic_t refcount; struct hlist_node hlist; struct list_head tasks; struct list_head mg_tasks; struct list_head cgrp_links; struct cgroup *dfl_cgrp; struct cgroup_subsys_state *subsys[13U]; struct list_head mg_preload_node; struct list_head mg_node; struct cgroup *mg_src_cgrp; struct cgroup *mg_dst_cgrp; struct css_set *mg_dst_cset; struct list_head e_cset_node[13U]; struct list_head task_iters; bool dead; struct callback_head callback_head; } ;
221 struct cgroup { struct cgroup_subsys_state self; unsigned long flags; int id; int level; int populated_cnt; struct kernfs_node *kn; struct cgroup_file procs_file; struct cgroup_file events_file; u16 subtree_control; u16 subtree_ss_mask; u16 old_subtree_control; u16 old_subtree_ss_mask; struct cgroup_subsys_state *subsys[13U]; struct cgroup_root *root; struct list_head cset_links; struct list_head e_csets[13U]; struct list_head pidlists; struct mutex pidlist_mutex; wait_queue_head_t offline_waitq; struct work_struct release_agent_work; int ancestor_ids[]; } ;
306 struct cgroup_root { struct kernfs_root *kf_root; unsigned int subsys_mask; int hierarchy_id; struct cgroup cgrp; int cgrp_ancestor_id_storage; atomic_t nr_cgrps; struct list_head root_list; unsigned int flags; struct idr cgroup_idr; char release_agent_path[4096U]; char name[64U]; } ;
345 struct cftype { char name[64U]; unsigned long private; size_t max_write_len; unsigned int flags; unsigned int file_offset; struct cgroup_subsys *ss; struct list_head node; struct kernfs_ops *kf_ops; u64 (*read_u64)(struct cgroup_subsys_state *, struct cftype *); s64 (*read_s64)(struct cgroup_subsys_state *, struct cftype *); int (*seq_show)(struct seq_file *, void *); void * (*seq_start)(struct seq_file *, loff_t *); void * (*seq_next)(struct seq_file *, void *, loff_t *); void (*seq_stop)(struct seq_file *, void *); int (*write_u64)(struct cgroup_subsys_state *, struct cftype *, u64 ); int (*write_s64)(struct cgroup_subsys_state *, struct cftype *, s64 ); ssize_t (*write)(struct kernfs_open_file *, char *, size_t , loff_t ); struct lock_class_key lockdep_key; } ;
430 struct cgroup_subsys { struct cgroup_subsys_state * (*css_alloc)(struct cgroup_subsys_state *); int (*css_online)(struct cgroup_subsys_state *); void (*css_offline)(struct cgroup_subsys_state *); void (*css_released)(struct cgroup_subsys_state *); void (*css_free)(struct cgroup_subsys_state *); void (*css_reset)(struct cgroup_subsys_state *); int (*can_attach)(struct cgroup_taskset *); void (*cancel_attach)(struct cgroup_taskset *); void (*attach)(struct cgroup_taskset *); void (*post_attach)(); int (*can_fork)(struct task_struct *); void (*cancel_fork)(struct task_struct *); void (*fork)(struct task_struct *); void (*exit)(struct task_struct *); void (*free)(struct task_struct *); void (*bind)(struct cgroup_subsys_state *); bool early_init; bool implicit_on_dfl; bool broken_hierarchy; bool warned_broken_hierarchy; int id; const char *name; const char *legacy_name; struct cgroup_root *root; struct idr css_idr; struct list_head cfts; struct cftype *dfl_cftypes; struct cftype *legacy_cftypes; unsigned int depends_on; } ;
128 struct futex_pi_state ;
129 struct robust_list_head ;
130 struct bio_list ;
131 struct fs_struct ;
132 struct perf_event_context ;
133 struct blk_plug ;
135 struct nameidata ;
188 struct cfs_rq ;
189 struct task_group ;
492 struct sighand_struct { atomic_t count; struct k_sigaction action[64U]; spinlock_t siglock; wait_queue_head_t signalfd_wqh; } ;
534 struct pacct_struct { int ac_flag; long ac_exitcode; unsigned long ac_mem; cputime_t ac_utime; cputime_t ac_stime; unsigned long ac_minflt; unsigned long ac_majflt; } ;
542 struct cpu_itimer { cputime_t expires; cputime_t incr; u32 error; u32 incr_error; } ;
549 struct prev_cputime { cputime_t utime; cputime_t stime; raw_spinlock_t lock; } ;
574 struct task_cputime { cputime_t utime; cputime_t stime; unsigned long long sum_exec_runtime; } ;
590 struct task_cputime_atomic { atomic64_t utime; atomic64_t stime; atomic64_t sum_exec_runtime; } ;
612 struct thread_group_cputimer { struct task_cputime_atomic cputime_atomic; bool running; bool checking_timer; } ;
657 struct autogroup ;
658 struct tty_struct ;
658 struct taskstats ;
658 struct tty_audit_buf ;
658 struct signal_struct { atomic_t sigcnt; atomic_t live; int nr_threads; atomic_t oom_victims; struct list_head thread_head; wait_queue_head_t wait_chldexit; struct task_struct *curr_target; struct sigpending shared_pending; int group_exit_code; int notify_count; struct task_struct *group_exit_task; int group_stop_count; unsigned int flags; unsigned char is_child_subreaper; unsigned char has_child_subreaper; int posix_timer_id; struct list_head posix_timers; struct hrtimer real_timer; struct pid *leader_pid; ktime_t it_real_incr; struct cpu_itimer it[2U]; struct thread_group_cputimer cputimer; struct task_cputime cputime_expires; struct list_head cpu_timers[3U]; struct pid *tty_old_pgrp; int leader; struct tty_struct *tty; struct autogroup *autogroup; seqlock_t stats_lock; cputime_t utime; cputime_t stime; cputime_t cutime; cputime_t cstime; cputime_t gtime; cputime_t cgtime; struct prev_cputime prev_cputime; unsigned long nvcsw; unsigned long nivcsw; unsigned long cnvcsw; unsigned long cnivcsw; unsigned long min_flt; unsigned long maj_flt; unsigned long cmin_flt; unsigned long cmaj_flt; unsigned long inblock; unsigned long oublock; unsigned long cinblock; unsigned long coublock; unsigned long maxrss; unsigned long cmaxrss; struct task_io_accounting ioac; unsigned long long sum_sched_runtime; struct rlimit rlim[16U]; struct pacct_struct pacct; struct taskstats *stats; unsigned int audit_tty; struct tty_audit_buf *tty_audit_buf; bool oom_flag_origin; short oom_score_adj; short oom_score_adj_min; struct mutex cred_guard_mutex; } ;
833 struct user_struct { atomic_t __count; atomic_t processes; atomic_t sigpending; atomic_t inotify_watches; atomic_t inotify_devs; atomic_t fanotify_listeners; atomic_long_t epoll_watches; unsigned long mq_bytes; unsigned long locked_shm; unsigned long unix_inflight; atomic_long_t pipe_bufs; struct key *uid_keyring; struct key *session_keyring; struct hlist_node uidhash_node; kuid_t uid; atomic_long_t locked_vm; } ;
878 struct backing_dev_info ;
879 struct reclaim_state ;
880 struct sched_info { unsigned long pcount; unsigned long long run_delay; unsigned long long last_arrival; unsigned long long last_queued; } ;
894 struct task_delay_info { spinlock_t lock; unsigned int flags; u64 blkio_start; u64 blkio_delay; u64 swapin_delay; u32 blkio_count; u32 swapin_count; u64 freepages_start; u64 freepages_delay; u32 freepages_count; } ;
951 struct wake_q_node { struct wake_q_node *next; } ;
1183 struct io_context ;
1217 struct pipe_inode_info ;
1219 struct load_weight { unsigned long weight; u32 inv_weight; } ;
1226 struct sched_avg { u64 last_update_time; u64 load_sum; u32 util_sum; u32 period_contrib; unsigned long load_avg; unsigned long util_avg; } ;
1284 struct sched_statistics { u64 wait_start; u64 wait_max; u64 wait_count; u64 wait_sum; u64 iowait_count; u64 iowait_sum; u64 sleep_start; u64 sleep_max; s64 sum_sleep_runtime; u64 block_start; u64 block_max; u64 exec_max; u64 slice_max; u64 nr_migrations_cold; u64 nr_failed_migrations_affine; u64 nr_failed_migrations_running; u64 nr_failed_migrations_hot; u64 nr_forced_migrations; u64 nr_wakeups; u64 nr_wakeups_sync; u64 nr_wakeups_migrate; u64 nr_wakeups_local; u64 nr_wakeups_remote; u64 nr_wakeups_affine; u64 nr_wakeups_affine_attempts; u64 nr_wakeups_passive; u64 nr_wakeups_idle; } ;
1319 struct sched_entity { struct load_weight load; struct rb_node run_node; struct list_head group_node; unsigned int on_rq; u64 exec_start; u64 sum_exec_runtime; u64 vruntime; u64 prev_sum_exec_runtime; u64 nr_migrations; struct sched_statistics statistics; int depth; struct sched_entity *parent; struct cfs_rq *cfs_rq; struct cfs_rq *my_q; struct sched_avg avg; } ;
1356 struct rt_rq ;
1356 struct sched_rt_entity { struct list_head run_list; unsigned long timeout; unsigned long watchdog_stamp; unsigned int time_slice; unsigned short on_rq; unsigned short on_list; struct sched_rt_entity *back; struct sched_rt_entity *parent; struct rt_rq *rt_rq; struct rt_rq *my_q; } ;
1374 struct sched_dl_entity { struct rb_node rb_node; u64 dl_runtime; u64 dl_deadline; u64 dl_period; u64 dl_bw; s64 runtime; u64 deadline; unsigned int flags; int dl_throttled; int dl_boosted; int dl_yielded; struct hrtimer dl_timer; } ;
1438 struct tlbflush_unmap_batch { struct cpumask cpumask; bool flush_required; bool writable; } ;
1457 struct sched_class ;
1457 struct files_struct ;
1457 struct compat_robust_list_head ;
1457 struct numa_group ;
1457 struct kcov ;
1457 struct task_struct { volatile long state; void *stack; atomic_t usage; unsigned int flags; unsigned int ptrace; struct llist_node wake_entry; int on_cpu; unsigned int wakee_flips; unsigned long wakee_flip_decay_ts; struct task_struct *last_wakee; int wake_cpu; int on_rq; int prio; int static_prio; int normal_prio; unsigned int rt_priority; const struct sched_class *sched_class; struct sched_entity se; struct sched_rt_entity rt; struct task_group *sched_task_group; struct sched_dl_entity dl; struct hlist_head preempt_notifiers; unsigned int policy; int nr_cpus_allowed; cpumask_t cpus_allowed; unsigned long rcu_tasks_nvcsw; bool rcu_tasks_holdout; struct list_head rcu_tasks_holdout_list; int rcu_tasks_idle_cpu; struct sched_info sched_info; struct list_head tasks; struct plist_node pushable_tasks; struct rb_node pushable_dl_tasks; struct mm_struct *mm; struct mm_struct *active_mm; u32 vmacache_seqnum; struct vm_area_struct *vmacache[4U]; struct task_rss_stat rss_stat; int exit_state; int exit_code; int exit_signal; int pdeath_signal; unsigned long jobctl; unsigned int personality; unsigned char sched_reset_on_fork; unsigned char sched_contributes_to_load; unsigned char sched_migrated; unsigned char sched_remote_wakeup; unsigned char; unsigned char in_execve; unsigned char in_iowait; unsigned char memcg_may_oom; unsigned char memcg_kmem_skip_account; unsigned char brk_randomized; unsigned long atomic_flags; struct restart_block restart_block; pid_t pid; pid_t tgid; struct task_struct *real_parent; struct task_struct *parent; struct list_head children; struct list_head sibling; struct task_struct *group_leader; struct list_head ptraced; struct list_head ptrace_entry; struct pid_link pids[3U]; struct list_head thread_group; struct list_head thread_node; struct completion *vfork_done; int *set_child_tid; int *clear_child_tid; cputime_t utime; cputime_t stime; cputime_t utimescaled; cputime_t stimescaled; cputime_t gtime; struct prev_cputime prev_cputime; unsigned long nvcsw; unsigned long nivcsw; u64 start_time; u64 real_start_time; unsigned long min_flt; unsigned long maj_flt; struct task_cputime cputime_expires; struct list_head cpu_timers[3U]; const struct cred *real_cred; const struct cred *cred; char comm[16U]; struct nameidata *nameidata; struct sysv_sem sysvsem; struct sysv_shm sysvshm; unsigned long last_switch_count; struct fs_struct *fs; struct files_struct *files; struct nsproxy *nsproxy; struct signal_struct *signal; struct sighand_struct *sighand; sigset_t blocked; sigset_t real_blocked; sigset_t saved_sigmask; struct sigpending pending; unsigned long sas_ss_sp; size_t sas_ss_size; unsigned int sas_ss_flags; struct callback_head *task_works; struct audit_context *audit_context; kuid_t loginuid; unsigned int sessionid; struct seccomp seccomp; u32 parent_exec_id; u32 self_exec_id; spinlock_t alloc_lock; raw_spinlock_t pi_lock; struct wake_q_node wake_q; struct rb_root pi_waiters; struct rb_node *pi_waiters_leftmost; struct rt_mutex_waiter *pi_blocked_on; struct mutex_waiter *blocked_on; unsigned int irq_events; unsigned long hardirq_enable_ip; unsigned long hardirq_disable_ip; unsigned int hardirq_enable_event; unsigned int hardirq_disable_event; int hardirqs_enabled; int hardirq_context; unsigned long softirq_disable_ip; unsigned long softirq_enable_ip; unsigned int softirq_disable_event; unsigned int softirq_enable_event; int softirqs_enabled; int softirq_context; u64 curr_chain_key; int lockdep_depth; unsigned int lockdep_recursion; struct held_lock held_locks[48U]; gfp_t lockdep_reclaim_gfp; unsigned int in_ubsan; void *journal_info; struct bio_list *bio_list; struct blk_plug *plug; struct reclaim_state *reclaim_state; struct backing_dev_info *backing_dev_info; struct io_context *io_context; unsigned long ptrace_message; siginfo_t *last_siginfo; struct task_io_accounting ioac; u64 acct_rss_mem1; u64 acct_vm_mem1; cputime_t acct_timexpd; nodemask_t mems_allowed; seqcount_t mems_allowed_seq; int cpuset_mem_spread_rotor; int cpuset_slab_spread_rotor; struct css_set *cgroups; struct list_head cg_list; struct robust_list_head *robust_list; struct compat_robust_list_head *compat_robust_list; struct list_head pi_state_list; struct futex_pi_state *pi_state_cache; struct perf_event_context *perf_event_ctxp[2U]; struct mutex perf_event_mutex; struct list_head perf_event_list; struct mempolicy *mempolicy; short il_next; short pref_node_fork; int numa_scan_seq; unsigned int numa_scan_period; unsigned int numa_scan_period_max; int numa_preferred_nid; unsigned long numa_migrate_retry; u64 node_stamp; u64 last_task_numa_placement; u64 last_sum_exec_runtime; struct callback_head numa_work; struct list_head numa_entry; struct numa_group *numa_group; unsigned long *numa_faults; unsigned long total_numa_faults; unsigned long numa_faults_locality[3U]; unsigned long numa_pages_migrated; struct tlbflush_unmap_batch tlb_ubc; struct callback_head rcu; struct pipe_inode_info *splice_pipe; struct page_frag task_frag; struct task_delay_info *delays; int make_it_fail; int nr_dirtied; int nr_dirtied_pause; unsigned long dirty_paused_when; int latency_record_count; struct latency_record latency_record[32U]; u64 timer_slack_ns; u64 default_timer_slack_ns; unsigned int kasan_depth; unsigned long trace; unsigned long trace_recursion; enum kcov_mode kcov_mode; unsigned int kcov_size; void *kcov_area; struct kcov *kcov; struct mem_cgroup *memcg_in_oom; gfp_t memcg_oom_gfp_mask; int memcg_oom_order; unsigned int memcg_nr_pages_over_high; struct uprobe_task *utask; unsigned int sequential_io; unsigned int sequential_io_avg; unsigned long task_state_change; int pagefault_disabled; struct task_struct *oom_reaper_list; struct thread_struct thread; } ;
26 struct device_type ;
28 struct class ;
52 struct klist_node ;
37 struct klist_node { void *n_klist; struct list_head n_node; struct kref n_ref; } ;
68 struct hlist_bl_node ;
68 struct hlist_bl_head { struct hlist_bl_node *first; } ;
36 struct hlist_bl_node { struct hlist_bl_node *next; struct hlist_bl_node **pprev; } ;
114 struct __anonstruct____missing_field_name_321 { spinlock_t lock; int count; } ;
114 union __anonunion____missing_field_name_320 { struct __anonstruct____missing_field_name_321 __annonCompField73; } ;
114 struct lockref { union __anonunion____missing_field_name_320 __annonCompField74; } ;
75 struct path ;
76 struct vfsmount ;
77 struct __anonstruct____missing_field_name_323 { u32 hash; u32 len; } ;
77 union __anonunion____missing_field_name_322 { struct __anonstruct____missing_field_name_323 __annonCompField75; u64 hash_len; } ;
77 struct qstr { union __anonunion____missing_field_name_322 __annonCompField76; const unsigned char *name; } ;
65 struct dentry_operations ;
65 union __anonunion____missing_field_name_324 { struct list_head d_lru; wait_queue_head_t *d_wait; } ;
65 union __anonunion_d_u_325 { struct hlist_node d_alias; struct hlist_bl_node d_in_lookup_hash; struct callback_head d_rcu; } ;
65 struct dentry { unsigned int d_flags; seqcount_t d_seq; struct hlist_bl_node d_hash; struct dentry *d_parent; struct qstr d_name; struct inode *d_inode; unsigned char d_iname[32U]; struct lockref d_lockref; const struct dentry_operations *d_op; struct super_block *d_sb; unsigned long d_time; void *d_fsdata; union __anonunion____missing_field_name_324 __annonCompField77; struct list_head d_child; struct list_head d_subdirs; union __anonunion_d_u_325 d_u; } ;
121 struct dentry_operations { int (*d_revalidate)(struct dentry *, unsigned int); int (*d_weak_revalidate)(struct dentry *, unsigned int); int (*d_hash)(const struct dentry *, struct qstr *); int (*d_compare)(const struct dentry *, const struct dentry *, unsigned int, const char *, const struct qstr *); int (*d_delete)(const struct dentry *); void (*d_release)(struct dentry *); void (*d_prune)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); char * (*d_dname)(struct dentry *, char *, int); struct vfsmount * (*d_automount)(struct path *); int (*d_manage)(struct dentry *, bool ); struct inode * (*d_select_inode)(struct dentry *, unsigned int); struct dentry * (*d_real)(struct dentry *, struct inode *); } ;
577 struct path { struct vfsmount *mnt; struct dentry *dentry; } ;
27 struct list_lru_one { struct list_head list; long nr_items; } ;
32 struct list_lru_memcg { struct list_lru_one *lru[0U]; } ;
37 struct list_lru_node { spinlock_t lock; struct list_lru_one lru; struct list_lru_memcg *memcg_lrus; } ;
47 struct list_lru { struct list_lru_node *node; struct list_head list; } ;
63 struct __anonstruct____missing_field_name_327 { struct radix_tree_node *parent; void *private_data; } ;
63 union __anonunion____missing_field_name_326 { struct __anonstruct____missing_field_name_327 __annonCompField78; struct callback_head callback_head; } ;
63 struct radix_tree_node { unsigned char shift; unsigned char offset; unsigned int count; union __anonunion____missing_field_name_326 __annonCompField79; struct list_head private_list; void *slots[64U]; unsigned long tags[3U][1U]; } ;
106 struct radix_tree_root { gfp_t gfp_mask; struct radix_tree_node *rnode; } ;
45 struct fiemap_extent { __u64 fe_logical; __u64 fe_physical; __u64 fe_length; __u64 fe_reserved64[2U]; __u32 fe_flags; __u32 fe_reserved[3U]; } ;
38 enum migrate_mode { MIGRATE_ASYNC = 0, MIGRATE_SYNC_LIGHT = 1, MIGRATE_SYNC = 2 } ;
44 struct bio_set ;
45 struct bio ;
46 struct bio_integrity_payload ;
47 struct block_device ;
17 typedef void bio_end_io_t(struct bio *);
19 struct bio_vec { struct page *bv_page; unsigned int bv_len; unsigned int bv_offset; } ;
28 struct bvec_iter { sector_t bi_sector; unsigned int bi_size; unsigned int bi_idx; unsigned int bi_bvec_done; } ;
40 union __anonunion____missing_field_name_332 { struct bio_integrity_payload *bi_integrity; } ;
40 struct bio { struct bio *bi_next; struct block_device *bi_bdev; unsigned int bi_flags; int bi_error; unsigned long bi_rw; struct bvec_iter bi_iter; unsigned int bi_phys_segments; unsigned int bi_seg_front_size; unsigned int bi_seg_back_size; atomic_t __bi_remaining; bio_end_io_t *bi_end_io; void *bi_private; struct io_context *bi_ioc; struct cgroup_subsys_state *bi_css; union __anonunion____missing_field_name_332 __annonCompField80; unsigned short bi_vcnt; unsigned short bi_max_vecs; atomic_t __bi_cnt; struct bio_vec *bi_io_vec; struct bio_set *bi_pool; struct bio_vec bi_inline_vecs[0U]; } ;
245 typedef unsigned int blk_qc_t;
268 struct delayed_call { void (*fn)(void *); void *arg; } ;
261 struct export_operations ;
262 struct hd_geometry ;
264 struct kiocb ;
265 struct poll_table_struct ;
266 struct kstatfs ;
267 struct swap_info_struct ;
268 struct iov_iter ;
269 struct fscrypt_info ;
270 struct fscrypt_operations ;
76 struct iattr { unsigned int ia_valid; umode_t ia_mode; kuid_t ia_uid; kgid_t ia_gid; loff_t ia_size; struct timespec ia_atime; struct timespec ia_mtime; struct timespec ia_ctime; struct file *ia_file; } ;
265 struct percpu_counter { raw_spinlock_t lock; s64 count; struct list_head list; s32 *counters; } ;
213 struct dquot ;
214 struct kqid ;
19 typedef __kernel_uid32_t projid_t;
23 struct __anonstruct_kprojid_t_333 { projid_t val; } ;
23 typedef struct __anonstruct_kprojid_t_333 kprojid_t;
181 enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ;
66 typedef long long qsize_t;
67 union __anonunion____missing_field_name_334 { kuid_t uid; kgid_t gid; kprojid_t projid; } ;
67 struct kqid { union __anonunion____missing_field_name_334 __annonCompField81; enum quota_type type; } ;
184 struct mem_dqblk { qsize_t dqb_bhardlimit; qsize_t dqb_bsoftlimit; qsize_t dqb_curspace; qsize_t dqb_rsvspace; qsize_t dqb_ihardlimit; qsize_t dqb_isoftlimit; qsize_t dqb_curinodes; time_t dqb_btime; time_t dqb_itime; } ;
206 struct quota_format_type ;
207 struct mem_dqinfo { struct quota_format_type *dqi_format; int dqi_fmt_id; struct list_head dqi_dirty_list; unsigned long dqi_flags; unsigned int dqi_bgrace; unsigned int dqi_igrace; qsize_t dqi_max_spc_limit; qsize_t dqi_max_ino_limit; void *dqi_priv; } ;
272 struct dquot { struct hlist_node dq_hash; struct list_head dq_inuse; struct list_head dq_free; struct list_head dq_dirty; struct mutex dq_lock; atomic_t dq_count; wait_queue_head_t dq_wait_unused; struct super_block *dq_sb; struct kqid dq_id; loff_t dq_off; unsigned long dq_flags; struct mem_dqblk dq_dqb; } ;
299 struct quota_format_ops { int (*check_quota_file)(struct super_block *, int); int (*read_file_info)(struct super_block *, int); int (*write_file_info)(struct super_block *, int); int (*free_file_info)(struct super_block *, int); int (*read_dqblk)(struct dquot *); int (*commit_dqblk)(struct dquot *); int (*release_dqblk)(struct dquot *); int (*get_next_id)(struct super_block *, struct kqid *); } ;
311 struct dquot_operations { int (*write_dquot)(struct dquot *); struct dquot * (*alloc_dquot)(struct super_block *, int); void (*destroy_dquot)(struct dquot *); int (*acquire_dquot)(struct dquot *); int (*release_dquot)(struct dquot *); int (*mark_dirty)(struct dquot *); int (*write_info)(struct super_block *, int); qsize_t * (*get_reserved_space)(struct inode *); int (*get_projid)(struct inode *, kprojid_t *); int (*get_next_id)(struct super_block *, struct kqid *); } ;
328 struct qc_dqblk { int d_fieldmask; u64 d_spc_hardlimit; u64 d_spc_softlimit; u64 d_ino_hardlimit; u64 d_ino_softlimit; u64 d_space; u64 d_ino_count; s64 d_ino_timer; s64 d_spc_timer; int d_ino_warns; int d_spc_warns; u64 d_rt_spc_hardlimit; u64 d_rt_spc_softlimit; u64 d_rt_space; s64 d_rt_spc_timer; int d_rt_spc_warns; } ;
351 struct qc_type_state { unsigned int flags; unsigned int spc_timelimit; unsigned int ino_timelimit; unsigned int rt_spc_timelimit; unsigned int spc_warnlimit; unsigned int ino_warnlimit; unsigned int rt_spc_warnlimit; unsigned long long ino; blkcnt_t blocks; blkcnt_t nextents; } ;
397 struct qc_state { unsigned int s_incoredqs; struct qc_type_state s_state[3U]; } ;
408 struct qc_info { int i_fieldmask; unsigned int i_flags; unsigned int i_spc_timelimit; unsigned int i_ino_timelimit; unsigned int i_rt_spc_timelimit; unsigned int i_spc_warnlimit; unsigned int i_ino_warnlimit; unsigned int i_rt_spc_warnlimit; } ;
421 struct quotactl_ops { int (*quota_on)(struct super_block *, int, int, struct path *); int (*quota_off)(struct super_block *, int); int (*quota_enable)(struct super_block *, unsigned int); int (*quota_disable)(struct super_block *, unsigned int); int (*quota_sync)(struct super_block *, int); int (*set_info)(struct super_block *, int, struct qc_info *); int (*get_dqblk)(struct super_block *, struct kqid , struct qc_dqblk *); int (*get_nextdqblk)(struct super_block *, struct kqid *, struct qc_dqblk *); int (*set_dqblk)(struct super_block *, struct kqid , struct qc_dqblk *); int (*get_state)(struct super_block *, struct qc_state *); int (*rm_xquota)(struct super_block *, unsigned int); } ;
437 struct quota_format_type { int qf_fmt_id; const struct quota_format_ops *qf_ops; struct module *qf_owner; struct quota_format_type *qf_next; } ;
501 struct quota_info { unsigned int flags; struct mutex dqio_mutex; struct mutex dqonoff_mutex; struct inode *files[3U]; struct mem_dqinfo info[3U]; const struct quota_format_ops *ops[3U]; } ;
531 struct kiocb { struct file *ki_filp; loff_t ki_pos; void (*ki_complete)(struct kiocb *, long, long); void *private; int ki_flags; } ;
371 struct address_space_operations { int (*writepage)(struct page *, struct writeback_control *); int (*readpage)(struct file *, struct page *); int (*writepages)(struct address_space *, struct writeback_control *); int (*set_page_dirty)(struct page *); int (*readpages)(struct file *, struct address_space *, struct list_head *, unsigned int); int (*write_begin)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page **, void **); int (*write_end)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page *, void *); sector_t (*bmap)(struct address_space *, sector_t ); void (*invalidatepage)(struct page *, unsigned int, unsigned int); int (*releasepage)(struct page *, gfp_t ); void (*freepage)(struct page *); ssize_t (*direct_IO)(struct kiocb *, struct iov_iter *); int (*migratepage)(struct address_space *, struct page *, struct page *, enum migrate_mode ); int (*launder_page)(struct page *); int (*is_partially_uptodate)(struct page *, unsigned long, unsigned long); void (*is_dirty_writeback)(struct page *, bool *, bool *); int (*error_remove_page)(struct address_space *, struct page *); int (*swap_activate)(struct swap_info_struct *, struct file *, sector_t *); void (*swap_deactivate)(struct file *); } ;
428 struct address_space { struct inode *host; struct radix_tree_root page_tree; spinlock_t tree_lock; atomic_t i_mmap_writable; struct rb_root i_mmap; struct rw_semaphore i_mmap_rwsem; unsigned long nrpages; unsigned long nrexceptional; unsigned long writeback_index; const struct address_space_operations *a_ops; unsigned long flags; spinlock_t private_lock; struct list_head private_list; void *private_data; } ;
449 struct request_queue ;
450 struct hd_struct ;
450 struct gendisk ;
450 struct block_device { dev_t bd_dev; int bd_openers; struct inode *bd_inode; struct super_block *bd_super; struct mutex bd_mutex; struct list_head bd_inodes; void *bd_claiming; void *bd_holder; int bd_holders; bool bd_write_holder; struct list_head bd_holder_disks; struct block_device *bd_contains; unsigned int bd_block_size; struct hd_struct *bd_part; unsigned int bd_part_count; int bd_invalidated; struct gendisk *bd_disk; struct request_queue *bd_queue; struct list_head bd_list; unsigned long bd_private; int bd_fsfreeze_count; struct mutex bd_fsfreeze_mutex; } ;
566 struct posix_acl ;
592 struct inode_operations ;
592 union __anonunion____missing_field_name_339 { const unsigned int i_nlink; unsigned int __i_nlink; } ;
592 union __anonunion____missing_field_name_340 { struct hlist_head i_dentry; struct callback_head i_rcu; } ;
592 struct file_lock_context ;
592 struct cdev ;
592 union __anonunion____missing_field_name_341 { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; char *i_link; unsigned int i_dir_seq; } ;
592 struct inode { umode_t i_mode; unsigned short i_opflags; kuid_t i_uid; kgid_t i_gid; unsigned int i_flags; struct posix_acl *i_acl; struct posix_acl *i_default_acl; const struct inode_operations *i_op; struct super_block *i_sb; struct address_space *i_mapping; void *i_security; unsigned long i_ino; union __anonunion____missing_field_name_339 __annonCompField82; dev_t i_rdev; loff_t i_size; struct timespec i_atime; struct timespec i_mtime; struct timespec i_ctime; spinlock_t i_lock; unsigned short i_bytes; unsigned int i_blkbits; blkcnt_t i_blocks; unsigned long i_state; struct rw_semaphore i_rwsem; unsigned long dirtied_when; unsigned long dirtied_time_when; struct hlist_node i_hash; struct list_head i_io_list; struct bdi_writeback *i_wb; int i_wb_frn_winner; u16 i_wb_frn_avg_time; u16 i_wb_frn_history; struct list_head i_lru; struct list_head i_sb_list; union __anonunion____missing_field_name_340 __annonCompField83; u64 i_version; atomic_t i_count; atomic_t i_dio_count; atomic_t i_writecount; atomic_t i_readcount; const struct file_operations *i_fop; struct file_lock_context *i_flctx; struct address_space i_data; struct list_head i_devices; union __anonunion____missing_field_name_341 __annonCompField84; __u32 i_generation; __u32 i_fsnotify_mask; struct hlist_head i_fsnotify_marks; struct fscrypt_info *i_crypt_info; void *i_private; } ;
870 struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; kuid_t uid; kuid_t euid; int signum; } ;
878 struct file_ra_state { unsigned long start; unsigned int size; unsigned int async_size; unsigned int ra_pages; unsigned int mmap_miss; loff_t prev_pos; } ;
901 union __anonunion_f_u_342 { struct llist_node fu_llist; struct callback_head fu_rcuhead; } ;
901 struct file { union __anonunion_f_u_342 f_u; struct path f_path; struct inode *f_inode; const struct file_operations *f_op; spinlock_t f_lock; atomic_long_t f_count; unsigned int f_flags; fmode_t f_mode; struct mutex f_pos_lock; loff_t f_pos; struct fown_struct f_owner; const struct cred *f_cred; struct file_ra_state f_ra; u64 f_version; void *f_security; void *private_data; struct list_head f_ep_links; struct list_head f_tfile_llink; struct address_space *f_mapping; } ;
986 typedef void *fl_owner_t;
987 struct file_lock ;
988 struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); } ;
994 struct lock_manager_operations { int (*lm_compare_owner)(struct file_lock *, struct file_lock *); unsigned long int (*lm_owner_key)(struct file_lock *); fl_owner_t (*lm_get_owner)(fl_owner_t ); void (*lm_put_owner)(fl_owner_t ); void (*lm_notify)(struct file_lock *); int (*lm_grant)(struct file_lock *, int); bool (*lm_break)(struct file_lock *); int (*lm_change)(struct file_lock *, int, struct list_head *); void (*lm_setup)(struct file_lock *, void **); } ;
1021 struct nlm_lockowner ;
1022 struct nfs_lock_info { u32 state; struct nlm_lockowner *owner; struct list_head list; } ;
14 struct nfs4_lock_state ;
15 struct nfs4_lock_info { struct nfs4_lock_state *owner; } ;
19 struct fasync_struct ;
19 struct __anonstruct_afs_344 { struct list_head link; int state; } ;
19 union __anonunion_fl_u_343 { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct __anonstruct_afs_344 afs; } ;
19 struct file_lock { struct file_lock *fl_next; struct list_head fl_list; struct hlist_node fl_link; struct list_head fl_block; fl_owner_t fl_owner; unsigned int fl_flags; unsigned char fl_type; unsigned int fl_pid; int fl_link_cpu; struct pid *fl_nspid; wait_queue_head_t fl_wait; struct file *fl_file; loff_t fl_start; loff_t fl_end; struct fasync_struct *fl_fasync; unsigned long fl_break_time; unsigned long fl_downgrade_time; const struct file_lock_operations *fl_ops; const struct lock_manager_operations *fl_lmops; union __anonunion_fl_u_343 fl_u; } ;
1074 struct file_lock_context { spinlock_t flc_lock; struct list_head flc_flock; struct list_head flc_posix; struct list_head flc_lease; } ;
1287 struct fasync_struct { spinlock_t fa_lock; int magic; int fa_fd; struct fasync_struct *fa_next; struct file *fa_file; struct callback_head fa_rcu; } ;
1322 struct sb_writers { int frozen; wait_queue_head_t wait_unfrozen; struct percpu_rw_semaphore rw_sem[3U]; } ;
1348 struct super_operations ;
1348 struct xattr_handler ;
1348 struct mtd_info ;
1348 struct super_block { struct list_head s_list; dev_t s_dev; unsigned char s_blocksize_bits; unsigned long s_blocksize; loff_t s_maxbytes; struct file_system_type *s_type; const struct super_operations *s_op; const struct dquot_operations *dq_op; const struct quotactl_ops *s_qcop; const struct export_operations *s_export_op; unsigned long s_flags; unsigned long s_iflags; unsigned long s_magic; struct dentry *s_root; struct rw_semaphore s_umount; int s_count; atomic_t s_active; void *s_security; const struct xattr_handler **s_xattr; const struct fscrypt_operations *s_cop; struct hlist_bl_head s_anon; struct list_head s_mounts; struct block_device *s_bdev; struct backing_dev_info *s_bdi; struct mtd_info *s_mtd; struct hlist_node s_instances; unsigned int s_quota_types; struct quota_info s_dquot; struct sb_writers s_writers; char s_id[32U]; u8 s_uuid[16U]; void *s_fs_info; unsigned int s_max_links; fmode_t s_mode; u32 s_time_gran; struct mutex s_vfs_rename_mutex; char *s_subtype; char *s_options; const struct dentry_operations *s_d_op; int cleancache_poolid; struct shrinker s_shrink; atomic_long_t s_remove_count; int s_readonly_remount; struct workqueue_struct *s_dio_done_wq; struct hlist_head s_pins; struct list_lru s_dentry_lru; struct list_lru s_inode_lru; struct callback_head rcu; struct work_struct destroy_work; struct mutex s_sync_lock; int s_stack_depth; spinlock_t s_inode_list_lock; struct list_head s_inodes; } ;
1594 struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; } ;
1608 struct dir_context ;
1633 struct dir_context { int (*actor)(struct dir_context *, const char *, int, loff_t , u64 , unsigned int); loff_t pos; } ;
1639 struct block_device_operations ;
1640 struct file_operations { struct module *owner; loff_t (*llseek)(struct file *, loff_t , int); ssize_t (*read)(struct file *, char *, size_t , loff_t *); ssize_t (*write)(struct file *, const char *, size_t , loff_t *); ssize_t (*read_iter)(struct kiocb *, struct iov_iter *); ssize_t (*write_iter)(struct kiocb *, struct iov_iter *); int (*iterate)(struct file *, struct dir_context *); int (*iterate_shared)(struct file *, struct dir_context *); unsigned int (*poll)(struct file *, struct poll_table_struct *); long int (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); long int (*compat_ioctl)(struct file *, unsigned int, unsigned long); int (*mmap)(struct file *, struct vm_area_struct *); int (*open)(struct inode *, struct file *); int (*flush)(struct file *, fl_owner_t ); int (*release)(struct inode *, struct file *); int (*fsync)(struct file *, loff_t , loff_t , int); int (*aio_fsync)(struct kiocb *, int); int (*fasync)(int, struct file *, int); int (*lock)(struct file *, int, struct file_lock *); ssize_t (*sendpage)(struct file *, struct page *, int, size_t , loff_t *, int); unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); int (*check_flags)(int); int (*flock)(struct file *, int, struct file_lock *); ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t , unsigned int); ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t , unsigned int); int (*setlease)(struct file *, long, struct file_lock **, void **); long int (*fallocate)(struct file *, int, loff_t , loff_t ); void (*show_fdinfo)(struct seq_file *, struct file *); ssize_t (*copy_file_range)(struct file *, loff_t , struct file *, loff_t , size_t , unsigned int); int (*clone_file_range)(struct file *, loff_t , struct file *, loff_t , u64 ); ssize_t (*dedupe_file_range)(struct file *, u64 , u64 , struct file *, u64 ); } ;
1709 struct inode_operations { struct dentry * (*lookup)(struct inode *, struct dentry *, unsigned int); const char * (*get_link)(struct dentry *, struct inode *, struct delayed_call *); int (*permission)(struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); int (*readlink)(struct dentry *, char *, int); int (*create)(struct inode *, struct dentry *, umode_t , bool ); int (*link)(struct dentry *, struct inode *, struct dentry *); int (*unlink)(struct inode *, struct dentry *); int (*symlink)(struct inode *, struct dentry *, const char *); int (*mkdir)(struct inode *, struct dentry *, umode_t ); int (*rmdir)(struct inode *, struct dentry *); int (*mknod)(struct inode *, struct dentry *, umode_t , dev_t ); int (*rename)(struct inode *, struct dentry *, struct inode *, struct dentry *); int (*rename2)(struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); int (*setattr)(struct dentry *, struct iattr *); int (*getattr)(struct vfsmount *, struct dentry *, struct kstat *); int (*setxattr)(struct dentry *, struct inode *, const char *, const void *, size_t , int); ssize_t (*getxattr)(struct dentry *, struct inode *, const char *, void *, size_t ); ssize_t (*listxattr)(struct dentry *, char *, size_t ); int (*removexattr)(struct dentry *, const char *); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 , u64 ); int (*update_time)(struct inode *, struct timespec *, int); int (*atomic_open)(struct inode *, struct dentry *, struct file *, unsigned int, umode_t , int *); int (*tmpfile)(struct inode *, struct dentry *, umode_t ); int (*set_acl)(struct inode *, struct posix_acl *, int); } ;
1766 struct super_operations { struct inode * (*alloc_inode)(struct super_block *); void (*destroy_inode)(struct inode *); void (*dirty_inode)(struct inode *, int); int (*write_inode)(struct inode *, struct writeback_control *); int (*drop_inode)(struct inode *); void (*evict_inode)(struct inode *); void (*put_super)(struct super_block *); int (*sync_fs)(struct super_block *, int); int (*freeze_super)(struct super_block *); int (*freeze_fs)(struct super_block *); int (*thaw_super)(struct super_block *); int (*unfreeze_fs)(struct super_block *); int (*statfs)(struct dentry *, struct kstatfs *); int (*remount_fs)(struct super_block *, int *, char *); void (*umount_begin)(struct super_block *); int (*show_options)(struct seq_file *, struct dentry *); int (*show_devname)(struct seq_file *, struct dentry *); int (*show_path)(struct seq_file *, struct dentry *); int (*show_stats)(struct seq_file *, struct dentry *); ssize_t (*quota_read)(struct super_block *, int, char *, size_t , loff_t ); ssize_t (*quota_write)(struct super_block *, int, const char *, size_t , loff_t ); struct dquot ** (*get_dquots)(struct inode *); int (*bdev_try_to_free_page)(struct super_block *, struct page *, gfp_t ); long int (*nr_cached_objects)(struct super_block *, struct shrink_control *); long int (*free_cached_objects)(struct super_block *, struct shrink_control *); } ;
2005 struct file_system_type { const char *name; int fs_flags; struct dentry * (*mount)(struct file_system_type *, int, const char *, void *); void (*kill_sb)(struct super_block *); struct module *owner; struct file_system_type *next; struct hlist_head fs_supers; struct lock_class_key s_lock_key; struct lock_class_key s_umount_key; struct lock_class_key s_vfs_rename_key; struct lock_class_key s_writers_key[3U]; struct lock_class_key i_lock_key; struct lock_class_key i_mutex_key; struct lock_class_key i_mutex_dir_key; } ;
3176 struct seq_file { char *buf; size_t size; size_t from; size_t count; size_t pad_until; loff_t index; loff_t read_pos; u64 version; struct mutex lock; const struct seq_operations *op; int poll_event; const struct file *file; void *private; } ;
30 struct seq_operations { void * (*start)(struct seq_file *, loff_t *); void (*stop)(struct seq_file *, void *); void * (*next)(struct seq_file *, void *, loff_t *); int (*show)(struct seq_file *, void *); } ;
222 struct pinctrl ;
223 struct pinctrl_state ;
194 struct dev_pin_info { struct pinctrl *p; struct pinctrl_state *default_state; struct pinctrl_state *init_state; struct pinctrl_state *sleep_state; struct pinctrl_state *idle_state; } ;
48 struct dma_map_ops ;
48 struct dev_archdata { struct dma_map_ops *dma_ops; void *iommu; } ;
24 struct device_private ;
25 struct device_driver ;
26 struct driver_private ;
27 struct subsys_private ;
28 struct bus_type ;
29 struct device_node ;
30 struct fwnode_handle ;
31 struct iommu_ops ;
32 struct iommu_group ;
61 struct device_attribute ;
61 struct bus_type { const char *name; const char *dev_name; struct device *dev_root; struct device_attribute *dev_attrs; const struct attribute_group **bus_groups; const struct attribute_group **dev_groups; const struct attribute_group **drv_groups; int (*match)(struct device *, struct device_driver *); int (*uevent)(struct device *, struct kobj_uevent_env *); int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*online)(struct device *); int (*offline)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct dev_pm_ops *pm; const struct iommu_ops *iommu_ops; struct subsys_private *p; struct lock_class_key lock_key; } ;
201 enum probe_type { PROBE_DEFAULT_STRATEGY = 0, PROBE_PREFER_ASYNCHRONOUS = 1, PROBE_FORCE_SYNCHRONOUS = 2 } ;
207 struct of_device_id ;
207 struct acpi_device_id ;
207 struct device_driver { const char *name; struct bus_type *bus; struct module *owner; const char *mod_name; bool suppress_bind_attrs; enum probe_type probe_type; const struct of_device_id *of_match_table; const struct acpi_device_id *acpi_match_table; int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct attribute_group **groups; const struct dev_pm_ops *pm; struct driver_private *p; } ;
357 struct class_attribute ;
357 struct class { const char *name; struct module *owner; struct class_attribute *class_attrs; const struct attribute_group **dev_groups; struct kobject *dev_kobj; int (*dev_uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *); void (*class_release)(struct class *); void (*dev_release)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct kobj_ns_type_operations *ns_type; const void * (*namespace)(struct device *); const struct dev_pm_ops *pm; struct subsys_private *p; } ;
450 struct class_attribute { struct attribute attr; ssize_t (*show)(struct class *, struct class_attribute *, char *); ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t ); } ;
525 struct device_type { const char *name; const struct attribute_group **groups; int (*uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *, kuid_t *, kgid_t *); void (*release)(struct device *); const struct dev_pm_ops *pm; } ;
546 struct device_attribute { struct attribute attr; ssize_t (*show)(struct device *, struct device_attribute *, char *); ssize_t (*store)(struct device *, struct device_attribute *, const char *, size_t ); } ;
699 struct device_dma_parameters { unsigned int max_segment_size; unsigned long segment_boundary_mask; } ;
708 struct dma_coherent_mem ;
708 struct cma ;
708 struct device { struct device *parent; struct device_private *p; struct kobject kobj; const char *init_name; const struct device_type *type; struct mutex mutex; struct bus_type *bus; struct device_driver *driver; void *platform_data; void *driver_data; struct dev_pm_info power; struct dev_pm_domain *pm_domain; struct irq_domain *msi_domain; struct dev_pin_info *pins; struct list_head msi_list; int numa_node; u64 *dma_mask; u64 coherent_dma_mask; unsigned long dma_pfn_offset; struct device_dma_parameters *dma_parms; struct list_head dma_pools; struct dma_coherent_mem *dma_mem; struct cma *cma_area; struct dev_archdata archdata; struct device_node *of_node; struct fwnode_handle *fwnode; dev_t devt; u32 id; spinlock_t devres_lock; struct list_head devres_head; struct klist_node knode_class; struct class *class; const struct attribute_group **groups; void (*release)(struct device *); struct iommu_group *iommu_group; bool offline_disabled; bool offline; } ;
862 struct wakeup_source { const char *name; struct list_head entry; spinlock_t lock; struct wake_irq *wakeirq; struct timer_list timer; unsigned long timer_expires; ktime_t total_time; ktime_t max_time; ktime_t last_time; ktime_t start_prevent_time; ktime_t prevent_sleep_time; unsigned long event_count; unsigned long active_count; unsigned long relax_count; unsigned long expire_count; unsigned long wakeup_count; bool active; bool autosleep_enabled; } ;
82 struct disk_stats { unsigned long sectors[2U]; unsigned long ios[2U]; unsigned long merges[2U]; unsigned long ticks[2U]; unsigned long io_ticks; unsigned long time_in_queue; } ;
91 struct partition_meta_info { char uuid[37U]; u8 volname[64U]; } ;
103 struct hd_struct { sector_t start_sect; sector_t nr_sects; seqcount_t nr_sects_seq; sector_t alignment_offset; unsigned int discard_alignment; struct device __dev; struct kobject *holder_dir; int policy; int partno; struct partition_meta_info *info; int make_it_fail; unsigned long stamp; atomic_t in_flight[2U]; struct disk_stats *dkstats; struct percpu_ref ref; struct callback_head callback_head; } ;
157 struct disk_part_tbl { struct callback_head callback_head; int len; struct hd_struct *last_lookup; struct hd_struct *part[]; } ;
164 struct disk_events ;
165 struct badblocks ;
166 struct blk_integrity_profile ;
166 struct blk_integrity { struct blk_integrity_profile *profile; unsigned char flags; unsigned char tuple_size; unsigned char interval_exp; unsigned char tag_size; } ;
177 struct timer_rand_state ;
177 struct gendisk { int major; int first_minor; int minors; char disk_name[32U]; char * (*devnode)(struct gendisk *, umode_t *); unsigned int events; unsigned int async_events; struct disk_part_tbl *part_tbl; struct hd_struct part0; const struct block_device_operations *fops; struct request_queue *queue; void *private_data; int flags; struct device *driverfs_dev; struct kobject *slave_dir; struct timer_rand_state *random; atomic_t sync_io; struct disk_events *ev; struct kobject integrity_kobj; int node_id; struct badblocks *bb; } ;
13 typedef unsigned long kernel_ulong_t;
14 struct pci_device_id { __u32 vendor; __u32 device; __u32 subvendor; __u32 subdevice; __u32 class; __u32 class_mask; kernel_ulong_t driver_data; } ;
186 struct acpi_device_id { __u8 id[9U]; kernel_ulong_t driver_data; __u32 cls; __u32 cls_msk; } ;
229 struct of_device_id { char name[32U]; char type[32U]; char compatible[128U]; const void *data; } ;
70 struct hotplug_slot ;
70 struct pci_slot { struct pci_bus *bus; struct list_head list; struct hotplug_slot *hotplug; unsigned char number; struct kobject kobj; } ;
104 typedef int pci_power_t;
131 typedef unsigned int pci_channel_state_t;
132 enum pci_channel_state { pci_channel_io_normal = 1, pci_channel_io_frozen = 2, pci_channel_io_perm_failure = 3 } ;
157 typedef unsigned short pci_dev_flags_t;
184 typedef unsigned short pci_bus_flags_t;
241 struct pcie_link_state ;
242 struct pci_vpd ;
243 struct pci_sriov ;
245 struct pci_driver ;
245 union __anonunion____missing_field_name_346 { struct pci_sriov *sriov; struct pci_dev *physfn; } ;
245 struct pci_dev { struct list_head bus_list; struct pci_bus *bus; struct pci_bus *subordinate; void *sysdata; struct proc_dir_entry *procent; struct pci_slot *slot; unsigned int devfn; unsigned short vendor; unsigned short device; unsigned short subsystem_vendor; unsigned short subsystem_device; unsigned int class; u8 revision; u8 hdr_type; u8 pcie_cap; u8 msi_cap; u8 msix_cap; unsigned char pcie_mpss; u8 rom_base_reg; u8 pin; u16 pcie_flags_reg; unsigned long *dma_alias_mask; struct pci_driver *driver; u64 dma_mask; struct device_dma_parameters dma_parms; pci_power_t current_state; u8 pm_cap; unsigned char pme_support; unsigned char pme_interrupt; unsigned char pme_poll; unsigned char d1_support; unsigned char d2_support; unsigned char no_d1d2; unsigned char no_d3cold; unsigned char d3cold_allowed; unsigned char mmio_always_on; unsigned char wakeup_prepared; unsigned char runtime_d3cold; unsigned char ignore_hotplug; unsigned int d3_delay; unsigned int d3cold_delay; struct pcie_link_state *link_state; pci_channel_state_t error_state; struct device dev; int cfg_size; unsigned int irq; struct resource resource[17U]; bool match_driver; unsigned char transparent; unsigned char multifunction; unsigned char is_added; unsigned char is_busmaster; unsigned char no_msi; unsigned char no_64bit_msi; unsigned char block_cfg_access; unsigned char broken_parity_status; unsigned char irq_reroute_variant; unsigned char msi_enabled; unsigned char msix_enabled; unsigned char ari_enabled; unsigned char ats_enabled; unsigned char is_managed; unsigned char needs_freset; unsigned char state_saved; unsigned char is_physfn; unsigned char is_virtfn; unsigned char reset_fn; unsigned char is_hotplug_bridge; unsigned char __aer_firmware_first_valid; unsigned char __aer_firmware_first; unsigned char broken_intx_masking; unsigned char io_window_1k; unsigned char irq_managed; unsigned char has_secondary_link; unsigned char non_compliant_bars; pci_dev_flags_t dev_flags; atomic_t enable_cnt; u32 saved_config_space[16U]; struct hlist_head saved_cap_space; struct bin_attribute *rom_attr; int rom_attr_enabled; struct bin_attribute *res_attr[17U]; struct bin_attribute *res_attr_wc[17U]; const struct attribute_group **msi_irq_groups; struct pci_vpd *vpd; union __anonunion____missing_field_name_346 __annonCompField85; u16 ats_cap; u8 ats_stu; atomic_t ats_ref_cnt; phys_addr_t rom; size_t romlen; char *driver_override; } ;
446 struct pci_ops ;
446 struct msi_controller ;
446 struct pci_bus { struct list_head node; struct pci_bus *parent; struct list_head children; struct list_head devices; struct pci_dev *self; struct list_head slots; struct resource *resource[4U]; struct list_head resources; struct resource busn_res; struct pci_ops *ops; struct msi_controller *msi; void *sysdata; struct proc_dir_entry *procdir; unsigned char number; unsigned char primary; unsigned char max_bus_speed; unsigned char cur_bus_speed; char name[48U]; unsigned short bridge_ctl; pci_bus_flags_t bus_flags; struct device *bridge; struct device dev; struct bin_attribute *legacy_io; struct bin_attribute *legacy_mem; unsigned char is_added; } ;
570 struct pci_ops { int (*add_bus)(struct pci_bus *); void (*remove_bus)(struct pci_bus *); void * (*map_bus)(struct pci_bus *, unsigned int, int); int (*read)(struct pci_bus *, unsigned int, int, int, u32 *); int (*write)(struct pci_bus *, unsigned int, int, int, u32 ); } ;
600 struct pci_dynids { spinlock_t lock; struct list_head list; } ;
614 typedef unsigned int pci_ers_result_t;
624 struct pci_error_handlers { pci_ers_result_t (*error_detected)(struct pci_dev *, enum pci_channel_state ); pci_ers_result_t (*mmio_enabled)(struct pci_dev *); pci_ers_result_t (*link_reset)(struct pci_dev *); pci_ers_result_t (*slot_reset)(struct pci_dev *); void (*reset_notify)(struct pci_dev *, bool ); void (*resume)(struct pci_dev *); } ;
657 struct pci_driver { struct list_head node; const char *name; const struct pci_device_id *id_table; int (*probe)(struct pci_dev *, const struct pci_device_id *); void (*remove)(struct pci_dev *); int (*suspend)(struct pci_dev *, pm_message_t ); int (*suspend_late)(struct pci_dev *, pm_message_t ); int (*resume_early)(struct pci_dev *); int (*resume)(struct pci_dev *); void (*shutdown)(struct pci_dev *); int (*sriov_configure)(struct pci_dev *, int); const struct pci_error_handlers *err_handler; struct device_driver driver; struct pci_dynids dynids; } ;
1238 struct scatterlist { unsigned long sg_magic; unsigned long page_link; unsigned int offset; unsigned int length; dma_addr_t dma_address; unsigned int dma_length; } ;
21 struct sg_table { struct scatterlist *sgl; unsigned int nents; unsigned int orig_nents; } ;
2040 struct dma_attrs { unsigned long flags[1U]; } ;
89 enum dma_data_direction { DMA_BIDIRECTIONAL = 0, DMA_TO_DEVICE = 1, DMA_FROM_DEVICE = 2, DMA_NONE = 3 } ;
158 struct dma_map_ops { void * (*alloc)(struct device *, size_t , dma_addr_t *, gfp_t , struct dma_attrs *); void (*free)(struct device *, size_t , void *, dma_addr_t , struct dma_attrs *); int (*mmap)(struct device *, struct vm_area_struct *, void *, dma_addr_t , size_t , struct dma_attrs *); int (*get_sgtable)(struct device *, struct sg_table *, void *, dma_addr_t , size_t , struct dma_attrs *); dma_addr_t (*map_page)(struct device *, struct page *, unsigned long, size_t , enum dma_data_direction , struct dma_attrs *); void (*unmap_page)(struct device *, dma_addr_t , size_t , enum dma_data_direction , struct dma_attrs *); int (*map_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , struct dma_attrs *); void (*unmap_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , struct dma_attrs *); void (*sync_single_for_cpu)(struct device *, dma_addr_t , size_t , enum dma_data_direction ); void (*sync_single_for_device)(struct device *, dma_addr_t , size_t , enum dma_data_direction ); void (*sync_sg_for_cpu)(struct device *, struct scatterlist *, int, enum dma_data_direction ); void (*sync_sg_for_device)(struct device *, struct scatterlist *, int, enum dma_data_direction ); int (*mapping_error)(struct device *, dma_addr_t ); int (*dma_supported)(struct device *, u64 ); int (*set_dma_mask)(struct device *, u64 ); int is_phys; } ;
72 struct fprop_local_percpu { struct percpu_counter events; unsigned int period; raw_spinlock_t lock; } ;
32 typedef int congested_fn(void *, int);
41 struct bdi_writeback_congested { unsigned long state; atomic_t refcnt; struct backing_dev_info *bdi; int blkcg_id; struct rb_node rb_node; } ;
60 union __anonunion____missing_field_name_347 { struct work_struct release_work; struct callback_head rcu; } ;
60 struct bdi_writeback { struct backing_dev_info *bdi; unsigned long state; unsigned long last_old_flush; struct list_head b_dirty; struct list_head b_io; struct list_head b_more_io; struct list_head b_dirty_time; spinlock_t list_lock; struct percpu_counter stat[4U]; struct bdi_writeback_congested *congested; unsigned long bw_time_stamp; unsigned long dirtied_stamp; unsigned long written_stamp; unsigned long write_bandwidth; unsigned long avg_write_bandwidth; unsigned long dirty_ratelimit; unsigned long balanced_dirty_ratelimit; struct fprop_local_percpu completions; int dirty_exceeded; spinlock_t work_lock; struct list_head work_list; struct delayed_work dwork; struct list_head bdi_node; struct percpu_ref refcnt; struct fprop_local_percpu memcg_completions; struct cgroup_subsys_state *memcg_css; struct cgroup_subsys_state *blkcg_css; struct list_head memcg_node; struct list_head blkcg_node; union __anonunion____missing_field_name_347 __annonCompField86; } ;
134 struct backing_dev_info { struct list_head bdi_list; unsigned long ra_pages; unsigned int capabilities; congested_fn *congested_fn; void *congested_data; char *name; unsigned int min_ratio; unsigned int max_ratio; unsigned int max_prop_frac; atomic_long_t tot_write_bandwidth; struct bdi_writeback wb; struct list_head wb_list; struct radix_tree_root cgwb_tree; struct rb_root cgwb_congested_tree; atomic_t usage_cnt; wait_queue_head_t wb_waitq; struct device *dev; struct timer_list laptop_mode_wb_timer; struct dentry *debug_dir; struct dentry *debug_stats; } ;
12 typedef void * mempool_alloc_t(gfp_t , void *);
13 typedef void mempool_free_t(void *, void *);
14 struct mempool_s { spinlock_t lock; int min_nr; int curr_nr; void **elements; void *pool_data; mempool_alloc_t *alloc; mempool_free_t *free; wait_queue_head_t wait; } ;
25 typedef struct mempool_s mempool_t;
79 union __anonunion____missing_field_name_348 { struct list_head q_node; struct kmem_cache *__rcu_icq_cache; } ;
79 union __anonunion____missing_field_name_349 { struct hlist_node ioc_node; struct callback_head __rcu_head; } ;
79 struct io_cq { struct request_queue *q; struct io_context *ioc; union __anonunion____missing_field_name_348 __annonCompField87; union __anonunion____missing_field_name_349 __annonCompField88; unsigned int flags; } ;
92 struct io_context { atomic_long_t refcount; atomic_t active_ref; atomic_t nr_tasks; spinlock_t lock; unsigned short ioprio; int nr_batch_requests; unsigned long last_waited; struct radix_tree_root icq_tree; struct io_cq *icq_hint; struct hlist_head icq_list; struct work_struct release_work; } ;
352 struct bio_integrity_payload { struct bio *bip_bio; struct bvec_iter bip_iter; bio_end_io_t *bip_end_io; unsigned short bip_slab; unsigned short bip_vcnt; unsigned short bip_max_vcnt; unsigned short bip_flags; struct work_struct bip_work; struct bio_vec *bip_vec; struct bio_vec bip_inline_vecs[0U]; } ;
583 struct bio_list { struct bio *head; struct bio *tail; } ;
715 struct bio_set { struct kmem_cache *bio_slab; unsigned int front_pad; mempool_t *bio_pool; mempool_t *bvec_pool; mempool_t *bio_integrity_pool; mempool_t *bvec_integrity_pool; spinlock_t rescue_lock; struct bio_list rescue_list; struct work_struct rescue_work; struct workqueue_struct *rescue_workqueue; } ;
64 struct bsg_class_device { struct device *class_dev; struct device *parent; int minor; struct request_queue *queue; struct kref ref; void (*release)(struct device *); } ;
22 struct elevator_queue ;
24 struct request ;
26 struct bsg_job ;
27 struct blkcg_gq ;
28 struct blk_flush_queue ;
29 struct pr_ops ;
51 typedef void rq_end_io_fn(struct request *, int);
52 struct request_list { struct request_queue *q; struct blkcg_gq *blkg; int count[2U]; int starved[2U]; mempool_t *rq_pool; wait_queue_head_t wait[2U]; unsigned int flags; } ;
77 union __anonunion____missing_field_name_350 { struct call_single_data csd; unsigned long fifo_time; } ;
77 struct blk_mq_ctx ;
77 union __anonunion____missing_field_name_351 { struct hlist_node hash; struct list_head ipi_list; } ;
77 union __anonunion____missing_field_name_352 { struct rb_node rb_node; void *completion_data; } ;
77 struct __anonstruct_elv_354 { struct io_cq *icq; void *priv[2U]; } ;
77 struct __anonstruct_flush_355 { unsigned int seq; struct list_head list; rq_end_io_fn *saved_end_io; } ;
77 union __anonunion____missing_field_name_353 { struct __anonstruct_elv_354 elv; struct __anonstruct_flush_355 flush; } ;
77 struct request { struct list_head queuelist; union __anonunion____missing_field_name_350 __annonCompField89; struct request_queue *q; struct blk_mq_ctx *mq_ctx; u64 cmd_flags; unsigned int cmd_type; unsigned long atomic_flags; int cpu; unsigned int __data_len; sector_t __sector; struct bio *bio; struct bio *biotail; union __anonunion____missing_field_name_351 __annonCompField90; union __anonunion____missing_field_name_352 __annonCompField91; union __anonunion____missing_field_name_353 __annonCompField92; struct gendisk *rq_disk; struct hd_struct *part; unsigned long start_time; struct request_list *rl; unsigned long long start_time_ns; unsigned long long io_start_time_ns; unsigned short nr_phys_segments; unsigned short nr_integrity_segments; unsigned short ioprio; void *special; int tag; int errors; unsigned char __cmd[16U]; unsigned char *cmd; unsigned short cmd_len; unsigned int extra_len; unsigned int sense_len; unsigned int resid_len; void *sense; unsigned long deadline; struct list_head timeout_list; unsigned int timeout; int retries; rq_end_io_fn *end_io; void *end_io_data; struct request *next_rq; } ;
117 struct elevator_type ;
12 typedef int elevator_merge_fn(struct request_queue *, struct request **, struct bio *);
15 typedef void elevator_merge_req_fn(struct request_queue *, struct request *, struct request *);
17 typedef void elevator_merged_fn(struct request_queue *, struct request *, int);
19 typedef int elevator_allow_merge_fn(struct request_queue *, struct request *, struct bio *);
21 typedef void elevator_bio_merged_fn(struct request_queue *, struct request *, struct bio *);
24 typedef int elevator_dispatch_fn(struct request_queue *, int);
26 typedef void elevator_add_req_fn(struct request_queue *, struct request *);
27 typedef struct request * elevator_request_list_fn(struct request_queue *, struct request *);
28 typedef void elevator_completed_req_fn(struct request_queue *, struct request *);
29 typedef int elevator_may_queue_fn(struct request_queue *, int);
31 typedef void elevator_init_icq_fn(struct io_cq *);
32 typedef void elevator_exit_icq_fn(struct io_cq *);
33 typedef int elevator_set_req_fn(struct request_queue *, struct request *, struct bio *, gfp_t );
35 typedef void elevator_put_req_fn(struct request *);
36 typedef void elevator_activate_req_fn(struct request_queue *, struct request *);
37 typedef void elevator_deactivate_req_fn(struct request_queue *, struct request *);
39 typedef int elevator_init_fn(struct request_queue *, struct elevator_type *);
41 typedef void elevator_exit_fn(struct elevator_queue *);
42 typedef void elevator_registered_fn(struct request_queue *);
43 struct elevator_ops { elevator_merge_fn *elevator_merge_fn; elevator_merged_fn *elevator_merged_fn; elevator_merge_req_fn *elevator_merge_req_fn; elevator_allow_merge_fn *elevator_allow_merge_fn; elevator_bio_merged_fn *elevator_bio_merged_fn; elevator_dispatch_fn *elevator_dispatch_fn; elevator_add_req_fn *elevator_add_req_fn; elevator_activate_req_fn *elevator_activate_req_fn; elevator_deactivate_req_fn *elevator_deactivate_req_fn; elevator_completed_req_fn *elevator_completed_req_fn; elevator_request_list_fn *elevator_former_req_fn; elevator_request_list_fn *elevator_latter_req_fn; elevator_init_icq_fn *elevator_init_icq_fn; elevator_exit_icq_fn *elevator_exit_icq_fn; elevator_set_req_fn *elevator_set_req_fn; elevator_put_req_fn *elevator_put_req_fn; elevator_may_queue_fn *elevator_may_queue_fn; elevator_init_fn *elevator_init_fn; elevator_exit_fn *elevator_exit_fn; elevator_registered_fn *elevator_registered_fn; } ;
74 struct elv_fs_entry { struct attribute attr; ssize_t (*show)(struct elevator_queue *, char *); ssize_t (*store)(struct elevator_queue *, const char *, size_t ); } ;
82 struct elevator_type { struct kmem_cache *icq_cache; struct elevator_ops ops; size_t icq_size; size_t icq_align; struct elv_fs_entry *elevator_attrs; char elevator_name[16U]; struct module *elevator_owner; char icq_cache_name[21U]; struct list_head list; } ;
103 struct elevator_queue { struct elevator_type *type; void *elevator_data; struct kobject kobj; struct mutex sysfs_lock; unsigned char registered; struct hlist_head hash[64U]; } ;
212 typedef void request_fn_proc(struct request_queue *);
213 typedef blk_qc_t make_request_fn(struct request_queue *, struct bio *);
214 typedef int prep_rq_fn(struct request_queue *, struct request *);
215 typedef void unprep_rq_fn(struct request_queue *, struct request *);
218 typedef void softirq_done_fn(struct request *);
219 typedef int dma_drain_needed_fn(struct request *);
220 typedef int lld_busy_fn(struct request_queue *);
221 typedef int bsg_job_fn(struct bsg_job *);
222 enum blk_eh_timer_return { BLK_EH_NOT_HANDLED = 0, BLK_EH_HANDLED = 1, BLK_EH_RESET_TIMER = 2 } ;
229 typedef enum blk_eh_timer_return rq_timed_out_fn(struct request *);
235 struct blk_queue_tag { struct request **tag_index; unsigned long *tag_map; int busy; int max_depth; int real_max_depth; atomic_t refcnt; int alloc_policy; int next_tag; } ;
246 struct queue_limits { unsigned long bounce_pfn; unsigned long seg_boundary_mask; unsigned long virt_boundary_mask; unsigned int max_hw_sectors; unsigned int max_dev_sectors; unsigned int chunk_sectors; unsigned int max_sectors; unsigned int max_segment_size; unsigned int physical_block_size; unsigned int alignment_offset; unsigned int io_min; unsigned int io_opt; unsigned int max_discard_sectors; unsigned int max_hw_discard_sectors; unsigned int max_write_same_sectors; unsigned int discard_granularity; unsigned int discard_alignment; unsigned short logical_block_size; unsigned short max_segments; unsigned short max_integrity_segments; unsigned char misaligned; unsigned char discard_misaligned; unsigned char cluster; unsigned char discard_zeroes_data; unsigned char raid_partial_stripes_expensive; } ;
282 struct blk_mq_ops ;
282 struct blk_mq_hw_ctx ;
282 struct throtl_data ;
282 struct blk_mq_tag_set ;
282 struct request_queue { struct list_head queue_head; struct request *last_merge; struct elevator_queue *elevator; int nr_rqs[2U]; int nr_rqs_elvpriv; struct request_list root_rl; request_fn_proc *request_fn; make_request_fn *make_request_fn; prep_rq_fn *prep_rq_fn; unprep_rq_fn *unprep_rq_fn; softirq_done_fn *softirq_done_fn; rq_timed_out_fn *rq_timed_out_fn; dma_drain_needed_fn *dma_drain_needed; lld_busy_fn *lld_busy_fn; struct blk_mq_ops *mq_ops; unsigned int *mq_map; struct blk_mq_ctx *queue_ctx; unsigned int nr_queues; struct blk_mq_hw_ctx **queue_hw_ctx; unsigned int nr_hw_queues; sector_t end_sector; struct request *boundary_rq; struct delayed_work delay_work; struct backing_dev_info backing_dev_info; void *queuedata; unsigned long queue_flags; int id; gfp_t bounce_gfp; spinlock_t __queue_lock; spinlock_t *queue_lock; struct kobject kobj; struct kobject mq_kobj; struct blk_integrity integrity; struct device *dev; int rpm_status; unsigned int nr_pending; unsigned long nr_requests; unsigned int nr_congestion_on; unsigned int nr_congestion_off; unsigned int nr_batching; unsigned int dma_drain_size; void *dma_drain_buffer; unsigned int dma_pad_mask; unsigned int dma_alignment; struct blk_queue_tag *queue_tags; struct list_head tag_busy_list; unsigned int nr_sorted; unsigned int in_flight[2U]; unsigned int request_fn_active; unsigned int rq_timeout; struct timer_list timeout; struct work_struct timeout_work; struct list_head timeout_list; struct list_head icq_list; unsigned long blkcg_pols[1U]; struct blkcg_gq *root_blkg; struct list_head blkg_list; struct queue_limits limits; unsigned int sg_timeout; unsigned int sg_reserved_size; int node; struct blk_flush_queue *fq; struct list_head requeue_list; spinlock_t requeue_lock; struct work_struct requeue_work; struct mutex sysfs_lock; int bypass_depth; atomic_t mq_freeze_depth; bsg_job_fn *bsg_job_fn; int bsg_job_size; struct bsg_class_device bsg_dev; struct throtl_data *td; struct callback_head callback_head; wait_queue_head_t mq_freeze_wq; struct percpu_ref q_usage_counter; struct list_head all_q_node; struct blk_mq_tag_set *tag_set; struct list_head tag_set_list; struct bio_set *bio_split; bool mq_sysfs_init_done; } ;
1046 struct blk_plug { struct list_head list; struct list_head mq_list; struct list_head cb_list; } ;
1477 struct blk_integrity_iter { void *prot_buf; void *data_buf; sector_t seed; unsigned int data_size; unsigned short interval; const char *disk_name; } ;
1506 typedef int integrity_processing_fn(struct blk_integrity_iter *);
1507 struct blk_integrity_profile { integrity_processing_fn *generate_fn; integrity_processing_fn *verify_fn; const char *name; } ;
1666 struct block_device_operations { int (*open)(struct block_device *, fmode_t ); void (*release)(struct gendisk *, fmode_t ); int (*rw_page)(struct block_device *, sector_t , struct page *, int); int (*ioctl)(struct block_device *, fmode_t , unsigned int, unsigned long); int (*compat_ioctl)(struct block_device *, fmode_t , unsigned int, unsigned long); long int (*direct_access)(struct block_device *, sector_t , void **, pfn_t *, long); unsigned int (*check_events)(struct gendisk *, unsigned int); int (*media_changed)(struct gendisk *); void (*unlock_native_capacity)(struct gendisk *); int (*revalidate_disk)(struct gendisk *); int (*getgeo)(struct block_device *, struct hd_geometry *); void (*swap_slot_free_notify)(struct block_device *, unsigned long); struct module *owner; const struct pr_ops *pr_ops; } ;
272 struct request_sense ;
696 struct request_sense { unsigned char error_code; unsigned char valid; __u8 segment_number; unsigned char sense_key; unsigned char reserved2; unsigned char ili; unsigned char reserved1; __u8 information[4U]; __u8 add_sense_len; __u8 command_info[4U]; __u8 asc; __u8 ascq; __u8 fruc; __u8 sks[3U]; __u8 asb[46U]; } ;
328 union __anonunion____missing_field_name_364 { unsigned long error_addr; unsigned long feature_addr; } ;
328 union __anonunion____missing_field_name_365 { unsigned long status_addr; unsigned long command_addr; } ;
328 struct ide_io_ports { unsigned long data_addr; union __anonunion____missing_field_name_364 __annonCompField93; unsigned long nsect_addr; unsigned long lbal_addr; unsigned long lbam_addr; unsigned long lbah_addr; unsigned long device_addr; union __anonunion____missing_field_name_365 __annonCompField94; unsigned long ctl_addr; unsigned long irq_addr; } ;
179 typedef u8 hwif_chipset_t;
212 enum ldv_29544 { ide_stopped = 0, ide_started = 1 } ;
235 typedef enum ldv_29544 ide_startstop_t;
270 union __anonunion____missing_field_name_367 { u8 error; u8 feature; } ;
270 union __anonunion____missing_field_name_368 { u8 status; u8 command; } ;
270 struct ide_taskfile { u8 data; union __anonunion____missing_field_name_367 __annonCompField96; u8 nsect; u8 lbal; u8 lbam; u8 lbah; u8 device; union __anonunion____missing_field_name_368 __annonCompField97; } ;
296 struct __anonstruct_out_370 { u8 tf; u8 hob; } ;
296 struct __anonstruct_in_371 { u8 tf; u8 hob; } ;
296 struct __anonstruct_valid_369 { struct __anonstruct_out_370 out; struct __anonstruct_in_371 in; } ;
296 struct ide_cmd { struct ide_taskfile tf; struct ide_taskfile hob; struct __anonstruct_valid_369 valid; u16 tf_flags; u8 ftf_flags; int protocol; int sg_nents; int orig_sg_nents; int sg_dma_direction; unsigned int nbytes; unsigned int nleft; unsigned int last_xfer_len; struct scatterlist *cursg; unsigned int cursg_ofs; struct request *rq; } ;
334 struct ide_atapi_pc { u8 c[12U]; int retries; int error; int req_xfer; struct request *rq; unsigned long flags; unsigned long timeout; } ;
360 struct ide_devset ;
361 struct ide_driver ;
362 struct ide_acpi_drive_link ;
363 struct ide_acpi_hwif_link ;
364 struct ide_drive_s ;
365 struct ide_disk_ops { int (*check)(struct ide_drive_s *, const char *); int (*get_capacity)(struct ide_drive_s *); void (*unlock_native_capacity)(struct ide_drive_s *); void (*setup)(struct ide_drive_s *); void (*flush)(struct ide_drive_s *); int (*init_media)(struct ide_drive_s *, struct gendisk *); int (*set_doorlock)(struct ide_drive_s *, struct gendisk *, int); ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, sector_t ); int (*ioctl)(struct ide_drive_s *, struct block_device *, fmode_t , unsigned int, unsigned long); } ;
446 struct ide_proc_devset ;
446 struct hwif_s ;
446 struct ide_drive_s { char name[4U]; char driver_req[10U]; struct request_queue *queue; struct request *rq; void *driver_data; u16 *id; struct proc_dir_entry *proc; const struct ide_proc_devset *settings; struct hwif_s *hwif; const struct ide_disk_ops *disk_ops; unsigned long dev_flags; unsigned long sleep; unsigned long timeout; u8 special_flags; u8 select; u8 retry_pio; u8 waiting_for_dma; u8 dma; u8 init_speed; u8 current_speed; u8 desired_speed; u8 pio_mode; u8 dma_mode; u8 dn; u8 acoustic; u8 media; u8 ready_stat; u8 mult_count; u8 mult_req; u8 io_32bit; u8 bad_wstat; u8 head; u8 sect; u8 bios_head; u8 bios_sect; u8 pc_delay; unsigned int bios_cyl; unsigned int cyl; void *drive_data; unsigned int failures; unsigned int max_failures; u64 probed_capacity; u64 capacity64; int lun; int crc_count; unsigned long debug_mask; struct ide_acpi_drive_link *acpidata; struct list_head list; struct device gendev; struct completion gendev_rel_comp; struct ide_atapi_pc *pc; struct ide_atapi_pc *failed_pc; int (*pc_callback)(struct ide_drive_s *, int); ide_startstop_t (*irq_handler)(struct ide_drive_s *); unsigned long atapi_flags; struct ide_atapi_pc request_sense_pc; bool sense_rq_armed; struct request sense_rq; struct request_sense sense_data; } ;
586 typedef struct ide_drive_s ide_drive_t;
588 struct ide_tp_ops { void (*exec_command)(struct hwif_s *, u8 ); u8 (*read_status)(struct hwif_s *); u8 (*read_altstatus)(struct hwif_s *); void (*write_devctl)(struct hwif_s *, u8 ); void (*dev_select)(ide_drive_t *); void (*tf_load)(ide_drive_t *, struct ide_taskfile *, u8 ); void (*tf_read)(ide_drive_t *, struct ide_taskfile *, u8 ); void (*input_data)(ide_drive_t *, struct ide_cmd *, void *, unsigned int); void (*output_data)(ide_drive_t *, struct ide_cmd *, void *, unsigned int); } ;
615 struct ide_port_ops { void (*init_dev)(ide_drive_t *); void (*set_pio_mode)(struct hwif_s *, ide_drive_t *); void (*set_dma_mode)(struct hwif_s *, ide_drive_t *); int (*reset_poll)(ide_drive_t *); void (*pre_reset)(ide_drive_t *); void (*resetproc)(ide_drive_t *); void (*maskproc)(ide_drive_t *, int); void (*quirkproc)(ide_drive_t *); void (*clear_irq)(ide_drive_t *); int (*test_irq)(struct hwif_s *); u8 (*mdma_filter)(ide_drive_t *); u8 (*udma_filter)(ide_drive_t *); u8 (*cable_detect)(struct hwif_s *); } ;
651 struct ide_dma_ops { void (*dma_host_set)(struct ide_drive_s *, int); int (*dma_setup)(struct ide_drive_s *, struct ide_cmd *); void (*dma_start)(struct ide_drive_s *); int (*dma_end)(struct ide_drive_s *); int (*dma_test_irq)(struct ide_drive_s *); void (*dma_lost_irq)(struct ide_drive_s *); int (*dma_check)(struct ide_drive_s *, struct ide_cmd *); int (*dma_timer_expiry)(struct ide_drive_s *); void (*dma_clear)(struct ide_drive_s *); u8 (*dma_sff_read_status)(struct hwif_s *); } ;
673 struct ide_host ;
674 struct hwif_s { struct hwif_s *mate; struct proc_dir_entry *proc; struct ide_host *host; char name[6U]; struct ide_io_ports io_ports; unsigned long sata_scr[3U]; ide_drive_t *devices[3U]; unsigned long port_flags; u8 major; u8 index; u8 channel; u32 host_flags; u8 pio_mask; u8 ultra_mask; u8 mwdma_mask; u8 swdma_mask; u8 cbl; hwif_chipset_t chipset; struct device *dev; void (*rw_disk)(ide_drive_t *, struct request *); const struct ide_tp_ops *tp_ops; const struct ide_port_ops *port_ops; const struct ide_dma_ops *dma_ops; unsigned int *dmatable_cpu; dma_addr_t dmatable_dma; int prd_max_nents; int prd_ent_size; struct scatterlist *sg_table; int sg_max_nents; struct ide_cmd cmd; int rqsize; int irq; unsigned long dma_base; unsigned long config_data; unsigned long select_data; unsigned long extra_base; unsigned int extra_ports; unsigned char present; unsigned char busy; struct device gendev; struct device *portdev; struct completion gendev_rel_comp; void *hwif_data; struct ide_acpi_hwif_link *acpidata; ide_startstop_t (*handler)(ide_drive_t *); unsigned char polling; ide_drive_t *cur_dev; struct request *rq; struct timer_list timer; unsigned long poll_timeout; int (*expiry)(ide_drive_t *); int req_gen; int req_gen_timer; spinlock_t lock; } ;
780 typedef struct hwif_s ide_hwif_t;
781 struct ide_host { ide_hwif_t *ports[5U]; unsigned int n_ports; struct device *dev[2U]; int (*init_chipset)(struct pci_dev *); void (*get_lock)(irqreturn_t (*)(int, void *), void *); void (*release_lock)(); irqreturn_t (*irq_handler)(int, void *); unsigned long host_flags; int irq_flags; void *host_priv; ide_hwif_t *cur_port; volatile unsigned long host_busy; } ;
819 struct ide_devset { int (*get)(ide_drive_t *); int (*set)(ide_drive_t *, int); unsigned int flags; } ;
894 struct ide_proc_devset { const char *name; const struct ide_devset *setting; int min; int max; int (*mulf)(ide_drive_t *); int (*divf)(ide_drive_t *); } ;
934 struct __anonstruct_ide_proc_entry_t_372 { const char *name; umode_t mode; const struct file_operations *proc_fops; } ;
934 typedef struct __anonstruct_ide_proc_entry_t_372 ide_proc_entry_t;
1019 struct ide_driver { const char *version; ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t ); struct device_driver gen_driver; int (*probe)(ide_drive_t *); void (*remove)(ide_drive_t *); void (*resume)(ide_drive_t *); void (*shutdown)(ide_drive_t *); ide_proc_entry_t * (*proc_entries)(ide_drive_t *); const struct ide_proc_devset * (*proc_devsets)(ide_drive_t *); } ;
9 struct mtop { short mt_op; int mt_count; } ;
23 struct mtget { long mt_type; long mt_resid; long mt_dsreg; long mt_gstat; long mt_erreg; __kernel_daddr_t mt_fileno; __kernel_daddr_t mt_blkno; } ;
85 struct mtpos { long mt_blkno; } ;
131 struct ide_tape_obj { ide_drive_t *drive; struct ide_driver *driver; struct gendisk *disk; struct device dev; struct ide_atapi_pc queued_pc; bool postponed_rq; unsigned long dsc_polling_start; struct timer_list dsc_timer; unsigned long best_dsc_rw_freq; unsigned long dsc_poll_freq; unsigned long dsc_timeout; u8 partition; unsigned int first_frame; u8 sense_key; u8 asc; u8 ascq; unsigned int minor; char name[4U]; u8 chrdev_dir; unsigned short blk_size; int user_bs_factor; u8 caps[20U]; int buffer_size; void *buf; void *cur; size_t valid; unsigned long avg_time; int avg_size; int avg_speed; int door_locked; char drv_write_prot; char write_prot; } ;
219 typedef struct ide_tape_obj idetape_tape_t;
1034 struct idetape_config { int dsc_rw_frequency; int dsc_media_access_frequency; int nr_stages; } ;
48 typedef int ldv_func_ret_type;
1 unsigned long int __builtin_object_size(void *, int);
1 long int __builtin_expect(long, long);
33 extern struct module __this_module;
72 void set_bit(long nr, volatile unsigned long *addr);
110 void clear_bit(long nr, volatile unsigned long *addr);
204 int test_and_set_bit(long nr, volatile unsigned long *addr);
250 int test_and_clear_bit(long nr, volatile unsigned long *addr);
308 int constant_test_bit(long nr, const volatile unsigned long *addr);
7 __u32 __arch_swab32(__u32 val);
46 __u16 __fswab16(__u16 val);
55 __u32 __fswab32(__u32 val);
160 __u16 __swab16p(const __u16 *p);
173 __u32 __swab32p(const __u32 *p);
79 __u32 __be32_to_cpup(const __be32 *p);
87 __u16 __be16_to_cpup(const __be16 *p);
154 int printk(const char *, ...);
255 void __might_fault(const char *, int);
3 bool ldv_is_err(const void *ptr);
11 void * ldv_create_class();
13 void ldv_unregister_class();
15 int ldv_register_chrdev(int major);
17 void ldv_unregister_chrdev_region();
31 void * __memcpy(void *, const void *, size_t );
56 void * __memset(void *, int, size_t );
75 char * strstr(const char *, const char *);
41 bool IS_ERR(const void *ptr);
138 void mutex_lock_nested(struct mutex *, unsigned int);
174 void mutex_unlock(struct mutex *);
78 extern volatile unsigned long jiffies;
284 unsigned int jiffies_to_msecs(const unsigned long);
87 const char * kobject_name(const struct kobject *kobj);
46 void msleep(unsigned int);
964 void * lowmem_page_address(const struct page *page);
5 void kasan_check_read(const void *, unsigned int);
6 void kasan_check_write(const void *, unsigned int);
676 unsigned long int _copy_from_user(void *, const void *, unsigned int);
678 unsigned long int _copy_to_user(void *, const void *, unsigned int);
698 void __copy_from_user_overflow();
703 void __copy_to_user_overflow();
719 unsigned long int copy_from_user(void *to, const void *from, unsigned long n);
756 unsigned long int copy_to_user(void *to, const void *from, unsigned long n);
154 void kfree(const void *);
318 void * __kmalloc(size_t , gfp_t );
466 void * kmalloc(size_t size, gfp_t flags);
620 void * kzalloc(size_t size, gfp_t flags);
859 unsigned int iminor(const struct inode *inode);
2426 int __register_chrdev(unsigned int, unsigned int, unsigned int, const char *, const struct file_operations *);
2429 void __unregister_chrdev(unsigned int, unsigned int, unsigned int, const char *);
2434 int ldv_register_chrdev_5(unsigned int major, const char *name, const struct file_operations *fops);
2434 int register_chrdev(unsigned int major, const char *name, const struct file_operations *fops);
2444 void ldv_unregister_chrdev_6(unsigned int major, const char *name);
2444 void unregister_chrdev(unsigned int major, const char *name);
2791 loff_t noop_llseek(struct file *, loff_t , int);
109 ssize_t seq_read(struct file *, char *, size_t , loff_t *);
110 loff_t seq_lseek(struct file *, loff_t , int);
117 void seq_printf(struct seq_file *, const char *, ...);
135 int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
137 int single_release(struct inode *, struct file *);
289 int driver_register(struct device_driver *);
290 void driver_unregister(struct device_driver *);
517 void class_destroy(struct class *);
520 void ldv_class_destroy_7(struct class *ldv_func_arg1);
524 void ldv_class_destroy_8(struct class *ldv_func_arg1);
865 const char * dev_name(const struct device *dev);
875 int dev_set_name(struct device *, const char *, ...);
1003 int device_register(struct device *);
1007 void device_del(struct device *);
1072 struct device * device_create(struct class *, struct device *, dev_t , void *, const char *, ...);
1080 void device_destroy(struct class *, dev_t );
1097 struct device * get_device(struct device *);
1098 void put_device(struct device *);
617 struct gendisk * alloc_disk(int);
619 void put_disk(struct gendisk *);
105 bool bio_has_data(struct bio *bio);
142 void * bio_data(struct bio *bio);
786 void blk_put_request(struct request *);
788 struct request * blk_get_request(struct request_queue *, int, gfp_t );
830 int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t );
834 int blk_execute_rq(struct request_queue *, struct gendisk *, struct request *, int);
859 unsigned int blk_rq_bytes(const struct request *rq);
871 unsigned int blk_rq_sectors(const struct request *rq);
39 void * PDE_DATA(const struct inode *);
942 void ide_proc_register_driver(ide_drive_t *, struct ide_driver *);
943 void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *);
945 extern const struct file_operations ide_capacity_proc_fops;
1042 int ide_device_get(ide_drive_t *);
1043 void ide_device_put(ide_drive_t *);
1054 int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned int, unsigned long);
1074 void ide_fixstring(u8 *, const int, const int);
1084 ide_startstop_t ide_do_reset(ide_drive_t *);
1090 int ide_complete_rq(ide_drive_t *, int, unsigned int);
1114 int ide_check_atapi_device(ide_drive_t *, const char *);
1116 void ide_init_pc(struct ide_atapi_pc *);
1138 int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *, void *, unsigned int);
1141 int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *);
1142 int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
1143 int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
1145 void ide_retry_pc(ide_drive_t *);
1147 void ide_prep_sense(ide_drive_t *, struct request *);
1154 ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_cmd *);
1176 void ide_stall_queue(ide_drive_t *, unsigned long);
1183 void ide_init_disk(struct gendisk *, ide_drive_t *);
1356 void ide_map_sg(ide_drive_t *, struct ide_cmd *);
1357 void ide_init_sg_cmd(struct ide_cmd *, unsigned int);
1449 void ide_register_region(struct gendisk *);
1450 void ide_unregister_region(struct gendisk *);
1540 extern struct bus_type ide_bus_type;
27 u32 get_unaligned_be32(const void *p);
37 void put_unaligned_le16(u16 val, void *p);
42 void put_unaligned_le32(u32 val, void *p);
47 void put_unaligned_le64(u64 val, void *p);
8 void __bad_unaligned_access_size();
221 struct mutex ide_tape_mutex = { { 1 }, { { { { { 0 } }, 3735899821U, 4294967295U, (void *)-1, { 0, { 0, 0 }, "ide_tape_mutex.wait_lock", 0, 0UL } } } }, { &(ide_tape_mutex.wait_list), &(ide_tape_mutex.wait_list) }, 0, (void *)(&ide_tape_mutex), { 0, { 0, 0 }, "ide_tape_mutex", 0, 0UL } };
222 struct mutex idetape_ref_mutex = { { 1 }, { { { { { 0 } }, 3735899821U, 4294967295U, (void *)-1, { 0, { 0, 0 }, "idetape_ref_mutex.wait_lock", 0, 0UL } } } }, { &(idetape_ref_mutex.wait_list), &(idetape_ref_mutex.wait_list) }, 0, (void *)(&idetape_ref_mutex), { 0, { 0, 0 }, "idetape_ref_mutex", 0, 0UL } };
224 struct mutex idetape_chrdev_mutex = { { 1 }, { { { { { 0 } }, 3735899821U, 4294967295U, (void *)-1, { 0, { 0, 0 }, "idetape_chrdev_mutex.wait_lock", 0, 0UL } } } }, { &(idetape_chrdev_mutex.wait_list), &(idetape_chrdev_mutex.wait_list) }, 0, (void *)(&idetape_chrdev_mutex), { 0, { 0, 0 }, "idetape_chrdev_mutex", 0, 0UL } };
226 struct class *idetape_sysfs_class = 0;
228 void ide_tape_release(struct device *dev);
230 struct ide_tape_obj *idetape_devs[20U] = { };
232 struct ide_tape_obj * ide_tape_get(struct gendisk *disk, bool cdev, unsigned int i);
255 void ide_tape_put(struct ide_tape_obj *tape);
269 void idetape_analyze_error(ide_drive_t *drive);
325 void ide_tape_handle_dsc(ide_drive_t *drive);
327 int ide_tape_callback(ide_drive_t *drive, int dsc);
379 void ide_tape_stall_queue(ide_drive_t *drive);
440 ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd, struct ide_atapi_pc *pc);
490 void idetape_create_mode_sense_cmd(struct ide_atapi_pc *pc, u8 page_code);
516 ide_startstop_t idetape_media_access_finished(ide_drive_t *drive);
544 void ide_tape_create_rw_cmd(idetape_tape_t *tape, struct ide_atapi_pc *pc, struct request *rq, u8 opcode);
567 ide_startstop_t idetape_do_request(ide_drive_t *drive, struct request *rq, sector_t block);
673 void idetape_create_write_filemark_cmd(ide_drive_t *drive, struct ide_atapi_pc *pc, int write_filemark);
682 int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout);
710 int idetape_flush_tape_buffers(ide_drive_t *drive);
724 int ide_tape_read_position(ide_drive_t *drive);
766 void idetape_create_locate_cmd(ide_drive_t *drive, struct ide_atapi_pc *pc, unsigned int block, u8 partition, int skip);
778 void __ide_tape_discard_merge_buffer(ide_drive_t *drive);
801 int idetape_position_tape(ide_drive_t *drive, unsigned int block, u8 partition, int skip);
823 void ide_tape_discard_merge_buffer(ide_drive_t *drive, int restore_position);
845 int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size);
887 void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc);
895 void idetape_create_rewind_cmd(ide_drive_t *drive, struct ide_atapi_pc *pc);
903 void idetape_create_erase_cmd(struct ide_atapi_pc *pc);
911 void idetape_create_space_cmd(struct ide_atapi_pc *pc, int count, u8 cmd);
920 void ide_tape_flush_merge_buffer(ide_drive_t *drive);
940 int idetape_init_rw(ide_drive_t *drive, int dir);
990 void idetape_pad_zeros(ide_drive_t *drive, int bcount);
1008 int idetape_rewind_tape(ide_drive_t *drive);
1029 int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned long arg);
1062 int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op, int mt_count);
1128 ssize_t idetape_chrdev_read(struct file *file, char *buf, size_t count, loff_t *ppos);
1183 ssize_t idetape_chrdev_write(struct file *file, const char *buf, size_t count, loff_t *ppos);
1226 int idetape_write_filemark(ide_drive_t *drive);
1253 int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count);
1369 long int do_idetape_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
1424 long int idetape_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
1438 void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive);
1463 int idetape_chrdev_open(struct inode *inode, struct file *filp);
1548 void idetape_write_release(ide_drive_t *drive, unsigned int minor);
1565 int idetape_chrdev_release(struct inode *inode, struct file *filp);
1602 void idetape_get_inquiry_results(ide_drive_t *drive);
1631 void idetape_get_mode_sense_results(ide_drive_t *drive);
1707 int mulf_tdsc(ide_drive_t *drive);
1708 int divf_tdsc(ide_drive_t *drive);
1709 int divf_buffer(ide_drive_t *drive);
1710 int divf_buffer_size(ide_drive_t *drive);
1712 int get_dsc_overlap(ide_drive_t *drive);
1712 int set_dsc_overlap(ide_drive_t *drive, int arg);
1712 const struct ide_devset ide_devset_dsc_overlap = { &get_dsc_overlap, &set_dsc_overlap, 1U };
1714 int get_tdsc(ide_drive_t *drive);
1714 int set_tdsc(ide_drive_t *drive, int arg);
1714 const struct ide_devset ide_devset_tdsc = { &get_tdsc, &set_tdsc, 1U };
1716 int get_avg_speed(ide_drive_t *drive);
1716 const struct ide_devset ide_devset_avg_speed = { &get_avg_speed, (int (*)(ide_drive_t *, int))0, 0U };
1717 int get_speed(ide_drive_t *drive);
1717 const struct ide_devset ide_devset_speed = { &get_speed, (int (*)(ide_drive_t *, int))0, 0U };
1718 int get_buffer(ide_drive_t *drive);
1718 const struct ide_devset ide_devset_buffer = { &get_buffer, (int (*)(ide_drive_t *, int))0, 0U };
1719 int get_buffer_size(ide_drive_t *drive);
1719 const struct ide_devset ide_devset_buffer_size = { &get_buffer_size, (int (*)(ide_drive_t *, int))0, 0U };
1721 const struct ide_proc_devset idetape_settings[7U] = { { "avg_speed", &ide_devset_avg_speed, 0, 65535, (int (*)(ide_drive_t *))0, (int (*)(ide_drive_t *))0 }, { "buffer", &ide_devset_buffer, 0, 65535, (int (*)(ide_drive_t *))0, &divf_buffer }, { "buffer_size", &ide_devset_buffer_size, 0, 65535, (int (*)(ide_drive_t *))0, &divf_buffer_size }, { "dsc_overlap", &ide_devset_dsc_overlap, 0, 1, (int (*)(ide_drive_t *))0, (int (*)(ide_drive_t *))0 }, { "speed", &ide_devset_speed, 0, 65535, (int (*)(ide_drive_t *))0, (int (*)(ide_drive_t *))0 }, { "tdsc", &ide_devset_tdsc, 12, 100, &mulf_tdsc, &divf_tdsc }, { (const char *)0, 0, 0, 0, 0, 0 } };
1744 void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor);
1807 void ide_tape_remove(ide_drive_t *drive);
1840 int idetape_name_proc_show(struct seq_file *m, void *v);
1849 int idetape_name_proc_open(struct inode *inode, struct file *file);
1854 const struct file_operations idetape_name_proc_fops = { &__this_module, &seq_lseek, &seq_read, 0, 0, 0, 0, 0, 0, 0, 0, 0, &idetape_name_proc_open, 0, &single_release, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1862 ide_proc_entry_t idetape_proc[3U] = { { "capacity", 33060U, &ide_capacity_proc_fops }, { "name", 33060U, &idetape_name_proc_fops } };
1868 ide_proc_entry_t * ide_tape_proc_entries(ide_drive_t *drive);
1873 const struct ide_proc_devset * ide_tape_proc_devsets(ide_drive_t *drive);
1879 int ide_tape_probe(ide_drive_t *drive);
1881 struct ide_driver idetape_driver = { "1.20", &idetape_do_request, { "ide-tape", &ide_bus_type, &__this_module, 0, (_Bool)0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, &ide_tape_probe, &ide_tape_remove, 0, 0, &ide_tape_proc_entries, &ide_tape_proc_devsets };
1898 const struct file_operations idetape_fops = { &__this_module, &noop_llseek, &idetape_chrdev_read, &idetape_chrdev_write, 0, 0, 0, 0, 0, &idetape_chrdev_ioctl, 0, 0, &idetape_chrdev_open, 0, &idetape_chrdev_release, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1908 int idetape_open(struct block_device *bdev, fmode_t mode);
1922 void idetape_release(struct gendisk *disk, fmode_t mode);
1931 int idetape_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg);
1947 const struct block_device_operations idetape_block_ops = { &idetape_open, &idetape_release, 0, &idetape_ioctl, 0, 0, 0, 0, 0, 0, 0, 0, &__this_module, 0 };
2029 void idetape_exit();
2036 int idetape_init();
2091 void ldv_check_final_state();
2094 void ldv_check_return_value(int);
2097 void ldv_check_return_value_probe(int);
2100 void ldv_initialize();
2103 void ldv_handler_precall();
2106 int nondet_int();
2109 int LDV_IN_INTERRUPT = 0;
2112 void ldv_main0_sequence_infinite_withcheck_stateful();
10 void ldv_error();
20 void ldv_stop();
25 int ldv_undef_int();
26 void * ldv_undef_ptr();
39 int ldv_undef_int_nonpositive();
14 void * ldv_err_ptr(long error);
21 long int ldv_ptr_err(const void *ptr);
28 bool ldv_is_err_or_null(const void *ptr);
28 int ldv_usb_gadget_class = 0;
31 int ldv_usb_gadget_chrdev = 0;
34 int ldv_usb_gadget = 0;
61 int ldv_register_class();
124 int ldv_register_chrdev_region();
158 int ldv_register_usb_gadget();
179 void ldv_unregister_usb_gadget();
return ;
}
-entry_point
{
2114 struct inode *var_group1;
2115 struct file *var_group2;
2116 int res_idetape_name_proc_open_50;
2117 ide_drive_t *var_ide_tape_probe_56_p0;
2118 int res_ide_tape_probe_56;
2119 ide_drive_t *var_ide_tape_remove_47_p0;
2120 ide_drive_t *var_idetape_do_request_10_p0;
2121 struct request *var_group3;
2122 unsigned long var_idetape_do_request_10_p2;
2123 ide_drive_t *var_ide_tape_proc_entries_51_p0;
2124 ide_drive_t *var_ide_tape_proc_devsets_52_p0;
2125 char *var_idetape_chrdev_read_30_p1;
2126 unsigned long var_idetape_chrdev_read_30_p2;
2127 loff_t *var_idetape_chrdev_read_30_p3;
2128 long res_idetape_chrdev_read_30;
2129 const char *var_idetape_chrdev_write_31_p1;
2130 unsigned long var_idetape_chrdev_write_31_p2;
2131 loff_t *var_idetape_chrdev_write_31_p3;
2132 long res_idetape_chrdev_write_31;
2133 unsigned int var_idetape_chrdev_ioctl_35_p1;
2134 unsigned long var_idetape_chrdev_ioctl_35_p2;
2135 int res_idetape_chrdev_open_37;
2136 struct block_device *var_group4;
2137 unsigned int var_idetape_open_53_p1;
2138 int res_idetape_open_53;
2139 struct gendisk *var_group5;
2140 unsigned int var_idetape_release_54_p1;
2141 unsigned int var_idetape_ioctl_55_p1;
2142 unsigned int var_idetape_ioctl_55_p2;
2143 unsigned long var_idetape_ioctl_55_p3;
2144 int ldv_s_idetape_name_proc_fops_file_operations;
2145 int ldv_s_idetape_driver_ide_driver;
2146 int ldv_s_idetape_fops_file_operations;
2147 int ldv_s_idetape_block_ops_block_device_operations;
2148 int tmp;
2149 int tmp___0;
2150 int tmp___1;
3068 ldv_s_idetape_name_proc_fops_file_operations = 0;
3070 ldv_s_idetape_driver_ide_driver = 0;
3073 ldv_s_idetape_fops_file_operations = 0;
3076 ldv_s_idetape_block_ops_block_device_operations = 0;
2996 LDV_IN_INTERRUPT = 1;
3005 ldv_initialize() { /* Function call is skipped due to function is undefined */}
3065 ldv_handler_precall() { /* Function call is skipped due to function is undefined */}
3066 -idetape_init()
{
2038 int error;
2039 void *tmp;
2040 _Bool tmp___0;
2041 int tmp___1;
2038 error = 1;
2039 -ldv_create_class()
{
40 void *is_got;
43 is_got = ldv_undef_ptr() { /* Function call is skipped due to function is undefined */}
46 assume(((unsigned long)is_got) <= ((unsigned long)((void *)2012)));
49 assume(!(ldv_usb_gadget != 0));
51 assume(!(ldv_usb_gadget_class != 0));
53 ldv_usb_gadget_class = 1;
57 return is_got;;
}
2039 idetape_sysfs_class = (struct class *)tmp;
2040 -IS_ERR((const void *)idetape_sysfs_class)
{
36 _Bool tmp;
37 -ldv_is_err(ptr)
{
10 return ((unsigned long)ptr) > 2012UL;;
}
37 return tmp;;
}
2040 assume(((int)tmp___0) == 0);
2047 -register_chrdev(37U, "ht", &idetape_fops)
{
48 int ldv_func_res;
49 int tmp;
50 int tmp___0;
50 -ldv_register_chrdev_5(major, name, fops)
{
2437 int tmp;
2437 tmp = __register_chrdev(major, 0U, 256U, name, fops) { /* Function call is skipped due to function is undefined */}
2437 return tmp;;
}
50 ldv_func_res = tmp;
52 -ldv_register_chrdev((int)major)
{
97 int is_reg;
100 -ldv_undef_int_nonpositive()
{
41 int ret;
42 int tmp;
41 tmp = ldv_undef_int() { /* Function call is skipped due to function is undefined */}
41 ret = tmp;
43 assume(!(ret > 0));
45 return ret;;
}
103 assume(is_reg == 0);
106 assume(!(ldv_usb_gadget != 0));
108 assume(!(ldv_usb_gadget_chrdev != 0));
110 ldv_usb_gadget_chrdev = 1;
111 assume(!(major == 0));
120 return is_reg;;
}
52 return tmp___0;;
}
2047 assume(!(tmp___1 != 0));
2054 error = driver_register(&(idetape_driver.gen_driver)) { /* Function call is skipped due to function is undefined */}
2055 assume(error != 0);
2056 goto out_free_driver;
2059 out_free_driver:;
2061 driver_unregister(&(idetape_driver.gen_driver)) { /* Function call is skipped due to function is undefined */}
2062 out_free_class:;
2063 -ldv_class_destroy_8(idetape_sysfs_class)
{
76 class_destroy(ldv_func_arg1) { /* Function call is skipped due to function is undefined */}
78 -ldv_unregister_class()
{
87 assume(!(ldv_usb_gadget != 0));
89 assume(!(ldv_usb_gadget_class != 1));
91 ldv_usb_gadget_class = 0;
92 return ;;
}
79 return ;;
}
2064 out:;
2065 return error;;
}
3066 assume(tmp != 0);
3067 goto ldv_final;
4191 -ldv_check_final_state()
{
191 assume(!(ldv_usb_gadget_class != 0));
193 assume(ldv_usb_gadget_chrdev != 0);
193 -ldv_error()
{
15 LDV_ERROR:;
}
}
}
Source code
1 2 /* 3 * IDE ATAPI streaming tape driver. 4 * 5 * Copyright (C) 1995-1999 Gadi Oxman <gadio@netvision.net.il> 6 * Copyright (C) 2003-2005 Bartlomiej Zolnierkiewicz 7 * 8 * This driver was constructed as a student project in the software laboratory 9 * of the faculty of electrical engineering in the Technion - Israel's 10 * Institute Of Technology, with the guide of Avner Lottem and Dr. Ilana David. 11 * 12 * It is hereby placed under the terms of the GNU general public license. 13 * (See linux/COPYING). 14 * 15 * For a historical changelog see 16 * Documentation/ide/ChangeLog.ide-tape.1995-2002 17 */ 18 19 #define DRV_NAME "ide-tape" 20 21 #define IDETAPE_VERSION "1.20" 22 23 #include <linux/module.h> 24 #include <linux/types.h> 25 #include <linux/string.h> 26 #include <linux/kernel.h> 27 #include <linux/delay.h> 28 #include <linux/timer.h> 29 #include <linux/mm.h> 30 #include <linux/interrupt.h> 31 #include <linux/jiffies.h> 32 #include <linux/major.h> 33 #include <linux/errno.h> 34 #include <linux/genhd.h> 35 #include <linux/seq_file.h> 36 #include <linux/slab.h> 37 #include <linux/pci.h> 38 #include <linux/ide.h> 39 #include <linux/completion.h> 40 #include <linux/bitops.h> 41 #include <linux/mutex.h> 42 #include <scsi/scsi.h> 43 44 #include <asm/byteorder.h> 45 #include <linux/uaccess.h> 46 #include <linux/io.h> 47 #include <asm/unaligned.h> 48 #include <linux/mtio.h> 49 50 /* define to see debug info */ 51 #undef IDETAPE_DEBUG_LOG 52 53 #ifdef IDETAPE_DEBUG_LOG 54 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 55 #else 56 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 57 #endif 58 59 /**************************** Tunable parameters *****************************/ 60 /* 61 * After each failed packet command we issue a request sense command and retry 62 * the packet command IDETAPE_MAX_PC_RETRIES times. 63 * 64 * Setting IDETAPE_MAX_PC_RETRIES to 0 will disable retries. 65 */ 66 #define IDETAPE_MAX_PC_RETRIES 3 67 68 /* 69 * The following parameter is used to select the point in the internal tape fifo 70 * in which we will start to refill the buffer. Decreasing the following 71 * parameter will improve the system's latency and interactive response, while 72 * using a high value might improve system throughput. 73 */ 74 #define IDETAPE_FIFO_THRESHOLD 2 75 76 /* 77 * DSC polling parameters. 78 * 79 * Polling for DSC (a single bit in the status register) is a very important 80 * function in ide-tape. There are two cases in which we poll for DSC: 81 * 82 * 1. Before a read/write packet command, to ensure that we can transfer data 83 * from/to the tape's data buffers, without causing an actual media access. 84 * In case the tape is not ready yet, we take out our request from the device 85 * request queue, so that ide.c could service requests from the other device 86 * on the same interface in the meantime. 87 * 88 * 2. After the successful initialization of a "media access packet command", 89 * which is a command that can take a long time to complete (the interval can 90 * range from several seconds to even an hour). Again, we postpone our request 91 * in the middle to free the bus for the other device. The polling frequency 92 * here should be lower than the read/write frequency since those media access 93 * commands are slow. We start from a "fast" frequency - IDETAPE_DSC_MA_FAST 94 * (1 second), and if we don't receive DSC after IDETAPE_DSC_MA_THRESHOLD 95 * (5 min), we switch it to a lower frequency - IDETAPE_DSC_MA_SLOW (1 min). 96 * 97 * We also set a timeout for the timer, in case something goes wrong. The 98 * timeout should be longer then the maximum execution time of a tape operation. 99 */ 100 101 /* DSC timings. */ 102 #define IDETAPE_DSC_RW_MIN 5*HZ/100 /* 50 msec */ 103 #define IDETAPE_DSC_RW_MAX 40*HZ/100 /* 400 msec */ 104 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ /* 2 minutes */ 105 #define IDETAPE_DSC_MA_FAST 2*HZ /* 2 seconds */ 106 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ /* 5 minutes */ 107 #define IDETAPE_DSC_MA_SLOW 30*HZ /* 30 seconds */ 108 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ /* 2 hours */ 109 110 /*************************** End of tunable parameters ***********************/ 111 112 /* tape directions */ 113 enum { 114 IDETAPE_DIR_NONE = (1 << 0), 115 IDETAPE_DIR_READ = (1 << 1), 116 IDETAPE_DIR_WRITE = (1 << 2), 117 }; 118 119 /* Tape door status */ 120 #define DOOR_UNLOCKED 0 121 #define DOOR_LOCKED 1 122 #define DOOR_EXPLICITLY_LOCKED 2 123 124 /* Some defines for the SPACE command */ 125 #define IDETAPE_SPACE_OVER_FILEMARK 1 126 #define IDETAPE_SPACE_TO_EOD 3 127 128 /* Some defines for the LOAD UNLOAD command */ 129 #define IDETAPE_LU_LOAD_MASK 1 130 #define IDETAPE_LU_RETENSION_MASK 2 131 #define IDETAPE_LU_EOT_MASK 4 132 133 /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ 134 #define IDETAPE_BLOCK_DESCRIPTOR 0 135 #define IDETAPE_CAPABILITIES_PAGE 0x2a 136 137 /* 138 * Most of our global data which we need to save even as we leave the driver due 139 * to an interrupt or a timer event is stored in the struct defined below. 140 */ 141 typedef struct ide_tape_obj { 142 ide_drive_t *drive; 143 struct ide_driver *driver; 144 struct gendisk *disk; 145 struct device dev; 146 147 /* used by REQ_IDETAPE_{READ,WRITE} requests */ 148 struct ide_atapi_pc queued_pc; 149 150 /* 151 * DSC polling variables. 152 * 153 * While polling for DSC we use postponed_rq to postpone the current 154 * request so that ide.c will be able to service pending requests on the 155 * other device. Note that at most we will have only one DSC (usually 156 * data transfer) request in the device request queue. 157 */ 158 bool postponed_rq; 159 160 /* The time in which we started polling for DSC */ 161 unsigned long dsc_polling_start; 162 /* Timer used to poll for dsc */ 163 struct timer_list dsc_timer; 164 /* Read/Write dsc polling frequency */ 165 unsigned long best_dsc_rw_freq; 166 unsigned long dsc_poll_freq; 167 unsigned long dsc_timeout; 168 169 /* Read position information */ 170 u8 partition; 171 /* Current block */ 172 unsigned int first_frame; 173 174 /* Last error information */ 175 u8 sense_key, asc, ascq; 176 177 /* Character device operation */ 178 unsigned int minor; 179 /* device name */ 180 char name[4]; 181 /* Current character device data transfer direction */ 182 u8 chrdev_dir; 183 184 /* tape block size, usually 512 or 1024 bytes */ 185 unsigned short blk_size; 186 int user_bs_factor; 187 188 /* Copy of the tape's Capabilities and Mechanical Page */ 189 u8 caps[20]; 190 191 /* 192 * Active data transfer request parameters. 193 * 194 * At most, there is only one ide-tape originated data transfer request 195 * in the device request queue. This allows ide.c to easily service 196 * requests from the other device when we postpone our active request. 197 */ 198 199 /* Data buffer size chosen based on the tape's recommendation */ 200 int buffer_size; 201 /* Staging buffer of buffer_size bytes */ 202 void *buf; 203 /* The read/write cursor */ 204 void *cur; 205 /* The number of valid bytes in buf */ 206 size_t valid; 207 208 /* Measures average tape speed */ 209 unsigned long avg_time; 210 int avg_size; 211 int avg_speed; 212 213 /* the door is currently locked */ 214 int door_locked; 215 /* the tape hardware is write protected */ 216 char drv_write_prot; 217 /* the tape is write protected (hardware or opened as read-only) */ 218 char write_prot; 219 } idetape_tape_t; 220 221 static DEFINE_MUTEX(ide_tape_mutex); 222 static DEFINE_MUTEX(idetape_ref_mutex); 223 224 static DEFINE_MUTEX(idetape_chrdev_mutex); 225 226 static struct class *idetape_sysfs_class; 227 228 static void ide_tape_release(struct device *); 229 230 static struct ide_tape_obj *idetape_devs[MAX_HWIFS * MAX_DRIVES]; 231 232 static struct ide_tape_obj *ide_tape_get(struct gendisk *disk, bool cdev, 233 unsigned int i) 234 { 235 struct ide_tape_obj *tape = NULL; 236 237 mutex_lock(&idetape_ref_mutex); 238 239 if (cdev) 240 tape = idetape_devs[i]; 241 else 242 tape = ide_drv_g(disk, ide_tape_obj); 243 244 if (tape) { 245 if (ide_device_get(tape->drive)) 246 tape = NULL; 247 else 248 get_device(&tape->dev); 249 } 250 251 mutex_unlock(&idetape_ref_mutex); 252 return tape; 253 } 254 255 static void ide_tape_put(struct ide_tape_obj *tape) 256 { 257 ide_drive_t *drive = tape->drive; 258 259 mutex_lock(&idetape_ref_mutex); 260 put_device(&tape->dev); 261 ide_device_put(drive); 262 mutex_unlock(&idetape_ref_mutex); 263 } 264 265 /* 266 * called on each failed packet command retry to analyze the request sense. We 267 * currently do not utilize this information. 268 */ 269 static void idetape_analyze_error(ide_drive_t *drive) 270 { 271 idetape_tape_t *tape = drive->driver_data; 272 struct ide_atapi_pc *pc = drive->failed_pc; 273 struct request *rq = drive->hwif->rq; 274 u8 *sense = bio_data(rq->bio); 275 276 tape->sense_key = sense[2] & 0xF; 277 tape->asc = sense[12]; 278 tape->ascq = sense[13]; 279 280 ide_debug_log(IDE_DBG_FUNC, 281 "cmd: 0x%x, sense key = %x, asc = %x, ascq = %x", 282 rq->cmd[0], tape->sense_key, tape->asc, tape->ascq); 283 284 /* correct remaining bytes to transfer */ 285 if (pc->flags & PC_FLAG_DMA_ERROR) 286 rq->resid_len = tape->blk_size * get_unaligned_be32(&sense[3]); 287 288 /* 289 * If error was the result of a zero-length read or write command, 290 * with sense key=5, asc=0x22, ascq=0, let it slide. Some drives 291 * (i.e. Seagate STT3401A Travan) don't support 0-length read/writes. 292 */ 293 if ((pc->c[0] == READ_6 || pc->c[0] == WRITE_6) 294 /* length == 0 */ 295 && pc->c[4] == 0 && pc->c[3] == 0 && pc->c[2] == 0) { 296 if (tape->sense_key == 5) { 297 /* don't report an error, everything's ok */ 298 pc->error = 0; 299 /* don't retry read/write */ 300 pc->flags |= PC_FLAG_ABORT; 301 } 302 } 303 if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { 304 pc->error = IDE_DRV_ERROR_FILEMARK; 305 pc->flags |= PC_FLAG_ABORT; 306 } 307 if (pc->c[0] == WRITE_6) { 308 if ((sense[2] & 0x40) || (tape->sense_key == 0xd 309 && tape->asc == 0x0 && tape->ascq == 0x2)) { 310 pc->error = IDE_DRV_ERROR_EOD; 311 pc->flags |= PC_FLAG_ABORT; 312 } 313 } 314 if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { 315 if (tape->sense_key == 8) { 316 pc->error = IDE_DRV_ERROR_EOD; 317 pc->flags |= PC_FLAG_ABORT; 318 } 319 if (!(pc->flags & PC_FLAG_ABORT) && 320 (blk_rq_bytes(rq) - rq->resid_len)) 321 pc->retries = IDETAPE_MAX_PC_RETRIES + 1; 322 } 323 } 324 325 static void ide_tape_handle_dsc(ide_drive_t *); 326 327 static int ide_tape_callback(ide_drive_t *drive, int dsc) 328 { 329 idetape_tape_t *tape = drive->driver_data; 330 struct ide_atapi_pc *pc = drive->pc; 331 struct request *rq = drive->hwif->rq; 332 int uptodate = pc->error ? 0 : 1; 333 int err = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; 334 335 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, dsc: %d, err: %d", rq->cmd[0], 336 dsc, err); 337 338 if (dsc) 339 ide_tape_handle_dsc(drive); 340 341 if (drive->failed_pc == pc) 342 drive->failed_pc = NULL; 343 344 if (pc->c[0] == REQUEST_SENSE) { 345 if (uptodate) 346 idetape_analyze_error(drive); 347 else 348 printk(KERN_ERR "ide-tape: Error in REQUEST SENSE " 349 "itself - Aborting request!\n"); 350 } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { 351 unsigned int blocks = 352 (blk_rq_bytes(rq) - rq->resid_len) / tape->blk_size; 353 354 tape->avg_size += blocks * tape->blk_size; 355 356 if (time_after_eq(jiffies, tape->avg_time + HZ)) { 357 tape->avg_speed = tape->avg_size * HZ / 358 (jiffies - tape->avg_time) / 1024; 359 tape->avg_size = 0; 360 tape->avg_time = jiffies; 361 } 362 363 tape->first_frame += blocks; 364 365 if (pc->error) { 366 uptodate = 0; 367 err = pc->error; 368 } 369 } 370 rq->errors = err; 371 372 return uptodate; 373 } 374 375 /* 376 * Postpone the current request so that ide.c will be able to service requests 377 * from another device on the same port while we are polling for DSC. 378 */ 379 static void ide_tape_stall_queue(ide_drive_t *drive) 380 { 381 idetape_tape_t *tape = drive->driver_data; 382 383 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, dsc_poll_freq: %lu", 384 drive->hwif->rq->cmd[0], tape->dsc_poll_freq); 385 386 tape->postponed_rq = true; 387 388 ide_stall_queue(drive, tape->dsc_poll_freq); 389 } 390 391 static void ide_tape_handle_dsc(ide_drive_t *drive) 392 { 393 idetape_tape_t *tape = drive->driver_data; 394 395 /* Media access command */ 396 tape->dsc_polling_start = jiffies; 397 tape->dsc_poll_freq = IDETAPE_DSC_MA_FAST; 398 tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT; 399 /* Allow ide.c to handle other requests */ 400 ide_tape_stall_queue(drive); 401 } 402 403 /* 404 * Packet Command Interface 405 * 406 * The current Packet Command is available in drive->pc, and will not change 407 * until we finish handling it. Each packet command is associated with a 408 * callback function that will be called when the command is finished. 409 * 410 * The handling will be done in three stages: 411 * 412 * 1. ide_tape_issue_pc will send the packet command to the drive, and will set 413 * the interrupt handler to ide_pc_intr. 414 * 415 * 2. On each interrupt, ide_pc_intr will be called. This step will be 416 * repeated until the device signals us that no more interrupts will be issued. 417 * 418 * 3. ATAPI Tape media access commands have immediate status with a delayed 419 * process. In case of a successful initiation of a media access packet command, 420 * the DSC bit will be set when the actual execution of the command is finished. 421 * Since the tape drive will not issue an interrupt, we have to poll for this 422 * event. In this case, we define the request as "low priority request" by 423 * setting rq_status to IDETAPE_RQ_POSTPONED, set a timer to poll for DSC and 424 * exit the driver. 425 * 426 * ide.c will then give higher priority to requests which originate from the 427 * other device, until will change rq_status to RQ_ACTIVE. 428 * 429 * 4. When the packet command is finished, it will be checked for errors. 430 * 431 * 5. In case an error was found, we queue a request sense packet command in 432 * front of the request queue and retry the operation up to 433 * IDETAPE_MAX_PC_RETRIES times. 434 * 435 * 6. In case no error was found, or we decided to give up and not to retry 436 * again, the callback function will be called and then we will handle the next 437 * request. 438 */ 439 440 static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive, 441 struct ide_cmd *cmd, 442 struct ide_atapi_pc *pc) 443 { 444 idetape_tape_t *tape = drive->driver_data; 445 struct request *rq = drive->hwif->rq; 446 447 if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) 448 drive->failed_pc = pc; 449 450 /* Set the current packet command */ 451 drive->pc = pc; 452 453 if (pc->retries > IDETAPE_MAX_PC_RETRIES || 454 (pc->flags & PC_FLAG_ABORT)) { 455 456 /* 457 * We will "abort" retrying a packet command in case legitimate 458 * error code was received (crossing a filemark, or end of the 459 * media, for example). 460 */ 461 if (!(pc->flags & PC_FLAG_ABORT)) { 462 if (!(pc->c[0] == TEST_UNIT_READY && 463 tape->sense_key == 2 && tape->asc == 4 && 464 (tape->ascq == 1 || tape->ascq == 8))) { 465 printk(KERN_ERR "ide-tape: %s: I/O error, " 466 "pc = %2x, key = %2x, " 467 "asc = %2x, ascq = %2x\n", 468 tape->name, pc->c[0], 469 tape->sense_key, tape->asc, 470 tape->ascq); 471 } 472 /* Giving up */ 473 pc->error = IDE_DRV_ERROR_GENERAL; 474 } 475 476 drive->failed_pc = NULL; 477 drive->pc_callback(drive, 0); 478 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); 479 return ide_stopped; 480 } 481 ide_debug_log(IDE_DBG_SENSE, "retry #%d, cmd: 0x%02x", pc->retries, 482 pc->c[0]); 483 484 pc->retries++; 485 486 return ide_issue_pc(drive, cmd); 487 } 488 489 /* A mode sense command is used to "sense" tape parameters. */ 490 static void idetape_create_mode_sense_cmd(struct ide_atapi_pc *pc, u8 page_code) 491 { 492 ide_init_pc(pc); 493 pc->c[0] = MODE_SENSE; 494 if (page_code != IDETAPE_BLOCK_DESCRIPTOR) 495 /* DBD = 1 - Don't return block descriptors */ 496 pc->c[1] = 8; 497 pc->c[2] = page_code; 498 /* 499 * Changed pc->c[3] to 0 (255 will at best return unused info). 500 * 501 * For SCSI this byte is defined as subpage instead of high byte 502 * of length and some IDE drives seem to interpret it this way 503 * and return an error when 255 is used. 504 */ 505 pc->c[3] = 0; 506 /* We will just discard data in that case */ 507 pc->c[4] = 255; 508 if (page_code == IDETAPE_BLOCK_DESCRIPTOR) 509 pc->req_xfer = 12; 510 else if (page_code == IDETAPE_CAPABILITIES_PAGE) 511 pc->req_xfer = 24; 512 else 513 pc->req_xfer = 50; 514 } 515 516 static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) 517 { 518 ide_hwif_t *hwif = drive->hwif; 519 idetape_tape_t *tape = drive->driver_data; 520 struct ide_atapi_pc *pc = drive->pc; 521 u8 stat; 522 523 stat = hwif->tp_ops->read_status(hwif); 524 525 if (stat & ATA_DSC) { 526 if (stat & ATA_ERR) { 527 /* Error detected */ 528 if (pc->c[0] != TEST_UNIT_READY) 529 printk(KERN_ERR "ide-tape: %s: I/O error, ", 530 tape->name); 531 /* Retry operation */ 532 ide_retry_pc(drive); 533 return ide_stopped; 534 } 535 pc->error = 0; 536 } else { 537 pc->error = IDE_DRV_ERROR_GENERAL; 538 drive->failed_pc = NULL; 539 } 540 drive->pc_callback(drive, 0); 541 return ide_stopped; 542 } 543 544 static void ide_tape_create_rw_cmd(idetape_tape_t *tape, 545 struct ide_atapi_pc *pc, struct request *rq, 546 u8 opcode) 547 { 548 unsigned int length = blk_rq_sectors(rq) / (tape->blk_size >> 9); 549 550 ide_init_pc(pc); 551 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); 552 pc->c[1] = 1; 553 554 if (blk_rq_bytes(rq) == tape->buffer_size) 555 pc->flags |= PC_FLAG_DMA_OK; 556 557 if (opcode == READ_6) 558 pc->c[0] = READ_6; 559 else if (opcode == WRITE_6) { 560 pc->c[0] = WRITE_6; 561 pc->flags |= PC_FLAG_WRITING; 562 } 563 564 memcpy(rq->cmd, pc->c, 12); 565 } 566 567 static ide_startstop_t idetape_do_request(ide_drive_t *drive, 568 struct request *rq, sector_t block) 569 { 570 ide_hwif_t *hwif = drive->hwif; 571 idetape_tape_t *tape = drive->driver_data; 572 struct ide_atapi_pc *pc = NULL; 573 struct ide_cmd cmd; 574 u8 stat; 575 576 ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, sector: %llu, nr_sectors: %u", 577 rq->cmd[0], (unsigned long long)blk_rq_pos(rq), 578 blk_rq_sectors(rq)); 579 580 BUG_ON(!(rq->cmd_type == REQ_TYPE_DRV_PRIV || 581 rq->cmd_type == REQ_TYPE_ATA_SENSE)); 582 583 /* Retry a failed packet command */ 584 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { 585 pc = drive->failed_pc; 586 goto out; 587 } 588 589 /* 590 * If the tape is still busy, postpone our request and service 591 * the other device meanwhile. 592 */ 593 stat = hwif->tp_ops->read_status(hwif); 594 595 if ((drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) == 0 && 596 (rq->cmd[13] & REQ_IDETAPE_PC2) == 0) 597 drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; 598 599 if (drive->dev_flags & IDE_DFLAG_POST_RESET) { 600 drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; 601 drive->dev_flags &= ~IDE_DFLAG_POST_RESET; 602 } 603 604 if (!(drive->atapi_flags & IDE_AFLAG_IGNORE_DSC) && 605 !(stat & ATA_DSC)) { 606 if (!tape->postponed_rq) { 607 tape->dsc_polling_start = jiffies; 608 tape->dsc_poll_freq = tape->best_dsc_rw_freq; 609 tape->dsc_timeout = jiffies + IDETAPE_DSC_RW_TIMEOUT; 610 } else if (time_after(jiffies, tape->dsc_timeout)) { 611 printk(KERN_ERR "ide-tape: %s: DSC timeout\n", 612 tape->name); 613 if (rq->cmd[13] & REQ_IDETAPE_PC2) { 614 idetape_media_access_finished(drive); 615 return ide_stopped; 616 } else { 617 return ide_do_reset(drive); 618 } 619 } else if (time_after(jiffies, 620 tape->dsc_polling_start + 621 IDETAPE_DSC_MA_THRESHOLD)) 622 tape->dsc_poll_freq = IDETAPE_DSC_MA_SLOW; 623 ide_tape_stall_queue(drive); 624 return ide_stopped; 625 } else { 626 drive->atapi_flags &= ~IDE_AFLAG_IGNORE_DSC; 627 tape->postponed_rq = false; 628 } 629 630 if (rq->cmd[13] & REQ_IDETAPE_READ) { 631 pc = &tape->queued_pc; 632 ide_tape_create_rw_cmd(tape, pc, rq, READ_6); 633 goto out; 634 } 635 if (rq->cmd[13] & REQ_IDETAPE_WRITE) { 636 pc = &tape->queued_pc; 637 ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); 638 goto out; 639 } 640 if (rq->cmd[13] & REQ_IDETAPE_PC1) { 641 pc = (struct ide_atapi_pc *)rq->special; 642 rq->cmd[13] &= ~(REQ_IDETAPE_PC1); 643 rq->cmd[13] |= REQ_IDETAPE_PC2; 644 goto out; 645 } 646 if (rq->cmd[13] & REQ_IDETAPE_PC2) { 647 idetape_media_access_finished(drive); 648 return ide_stopped; 649 } 650 BUG(); 651 652 out: 653 /* prepare sense request for this command */ 654 ide_prep_sense(drive, rq); 655 656 memset(&cmd, 0, sizeof(cmd)); 657 658 if (rq_data_dir(rq)) 659 cmd.tf_flags |= IDE_TFLAG_WRITE; 660 661 cmd.rq = rq; 662 663 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); 664 ide_map_sg(drive, &cmd); 665 666 return ide_tape_issue_pc(drive, &cmd, pc); 667 } 668 669 /* 670 * Write a filemark if write_filemark=1. Flush the device buffers without 671 * writing a filemark otherwise. 672 */ 673 static void idetape_create_write_filemark_cmd(ide_drive_t *drive, 674 struct ide_atapi_pc *pc, int write_filemark) 675 { 676 ide_init_pc(pc); 677 pc->c[0] = WRITE_FILEMARKS; 678 pc->c[4] = write_filemark; 679 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 680 } 681 682 static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) 683 { 684 idetape_tape_t *tape = drive->driver_data; 685 struct gendisk *disk = tape->disk; 686 int load_attempted = 0; 687 688 /* Wait for the tape to become ready */ 689 set_bit(ilog2(IDE_AFLAG_MEDIUM_PRESENT), &drive->atapi_flags); 690 timeout += jiffies; 691 while (time_before(jiffies, timeout)) { 692 if (ide_do_test_unit_ready(drive, disk) == 0) 693 return 0; 694 if ((tape->sense_key == 2 && tape->asc == 4 && tape->ascq == 2) 695 || (tape->asc == 0x3A)) { 696 /* no media */ 697 if (load_attempted) 698 return -ENOMEDIUM; 699 ide_do_start_stop(drive, disk, IDETAPE_LU_LOAD_MASK); 700 load_attempted = 1; 701 /* not about to be ready */ 702 } else if (!(tape->sense_key == 2 && tape->asc == 4 && 703 (tape->ascq == 1 || tape->ascq == 8))) 704 return -EIO; 705 msleep(100); 706 } 707 return -EIO; 708 } 709 710 static int idetape_flush_tape_buffers(ide_drive_t *drive) 711 { 712 struct ide_tape_obj *tape = drive->driver_data; 713 struct ide_atapi_pc pc; 714 int rc; 715 716 idetape_create_write_filemark_cmd(drive, &pc, 0); 717 rc = ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0); 718 if (rc) 719 return rc; 720 idetape_wait_ready(drive, 60 * 5 * HZ); 721 return 0; 722 } 723 724 static int ide_tape_read_position(ide_drive_t *drive) 725 { 726 idetape_tape_t *tape = drive->driver_data; 727 struct ide_atapi_pc pc; 728 u8 buf[20]; 729 730 ide_debug_log(IDE_DBG_FUNC, "enter"); 731 732 /* prep cmd */ 733 ide_init_pc(&pc); 734 pc.c[0] = READ_POSITION; 735 pc.req_xfer = 20; 736 737 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) 738 return -1; 739 740 if (!pc.error) { 741 ide_debug_log(IDE_DBG_FUNC, "BOP - %s", 742 (buf[0] & 0x80) ? "Yes" : "No"); 743 ide_debug_log(IDE_DBG_FUNC, "EOP - %s", 744 (buf[0] & 0x40) ? "Yes" : "No"); 745 746 if (buf[0] & 0x4) { 747 printk(KERN_INFO "ide-tape: Block location is unknown" 748 "to the tape\n"); 749 clear_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), 750 &drive->atapi_flags); 751 return -1; 752 } else { 753 ide_debug_log(IDE_DBG_FUNC, "Block Location: %u", 754 be32_to_cpup((__be32 *)&buf[4])); 755 756 tape->partition = buf[1]; 757 tape->first_frame = be32_to_cpup((__be32 *)&buf[4]); 758 set_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), 759 &drive->atapi_flags); 760 } 761 } 762 763 return tape->first_frame; 764 } 765 766 static void idetape_create_locate_cmd(ide_drive_t *drive, 767 struct ide_atapi_pc *pc, 768 unsigned int block, u8 partition, int skip) 769 { 770 ide_init_pc(pc); 771 pc->c[0] = POSITION_TO_ELEMENT; 772 pc->c[1] = 2; 773 put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]); 774 pc->c[8] = partition; 775 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 776 } 777 778 static void __ide_tape_discard_merge_buffer(ide_drive_t *drive) 779 { 780 idetape_tape_t *tape = drive->driver_data; 781 782 if (tape->chrdev_dir != IDETAPE_DIR_READ) 783 return; 784 785 clear_bit(ilog2(IDE_AFLAG_FILEMARK), &drive->atapi_flags); 786 tape->valid = 0; 787 if (tape->buf != NULL) { 788 kfree(tape->buf); 789 tape->buf = NULL; 790 } 791 792 tape->chrdev_dir = IDETAPE_DIR_NONE; 793 } 794 795 /* 796 * Position the tape to the requested block using the LOCATE packet command. 797 * A READ POSITION command is then issued to check where we are positioned. Like 798 * all higher level operations, we queue the commands at the tail of the request 799 * queue and wait for their completion. 800 */ 801 static int idetape_position_tape(ide_drive_t *drive, unsigned int block, 802 u8 partition, int skip) 803 { 804 idetape_tape_t *tape = drive->driver_data; 805 struct gendisk *disk = tape->disk; 806 int ret; 807 struct ide_atapi_pc pc; 808 809 if (tape->chrdev_dir == IDETAPE_DIR_READ) 810 __ide_tape_discard_merge_buffer(drive); 811 idetape_wait_ready(drive, 60 * 5 * HZ); 812 idetape_create_locate_cmd(drive, &pc, block, partition, skip); 813 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 814 if (ret) 815 return ret; 816 817 ret = ide_tape_read_position(drive); 818 if (ret < 0) 819 return ret; 820 return 0; 821 } 822 823 static void ide_tape_discard_merge_buffer(ide_drive_t *drive, 824 int restore_position) 825 { 826 idetape_tape_t *tape = drive->driver_data; 827 int seek, position; 828 829 __ide_tape_discard_merge_buffer(drive); 830 if (restore_position) { 831 position = ide_tape_read_position(drive); 832 seek = position > 0 ? position : 0; 833 if (idetape_position_tape(drive, seek, 0, 0)) { 834 printk(KERN_INFO "ide-tape: %s: position_tape failed in" 835 " %s\n", tape->name, __func__); 836 return; 837 } 838 } 839 } 840 841 /* 842 * Generate a read/write request for the block device interface and wait for it 843 * to be serviced. 844 */ 845 static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size) 846 { 847 idetape_tape_t *tape = drive->driver_data; 848 struct request *rq; 849 int ret; 850 851 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, size: %d", cmd, size); 852 853 BUG_ON(cmd != REQ_IDETAPE_READ && cmd != REQ_IDETAPE_WRITE); 854 BUG_ON(size < 0 || size % tape->blk_size); 855 856 rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); 857 rq->cmd_type = REQ_TYPE_DRV_PRIV; 858 rq->cmd[13] = cmd; 859 rq->rq_disk = tape->disk; 860 rq->__sector = tape->first_frame; 861 862 if (size) { 863 ret = blk_rq_map_kern(drive->queue, rq, tape->buf, size, 864 __GFP_RECLAIM); 865 if (ret) 866 goto out_put; 867 } 868 869 blk_execute_rq(drive->queue, tape->disk, rq, 0); 870 871 /* calculate the number of transferred bytes and update buffer state */ 872 size -= rq->resid_len; 873 tape->cur = tape->buf; 874 if (cmd == REQ_IDETAPE_READ) 875 tape->valid = size; 876 else 877 tape->valid = 0; 878 879 ret = size; 880 if (rq->errors == IDE_DRV_ERROR_GENERAL) 881 ret = -EIO; 882 out_put: 883 blk_put_request(rq); 884 return ret; 885 } 886 887 static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc) 888 { 889 ide_init_pc(pc); 890 pc->c[0] = INQUIRY; 891 pc->c[4] = 254; 892 pc->req_xfer = 254; 893 } 894 895 static void idetape_create_rewind_cmd(ide_drive_t *drive, 896 struct ide_atapi_pc *pc) 897 { 898 ide_init_pc(pc); 899 pc->c[0] = REZERO_UNIT; 900 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 901 } 902 903 static void idetape_create_erase_cmd(struct ide_atapi_pc *pc) 904 { 905 ide_init_pc(pc); 906 pc->c[0] = ERASE; 907 pc->c[1] = 1; 908 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 909 } 910 911 static void idetape_create_space_cmd(struct ide_atapi_pc *pc, int count, u8 cmd) 912 { 913 ide_init_pc(pc); 914 pc->c[0] = SPACE; 915 put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]); 916 pc->c[1] = cmd; 917 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 918 } 919 920 static void ide_tape_flush_merge_buffer(ide_drive_t *drive) 921 { 922 idetape_tape_t *tape = drive->driver_data; 923 924 if (tape->chrdev_dir != IDETAPE_DIR_WRITE) { 925 printk(KERN_ERR "ide-tape: bug: Trying to empty merge buffer" 926 " but we are not writing.\n"); 927 return; 928 } 929 if (tape->buf) { 930 size_t aligned = roundup(tape->valid, tape->blk_size); 931 932 memset(tape->cur, 0, aligned - tape->valid); 933 idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE, aligned); 934 kfree(tape->buf); 935 tape->buf = NULL; 936 } 937 tape->chrdev_dir = IDETAPE_DIR_NONE; 938 } 939 940 static int idetape_init_rw(ide_drive_t *drive, int dir) 941 { 942 idetape_tape_t *tape = drive->driver_data; 943 int rc; 944 945 BUG_ON(dir != IDETAPE_DIR_READ && dir != IDETAPE_DIR_WRITE); 946 947 if (tape->chrdev_dir == dir) 948 return 0; 949 950 if (tape->chrdev_dir == IDETAPE_DIR_READ) 951 ide_tape_discard_merge_buffer(drive, 1); 952 else if (tape->chrdev_dir == IDETAPE_DIR_WRITE) { 953 ide_tape_flush_merge_buffer(drive); 954 idetape_flush_tape_buffers(drive); 955 } 956 957 if (tape->buf || tape->valid) { 958 printk(KERN_ERR "ide-tape: valid should be 0 now\n"); 959 tape->valid = 0; 960 } 961 962 tape->buf = kmalloc(tape->buffer_size, GFP_KERNEL); 963 if (!tape->buf) 964 return -ENOMEM; 965 tape->chrdev_dir = dir; 966 tape->cur = tape->buf; 967 968 /* 969 * Issue a 0 rw command to ensure that DSC handshake is 970 * switched from completion mode to buffer available mode. No 971 * point in issuing this if DSC overlap isn't supported, some 972 * drives (Seagate STT3401A) will return an error. 973 */ 974 if (drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) { 975 int cmd = dir == IDETAPE_DIR_READ ? REQ_IDETAPE_READ 976 : REQ_IDETAPE_WRITE; 977 978 rc = idetape_queue_rw_tail(drive, cmd, 0); 979 if (rc < 0) { 980 kfree(tape->buf); 981 tape->buf = NULL; 982 tape->chrdev_dir = IDETAPE_DIR_NONE; 983 return rc; 984 } 985 } 986 987 return 0; 988 } 989 990 static void idetape_pad_zeros(ide_drive_t *drive, int bcount) 991 { 992 idetape_tape_t *tape = drive->driver_data; 993 994 memset(tape->buf, 0, tape->buffer_size); 995 996 while (bcount) { 997 unsigned int count = min(tape->buffer_size, bcount); 998 999 idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE, count); 1000 bcount -= count; 1001 } 1002 } 1003 1004 /* 1005 * Rewinds the tape to the Beginning Of the current Partition (BOP). We 1006 * currently support only one partition. 1007 */ 1008 static int idetape_rewind_tape(ide_drive_t *drive) 1009 { 1010 struct ide_tape_obj *tape = drive->driver_data; 1011 struct gendisk *disk = tape->disk; 1012 struct ide_atapi_pc pc; 1013 int ret; 1014 1015 ide_debug_log(IDE_DBG_FUNC, "enter"); 1016 1017 idetape_create_rewind_cmd(drive, &pc); 1018 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 1019 if (ret) 1020 return ret; 1021 1022 ret = ide_tape_read_position(drive); 1023 if (ret < 0) 1024 return ret; 1025 return 0; 1026 } 1027 1028 /* mtio.h compatible commands should be issued to the chrdev interface. */ 1029 static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, 1030 unsigned long arg) 1031 { 1032 idetape_tape_t *tape = drive->driver_data; 1033 void __user *argp = (void __user *)arg; 1034 1035 struct idetape_config { 1036 int dsc_rw_frequency; 1037 int dsc_media_access_frequency; 1038 int nr_stages; 1039 } config; 1040 1041 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%04x", cmd); 1042 1043 switch (cmd) { 1044 case 0x0340: 1045 if (copy_from_user(&config, argp, sizeof(config))) 1046 return -EFAULT; 1047 tape->best_dsc_rw_freq = config.dsc_rw_frequency; 1048 break; 1049 case 0x0350: 1050 memset(&config, 0, sizeof(config)); 1051 config.dsc_rw_frequency = (int) tape->best_dsc_rw_freq; 1052 config.nr_stages = 1; 1053 if (copy_to_user(argp, &config, sizeof(config))) 1054 return -EFAULT; 1055 break; 1056 default: 1057 return -EIO; 1058 } 1059 return 0; 1060 } 1061 1062 static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op, 1063 int mt_count) 1064 { 1065 idetape_tape_t *tape = drive->driver_data; 1066 struct gendisk *disk = tape->disk; 1067 struct ide_atapi_pc pc; 1068 int retval, count = 0; 1069 int sprev = !!(tape->caps[4] & 0x20); 1070 1071 1072 ide_debug_log(IDE_DBG_FUNC, "mt_op: %d, mt_count: %d", mt_op, mt_count); 1073 1074 if (mt_count == 0) 1075 return 0; 1076 if (MTBSF == mt_op || MTBSFM == mt_op) { 1077 if (!sprev) 1078 return -EIO; 1079 mt_count = -mt_count; 1080 } 1081 1082 if (tape->chrdev_dir == IDETAPE_DIR_READ) { 1083 tape->valid = 0; 1084 if (test_and_clear_bit(ilog2(IDE_AFLAG_FILEMARK), 1085 &drive->atapi_flags)) 1086 ++count; 1087 ide_tape_discard_merge_buffer(drive, 0); 1088 } 1089 1090 switch (mt_op) { 1091 case MTFSF: 1092 case MTBSF: 1093 idetape_create_space_cmd(&pc, mt_count - count, 1094 IDETAPE_SPACE_OVER_FILEMARK); 1095 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 1096 case MTFSFM: 1097 case MTBSFM: 1098 if (!sprev) 1099 return -EIO; 1100 retval = idetape_space_over_filemarks(drive, MTFSF, 1101 mt_count - count); 1102 if (retval) 1103 return retval; 1104 count = (MTBSFM == mt_op ? 1 : -1); 1105 return idetape_space_over_filemarks(drive, MTFSF, count); 1106 default: 1107 printk(KERN_ERR "ide-tape: MTIO operation %d not supported\n", 1108 mt_op); 1109 return -EIO; 1110 } 1111 } 1112 1113 /* 1114 * Our character device read / write functions. 1115 * 1116 * The tape is optimized to maximize throughput when it is transferring an 1117 * integral number of the "continuous transfer limit", which is a parameter of 1118 * the specific tape (26kB on my particular tape, 32kB for Onstream). 1119 * 1120 * As of version 1.3 of the driver, the character device provides an abstract 1121 * continuous view of the media - any mix of block sizes (even 1 byte) on the 1122 * same backup/restore procedure is supported. The driver will internally 1123 * convert the requests to the recommended transfer unit, so that an unmatch 1124 * between the user's block size to the recommended size will only result in a 1125 * (slightly) increased driver overhead, but will no longer hit performance. 1126 * This is not applicable to Onstream. 1127 */ 1128 static ssize_t idetape_chrdev_read(struct file *file, char __user *buf, 1129 size_t count, loff_t *ppos) 1130 { 1131 struct ide_tape_obj *tape = file->private_data; 1132 ide_drive_t *drive = tape->drive; 1133 size_t done = 0; 1134 ssize_t ret = 0; 1135 int rc; 1136 1137 ide_debug_log(IDE_DBG_FUNC, "count %Zd", count); 1138 1139 if (tape->chrdev_dir != IDETAPE_DIR_READ) { 1140 if (test_bit(ilog2(IDE_AFLAG_DETECT_BS), &drive->atapi_flags)) 1141 if (count > tape->blk_size && 1142 (count % tape->blk_size) == 0) 1143 tape->user_bs_factor = count / tape->blk_size; 1144 } 1145 1146 rc = idetape_init_rw(drive, IDETAPE_DIR_READ); 1147 if (rc < 0) 1148 return rc; 1149 1150 while (done < count) { 1151 size_t todo; 1152 1153 /* refill if staging buffer is empty */ 1154 if (!tape->valid) { 1155 /* If we are at a filemark, nothing more to read */ 1156 if (test_bit(ilog2(IDE_AFLAG_FILEMARK), 1157 &drive->atapi_flags)) 1158 break; 1159 /* read */ 1160 if (idetape_queue_rw_tail(drive, REQ_IDETAPE_READ, 1161 tape->buffer_size) <= 0) 1162 break; 1163 } 1164 1165 /* copy out */ 1166 todo = min_t(size_t, count - done, tape->valid); 1167 if (copy_to_user(buf + done, tape->cur, todo)) 1168 ret = -EFAULT; 1169 1170 tape->cur += todo; 1171 tape->valid -= todo; 1172 done += todo; 1173 } 1174 1175 if (!done && test_bit(ilog2(IDE_AFLAG_FILEMARK), &drive->atapi_flags)) { 1176 idetape_space_over_filemarks(drive, MTFSF, 1); 1177 return 0; 1178 } 1179 1180 return ret ? ret : done; 1181 } 1182 1183 static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, 1184 size_t count, loff_t *ppos) 1185 { 1186 struct ide_tape_obj *tape = file->private_data; 1187 ide_drive_t *drive = tape->drive; 1188 size_t done = 0; 1189 ssize_t ret = 0; 1190 int rc; 1191 1192 /* The drive is write protected. */ 1193 if (tape->write_prot) 1194 return -EACCES; 1195 1196 ide_debug_log(IDE_DBG_FUNC, "count %Zd", count); 1197 1198 /* Initialize write operation */ 1199 rc = idetape_init_rw(drive, IDETAPE_DIR_WRITE); 1200 if (rc < 0) 1201 return rc; 1202 1203 while (done < count) { 1204 size_t todo; 1205 1206 /* flush if staging buffer is full */ 1207 if (tape->valid == tape->buffer_size && 1208 idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE, 1209 tape->buffer_size) <= 0) 1210 return rc; 1211 1212 /* copy in */ 1213 todo = min_t(size_t, count - done, 1214 tape->buffer_size - tape->valid); 1215 if (copy_from_user(tape->cur, buf + done, todo)) 1216 ret = -EFAULT; 1217 1218 tape->cur += todo; 1219 tape->valid += todo; 1220 done += todo; 1221 } 1222 1223 return ret ? ret : done; 1224 } 1225 1226 static int idetape_write_filemark(ide_drive_t *drive) 1227 { 1228 struct ide_tape_obj *tape = drive->driver_data; 1229 struct ide_atapi_pc pc; 1230 1231 /* Write a filemark */ 1232 idetape_create_write_filemark_cmd(drive, &pc, 1); 1233 if (ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0)) { 1234 printk(KERN_ERR "ide-tape: Couldn't write a filemark\n"); 1235 return -EIO; 1236 } 1237 return 0; 1238 } 1239 1240 /* 1241 * Called from idetape_chrdev_ioctl when the general mtio MTIOCTOP ioctl is 1242 * requested. 1243 * 1244 * Note: MTBSF and MTBSFM are not supported when the tape doesn't support 1245 * spacing over filemarks in the reverse direction. In this case, MTFSFM is also 1246 * usually not supported. 1247 * 1248 * The following commands are currently not supported: 1249 * 1250 * MTFSS, MTBSS, MTWSM, MTSETDENSITY, MTSETDRVBUFFER, MT_ST_BOOLEANS, 1251 * MT_ST_WRITE_THRESHOLD. 1252 */ 1253 static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) 1254 { 1255 idetape_tape_t *tape = drive->driver_data; 1256 struct gendisk *disk = tape->disk; 1257 struct ide_atapi_pc pc; 1258 int i, retval; 1259 1260 ide_debug_log(IDE_DBG_FUNC, "MTIOCTOP ioctl: mt_op: %d, mt_count: %d", 1261 mt_op, mt_count); 1262 1263 switch (mt_op) { 1264 case MTFSF: 1265 case MTFSFM: 1266 case MTBSF: 1267 case MTBSFM: 1268 if (!mt_count) 1269 return 0; 1270 return idetape_space_over_filemarks(drive, mt_op, mt_count); 1271 default: 1272 break; 1273 } 1274 1275 switch (mt_op) { 1276 case MTWEOF: 1277 if (tape->write_prot) 1278 return -EACCES; 1279 ide_tape_discard_merge_buffer(drive, 1); 1280 for (i = 0; i < mt_count; i++) { 1281 retval = idetape_write_filemark(drive); 1282 if (retval) 1283 return retval; 1284 } 1285 return 0; 1286 case MTREW: 1287 ide_tape_discard_merge_buffer(drive, 0); 1288 if (idetape_rewind_tape(drive)) 1289 return -EIO; 1290 return 0; 1291 case MTLOAD: 1292 ide_tape_discard_merge_buffer(drive, 0); 1293 return ide_do_start_stop(drive, disk, IDETAPE_LU_LOAD_MASK); 1294 case MTUNLOAD: 1295 case MTOFFL: 1296 /* 1297 * If door is locked, attempt to unlock before 1298 * attempting to eject. 1299 */ 1300 if (tape->door_locked) { 1301 if (!ide_set_media_lock(drive, disk, 0)) 1302 tape->door_locked = DOOR_UNLOCKED; 1303 } 1304 ide_tape_discard_merge_buffer(drive, 0); 1305 retval = ide_do_start_stop(drive, disk, !IDETAPE_LU_LOAD_MASK); 1306 if (!retval) 1307 clear_bit(ilog2(IDE_AFLAG_MEDIUM_PRESENT), 1308 &drive->atapi_flags); 1309 return retval; 1310 case MTNOP: 1311 ide_tape_discard_merge_buffer(drive, 0); 1312 return idetape_flush_tape_buffers(drive); 1313 case MTRETEN: 1314 ide_tape_discard_merge_buffer(drive, 0); 1315 return ide_do_start_stop(drive, disk, 1316 IDETAPE_LU_RETENSION_MASK | IDETAPE_LU_LOAD_MASK); 1317 case MTEOM: 1318 idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); 1319 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 1320 case MTERASE: 1321 (void)idetape_rewind_tape(drive); 1322 idetape_create_erase_cmd(&pc); 1323 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 1324 case MTSETBLK: 1325 if (mt_count) { 1326 if (mt_count < tape->blk_size || 1327 mt_count % tape->blk_size) 1328 return -EIO; 1329 tape->user_bs_factor = mt_count / tape->blk_size; 1330 clear_bit(ilog2(IDE_AFLAG_DETECT_BS), 1331 &drive->atapi_flags); 1332 } else 1333 set_bit(ilog2(IDE_AFLAG_DETECT_BS), 1334 &drive->atapi_flags); 1335 return 0; 1336 case MTSEEK: 1337 ide_tape_discard_merge_buffer(drive, 0); 1338 return idetape_position_tape(drive, 1339 mt_count * tape->user_bs_factor, tape->partition, 0); 1340 case MTSETPART: 1341 ide_tape_discard_merge_buffer(drive, 0); 1342 return idetape_position_tape(drive, 0, mt_count, 0); 1343 case MTFSR: 1344 case MTBSR: 1345 case MTLOCK: 1346 retval = ide_set_media_lock(drive, disk, 1); 1347 if (retval) 1348 return retval; 1349 tape->door_locked = DOOR_EXPLICITLY_LOCKED; 1350 return 0; 1351 case MTUNLOCK: 1352 retval = ide_set_media_lock(drive, disk, 0); 1353 if (retval) 1354 return retval; 1355 tape->door_locked = DOOR_UNLOCKED; 1356 return 0; 1357 default: 1358 printk(KERN_ERR "ide-tape: MTIO operation %d not supported\n", 1359 mt_op); 1360 return -EIO; 1361 } 1362 } 1363 1364 /* 1365 * Our character device ioctls. General mtio.h magnetic io commands are 1366 * supported here, and not in the corresponding block interface. Our own 1367 * ide-tape ioctls are supported on both interfaces. 1368 */ 1369 static long do_idetape_chrdev_ioctl(struct file *file, 1370 unsigned int cmd, unsigned long arg) 1371 { 1372 struct ide_tape_obj *tape = file->private_data; 1373 ide_drive_t *drive = tape->drive; 1374 struct mtop mtop; 1375 struct mtget mtget; 1376 struct mtpos mtpos; 1377 int block_offset = 0, position = tape->first_frame; 1378 void __user *argp = (void __user *)arg; 1379 1380 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x", cmd); 1381 1382 if (tape->chrdev_dir == IDETAPE_DIR_WRITE) { 1383 ide_tape_flush_merge_buffer(drive); 1384 idetape_flush_tape_buffers(drive); 1385 } 1386 if (cmd == MTIOCGET || cmd == MTIOCPOS) { 1387 block_offset = tape->valid / 1388 (tape->blk_size * tape->user_bs_factor); 1389 position = ide_tape_read_position(drive); 1390 if (position < 0) 1391 return -EIO; 1392 } 1393 switch (cmd) { 1394 case MTIOCTOP: 1395 if (copy_from_user(&mtop, argp, sizeof(struct mtop))) 1396 return -EFAULT; 1397 return idetape_mtioctop(drive, mtop.mt_op, mtop.mt_count); 1398 case MTIOCGET: 1399 memset(&mtget, 0, sizeof(struct mtget)); 1400 mtget.mt_type = MT_ISSCSI2; 1401 mtget.mt_blkno = position / tape->user_bs_factor - block_offset; 1402 mtget.mt_dsreg = 1403 ((tape->blk_size * tape->user_bs_factor) 1404 << MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK; 1405 1406 if (tape->drv_write_prot) 1407 mtget.mt_gstat |= GMT_WR_PROT(0xffffffff); 1408 1409 if (copy_to_user(argp, &mtget, sizeof(struct mtget))) 1410 return -EFAULT; 1411 return 0; 1412 case MTIOCPOS: 1413 mtpos.mt_blkno = position / tape->user_bs_factor - block_offset; 1414 if (copy_to_user(argp, &mtpos, sizeof(struct mtpos))) 1415 return -EFAULT; 1416 return 0; 1417 default: 1418 if (tape->chrdev_dir == IDETAPE_DIR_READ) 1419 ide_tape_discard_merge_buffer(drive, 1); 1420 return idetape_blkdev_ioctl(drive, cmd, arg); 1421 } 1422 } 1423 1424 static long idetape_chrdev_ioctl(struct file *file, 1425 unsigned int cmd, unsigned long arg) 1426 { 1427 long ret; 1428 mutex_lock(&ide_tape_mutex); 1429 ret = do_idetape_chrdev_ioctl(file, cmd, arg); 1430 mutex_unlock(&ide_tape_mutex); 1431 return ret; 1432 } 1433 1434 /* 1435 * Do a mode sense page 0 with block descriptor and if it succeeds set the tape 1436 * block size with the reported value. 1437 */ 1438 static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) 1439 { 1440 idetape_tape_t *tape = drive->driver_data; 1441 struct ide_atapi_pc pc; 1442 u8 buf[12]; 1443 1444 idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); 1445 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { 1446 printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); 1447 if (tape->blk_size == 0) { 1448 printk(KERN_WARNING "ide-tape: Cannot deal with zero " 1449 "block size, assuming 32k\n"); 1450 tape->blk_size = 32768; 1451 } 1452 return; 1453 } 1454 tape->blk_size = (buf[4 + 5] << 16) + 1455 (buf[4 + 6] << 8) + 1456 buf[4 + 7]; 1457 tape->drv_write_prot = (buf[2] & 0x80) >> 7; 1458 1459 ide_debug_log(IDE_DBG_FUNC, "blk_size: %d, write_prot: %d", 1460 tape->blk_size, tape->drv_write_prot); 1461 } 1462 1463 static int idetape_chrdev_open(struct inode *inode, struct file *filp) 1464 { 1465 unsigned int minor = iminor(inode), i = minor & ~0xc0; 1466 ide_drive_t *drive; 1467 idetape_tape_t *tape; 1468 int retval; 1469 1470 if (i >= MAX_HWIFS * MAX_DRIVES) 1471 return -ENXIO; 1472 1473 mutex_lock(&idetape_chrdev_mutex); 1474 1475 tape = ide_tape_get(NULL, true, i); 1476 if (!tape) { 1477 mutex_unlock(&idetape_chrdev_mutex); 1478 return -ENXIO; 1479 } 1480 1481 drive = tape->drive; 1482 filp->private_data = tape; 1483 1484 ide_debug_log(IDE_DBG_FUNC, "enter"); 1485 1486 /* 1487 * We really want to do nonseekable_open(inode, filp); here, but some 1488 * versions of tar incorrectly call lseek on tapes and bail out if that 1489 * fails. So we disallow pread() and pwrite(), but permit lseeks. 1490 */ 1491 filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); 1492 1493 1494 if (test_and_set_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags)) { 1495 retval = -EBUSY; 1496 goto out_put_tape; 1497 } 1498 1499 retval = idetape_wait_ready(drive, 60 * HZ); 1500 if (retval) { 1501 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); 1502 printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name); 1503 goto out_put_tape; 1504 } 1505 1506 ide_tape_read_position(drive); 1507 if (!test_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), &drive->atapi_flags)) 1508 (void)idetape_rewind_tape(drive); 1509 1510 /* Read block size and write protect status from drive. */ 1511 ide_tape_get_bsize_from_bdesc(drive); 1512 1513 /* Set write protect flag if device is opened as read-only. */ 1514 if ((filp->f_flags & O_ACCMODE) == O_RDONLY) 1515 tape->write_prot = 1; 1516 else 1517 tape->write_prot = tape->drv_write_prot; 1518 1519 /* Make sure drive isn't write protected if user wants to write. */ 1520 if (tape->write_prot) { 1521 if ((filp->f_flags & O_ACCMODE) == O_WRONLY || 1522 (filp->f_flags & O_ACCMODE) == O_RDWR) { 1523 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); 1524 retval = -EROFS; 1525 goto out_put_tape; 1526 } 1527 } 1528 1529 /* Lock the tape drive door so user can't eject. */ 1530 if (tape->chrdev_dir == IDETAPE_DIR_NONE) { 1531 if (!ide_set_media_lock(drive, tape->disk, 1)) { 1532 if (tape->door_locked != DOOR_EXPLICITLY_LOCKED) 1533 tape->door_locked = DOOR_LOCKED; 1534 } 1535 } 1536 mutex_unlock(&idetape_chrdev_mutex); 1537 1538 return 0; 1539 1540 out_put_tape: 1541 ide_tape_put(tape); 1542 1543 mutex_unlock(&idetape_chrdev_mutex); 1544 1545 return retval; 1546 } 1547 1548 static void idetape_write_release(ide_drive_t *drive, unsigned int minor) 1549 { 1550 idetape_tape_t *tape = drive->driver_data; 1551 1552 ide_tape_flush_merge_buffer(drive); 1553 tape->buf = kmalloc(tape->buffer_size, GFP_KERNEL); 1554 if (tape->buf != NULL) { 1555 idetape_pad_zeros(drive, tape->blk_size * 1556 (tape->user_bs_factor - 1)); 1557 kfree(tape->buf); 1558 tape->buf = NULL; 1559 } 1560 idetape_write_filemark(drive); 1561 idetape_flush_tape_buffers(drive); 1562 idetape_flush_tape_buffers(drive); 1563 } 1564 1565 static int idetape_chrdev_release(struct inode *inode, struct file *filp) 1566 { 1567 struct ide_tape_obj *tape = filp->private_data; 1568 ide_drive_t *drive = tape->drive; 1569 unsigned int minor = iminor(inode); 1570 1571 mutex_lock(&idetape_chrdev_mutex); 1572 1573 tape = drive->driver_data; 1574 1575 ide_debug_log(IDE_DBG_FUNC, "enter"); 1576 1577 if (tape->chrdev_dir == IDETAPE_DIR_WRITE) 1578 idetape_write_release(drive, minor); 1579 if (tape->chrdev_dir == IDETAPE_DIR_READ) { 1580 if (minor < 128) 1581 ide_tape_discard_merge_buffer(drive, 1); 1582 } 1583 1584 if (minor < 128 && test_bit(ilog2(IDE_AFLAG_MEDIUM_PRESENT), 1585 &drive->atapi_flags)) 1586 (void) idetape_rewind_tape(drive); 1587 1588 if (tape->chrdev_dir == IDETAPE_DIR_NONE) { 1589 if (tape->door_locked == DOOR_LOCKED) { 1590 if (!ide_set_media_lock(drive, tape->disk, 0)) 1591 tape->door_locked = DOOR_UNLOCKED; 1592 } 1593 } 1594 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); 1595 ide_tape_put(tape); 1596 1597 mutex_unlock(&idetape_chrdev_mutex); 1598 1599 return 0; 1600 } 1601 1602 static void idetape_get_inquiry_results(ide_drive_t *drive) 1603 { 1604 idetape_tape_t *tape = drive->driver_data; 1605 struct ide_atapi_pc pc; 1606 u8 pc_buf[256]; 1607 char fw_rev[4], vendor_id[8], product_id[16]; 1608 1609 idetape_create_inquiry_cmd(&pc); 1610 if (ide_queue_pc_tail(drive, tape->disk, &pc, pc_buf, pc.req_xfer)) { 1611 printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", 1612 tape->name); 1613 return; 1614 } 1615 memcpy(vendor_id, &pc_buf[8], 8); 1616 memcpy(product_id, &pc_buf[16], 16); 1617 memcpy(fw_rev, &pc_buf[32], 4); 1618 1619 ide_fixstring(vendor_id, 8, 0); 1620 ide_fixstring(product_id, 16, 0); 1621 ide_fixstring(fw_rev, 4, 0); 1622 1623 printk(KERN_INFO "ide-tape: %s <-> %s: %.8s %.16s rev %.4s\n", 1624 drive->name, tape->name, vendor_id, product_id, fw_rev); 1625 } 1626 1627 /* 1628 * Ask the tape about its various parameters. In particular, we will adjust our 1629 * data transfer buffer size to the recommended value as returned by the tape. 1630 */ 1631 static void idetape_get_mode_sense_results(ide_drive_t *drive) 1632 { 1633 idetape_tape_t *tape = drive->driver_data; 1634 struct ide_atapi_pc pc; 1635 u8 buf[24], *caps; 1636 u8 speed, max_speed; 1637 1638 idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); 1639 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { 1640 printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" 1641 " some default values\n"); 1642 tape->blk_size = 512; 1643 put_unaligned(52, (u16 *)&tape->caps[12]); 1644 put_unaligned(540, (u16 *)&tape->caps[14]); 1645 put_unaligned(6*52, (u16 *)&tape->caps[16]); 1646 return; 1647 } 1648 caps = buf + 4 + buf[3]; 1649 1650 /* convert to host order and save for later use */ 1651 speed = be16_to_cpup((__be16 *)&caps[14]); 1652 max_speed = be16_to_cpup((__be16 *)&caps[8]); 1653 1654 *(u16 *)&caps[8] = max_speed; 1655 *(u16 *)&caps[12] = be16_to_cpup((__be16 *)&caps[12]); 1656 *(u16 *)&caps[14] = speed; 1657 *(u16 *)&caps[16] = be16_to_cpup((__be16 *)&caps[16]); 1658 1659 if (!speed) { 1660 printk(KERN_INFO "ide-tape: %s: invalid tape speed " 1661 "(assuming 650KB/sec)\n", drive->name); 1662 *(u16 *)&caps[14] = 650; 1663 } 1664 if (!max_speed) { 1665 printk(KERN_INFO "ide-tape: %s: invalid max_speed " 1666 "(assuming 650KB/sec)\n", drive->name); 1667 *(u16 *)&caps[8] = 650; 1668 } 1669 1670 memcpy(&tape->caps, caps, 20); 1671 1672 /* device lacks locking support according to capabilities page */ 1673 if ((caps[6] & 1) == 0) 1674 drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; 1675 1676 if (caps[7] & 0x02) 1677 tape->blk_size = 512; 1678 else if (caps[7] & 0x04) 1679 tape->blk_size = 1024; 1680 } 1681 1682 #ifdef CONFIG_IDE_PROC_FS 1683 #define ide_tape_devset_get(name, field) \ 1684 static int get_##name(ide_drive_t *drive) \ 1685 { \ 1686 idetape_tape_t *tape = drive->driver_data; \ 1687 return tape->field; \ 1688 } 1689 1690 #define ide_tape_devset_set(name, field) \ 1691 static int set_##name(ide_drive_t *drive, int arg) \ 1692 { \ 1693 idetape_tape_t *tape = drive->driver_data; \ 1694 tape->field = arg; \ 1695 return 0; \ 1696 } 1697 1698 #define ide_tape_devset_rw_field(_name, _field) \ 1699 ide_tape_devset_get(_name, _field) \ 1700 ide_tape_devset_set(_name, _field) \ 1701 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 1702 1703 #define ide_tape_devset_r_field(_name, _field) \ 1704 ide_tape_devset_get(_name, _field) \ 1705 IDE_DEVSET(_name, 0, get_##_name, NULL) 1706 1707 static int mulf_tdsc(ide_drive_t *drive) { return 1000; } 1708 static int divf_tdsc(ide_drive_t *drive) { return HZ; } 1709 static int divf_buffer(ide_drive_t *drive) { return 2; } 1710 static int divf_buffer_size(ide_drive_t *drive) { return 1024; } 1711 1712 ide_devset_rw_flag(dsc_overlap, IDE_DFLAG_DSC_OVERLAP); 1713 1714 ide_tape_devset_rw_field(tdsc, best_dsc_rw_freq); 1715 1716 ide_tape_devset_r_field(avg_speed, avg_speed); 1717 ide_tape_devset_r_field(speed, caps[14]); 1718 ide_tape_devset_r_field(buffer, caps[16]); 1719 ide_tape_devset_r_field(buffer_size, buffer_size); 1720 1721 static const struct ide_proc_devset idetape_settings[] = { 1722 __IDE_PROC_DEVSET(avg_speed, 0, 0xffff, NULL, NULL), 1723 __IDE_PROC_DEVSET(buffer, 0, 0xffff, NULL, divf_buffer), 1724 __IDE_PROC_DEVSET(buffer_size, 0, 0xffff, NULL, divf_buffer_size), 1725 __IDE_PROC_DEVSET(dsc_overlap, 0, 1, NULL, NULL), 1726 __IDE_PROC_DEVSET(speed, 0, 0xffff, NULL, NULL), 1727 __IDE_PROC_DEVSET(tdsc, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX, 1728 mulf_tdsc, divf_tdsc), 1729 { NULL }, 1730 }; 1731 #endif 1732 1733 /* 1734 * The function below is called to: 1735 * 1736 * 1. Initialize our various state variables. 1737 * 2. Ask the tape for its capabilities. 1738 * 3. Allocate a buffer which will be used for data transfer. The buffer size 1739 * is chosen based on the recommendation which we received in step 2. 1740 * 1741 * Note that at this point ide.c already assigned us an irq, so that we can 1742 * queue requests here and wait for their completion. 1743 */ 1744 static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) 1745 { 1746 unsigned long t; 1747 int speed; 1748 int buffer_size; 1749 u16 *ctl = (u16 *)&tape->caps[12]; 1750 1751 ide_debug_log(IDE_DBG_FUNC, "minor: %d", minor); 1752 1753 drive->pc_callback = ide_tape_callback; 1754 1755 drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; 1756 1757 if (drive->hwif->host_flags & IDE_HFLAG_NO_DSC) { 1758 printk(KERN_INFO "ide-tape: %s: disabling DSC overlap\n", 1759 tape->name); 1760 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; 1761 } 1762 1763 /* Seagate Travan drives do not support DSC overlap. */ 1764 if (strstr((char *)&drive->id[ATA_ID_PROD], "Seagate STT3401")) 1765 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; 1766 1767 tape->minor = minor; 1768 tape->name[0] = 'h'; 1769 tape->name[1] = 't'; 1770 tape->name[2] = '0' + minor; 1771 tape->chrdev_dir = IDETAPE_DIR_NONE; 1772 1773 idetape_get_inquiry_results(drive); 1774 idetape_get_mode_sense_results(drive); 1775 ide_tape_get_bsize_from_bdesc(drive); 1776 tape->user_bs_factor = 1; 1777 tape->buffer_size = *ctl * tape->blk_size; 1778 while (tape->buffer_size > 0xffff) { 1779 printk(KERN_NOTICE "ide-tape: decreasing stage size\n"); 1780 *ctl /= 2; 1781 tape->buffer_size = *ctl * tape->blk_size; 1782 } 1783 buffer_size = tape->buffer_size; 1784 1785 /* select the "best" DSC read/write polling freq */ 1786 speed = max(*(u16 *)&tape->caps[14], *(u16 *)&tape->caps[8]); 1787 1788 t = (IDETAPE_FIFO_THRESHOLD * tape->buffer_size * HZ) / (speed * 1000); 1789 1790 /* 1791 * Ensure that the number we got makes sense; limit it within 1792 * IDETAPE_DSC_RW_MIN and IDETAPE_DSC_RW_MAX. 1793 */ 1794 tape->best_dsc_rw_freq = clamp_t(unsigned long, t, IDETAPE_DSC_RW_MIN, 1795 IDETAPE_DSC_RW_MAX); 1796 printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, " 1797 "%ums tDSC%s\n", 1798 drive->name, tape->name, *(u16 *)&tape->caps[14], 1799 (*(u16 *)&tape->caps[16] * 512) / tape->buffer_size, 1800 tape->buffer_size / 1024, 1801 jiffies_to_msecs(tape->best_dsc_rw_freq), 1802 (drive->dev_flags & IDE_DFLAG_USING_DMA) ? ", DMA" : ""); 1803 1804 ide_proc_register_driver(drive, tape->driver); 1805 } 1806 1807 static void ide_tape_remove(ide_drive_t *drive) 1808 { 1809 idetape_tape_t *tape = drive->driver_data; 1810 1811 ide_proc_unregister_driver(drive, tape->driver); 1812 device_del(&tape->dev); 1813 ide_unregister_region(tape->disk); 1814 1815 mutex_lock(&idetape_ref_mutex); 1816 put_device(&tape->dev); 1817 mutex_unlock(&idetape_ref_mutex); 1818 } 1819 1820 static void ide_tape_release(struct device *dev) 1821 { 1822 struct ide_tape_obj *tape = to_ide_drv(dev, ide_tape_obj); 1823 ide_drive_t *drive = tape->drive; 1824 struct gendisk *g = tape->disk; 1825 1826 BUG_ON(tape->valid); 1827 1828 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; 1829 drive->driver_data = NULL; 1830 device_destroy(idetape_sysfs_class, MKDEV(IDETAPE_MAJOR, tape->minor)); 1831 device_destroy(idetape_sysfs_class, 1832 MKDEV(IDETAPE_MAJOR, tape->minor + 128)); 1833 idetape_devs[tape->minor] = NULL; 1834 g->private_data = NULL; 1835 put_disk(g); 1836 kfree(tape); 1837 } 1838 1839 #ifdef CONFIG_IDE_PROC_FS 1840 static int idetape_name_proc_show(struct seq_file *m, void *v) 1841 { 1842 ide_drive_t *drive = (ide_drive_t *) m->private; 1843 idetape_tape_t *tape = drive->driver_data; 1844 1845 seq_printf(m, "%s\n", tape->name); 1846 return 0; 1847 } 1848 1849 static int idetape_name_proc_open(struct inode *inode, struct file *file) 1850 { 1851 return single_open(file, idetape_name_proc_show, PDE_DATA(inode)); 1852 } 1853 1854 static const struct file_operations idetape_name_proc_fops = { 1855 .owner = THIS_MODULE, 1856 .open = idetape_name_proc_open, 1857 .read = seq_read, 1858 .llseek = seq_lseek, 1859 .release = single_release, 1860 }; 1861 1862 static ide_proc_entry_t idetape_proc[] = { 1863 { "capacity", S_IFREG|S_IRUGO, &ide_capacity_proc_fops }, 1864 { "name", S_IFREG|S_IRUGO, &idetape_name_proc_fops }, 1865 {} 1866 }; 1867 1868 static ide_proc_entry_t *ide_tape_proc_entries(ide_drive_t *drive) 1869 { 1870 return idetape_proc; 1871 } 1872 1873 static const struct ide_proc_devset *ide_tape_proc_devsets(ide_drive_t *drive) 1874 { 1875 return idetape_settings; 1876 } 1877 #endif 1878 1879 static int ide_tape_probe(ide_drive_t *); 1880 1881 static struct ide_driver idetape_driver = { 1882 .gen_driver = { 1883 .owner = THIS_MODULE, 1884 .name = "ide-tape", 1885 .bus = &ide_bus_type, 1886 }, 1887 .probe = ide_tape_probe, 1888 .remove = ide_tape_remove, 1889 .version = IDETAPE_VERSION, 1890 .do_request = idetape_do_request, 1891 #ifdef CONFIG_IDE_PROC_FS 1892 .proc_entries = ide_tape_proc_entries, 1893 .proc_devsets = ide_tape_proc_devsets, 1894 #endif 1895 }; 1896 1897 /* Our character device supporting functions, passed to register_chrdev. */ 1898 static const struct file_operations idetape_fops = { 1899 .owner = THIS_MODULE, 1900 .read = idetape_chrdev_read, 1901 .write = idetape_chrdev_write, 1902 .unlocked_ioctl = idetape_chrdev_ioctl, 1903 .open = idetape_chrdev_open, 1904 .release = idetape_chrdev_release, 1905 .llseek = noop_llseek, 1906 }; 1907 1908 static int idetape_open(struct block_device *bdev, fmode_t mode) 1909 { 1910 struct ide_tape_obj *tape; 1911 1912 mutex_lock(&ide_tape_mutex); 1913 tape = ide_tape_get(bdev->bd_disk, false, 0); 1914 mutex_unlock(&ide_tape_mutex); 1915 1916 if (!tape) 1917 return -ENXIO; 1918 1919 return 0; 1920 } 1921 1922 static void idetape_release(struct gendisk *disk, fmode_t mode) 1923 { 1924 struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); 1925 1926 mutex_lock(&ide_tape_mutex); 1927 ide_tape_put(tape); 1928 mutex_unlock(&ide_tape_mutex); 1929 } 1930 1931 static int idetape_ioctl(struct block_device *bdev, fmode_t mode, 1932 unsigned int cmd, unsigned long arg) 1933 { 1934 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj); 1935 ide_drive_t *drive = tape->drive; 1936 int err; 1937 1938 mutex_lock(&ide_tape_mutex); 1939 err = generic_ide_ioctl(drive, bdev, cmd, arg); 1940 if (err == -EINVAL) 1941 err = idetape_blkdev_ioctl(drive, cmd, arg); 1942 mutex_unlock(&ide_tape_mutex); 1943 1944 return err; 1945 } 1946 1947 static const struct block_device_operations idetape_block_ops = { 1948 .owner = THIS_MODULE, 1949 .open = idetape_open, 1950 .release = idetape_release, 1951 .ioctl = idetape_ioctl, 1952 }; 1953 1954 static int ide_tape_probe(ide_drive_t *drive) 1955 { 1956 idetape_tape_t *tape; 1957 struct gendisk *g; 1958 int minor; 1959 1960 ide_debug_log(IDE_DBG_FUNC, "enter"); 1961 1962 if (!strstr(DRV_NAME, drive->driver_req)) 1963 goto failed; 1964 1965 if (drive->media != ide_tape) 1966 goto failed; 1967 1968 if ((drive->dev_flags & IDE_DFLAG_ID_READ) && 1969 ide_check_atapi_device(drive, DRV_NAME) == 0) { 1970 printk(KERN_ERR "ide-tape: %s: not supported by this version of" 1971 " the driver\n", drive->name); 1972 goto failed; 1973 } 1974 tape = kzalloc(sizeof(idetape_tape_t), GFP_KERNEL); 1975 if (tape == NULL) { 1976 printk(KERN_ERR "ide-tape: %s: Can't allocate a tape struct\n", 1977 drive->name); 1978 goto failed; 1979 } 1980 1981 g = alloc_disk(1 << PARTN_BITS); 1982 if (!g) 1983 goto out_free_tape; 1984 1985 ide_init_disk(g, drive); 1986 1987 tape->dev.parent = &drive->gendev; 1988 tape->dev.release = ide_tape_release; 1989 dev_set_name(&tape->dev, "%s", dev_name(&drive->gendev)); 1990 1991 if (device_register(&tape->dev)) 1992 goto out_free_disk; 1993 1994 tape->drive = drive; 1995 tape->driver = &idetape_driver; 1996 tape->disk = g; 1997 1998 g->private_data = &tape->driver; 1999 2000 drive->driver_data = tape; 2001 2002 mutex_lock(&idetape_ref_mutex); 2003 for (minor = 0; idetape_devs[minor]; minor++) 2004 ; 2005 idetape_devs[minor] = tape; 2006 mutex_unlock(&idetape_ref_mutex); 2007 2008 idetape_setup(drive, tape, minor); 2009 2010 device_create(idetape_sysfs_class, &drive->gendev, 2011 MKDEV(IDETAPE_MAJOR, minor), NULL, "%s", tape->name); 2012 device_create(idetape_sysfs_class, &drive->gendev, 2013 MKDEV(IDETAPE_MAJOR, minor + 128), NULL, 2014 "n%s", tape->name); 2015 2016 g->fops = &idetape_block_ops; 2017 ide_register_region(g); 2018 2019 return 0; 2020 2021 out_free_disk: 2022 put_disk(g); 2023 out_free_tape: 2024 kfree(tape); 2025 failed: 2026 return -ENODEV; 2027 } 2028 2029 static void __exit idetape_exit(void) 2030 { 2031 driver_unregister(&idetape_driver.gen_driver); 2032 class_destroy(idetape_sysfs_class); 2033 unregister_chrdev(IDETAPE_MAJOR, "ht"); 2034 } 2035 2036 static int __init idetape_init(void) 2037 { 2038 int error = 1; 2039 idetape_sysfs_class = class_create(THIS_MODULE, "ide_tape"); 2040 if (IS_ERR(idetape_sysfs_class)) { 2041 idetape_sysfs_class = NULL; 2042 printk(KERN_ERR "Unable to create sysfs class for ide tapes\n"); 2043 error = -EBUSY; 2044 goto out; 2045 } 2046 2047 if (register_chrdev(IDETAPE_MAJOR, "ht", &idetape_fops)) { 2048 printk(KERN_ERR "ide-tape: Failed to register chrdev" 2049 " interface\n"); 2050 error = -EBUSY; 2051 goto out_free_class; 2052 } 2053 2054 error = driver_register(&idetape_driver.gen_driver); 2055 if (error) 2056 goto out_free_driver; 2057 2058 return 0; 2059 2060 out_free_driver: 2061 driver_unregister(&idetape_driver.gen_driver); 2062 out_free_class: 2063 class_destroy(idetape_sysfs_class); 2064 out: 2065 return error; 2066 } 2067 2068 MODULE_ALIAS("ide:*m-tape*"); 2069 module_init(idetape_init); 2070 module_exit(idetape_exit); 2071 MODULE_ALIAS_CHARDEV_MAJOR(IDETAPE_MAJOR); 2072 MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver"); 2073 MODULE_LICENSE("GPL"); 2074 2075 2076 2077 2078 2079 /* LDV_COMMENT_BEGIN_MAIN */ 2080 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 2081 2082 /*###########################################################################*/ 2083 2084 /*############## Driver Environment Generator 0.2 output ####################*/ 2085 2086 /*###########################################################################*/ 2087 2088 2089 2090 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test if all kernel resources are correctly released by driver before driver will be unloaded. */ 2091 void ldv_check_final_state(void); 2092 2093 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 2094 void ldv_check_return_value(int res); 2095 2096 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 2097 void ldv_check_return_value_probe(int res); 2098 2099 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 2100 void ldv_initialize(void); 2101 2102 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 2103 void ldv_handler_precall(void); 2104 2105 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 2106 int nondet_int(void); 2107 2108 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 2109 int LDV_IN_INTERRUPT; 2110 2111 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 2112 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 2113 2114 2115 2116 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 2117 /*============================= VARIABLE DECLARATION PART =============================*/ 2118 /** STRUCT: struct type: file_operations, struct name: idetape_name_proc_fops **/ 2119 /* content: static int idetape_name_proc_open(struct inode *inode, struct file *file)*/ 2120 /* LDV_COMMENT_BEGIN_PREP */ 2121 #define DRV_NAME "ide-tape" 2122 #define IDETAPE_VERSION "1.20" 2123 #undef IDETAPE_DEBUG_LOG 2124 #ifdef IDETAPE_DEBUG_LOG 2125 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2126 #else 2127 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2128 #endif 2129 #define IDETAPE_MAX_PC_RETRIES 3 2130 #define IDETAPE_FIFO_THRESHOLD 2 2131 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2132 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2133 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2134 #define IDETAPE_DSC_MA_FAST 2*HZ 2135 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2136 #define IDETAPE_DSC_MA_SLOW 30*HZ 2137 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2138 #define DOOR_UNLOCKED 0 2139 #define DOOR_LOCKED 1 2140 #define DOOR_EXPLICITLY_LOCKED 2 2141 #define IDETAPE_SPACE_OVER_FILEMARK 1 2142 #define IDETAPE_SPACE_TO_EOD 3 2143 #define IDETAPE_LU_LOAD_MASK 1 2144 #define IDETAPE_LU_RETENSION_MASK 2 2145 #define IDETAPE_LU_EOT_MASK 4 2146 #define IDETAPE_BLOCK_DESCRIPTOR 0 2147 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2148 #ifdef CONFIG_IDE_PROC_FS 2149 #define ide_tape_devset_get(name, field) \ 2150 static int get_##name(ide_drive_t *drive) \ 2151 { \ 2152 idetape_tape_t *tape = drive->driver_data; \ 2153 return tape->field; \ 2154 } 2155 #define ide_tape_devset_set(name, field) \ 2156 static int set_##name(ide_drive_t *drive, int arg) \ 2157 { \ 2158 idetape_tape_t *tape = drive->driver_data; \ 2159 tape->field = arg; \ 2160 return 0; \ 2161 } 2162 #define ide_tape_devset_rw_field(_name, _field) \ 2163 ide_tape_devset_get(_name, _field) \ 2164 ide_tape_devset_set(_name, _field) \ 2165 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2166 #define ide_tape_devset_r_field(_name, _field) \ 2167 ide_tape_devset_get(_name, _field) \ 2168 IDE_DEVSET(_name, 0, get_##_name, NULL) 2169 #endif 2170 #ifdef CONFIG_IDE_PROC_FS 2171 /* LDV_COMMENT_END_PREP */ 2172 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_name_proc_open" */ 2173 struct inode * var_group1; 2174 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_name_proc_open" */ 2175 struct file * var_group2; 2176 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "idetape_name_proc_open" */ 2177 static int res_idetape_name_proc_open_50; 2178 /* LDV_COMMENT_BEGIN_PREP */ 2179 #endif 2180 #ifdef CONFIG_IDE_PROC_FS 2181 #endif 2182 /* LDV_COMMENT_END_PREP */ 2183 2184 /** STRUCT: struct type: ide_driver, struct name: idetape_driver **/ 2185 /* content: static int ide_tape_probe(ide_drive_t *drive)*/ 2186 /* LDV_COMMENT_BEGIN_PREP */ 2187 #define DRV_NAME "ide-tape" 2188 #define IDETAPE_VERSION "1.20" 2189 #undef IDETAPE_DEBUG_LOG 2190 #ifdef IDETAPE_DEBUG_LOG 2191 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2192 #else 2193 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2194 #endif 2195 #define IDETAPE_MAX_PC_RETRIES 3 2196 #define IDETAPE_FIFO_THRESHOLD 2 2197 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2198 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2199 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2200 #define IDETAPE_DSC_MA_FAST 2*HZ 2201 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2202 #define IDETAPE_DSC_MA_SLOW 30*HZ 2203 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2204 #define DOOR_UNLOCKED 0 2205 #define DOOR_LOCKED 1 2206 #define DOOR_EXPLICITLY_LOCKED 2 2207 #define IDETAPE_SPACE_OVER_FILEMARK 1 2208 #define IDETAPE_SPACE_TO_EOD 3 2209 #define IDETAPE_LU_LOAD_MASK 1 2210 #define IDETAPE_LU_RETENSION_MASK 2 2211 #define IDETAPE_LU_EOT_MASK 4 2212 #define IDETAPE_BLOCK_DESCRIPTOR 0 2213 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2214 #ifdef CONFIG_IDE_PROC_FS 2215 #define ide_tape_devset_get(name, field) \ 2216 static int get_##name(ide_drive_t *drive) \ 2217 { \ 2218 idetape_tape_t *tape = drive->driver_data; \ 2219 return tape->field; \ 2220 } 2221 #define ide_tape_devset_set(name, field) \ 2222 static int set_##name(ide_drive_t *drive, int arg) \ 2223 { \ 2224 idetape_tape_t *tape = drive->driver_data; \ 2225 tape->field = arg; \ 2226 return 0; \ 2227 } 2228 #define ide_tape_devset_rw_field(_name, _field) \ 2229 ide_tape_devset_get(_name, _field) \ 2230 ide_tape_devset_set(_name, _field) \ 2231 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2232 #define ide_tape_devset_r_field(_name, _field) \ 2233 ide_tape_devset_get(_name, _field) \ 2234 IDE_DEVSET(_name, 0, get_##_name, NULL) 2235 #endif 2236 #ifdef CONFIG_IDE_PROC_FS 2237 #endif 2238 #ifdef CONFIG_IDE_PROC_FS 2239 #endif 2240 /* LDV_COMMENT_END_PREP */ 2241 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ide_tape_probe" */ 2242 ide_drive_t * var_ide_tape_probe_56_p0; 2243 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ide_tape_probe" */ 2244 static int res_ide_tape_probe_56; 2245 /* content: static void ide_tape_remove(ide_drive_t *drive)*/ 2246 /* LDV_COMMENT_BEGIN_PREP */ 2247 #define DRV_NAME "ide-tape" 2248 #define IDETAPE_VERSION "1.20" 2249 #undef IDETAPE_DEBUG_LOG 2250 #ifdef IDETAPE_DEBUG_LOG 2251 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2252 #else 2253 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2254 #endif 2255 #define IDETAPE_MAX_PC_RETRIES 3 2256 #define IDETAPE_FIFO_THRESHOLD 2 2257 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2258 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2259 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2260 #define IDETAPE_DSC_MA_FAST 2*HZ 2261 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2262 #define IDETAPE_DSC_MA_SLOW 30*HZ 2263 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2264 #define DOOR_UNLOCKED 0 2265 #define DOOR_LOCKED 1 2266 #define DOOR_EXPLICITLY_LOCKED 2 2267 #define IDETAPE_SPACE_OVER_FILEMARK 1 2268 #define IDETAPE_SPACE_TO_EOD 3 2269 #define IDETAPE_LU_LOAD_MASK 1 2270 #define IDETAPE_LU_RETENSION_MASK 2 2271 #define IDETAPE_LU_EOT_MASK 4 2272 #define IDETAPE_BLOCK_DESCRIPTOR 0 2273 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2274 #ifdef CONFIG_IDE_PROC_FS 2275 #define ide_tape_devset_get(name, field) \ 2276 static int get_##name(ide_drive_t *drive) \ 2277 { \ 2278 idetape_tape_t *tape = drive->driver_data; \ 2279 return tape->field; \ 2280 } 2281 #define ide_tape_devset_set(name, field) \ 2282 static int set_##name(ide_drive_t *drive, int arg) \ 2283 { \ 2284 idetape_tape_t *tape = drive->driver_data; \ 2285 tape->field = arg; \ 2286 return 0; \ 2287 } 2288 #define ide_tape_devset_rw_field(_name, _field) \ 2289 ide_tape_devset_get(_name, _field) \ 2290 ide_tape_devset_set(_name, _field) \ 2291 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2292 #define ide_tape_devset_r_field(_name, _field) \ 2293 ide_tape_devset_get(_name, _field) \ 2294 IDE_DEVSET(_name, 0, get_##_name, NULL) 2295 #endif 2296 /* LDV_COMMENT_END_PREP */ 2297 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ide_tape_remove" */ 2298 ide_drive_t * var_ide_tape_remove_47_p0; 2299 /* LDV_COMMENT_BEGIN_PREP */ 2300 #ifdef CONFIG_IDE_PROC_FS 2301 #endif 2302 #ifdef CONFIG_IDE_PROC_FS 2303 #endif 2304 /* LDV_COMMENT_END_PREP */ 2305 /* content: static ide_startstop_t idetape_do_request(ide_drive_t *drive, struct request *rq, sector_t block)*/ 2306 /* LDV_COMMENT_BEGIN_PREP */ 2307 #define DRV_NAME "ide-tape" 2308 #define IDETAPE_VERSION "1.20" 2309 #undef IDETAPE_DEBUG_LOG 2310 #ifdef IDETAPE_DEBUG_LOG 2311 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2312 #else 2313 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2314 #endif 2315 #define IDETAPE_MAX_PC_RETRIES 3 2316 #define IDETAPE_FIFO_THRESHOLD 2 2317 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2318 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2319 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2320 #define IDETAPE_DSC_MA_FAST 2*HZ 2321 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2322 #define IDETAPE_DSC_MA_SLOW 30*HZ 2323 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2324 #define DOOR_UNLOCKED 0 2325 #define DOOR_LOCKED 1 2326 #define DOOR_EXPLICITLY_LOCKED 2 2327 #define IDETAPE_SPACE_OVER_FILEMARK 1 2328 #define IDETAPE_SPACE_TO_EOD 3 2329 #define IDETAPE_LU_LOAD_MASK 1 2330 #define IDETAPE_LU_RETENSION_MASK 2 2331 #define IDETAPE_LU_EOT_MASK 4 2332 #define IDETAPE_BLOCK_DESCRIPTOR 0 2333 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2334 /* LDV_COMMENT_END_PREP */ 2335 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_do_request" */ 2336 ide_drive_t * var_idetape_do_request_10_p0; 2337 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_do_request" */ 2338 struct request * var_group3; 2339 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_do_request" */ 2340 sector_t var_idetape_do_request_10_p2; 2341 /* LDV_COMMENT_BEGIN_PREP */ 2342 #ifdef CONFIG_IDE_PROC_FS 2343 #define ide_tape_devset_get(name, field) \ 2344 static int get_##name(ide_drive_t *drive) \ 2345 { \ 2346 idetape_tape_t *tape = drive->driver_data; \ 2347 return tape->field; \ 2348 } 2349 #define ide_tape_devset_set(name, field) \ 2350 static int set_##name(ide_drive_t *drive, int arg) \ 2351 { \ 2352 idetape_tape_t *tape = drive->driver_data; \ 2353 tape->field = arg; \ 2354 return 0; \ 2355 } 2356 #define ide_tape_devset_rw_field(_name, _field) \ 2357 ide_tape_devset_get(_name, _field) \ 2358 ide_tape_devset_set(_name, _field) \ 2359 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2360 #define ide_tape_devset_r_field(_name, _field) \ 2361 ide_tape_devset_get(_name, _field) \ 2362 IDE_DEVSET(_name, 0, get_##_name, NULL) 2363 #endif 2364 #ifdef CONFIG_IDE_PROC_FS 2365 #endif 2366 #ifdef CONFIG_IDE_PROC_FS 2367 #endif 2368 /* LDV_COMMENT_END_PREP */ 2369 /* content: static ide_proc_entry_t *ide_tape_proc_entries(ide_drive_t *drive)*/ 2370 /* LDV_COMMENT_BEGIN_PREP */ 2371 #define DRV_NAME "ide-tape" 2372 #define IDETAPE_VERSION "1.20" 2373 #undef IDETAPE_DEBUG_LOG 2374 #ifdef IDETAPE_DEBUG_LOG 2375 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2376 #else 2377 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2378 #endif 2379 #define IDETAPE_MAX_PC_RETRIES 3 2380 #define IDETAPE_FIFO_THRESHOLD 2 2381 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2382 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2383 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2384 #define IDETAPE_DSC_MA_FAST 2*HZ 2385 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2386 #define IDETAPE_DSC_MA_SLOW 30*HZ 2387 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2388 #define DOOR_UNLOCKED 0 2389 #define DOOR_LOCKED 1 2390 #define DOOR_EXPLICITLY_LOCKED 2 2391 #define IDETAPE_SPACE_OVER_FILEMARK 1 2392 #define IDETAPE_SPACE_TO_EOD 3 2393 #define IDETAPE_LU_LOAD_MASK 1 2394 #define IDETAPE_LU_RETENSION_MASK 2 2395 #define IDETAPE_LU_EOT_MASK 4 2396 #define IDETAPE_BLOCK_DESCRIPTOR 0 2397 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2398 #ifdef CONFIG_IDE_PROC_FS 2399 #define ide_tape_devset_get(name, field) \ 2400 static int get_##name(ide_drive_t *drive) \ 2401 { \ 2402 idetape_tape_t *tape = drive->driver_data; \ 2403 return tape->field; \ 2404 } 2405 #define ide_tape_devset_set(name, field) \ 2406 static int set_##name(ide_drive_t *drive, int arg) \ 2407 { \ 2408 idetape_tape_t *tape = drive->driver_data; \ 2409 tape->field = arg; \ 2410 return 0; \ 2411 } 2412 #define ide_tape_devset_rw_field(_name, _field) \ 2413 ide_tape_devset_get(_name, _field) \ 2414 ide_tape_devset_set(_name, _field) \ 2415 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2416 #define ide_tape_devset_r_field(_name, _field) \ 2417 ide_tape_devset_get(_name, _field) \ 2418 IDE_DEVSET(_name, 0, get_##_name, NULL) 2419 #endif 2420 #ifdef CONFIG_IDE_PROC_FS 2421 /* LDV_COMMENT_END_PREP */ 2422 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ide_tape_proc_entries" */ 2423 ide_drive_t * var_ide_tape_proc_entries_51_p0; 2424 /* LDV_COMMENT_BEGIN_PREP */ 2425 #endif 2426 #ifdef CONFIG_IDE_PROC_FS 2427 #endif 2428 /* LDV_COMMENT_END_PREP */ 2429 /* content: static const struct ide_proc_devset *ide_tape_proc_devsets(ide_drive_t *drive)*/ 2430 /* LDV_COMMENT_BEGIN_PREP */ 2431 #define DRV_NAME "ide-tape" 2432 #define IDETAPE_VERSION "1.20" 2433 #undef IDETAPE_DEBUG_LOG 2434 #ifdef IDETAPE_DEBUG_LOG 2435 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2436 #else 2437 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2438 #endif 2439 #define IDETAPE_MAX_PC_RETRIES 3 2440 #define IDETAPE_FIFO_THRESHOLD 2 2441 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2442 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2443 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2444 #define IDETAPE_DSC_MA_FAST 2*HZ 2445 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2446 #define IDETAPE_DSC_MA_SLOW 30*HZ 2447 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2448 #define DOOR_UNLOCKED 0 2449 #define DOOR_LOCKED 1 2450 #define DOOR_EXPLICITLY_LOCKED 2 2451 #define IDETAPE_SPACE_OVER_FILEMARK 1 2452 #define IDETAPE_SPACE_TO_EOD 3 2453 #define IDETAPE_LU_LOAD_MASK 1 2454 #define IDETAPE_LU_RETENSION_MASK 2 2455 #define IDETAPE_LU_EOT_MASK 4 2456 #define IDETAPE_BLOCK_DESCRIPTOR 0 2457 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2458 #ifdef CONFIG_IDE_PROC_FS 2459 #define ide_tape_devset_get(name, field) \ 2460 static int get_##name(ide_drive_t *drive) \ 2461 { \ 2462 idetape_tape_t *tape = drive->driver_data; \ 2463 return tape->field; \ 2464 } 2465 #define ide_tape_devset_set(name, field) \ 2466 static int set_##name(ide_drive_t *drive, int arg) \ 2467 { \ 2468 idetape_tape_t *tape = drive->driver_data; \ 2469 tape->field = arg; \ 2470 return 0; \ 2471 } 2472 #define ide_tape_devset_rw_field(_name, _field) \ 2473 ide_tape_devset_get(_name, _field) \ 2474 ide_tape_devset_set(_name, _field) \ 2475 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2476 #define ide_tape_devset_r_field(_name, _field) \ 2477 ide_tape_devset_get(_name, _field) \ 2478 IDE_DEVSET(_name, 0, get_##_name, NULL) 2479 #endif 2480 #ifdef CONFIG_IDE_PROC_FS 2481 /* LDV_COMMENT_END_PREP */ 2482 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ide_tape_proc_devsets" */ 2483 ide_drive_t * var_ide_tape_proc_devsets_52_p0; 2484 /* LDV_COMMENT_BEGIN_PREP */ 2485 #endif 2486 #ifdef CONFIG_IDE_PROC_FS 2487 #endif 2488 /* LDV_COMMENT_END_PREP */ 2489 2490 /** STRUCT: struct type: file_operations, struct name: idetape_fops **/ 2491 /* content: static ssize_t idetape_chrdev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)*/ 2492 /* LDV_COMMENT_BEGIN_PREP */ 2493 #define DRV_NAME "ide-tape" 2494 #define IDETAPE_VERSION "1.20" 2495 #undef IDETAPE_DEBUG_LOG 2496 #ifdef IDETAPE_DEBUG_LOG 2497 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2498 #else 2499 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2500 #endif 2501 #define IDETAPE_MAX_PC_RETRIES 3 2502 #define IDETAPE_FIFO_THRESHOLD 2 2503 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2504 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2505 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2506 #define IDETAPE_DSC_MA_FAST 2*HZ 2507 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2508 #define IDETAPE_DSC_MA_SLOW 30*HZ 2509 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2510 #define DOOR_UNLOCKED 0 2511 #define DOOR_LOCKED 1 2512 #define DOOR_EXPLICITLY_LOCKED 2 2513 #define IDETAPE_SPACE_OVER_FILEMARK 1 2514 #define IDETAPE_SPACE_TO_EOD 3 2515 #define IDETAPE_LU_LOAD_MASK 1 2516 #define IDETAPE_LU_RETENSION_MASK 2 2517 #define IDETAPE_LU_EOT_MASK 4 2518 #define IDETAPE_BLOCK_DESCRIPTOR 0 2519 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2520 /* LDV_COMMENT_END_PREP */ 2521 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_chrdev_read" */ 2522 char __user * var_idetape_chrdev_read_30_p1; 2523 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_chrdev_read" */ 2524 size_t var_idetape_chrdev_read_30_p2; 2525 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_chrdev_read" */ 2526 loff_t * var_idetape_chrdev_read_30_p3; 2527 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "idetape_chrdev_read" */ 2528 static ssize_t res_idetape_chrdev_read_30; 2529 /* LDV_COMMENT_BEGIN_PREP */ 2530 #ifdef CONFIG_IDE_PROC_FS 2531 #define ide_tape_devset_get(name, field) \ 2532 static int get_##name(ide_drive_t *drive) \ 2533 { \ 2534 idetape_tape_t *tape = drive->driver_data; \ 2535 return tape->field; \ 2536 } 2537 #define ide_tape_devset_set(name, field) \ 2538 static int set_##name(ide_drive_t *drive, int arg) \ 2539 { \ 2540 idetape_tape_t *tape = drive->driver_data; \ 2541 tape->field = arg; \ 2542 return 0; \ 2543 } 2544 #define ide_tape_devset_rw_field(_name, _field) \ 2545 ide_tape_devset_get(_name, _field) \ 2546 ide_tape_devset_set(_name, _field) \ 2547 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2548 #define ide_tape_devset_r_field(_name, _field) \ 2549 ide_tape_devset_get(_name, _field) \ 2550 IDE_DEVSET(_name, 0, get_##_name, NULL) 2551 #endif 2552 #ifdef CONFIG_IDE_PROC_FS 2553 #endif 2554 #ifdef CONFIG_IDE_PROC_FS 2555 #endif 2556 /* LDV_COMMENT_END_PREP */ 2557 /* content: static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)*/ 2558 /* LDV_COMMENT_BEGIN_PREP */ 2559 #define DRV_NAME "ide-tape" 2560 #define IDETAPE_VERSION "1.20" 2561 #undef IDETAPE_DEBUG_LOG 2562 #ifdef IDETAPE_DEBUG_LOG 2563 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2564 #else 2565 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2566 #endif 2567 #define IDETAPE_MAX_PC_RETRIES 3 2568 #define IDETAPE_FIFO_THRESHOLD 2 2569 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2570 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2571 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2572 #define IDETAPE_DSC_MA_FAST 2*HZ 2573 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2574 #define IDETAPE_DSC_MA_SLOW 30*HZ 2575 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2576 #define DOOR_UNLOCKED 0 2577 #define DOOR_LOCKED 1 2578 #define DOOR_EXPLICITLY_LOCKED 2 2579 #define IDETAPE_SPACE_OVER_FILEMARK 1 2580 #define IDETAPE_SPACE_TO_EOD 3 2581 #define IDETAPE_LU_LOAD_MASK 1 2582 #define IDETAPE_LU_RETENSION_MASK 2 2583 #define IDETAPE_LU_EOT_MASK 4 2584 #define IDETAPE_BLOCK_DESCRIPTOR 0 2585 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2586 /* LDV_COMMENT_END_PREP */ 2587 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_chrdev_write" */ 2588 const char __user * var_idetape_chrdev_write_31_p1; 2589 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_chrdev_write" */ 2590 size_t var_idetape_chrdev_write_31_p2; 2591 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_chrdev_write" */ 2592 loff_t * var_idetape_chrdev_write_31_p3; 2593 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "idetape_chrdev_write" */ 2594 static ssize_t res_idetape_chrdev_write_31; 2595 /* LDV_COMMENT_BEGIN_PREP */ 2596 #ifdef CONFIG_IDE_PROC_FS 2597 #define ide_tape_devset_get(name, field) \ 2598 static int get_##name(ide_drive_t *drive) \ 2599 { \ 2600 idetape_tape_t *tape = drive->driver_data; \ 2601 return tape->field; \ 2602 } 2603 #define ide_tape_devset_set(name, field) \ 2604 static int set_##name(ide_drive_t *drive, int arg) \ 2605 { \ 2606 idetape_tape_t *tape = drive->driver_data; \ 2607 tape->field = arg; \ 2608 return 0; \ 2609 } 2610 #define ide_tape_devset_rw_field(_name, _field) \ 2611 ide_tape_devset_get(_name, _field) \ 2612 ide_tape_devset_set(_name, _field) \ 2613 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2614 #define ide_tape_devset_r_field(_name, _field) \ 2615 ide_tape_devset_get(_name, _field) \ 2616 IDE_DEVSET(_name, 0, get_##_name, NULL) 2617 #endif 2618 #ifdef CONFIG_IDE_PROC_FS 2619 #endif 2620 #ifdef CONFIG_IDE_PROC_FS 2621 #endif 2622 /* LDV_COMMENT_END_PREP */ 2623 /* content: static long idetape_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)*/ 2624 /* LDV_COMMENT_BEGIN_PREP */ 2625 #define DRV_NAME "ide-tape" 2626 #define IDETAPE_VERSION "1.20" 2627 #undef IDETAPE_DEBUG_LOG 2628 #ifdef IDETAPE_DEBUG_LOG 2629 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2630 #else 2631 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2632 #endif 2633 #define IDETAPE_MAX_PC_RETRIES 3 2634 #define IDETAPE_FIFO_THRESHOLD 2 2635 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2636 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2637 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2638 #define IDETAPE_DSC_MA_FAST 2*HZ 2639 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2640 #define IDETAPE_DSC_MA_SLOW 30*HZ 2641 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2642 #define DOOR_UNLOCKED 0 2643 #define DOOR_LOCKED 1 2644 #define DOOR_EXPLICITLY_LOCKED 2 2645 #define IDETAPE_SPACE_OVER_FILEMARK 1 2646 #define IDETAPE_SPACE_TO_EOD 3 2647 #define IDETAPE_LU_LOAD_MASK 1 2648 #define IDETAPE_LU_RETENSION_MASK 2 2649 #define IDETAPE_LU_EOT_MASK 4 2650 #define IDETAPE_BLOCK_DESCRIPTOR 0 2651 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2652 /* LDV_COMMENT_END_PREP */ 2653 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_chrdev_ioctl" */ 2654 unsigned int var_idetape_chrdev_ioctl_35_p1; 2655 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_chrdev_ioctl" */ 2656 unsigned long var_idetape_chrdev_ioctl_35_p2; 2657 /* LDV_COMMENT_BEGIN_PREP */ 2658 #ifdef CONFIG_IDE_PROC_FS 2659 #define ide_tape_devset_get(name, field) \ 2660 static int get_##name(ide_drive_t *drive) \ 2661 { \ 2662 idetape_tape_t *tape = drive->driver_data; \ 2663 return tape->field; \ 2664 } 2665 #define ide_tape_devset_set(name, field) \ 2666 static int set_##name(ide_drive_t *drive, int arg) \ 2667 { \ 2668 idetape_tape_t *tape = drive->driver_data; \ 2669 tape->field = arg; \ 2670 return 0; \ 2671 } 2672 #define ide_tape_devset_rw_field(_name, _field) \ 2673 ide_tape_devset_get(_name, _field) \ 2674 ide_tape_devset_set(_name, _field) \ 2675 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2676 #define ide_tape_devset_r_field(_name, _field) \ 2677 ide_tape_devset_get(_name, _field) \ 2678 IDE_DEVSET(_name, 0, get_##_name, NULL) 2679 #endif 2680 #ifdef CONFIG_IDE_PROC_FS 2681 #endif 2682 #ifdef CONFIG_IDE_PROC_FS 2683 #endif 2684 /* LDV_COMMENT_END_PREP */ 2685 /* content: static int idetape_chrdev_open(struct inode *inode, struct file *filp)*/ 2686 /* LDV_COMMENT_BEGIN_PREP */ 2687 #define DRV_NAME "ide-tape" 2688 #define IDETAPE_VERSION "1.20" 2689 #undef IDETAPE_DEBUG_LOG 2690 #ifdef IDETAPE_DEBUG_LOG 2691 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2692 #else 2693 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2694 #endif 2695 #define IDETAPE_MAX_PC_RETRIES 3 2696 #define IDETAPE_FIFO_THRESHOLD 2 2697 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2698 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2699 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2700 #define IDETAPE_DSC_MA_FAST 2*HZ 2701 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2702 #define IDETAPE_DSC_MA_SLOW 30*HZ 2703 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2704 #define DOOR_UNLOCKED 0 2705 #define DOOR_LOCKED 1 2706 #define DOOR_EXPLICITLY_LOCKED 2 2707 #define IDETAPE_SPACE_OVER_FILEMARK 1 2708 #define IDETAPE_SPACE_TO_EOD 3 2709 #define IDETAPE_LU_LOAD_MASK 1 2710 #define IDETAPE_LU_RETENSION_MASK 2 2711 #define IDETAPE_LU_EOT_MASK 4 2712 #define IDETAPE_BLOCK_DESCRIPTOR 0 2713 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2714 /* LDV_COMMENT_END_PREP */ 2715 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "idetape_chrdev_open" */ 2716 static int res_idetape_chrdev_open_37; 2717 /* LDV_COMMENT_BEGIN_PREP */ 2718 #ifdef CONFIG_IDE_PROC_FS 2719 #define ide_tape_devset_get(name, field) \ 2720 static int get_##name(ide_drive_t *drive) \ 2721 { \ 2722 idetape_tape_t *tape = drive->driver_data; \ 2723 return tape->field; \ 2724 } 2725 #define ide_tape_devset_set(name, field) \ 2726 static int set_##name(ide_drive_t *drive, int arg) \ 2727 { \ 2728 idetape_tape_t *tape = drive->driver_data; \ 2729 tape->field = arg; \ 2730 return 0; \ 2731 } 2732 #define ide_tape_devset_rw_field(_name, _field) \ 2733 ide_tape_devset_get(_name, _field) \ 2734 ide_tape_devset_set(_name, _field) \ 2735 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2736 #define ide_tape_devset_r_field(_name, _field) \ 2737 ide_tape_devset_get(_name, _field) \ 2738 IDE_DEVSET(_name, 0, get_##_name, NULL) 2739 #endif 2740 #ifdef CONFIG_IDE_PROC_FS 2741 #endif 2742 #ifdef CONFIG_IDE_PROC_FS 2743 #endif 2744 /* LDV_COMMENT_END_PREP */ 2745 /* content: static int idetape_chrdev_release(struct inode *inode, struct file *filp)*/ 2746 /* LDV_COMMENT_BEGIN_PREP */ 2747 #define DRV_NAME "ide-tape" 2748 #define IDETAPE_VERSION "1.20" 2749 #undef IDETAPE_DEBUG_LOG 2750 #ifdef IDETAPE_DEBUG_LOG 2751 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2752 #else 2753 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2754 #endif 2755 #define IDETAPE_MAX_PC_RETRIES 3 2756 #define IDETAPE_FIFO_THRESHOLD 2 2757 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2758 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2759 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2760 #define IDETAPE_DSC_MA_FAST 2*HZ 2761 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2762 #define IDETAPE_DSC_MA_SLOW 30*HZ 2763 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2764 #define DOOR_UNLOCKED 0 2765 #define DOOR_LOCKED 1 2766 #define DOOR_EXPLICITLY_LOCKED 2 2767 #define IDETAPE_SPACE_OVER_FILEMARK 1 2768 #define IDETAPE_SPACE_TO_EOD 3 2769 #define IDETAPE_LU_LOAD_MASK 1 2770 #define IDETAPE_LU_RETENSION_MASK 2 2771 #define IDETAPE_LU_EOT_MASK 4 2772 #define IDETAPE_BLOCK_DESCRIPTOR 0 2773 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2774 /* LDV_COMMENT_END_PREP */ 2775 /* LDV_COMMENT_BEGIN_PREP */ 2776 #ifdef CONFIG_IDE_PROC_FS 2777 #define ide_tape_devset_get(name, field) \ 2778 static int get_##name(ide_drive_t *drive) \ 2779 { \ 2780 idetape_tape_t *tape = drive->driver_data; \ 2781 return tape->field; \ 2782 } 2783 #define ide_tape_devset_set(name, field) \ 2784 static int set_##name(ide_drive_t *drive, int arg) \ 2785 { \ 2786 idetape_tape_t *tape = drive->driver_data; \ 2787 tape->field = arg; \ 2788 return 0; \ 2789 } 2790 #define ide_tape_devset_rw_field(_name, _field) \ 2791 ide_tape_devset_get(_name, _field) \ 2792 ide_tape_devset_set(_name, _field) \ 2793 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2794 #define ide_tape_devset_r_field(_name, _field) \ 2795 ide_tape_devset_get(_name, _field) \ 2796 IDE_DEVSET(_name, 0, get_##_name, NULL) 2797 #endif 2798 #ifdef CONFIG_IDE_PROC_FS 2799 #endif 2800 #ifdef CONFIG_IDE_PROC_FS 2801 #endif 2802 /* LDV_COMMENT_END_PREP */ 2803 2804 /** STRUCT: struct type: block_device_operations, struct name: idetape_block_ops **/ 2805 /* content: static int idetape_open(struct block_device *bdev, fmode_t mode)*/ 2806 /* LDV_COMMENT_BEGIN_PREP */ 2807 #define DRV_NAME "ide-tape" 2808 #define IDETAPE_VERSION "1.20" 2809 #undef IDETAPE_DEBUG_LOG 2810 #ifdef IDETAPE_DEBUG_LOG 2811 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2812 #else 2813 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2814 #endif 2815 #define IDETAPE_MAX_PC_RETRIES 3 2816 #define IDETAPE_FIFO_THRESHOLD 2 2817 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2818 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2819 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2820 #define IDETAPE_DSC_MA_FAST 2*HZ 2821 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2822 #define IDETAPE_DSC_MA_SLOW 30*HZ 2823 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2824 #define DOOR_UNLOCKED 0 2825 #define DOOR_LOCKED 1 2826 #define DOOR_EXPLICITLY_LOCKED 2 2827 #define IDETAPE_SPACE_OVER_FILEMARK 1 2828 #define IDETAPE_SPACE_TO_EOD 3 2829 #define IDETAPE_LU_LOAD_MASK 1 2830 #define IDETAPE_LU_RETENSION_MASK 2 2831 #define IDETAPE_LU_EOT_MASK 4 2832 #define IDETAPE_BLOCK_DESCRIPTOR 0 2833 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2834 #ifdef CONFIG_IDE_PROC_FS 2835 #define ide_tape_devset_get(name, field) \ 2836 static int get_##name(ide_drive_t *drive) \ 2837 { \ 2838 idetape_tape_t *tape = drive->driver_data; \ 2839 return tape->field; \ 2840 } 2841 #define ide_tape_devset_set(name, field) \ 2842 static int set_##name(ide_drive_t *drive, int arg) \ 2843 { \ 2844 idetape_tape_t *tape = drive->driver_data; \ 2845 tape->field = arg; \ 2846 return 0; \ 2847 } 2848 #define ide_tape_devset_rw_field(_name, _field) \ 2849 ide_tape_devset_get(_name, _field) \ 2850 ide_tape_devset_set(_name, _field) \ 2851 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2852 #define ide_tape_devset_r_field(_name, _field) \ 2853 ide_tape_devset_get(_name, _field) \ 2854 IDE_DEVSET(_name, 0, get_##_name, NULL) 2855 #endif 2856 #ifdef CONFIG_IDE_PROC_FS 2857 #endif 2858 #ifdef CONFIG_IDE_PROC_FS 2859 #endif 2860 /* LDV_COMMENT_END_PREP */ 2861 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_open" */ 2862 struct block_device * var_group4; 2863 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_open" */ 2864 fmode_t var_idetape_open_53_p1; 2865 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "idetape_open" */ 2866 static int res_idetape_open_53; 2867 /* content: static void idetape_release(struct gendisk *disk, fmode_t mode)*/ 2868 /* LDV_COMMENT_BEGIN_PREP */ 2869 #define DRV_NAME "ide-tape" 2870 #define IDETAPE_VERSION "1.20" 2871 #undef IDETAPE_DEBUG_LOG 2872 #ifdef IDETAPE_DEBUG_LOG 2873 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2874 #else 2875 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2876 #endif 2877 #define IDETAPE_MAX_PC_RETRIES 3 2878 #define IDETAPE_FIFO_THRESHOLD 2 2879 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2880 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2881 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2882 #define IDETAPE_DSC_MA_FAST 2*HZ 2883 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2884 #define IDETAPE_DSC_MA_SLOW 30*HZ 2885 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2886 #define DOOR_UNLOCKED 0 2887 #define DOOR_LOCKED 1 2888 #define DOOR_EXPLICITLY_LOCKED 2 2889 #define IDETAPE_SPACE_OVER_FILEMARK 1 2890 #define IDETAPE_SPACE_TO_EOD 3 2891 #define IDETAPE_LU_LOAD_MASK 1 2892 #define IDETAPE_LU_RETENSION_MASK 2 2893 #define IDETAPE_LU_EOT_MASK 4 2894 #define IDETAPE_BLOCK_DESCRIPTOR 0 2895 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2896 #ifdef CONFIG_IDE_PROC_FS 2897 #define ide_tape_devset_get(name, field) \ 2898 static int get_##name(ide_drive_t *drive) \ 2899 { \ 2900 idetape_tape_t *tape = drive->driver_data; \ 2901 return tape->field; \ 2902 } 2903 #define ide_tape_devset_set(name, field) \ 2904 static int set_##name(ide_drive_t *drive, int arg) \ 2905 { \ 2906 idetape_tape_t *tape = drive->driver_data; \ 2907 tape->field = arg; \ 2908 return 0; \ 2909 } 2910 #define ide_tape_devset_rw_field(_name, _field) \ 2911 ide_tape_devset_get(_name, _field) \ 2912 ide_tape_devset_set(_name, _field) \ 2913 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2914 #define ide_tape_devset_r_field(_name, _field) \ 2915 ide_tape_devset_get(_name, _field) \ 2916 IDE_DEVSET(_name, 0, get_##_name, NULL) 2917 #endif 2918 #ifdef CONFIG_IDE_PROC_FS 2919 #endif 2920 #ifdef CONFIG_IDE_PROC_FS 2921 #endif 2922 /* LDV_COMMENT_END_PREP */ 2923 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_release" */ 2924 struct gendisk * var_group5; 2925 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_release" */ 2926 fmode_t var_idetape_release_54_p1; 2927 /* content: static int idetape_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg)*/ 2928 /* LDV_COMMENT_BEGIN_PREP */ 2929 #define DRV_NAME "ide-tape" 2930 #define IDETAPE_VERSION "1.20" 2931 #undef IDETAPE_DEBUG_LOG 2932 #ifdef IDETAPE_DEBUG_LOG 2933 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2934 #else 2935 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2936 #endif 2937 #define IDETAPE_MAX_PC_RETRIES 3 2938 #define IDETAPE_FIFO_THRESHOLD 2 2939 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2940 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2941 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2942 #define IDETAPE_DSC_MA_FAST 2*HZ 2943 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2944 #define IDETAPE_DSC_MA_SLOW 30*HZ 2945 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2946 #define DOOR_UNLOCKED 0 2947 #define DOOR_LOCKED 1 2948 #define DOOR_EXPLICITLY_LOCKED 2 2949 #define IDETAPE_SPACE_OVER_FILEMARK 1 2950 #define IDETAPE_SPACE_TO_EOD 3 2951 #define IDETAPE_LU_LOAD_MASK 1 2952 #define IDETAPE_LU_RETENSION_MASK 2 2953 #define IDETAPE_LU_EOT_MASK 4 2954 #define IDETAPE_BLOCK_DESCRIPTOR 0 2955 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2956 #ifdef CONFIG_IDE_PROC_FS 2957 #define ide_tape_devset_get(name, field) \ 2958 static int get_##name(ide_drive_t *drive) \ 2959 { \ 2960 idetape_tape_t *tape = drive->driver_data; \ 2961 return tape->field; \ 2962 } 2963 #define ide_tape_devset_set(name, field) \ 2964 static int set_##name(ide_drive_t *drive, int arg) \ 2965 { \ 2966 idetape_tape_t *tape = drive->driver_data; \ 2967 tape->field = arg; \ 2968 return 0; \ 2969 } 2970 #define ide_tape_devset_rw_field(_name, _field) \ 2971 ide_tape_devset_get(_name, _field) \ 2972 ide_tape_devset_set(_name, _field) \ 2973 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2974 #define ide_tape_devset_r_field(_name, _field) \ 2975 ide_tape_devset_get(_name, _field) \ 2976 IDE_DEVSET(_name, 0, get_##_name, NULL) 2977 #endif 2978 #ifdef CONFIG_IDE_PROC_FS 2979 #endif 2980 #ifdef CONFIG_IDE_PROC_FS 2981 #endif 2982 /* LDV_COMMENT_END_PREP */ 2983 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_ioctl" */ 2984 fmode_t var_idetape_ioctl_55_p1; 2985 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_ioctl" */ 2986 unsigned int var_idetape_ioctl_55_p2; 2987 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_ioctl" */ 2988 unsigned long var_idetape_ioctl_55_p3; 2989 2990 2991 2992 2993 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 2994 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 2995 /*============================= VARIABLE INITIALIZING PART =============================*/ 2996 LDV_IN_INTERRUPT=1; 2997 2998 2999 3000 3001 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 3002 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 3003 /*============================= FUNCTION CALL SECTION =============================*/ 3004 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 3005 ldv_initialize(); 3006 3007 /** INIT: init_type: ST_MODULE_INIT **/ 3008 /* content: static int __init idetape_init(void)*/ 3009 /* LDV_COMMENT_BEGIN_PREP */ 3010 #define DRV_NAME "ide-tape" 3011 #define IDETAPE_VERSION "1.20" 3012 #undef IDETAPE_DEBUG_LOG 3013 #ifdef IDETAPE_DEBUG_LOG 3014 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3015 #else 3016 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3017 #endif 3018 #define IDETAPE_MAX_PC_RETRIES 3 3019 #define IDETAPE_FIFO_THRESHOLD 2 3020 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3021 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3022 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3023 #define IDETAPE_DSC_MA_FAST 2*HZ 3024 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3025 #define IDETAPE_DSC_MA_SLOW 30*HZ 3026 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3027 #define DOOR_UNLOCKED 0 3028 #define DOOR_LOCKED 1 3029 #define DOOR_EXPLICITLY_LOCKED 2 3030 #define IDETAPE_SPACE_OVER_FILEMARK 1 3031 #define IDETAPE_SPACE_TO_EOD 3 3032 #define IDETAPE_LU_LOAD_MASK 1 3033 #define IDETAPE_LU_RETENSION_MASK 2 3034 #define IDETAPE_LU_EOT_MASK 4 3035 #define IDETAPE_BLOCK_DESCRIPTOR 0 3036 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3037 #ifdef CONFIG_IDE_PROC_FS 3038 #define ide_tape_devset_get(name, field) \ 3039 static int get_##name(ide_drive_t *drive) \ 3040 { \ 3041 idetape_tape_t *tape = drive->driver_data; \ 3042 return tape->field; \ 3043 } 3044 #define ide_tape_devset_set(name, field) \ 3045 static int set_##name(ide_drive_t *drive, int arg) \ 3046 { \ 3047 idetape_tape_t *tape = drive->driver_data; \ 3048 tape->field = arg; \ 3049 return 0; \ 3050 } 3051 #define ide_tape_devset_rw_field(_name, _field) \ 3052 ide_tape_devset_get(_name, _field) \ 3053 ide_tape_devset_set(_name, _field) \ 3054 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3055 #define ide_tape_devset_r_field(_name, _field) \ 3056 ide_tape_devset_get(_name, _field) \ 3057 IDE_DEVSET(_name, 0, get_##_name, NULL) 3058 #endif 3059 #ifdef CONFIG_IDE_PROC_FS 3060 #endif 3061 #ifdef CONFIG_IDE_PROC_FS 3062 #endif 3063 /* LDV_COMMENT_END_PREP */ 3064 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver init function after driver loading to kernel. This function declared as "MODULE_INIT(function name)". */ 3065 ldv_handler_precall(); 3066 if(idetape_init()) 3067 goto ldv_final; 3068 int ldv_s_idetape_name_proc_fops_file_operations = 0; 3069 3070 int ldv_s_idetape_driver_ide_driver = 0; 3071 3072 3073 int ldv_s_idetape_fops_file_operations = 0; 3074 3075 3076 int ldv_s_idetape_block_ops_block_device_operations = 0; 3077 3078 3079 3080 while( nondet_int() 3081 || !(ldv_s_idetape_name_proc_fops_file_operations == 0) 3082 || !(ldv_s_idetape_driver_ide_driver == 0) 3083 || !(ldv_s_idetape_fops_file_operations == 0) 3084 || !(ldv_s_idetape_block_ops_block_device_operations == 0) 3085 ) { 3086 3087 switch(nondet_int()) { 3088 3089 case 0: { 3090 3091 /** STRUCT: struct type: file_operations, struct name: idetape_name_proc_fops **/ 3092 if(ldv_s_idetape_name_proc_fops_file_operations==0) { 3093 3094 /* content: static int idetape_name_proc_open(struct inode *inode, struct file *file)*/ 3095 /* LDV_COMMENT_BEGIN_PREP */ 3096 #define DRV_NAME "ide-tape" 3097 #define IDETAPE_VERSION "1.20" 3098 #undef IDETAPE_DEBUG_LOG 3099 #ifdef IDETAPE_DEBUG_LOG 3100 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3101 #else 3102 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3103 #endif 3104 #define IDETAPE_MAX_PC_RETRIES 3 3105 #define IDETAPE_FIFO_THRESHOLD 2 3106 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3107 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3108 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3109 #define IDETAPE_DSC_MA_FAST 2*HZ 3110 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3111 #define IDETAPE_DSC_MA_SLOW 30*HZ 3112 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3113 #define DOOR_UNLOCKED 0 3114 #define DOOR_LOCKED 1 3115 #define DOOR_EXPLICITLY_LOCKED 2 3116 #define IDETAPE_SPACE_OVER_FILEMARK 1 3117 #define IDETAPE_SPACE_TO_EOD 3 3118 #define IDETAPE_LU_LOAD_MASK 1 3119 #define IDETAPE_LU_RETENSION_MASK 2 3120 #define IDETAPE_LU_EOT_MASK 4 3121 #define IDETAPE_BLOCK_DESCRIPTOR 0 3122 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3123 #ifdef CONFIG_IDE_PROC_FS 3124 #define ide_tape_devset_get(name, field) \ 3125 static int get_##name(ide_drive_t *drive) \ 3126 { \ 3127 idetape_tape_t *tape = drive->driver_data; \ 3128 return tape->field; \ 3129 } 3130 #define ide_tape_devset_set(name, field) \ 3131 static int set_##name(ide_drive_t *drive, int arg) \ 3132 { \ 3133 idetape_tape_t *tape = drive->driver_data; \ 3134 tape->field = arg; \ 3135 return 0; \ 3136 } 3137 #define ide_tape_devset_rw_field(_name, _field) \ 3138 ide_tape_devset_get(_name, _field) \ 3139 ide_tape_devset_set(_name, _field) \ 3140 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3141 #define ide_tape_devset_r_field(_name, _field) \ 3142 ide_tape_devset_get(_name, _field) \ 3143 IDE_DEVSET(_name, 0, get_##_name, NULL) 3144 #endif 3145 #ifdef CONFIG_IDE_PROC_FS 3146 /* LDV_COMMENT_END_PREP */ 3147 /* LDV_COMMENT_FUNCTION_CALL Function from field "open" from driver structure with callbacks "idetape_name_proc_fops". Standart function test for correct return result. */ 3148 ldv_handler_precall(); 3149 res_idetape_name_proc_open_50 = idetape_name_proc_open( var_group1, var_group2); 3150 ldv_check_return_value(res_idetape_name_proc_open_50); 3151 if(res_idetape_name_proc_open_50) 3152 goto ldv_module_exit; 3153 /* LDV_COMMENT_BEGIN_PREP */ 3154 #endif 3155 #ifdef CONFIG_IDE_PROC_FS 3156 #endif 3157 /* LDV_COMMENT_END_PREP */ 3158 ldv_s_idetape_name_proc_fops_file_operations=0; 3159 3160 } 3161 3162 } 3163 3164 break; 3165 case 1: { 3166 3167 /** STRUCT: struct type: ide_driver, struct name: idetape_driver **/ 3168 if(ldv_s_idetape_driver_ide_driver==0) { 3169 3170 /* content: static int ide_tape_probe(ide_drive_t *drive)*/ 3171 /* LDV_COMMENT_BEGIN_PREP */ 3172 #define DRV_NAME "ide-tape" 3173 #define IDETAPE_VERSION "1.20" 3174 #undef IDETAPE_DEBUG_LOG 3175 #ifdef IDETAPE_DEBUG_LOG 3176 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3177 #else 3178 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3179 #endif 3180 #define IDETAPE_MAX_PC_RETRIES 3 3181 #define IDETAPE_FIFO_THRESHOLD 2 3182 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3183 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3184 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3185 #define IDETAPE_DSC_MA_FAST 2*HZ 3186 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3187 #define IDETAPE_DSC_MA_SLOW 30*HZ 3188 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3189 #define DOOR_UNLOCKED 0 3190 #define DOOR_LOCKED 1 3191 #define DOOR_EXPLICITLY_LOCKED 2 3192 #define IDETAPE_SPACE_OVER_FILEMARK 1 3193 #define IDETAPE_SPACE_TO_EOD 3 3194 #define IDETAPE_LU_LOAD_MASK 1 3195 #define IDETAPE_LU_RETENSION_MASK 2 3196 #define IDETAPE_LU_EOT_MASK 4 3197 #define IDETAPE_BLOCK_DESCRIPTOR 0 3198 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3199 #ifdef CONFIG_IDE_PROC_FS 3200 #define ide_tape_devset_get(name, field) \ 3201 static int get_##name(ide_drive_t *drive) \ 3202 { \ 3203 idetape_tape_t *tape = drive->driver_data; \ 3204 return tape->field; \ 3205 } 3206 #define ide_tape_devset_set(name, field) \ 3207 static int set_##name(ide_drive_t *drive, int arg) \ 3208 { \ 3209 idetape_tape_t *tape = drive->driver_data; \ 3210 tape->field = arg; \ 3211 return 0; \ 3212 } 3213 #define ide_tape_devset_rw_field(_name, _field) \ 3214 ide_tape_devset_get(_name, _field) \ 3215 ide_tape_devset_set(_name, _field) \ 3216 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3217 #define ide_tape_devset_r_field(_name, _field) \ 3218 ide_tape_devset_get(_name, _field) \ 3219 IDE_DEVSET(_name, 0, get_##_name, NULL) 3220 #endif 3221 #ifdef CONFIG_IDE_PROC_FS 3222 #endif 3223 #ifdef CONFIG_IDE_PROC_FS 3224 #endif 3225 /* LDV_COMMENT_END_PREP */ 3226 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "idetape_driver". Standart function test for correct return result. */ 3227 res_ide_tape_probe_56 = ide_tape_probe( var_ide_tape_probe_56_p0); 3228 ldv_check_return_value(res_ide_tape_probe_56); 3229 ldv_check_return_value_probe(res_ide_tape_probe_56); 3230 if(res_ide_tape_probe_56) 3231 goto ldv_module_exit; 3232 ldv_s_idetape_driver_ide_driver++; 3233 3234 } 3235 3236 } 3237 3238 break; 3239 case 2: { 3240 3241 /** STRUCT: struct type: ide_driver, struct name: idetape_driver **/ 3242 if(ldv_s_idetape_driver_ide_driver==1) { 3243 3244 /* content: static void ide_tape_remove(ide_drive_t *drive)*/ 3245 /* LDV_COMMENT_BEGIN_PREP */ 3246 #define DRV_NAME "ide-tape" 3247 #define IDETAPE_VERSION "1.20" 3248 #undef IDETAPE_DEBUG_LOG 3249 #ifdef IDETAPE_DEBUG_LOG 3250 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3251 #else 3252 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3253 #endif 3254 #define IDETAPE_MAX_PC_RETRIES 3 3255 #define IDETAPE_FIFO_THRESHOLD 2 3256 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3257 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3258 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3259 #define IDETAPE_DSC_MA_FAST 2*HZ 3260 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3261 #define IDETAPE_DSC_MA_SLOW 30*HZ 3262 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3263 #define DOOR_UNLOCKED 0 3264 #define DOOR_LOCKED 1 3265 #define DOOR_EXPLICITLY_LOCKED 2 3266 #define IDETAPE_SPACE_OVER_FILEMARK 1 3267 #define IDETAPE_SPACE_TO_EOD 3 3268 #define IDETAPE_LU_LOAD_MASK 1 3269 #define IDETAPE_LU_RETENSION_MASK 2 3270 #define IDETAPE_LU_EOT_MASK 4 3271 #define IDETAPE_BLOCK_DESCRIPTOR 0 3272 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3273 #ifdef CONFIG_IDE_PROC_FS 3274 #define ide_tape_devset_get(name, field) \ 3275 static int get_##name(ide_drive_t *drive) \ 3276 { \ 3277 idetape_tape_t *tape = drive->driver_data; \ 3278 return tape->field; \ 3279 } 3280 #define ide_tape_devset_set(name, field) \ 3281 static int set_##name(ide_drive_t *drive, int arg) \ 3282 { \ 3283 idetape_tape_t *tape = drive->driver_data; \ 3284 tape->field = arg; \ 3285 return 0; \ 3286 } 3287 #define ide_tape_devset_rw_field(_name, _field) \ 3288 ide_tape_devset_get(_name, _field) \ 3289 ide_tape_devset_set(_name, _field) \ 3290 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3291 #define ide_tape_devset_r_field(_name, _field) \ 3292 ide_tape_devset_get(_name, _field) \ 3293 IDE_DEVSET(_name, 0, get_##_name, NULL) 3294 #endif 3295 /* LDV_COMMENT_END_PREP */ 3296 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "idetape_driver" */ 3297 ldv_handler_precall(); 3298 ide_tape_remove( var_ide_tape_remove_47_p0); 3299 /* LDV_COMMENT_BEGIN_PREP */ 3300 #ifdef CONFIG_IDE_PROC_FS 3301 #endif 3302 #ifdef CONFIG_IDE_PROC_FS 3303 #endif 3304 /* LDV_COMMENT_END_PREP */ 3305 ldv_s_idetape_driver_ide_driver=0; 3306 3307 } 3308 3309 } 3310 3311 break; 3312 case 3: { 3313 3314 /** STRUCT: struct type: ide_driver, struct name: idetape_driver **/ 3315 3316 3317 /* content: static ide_startstop_t idetape_do_request(ide_drive_t *drive, struct request *rq, sector_t block)*/ 3318 /* LDV_COMMENT_BEGIN_PREP */ 3319 #define DRV_NAME "ide-tape" 3320 #define IDETAPE_VERSION "1.20" 3321 #undef IDETAPE_DEBUG_LOG 3322 #ifdef IDETAPE_DEBUG_LOG 3323 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3324 #else 3325 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3326 #endif 3327 #define IDETAPE_MAX_PC_RETRIES 3 3328 #define IDETAPE_FIFO_THRESHOLD 2 3329 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3330 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3331 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3332 #define IDETAPE_DSC_MA_FAST 2*HZ 3333 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3334 #define IDETAPE_DSC_MA_SLOW 30*HZ 3335 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3336 #define DOOR_UNLOCKED 0 3337 #define DOOR_LOCKED 1 3338 #define DOOR_EXPLICITLY_LOCKED 2 3339 #define IDETAPE_SPACE_OVER_FILEMARK 1 3340 #define IDETAPE_SPACE_TO_EOD 3 3341 #define IDETAPE_LU_LOAD_MASK 1 3342 #define IDETAPE_LU_RETENSION_MASK 2 3343 #define IDETAPE_LU_EOT_MASK 4 3344 #define IDETAPE_BLOCK_DESCRIPTOR 0 3345 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3346 /* LDV_COMMENT_END_PREP */ 3347 /* LDV_COMMENT_FUNCTION_CALL Function from field "do_request" from driver structure with callbacks "idetape_driver" */ 3348 ldv_handler_precall(); 3349 idetape_do_request( var_idetape_do_request_10_p0, var_group3, var_idetape_do_request_10_p2); 3350 /* LDV_COMMENT_BEGIN_PREP */ 3351 #ifdef CONFIG_IDE_PROC_FS 3352 #define ide_tape_devset_get(name, field) \ 3353 static int get_##name(ide_drive_t *drive) \ 3354 { \ 3355 idetape_tape_t *tape = drive->driver_data; \ 3356 return tape->field; \ 3357 } 3358 #define ide_tape_devset_set(name, field) \ 3359 static int set_##name(ide_drive_t *drive, int arg) \ 3360 { \ 3361 idetape_tape_t *tape = drive->driver_data; \ 3362 tape->field = arg; \ 3363 return 0; \ 3364 } 3365 #define ide_tape_devset_rw_field(_name, _field) \ 3366 ide_tape_devset_get(_name, _field) \ 3367 ide_tape_devset_set(_name, _field) \ 3368 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3369 #define ide_tape_devset_r_field(_name, _field) \ 3370 ide_tape_devset_get(_name, _field) \ 3371 IDE_DEVSET(_name, 0, get_##_name, NULL) 3372 #endif 3373 #ifdef CONFIG_IDE_PROC_FS 3374 #endif 3375 #ifdef CONFIG_IDE_PROC_FS 3376 #endif 3377 /* LDV_COMMENT_END_PREP */ 3378 3379 3380 3381 3382 } 3383 3384 break; 3385 case 4: { 3386 3387 /** STRUCT: struct type: ide_driver, struct name: idetape_driver **/ 3388 3389 3390 /* content: static ide_proc_entry_t *ide_tape_proc_entries(ide_drive_t *drive)*/ 3391 /* LDV_COMMENT_BEGIN_PREP */ 3392 #define DRV_NAME "ide-tape" 3393 #define IDETAPE_VERSION "1.20" 3394 #undef IDETAPE_DEBUG_LOG 3395 #ifdef IDETAPE_DEBUG_LOG 3396 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3397 #else 3398 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3399 #endif 3400 #define IDETAPE_MAX_PC_RETRIES 3 3401 #define IDETAPE_FIFO_THRESHOLD 2 3402 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3403 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3404 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3405 #define IDETAPE_DSC_MA_FAST 2*HZ 3406 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3407 #define IDETAPE_DSC_MA_SLOW 30*HZ 3408 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3409 #define DOOR_UNLOCKED 0 3410 #define DOOR_LOCKED 1 3411 #define DOOR_EXPLICITLY_LOCKED 2 3412 #define IDETAPE_SPACE_OVER_FILEMARK 1 3413 #define IDETAPE_SPACE_TO_EOD 3 3414 #define IDETAPE_LU_LOAD_MASK 1 3415 #define IDETAPE_LU_RETENSION_MASK 2 3416 #define IDETAPE_LU_EOT_MASK 4 3417 #define IDETAPE_BLOCK_DESCRIPTOR 0 3418 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3419 #ifdef CONFIG_IDE_PROC_FS 3420 #define ide_tape_devset_get(name, field) \ 3421 static int get_##name(ide_drive_t *drive) \ 3422 { \ 3423 idetape_tape_t *tape = drive->driver_data; \ 3424 return tape->field; \ 3425 } 3426 #define ide_tape_devset_set(name, field) \ 3427 static int set_##name(ide_drive_t *drive, int arg) \ 3428 { \ 3429 idetape_tape_t *tape = drive->driver_data; \ 3430 tape->field = arg; \ 3431 return 0; \ 3432 } 3433 #define ide_tape_devset_rw_field(_name, _field) \ 3434 ide_tape_devset_get(_name, _field) \ 3435 ide_tape_devset_set(_name, _field) \ 3436 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3437 #define ide_tape_devset_r_field(_name, _field) \ 3438 ide_tape_devset_get(_name, _field) \ 3439 IDE_DEVSET(_name, 0, get_##_name, NULL) 3440 #endif 3441 #ifdef CONFIG_IDE_PROC_FS 3442 /* LDV_COMMENT_END_PREP */ 3443 /* LDV_COMMENT_FUNCTION_CALL Function from field "proc_entries" from driver structure with callbacks "idetape_driver" */ 3444 ldv_handler_precall(); 3445 ide_tape_proc_entries( var_ide_tape_proc_entries_51_p0); 3446 /* LDV_COMMENT_BEGIN_PREP */ 3447 #endif 3448 #ifdef CONFIG_IDE_PROC_FS 3449 #endif 3450 /* LDV_COMMENT_END_PREP */ 3451 3452 3453 3454 3455 } 3456 3457 break; 3458 case 5: { 3459 3460 /** STRUCT: struct type: ide_driver, struct name: idetape_driver **/ 3461 3462 3463 /* content: static const struct ide_proc_devset *ide_tape_proc_devsets(ide_drive_t *drive)*/ 3464 /* LDV_COMMENT_BEGIN_PREP */ 3465 #define DRV_NAME "ide-tape" 3466 #define IDETAPE_VERSION "1.20" 3467 #undef IDETAPE_DEBUG_LOG 3468 #ifdef IDETAPE_DEBUG_LOG 3469 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3470 #else 3471 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3472 #endif 3473 #define IDETAPE_MAX_PC_RETRIES 3 3474 #define IDETAPE_FIFO_THRESHOLD 2 3475 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3476 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3477 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3478 #define IDETAPE_DSC_MA_FAST 2*HZ 3479 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3480 #define IDETAPE_DSC_MA_SLOW 30*HZ 3481 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3482 #define DOOR_UNLOCKED 0 3483 #define DOOR_LOCKED 1 3484 #define DOOR_EXPLICITLY_LOCKED 2 3485 #define IDETAPE_SPACE_OVER_FILEMARK 1 3486 #define IDETAPE_SPACE_TO_EOD 3 3487 #define IDETAPE_LU_LOAD_MASK 1 3488 #define IDETAPE_LU_RETENSION_MASK 2 3489 #define IDETAPE_LU_EOT_MASK 4 3490 #define IDETAPE_BLOCK_DESCRIPTOR 0 3491 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3492 #ifdef CONFIG_IDE_PROC_FS 3493 #define ide_tape_devset_get(name, field) \ 3494 static int get_##name(ide_drive_t *drive) \ 3495 { \ 3496 idetape_tape_t *tape = drive->driver_data; \ 3497 return tape->field; \ 3498 } 3499 #define ide_tape_devset_set(name, field) \ 3500 static int set_##name(ide_drive_t *drive, int arg) \ 3501 { \ 3502 idetape_tape_t *tape = drive->driver_data; \ 3503 tape->field = arg; \ 3504 return 0; \ 3505 } 3506 #define ide_tape_devset_rw_field(_name, _field) \ 3507 ide_tape_devset_get(_name, _field) \ 3508 ide_tape_devset_set(_name, _field) \ 3509 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3510 #define ide_tape_devset_r_field(_name, _field) \ 3511 ide_tape_devset_get(_name, _field) \ 3512 IDE_DEVSET(_name, 0, get_##_name, NULL) 3513 #endif 3514 #ifdef CONFIG_IDE_PROC_FS 3515 /* LDV_COMMENT_END_PREP */ 3516 /* LDV_COMMENT_FUNCTION_CALL Function from field "proc_devsets" from driver structure with callbacks "idetape_driver" */ 3517 ldv_handler_precall(); 3518 ide_tape_proc_devsets( var_ide_tape_proc_devsets_52_p0); 3519 /* LDV_COMMENT_BEGIN_PREP */ 3520 #endif 3521 #ifdef CONFIG_IDE_PROC_FS 3522 #endif 3523 /* LDV_COMMENT_END_PREP */ 3524 3525 3526 3527 3528 } 3529 3530 break; 3531 case 6: { 3532 3533 /** STRUCT: struct type: file_operations, struct name: idetape_fops **/ 3534 if(ldv_s_idetape_fops_file_operations==0) { 3535 3536 /* content: static int idetape_chrdev_open(struct inode *inode, struct file *filp)*/ 3537 /* LDV_COMMENT_BEGIN_PREP */ 3538 #define DRV_NAME "ide-tape" 3539 #define IDETAPE_VERSION "1.20" 3540 #undef IDETAPE_DEBUG_LOG 3541 #ifdef IDETAPE_DEBUG_LOG 3542 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3543 #else 3544 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3545 #endif 3546 #define IDETAPE_MAX_PC_RETRIES 3 3547 #define IDETAPE_FIFO_THRESHOLD 2 3548 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3549 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3550 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3551 #define IDETAPE_DSC_MA_FAST 2*HZ 3552 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3553 #define IDETAPE_DSC_MA_SLOW 30*HZ 3554 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3555 #define DOOR_UNLOCKED 0 3556 #define DOOR_LOCKED 1 3557 #define DOOR_EXPLICITLY_LOCKED 2 3558 #define IDETAPE_SPACE_OVER_FILEMARK 1 3559 #define IDETAPE_SPACE_TO_EOD 3 3560 #define IDETAPE_LU_LOAD_MASK 1 3561 #define IDETAPE_LU_RETENSION_MASK 2 3562 #define IDETAPE_LU_EOT_MASK 4 3563 #define IDETAPE_BLOCK_DESCRIPTOR 0 3564 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3565 /* LDV_COMMENT_END_PREP */ 3566 /* LDV_COMMENT_FUNCTION_CALL Function from field "open" from driver structure with callbacks "idetape_fops". Standart function test for correct return result. */ 3567 ldv_handler_precall(); 3568 res_idetape_chrdev_open_37 = idetape_chrdev_open( var_group1, var_group2); 3569 ldv_check_return_value(res_idetape_chrdev_open_37); 3570 if(res_idetape_chrdev_open_37) 3571 goto ldv_module_exit; 3572 /* LDV_COMMENT_BEGIN_PREP */ 3573 #ifdef CONFIG_IDE_PROC_FS 3574 #define ide_tape_devset_get(name, field) \ 3575 static int get_##name(ide_drive_t *drive) \ 3576 { \ 3577 idetape_tape_t *tape = drive->driver_data; \ 3578 return tape->field; \ 3579 } 3580 #define ide_tape_devset_set(name, field) \ 3581 static int set_##name(ide_drive_t *drive, int arg) \ 3582 { \ 3583 idetape_tape_t *tape = drive->driver_data; \ 3584 tape->field = arg; \ 3585 return 0; \ 3586 } 3587 #define ide_tape_devset_rw_field(_name, _field) \ 3588 ide_tape_devset_get(_name, _field) \ 3589 ide_tape_devset_set(_name, _field) \ 3590 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3591 #define ide_tape_devset_r_field(_name, _field) \ 3592 ide_tape_devset_get(_name, _field) \ 3593 IDE_DEVSET(_name, 0, get_##_name, NULL) 3594 #endif 3595 #ifdef CONFIG_IDE_PROC_FS 3596 #endif 3597 #ifdef CONFIG_IDE_PROC_FS 3598 #endif 3599 /* LDV_COMMENT_END_PREP */ 3600 ldv_s_idetape_fops_file_operations++; 3601 3602 } 3603 3604 } 3605 3606 break; 3607 case 7: { 3608 3609 /** STRUCT: struct type: file_operations, struct name: idetape_fops **/ 3610 if(ldv_s_idetape_fops_file_operations==1) { 3611 3612 /* content: static ssize_t idetape_chrdev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)*/ 3613 /* LDV_COMMENT_BEGIN_PREP */ 3614 #define DRV_NAME "ide-tape" 3615 #define IDETAPE_VERSION "1.20" 3616 #undef IDETAPE_DEBUG_LOG 3617 #ifdef IDETAPE_DEBUG_LOG 3618 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3619 #else 3620 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3621 #endif 3622 #define IDETAPE_MAX_PC_RETRIES 3 3623 #define IDETAPE_FIFO_THRESHOLD 2 3624 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3625 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3626 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3627 #define IDETAPE_DSC_MA_FAST 2*HZ 3628 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3629 #define IDETAPE_DSC_MA_SLOW 30*HZ 3630 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3631 #define DOOR_UNLOCKED 0 3632 #define DOOR_LOCKED 1 3633 #define DOOR_EXPLICITLY_LOCKED 2 3634 #define IDETAPE_SPACE_OVER_FILEMARK 1 3635 #define IDETAPE_SPACE_TO_EOD 3 3636 #define IDETAPE_LU_LOAD_MASK 1 3637 #define IDETAPE_LU_RETENSION_MASK 2 3638 #define IDETAPE_LU_EOT_MASK 4 3639 #define IDETAPE_BLOCK_DESCRIPTOR 0 3640 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3641 /* LDV_COMMENT_END_PREP */ 3642 /* LDV_COMMENT_FUNCTION_CALL Function from field "read" from driver structure with callbacks "idetape_fops". Standart function test for correct return result. */ 3643 ldv_handler_precall(); 3644 res_idetape_chrdev_read_30 = idetape_chrdev_read( var_group2, var_idetape_chrdev_read_30_p1, var_idetape_chrdev_read_30_p2, var_idetape_chrdev_read_30_p3); 3645 ldv_check_return_value(res_idetape_chrdev_read_30); 3646 if(res_idetape_chrdev_read_30 < 0) 3647 goto ldv_module_exit; 3648 /* LDV_COMMENT_BEGIN_PREP */ 3649 #ifdef CONFIG_IDE_PROC_FS 3650 #define ide_tape_devset_get(name, field) \ 3651 static int get_##name(ide_drive_t *drive) \ 3652 { \ 3653 idetape_tape_t *tape = drive->driver_data; \ 3654 return tape->field; \ 3655 } 3656 #define ide_tape_devset_set(name, field) \ 3657 static int set_##name(ide_drive_t *drive, int arg) \ 3658 { \ 3659 idetape_tape_t *tape = drive->driver_data; \ 3660 tape->field = arg; \ 3661 return 0; \ 3662 } 3663 #define ide_tape_devset_rw_field(_name, _field) \ 3664 ide_tape_devset_get(_name, _field) \ 3665 ide_tape_devset_set(_name, _field) \ 3666 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3667 #define ide_tape_devset_r_field(_name, _field) \ 3668 ide_tape_devset_get(_name, _field) \ 3669 IDE_DEVSET(_name, 0, get_##_name, NULL) 3670 #endif 3671 #ifdef CONFIG_IDE_PROC_FS 3672 #endif 3673 #ifdef CONFIG_IDE_PROC_FS 3674 #endif 3675 /* LDV_COMMENT_END_PREP */ 3676 ldv_s_idetape_fops_file_operations++; 3677 3678 } 3679 3680 } 3681 3682 break; 3683 case 8: { 3684 3685 /** STRUCT: struct type: file_operations, struct name: idetape_fops **/ 3686 if(ldv_s_idetape_fops_file_operations==2) { 3687 3688 /* content: static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)*/ 3689 /* LDV_COMMENT_BEGIN_PREP */ 3690 #define DRV_NAME "ide-tape" 3691 #define IDETAPE_VERSION "1.20" 3692 #undef IDETAPE_DEBUG_LOG 3693 #ifdef IDETAPE_DEBUG_LOG 3694 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3695 #else 3696 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3697 #endif 3698 #define IDETAPE_MAX_PC_RETRIES 3 3699 #define IDETAPE_FIFO_THRESHOLD 2 3700 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3701 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3702 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3703 #define IDETAPE_DSC_MA_FAST 2*HZ 3704 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3705 #define IDETAPE_DSC_MA_SLOW 30*HZ 3706 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3707 #define DOOR_UNLOCKED 0 3708 #define DOOR_LOCKED 1 3709 #define DOOR_EXPLICITLY_LOCKED 2 3710 #define IDETAPE_SPACE_OVER_FILEMARK 1 3711 #define IDETAPE_SPACE_TO_EOD 3 3712 #define IDETAPE_LU_LOAD_MASK 1 3713 #define IDETAPE_LU_RETENSION_MASK 2 3714 #define IDETAPE_LU_EOT_MASK 4 3715 #define IDETAPE_BLOCK_DESCRIPTOR 0 3716 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3717 /* LDV_COMMENT_END_PREP */ 3718 /* LDV_COMMENT_FUNCTION_CALL Function from field "write" from driver structure with callbacks "idetape_fops". Standart function test for correct return result. */ 3719 ldv_handler_precall(); 3720 res_idetape_chrdev_write_31 = idetape_chrdev_write( var_group2, var_idetape_chrdev_write_31_p1, var_idetape_chrdev_write_31_p2, var_idetape_chrdev_write_31_p3); 3721 ldv_check_return_value(res_idetape_chrdev_write_31); 3722 if(res_idetape_chrdev_write_31 < 0) 3723 goto ldv_module_exit; 3724 /* LDV_COMMENT_BEGIN_PREP */ 3725 #ifdef CONFIG_IDE_PROC_FS 3726 #define ide_tape_devset_get(name, field) \ 3727 static int get_##name(ide_drive_t *drive) \ 3728 { \ 3729 idetape_tape_t *tape = drive->driver_data; \ 3730 return tape->field; \ 3731 } 3732 #define ide_tape_devset_set(name, field) \ 3733 static int set_##name(ide_drive_t *drive, int arg) \ 3734 { \ 3735 idetape_tape_t *tape = drive->driver_data; \ 3736 tape->field = arg; \ 3737 return 0; \ 3738 } 3739 #define ide_tape_devset_rw_field(_name, _field) \ 3740 ide_tape_devset_get(_name, _field) \ 3741 ide_tape_devset_set(_name, _field) \ 3742 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3743 #define ide_tape_devset_r_field(_name, _field) \ 3744 ide_tape_devset_get(_name, _field) \ 3745 IDE_DEVSET(_name, 0, get_##_name, NULL) 3746 #endif 3747 #ifdef CONFIG_IDE_PROC_FS 3748 #endif 3749 #ifdef CONFIG_IDE_PROC_FS 3750 #endif 3751 /* LDV_COMMENT_END_PREP */ 3752 ldv_s_idetape_fops_file_operations++; 3753 3754 } 3755 3756 } 3757 3758 break; 3759 case 9: { 3760 3761 /** STRUCT: struct type: file_operations, struct name: idetape_fops **/ 3762 if(ldv_s_idetape_fops_file_operations==3) { 3763 3764 /* content: static int idetape_chrdev_release(struct inode *inode, struct file *filp)*/ 3765 /* LDV_COMMENT_BEGIN_PREP */ 3766 #define DRV_NAME "ide-tape" 3767 #define IDETAPE_VERSION "1.20" 3768 #undef IDETAPE_DEBUG_LOG 3769 #ifdef IDETAPE_DEBUG_LOG 3770 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3771 #else 3772 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3773 #endif 3774 #define IDETAPE_MAX_PC_RETRIES 3 3775 #define IDETAPE_FIFO_THRESHOLD 2 3776 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3777 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3778 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3779 #define IDETAPE_DSC_MA_FAST 2*HZ 3780 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3781 #define IDETAPE_DSC_MA_SLOW 30*HZ 3782 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3783 #define DOOR_UNLOCKED 0 3784 #define DOOR_LOCKED 1 3785 #define DOOR_EXPLICITLY_LOCKED 2 3786 #define IDETAPE_SPACE_OVER_FILEMARK 1 3787 #define IDETAPE_SPACE_TO_EOD 3 3788 #define IDETAPE_LU_LOAD_MASK 1 3789 #define IDETAPE_LU_RETENSION_MASK 2 3790 #define IDETAPE_LU_EOT_MASK 4 3791 #define IDETAPE_BLOCK_DESCRIPTOR 0 3792 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3793 /* LDV_COMMENT_END_PREP */ 3794 /* LDV_COMMENT_FUNCTION_CALL Function from field "release" from driver structure with callbacks "idetape_fops" */ 3795 ldv_handler_precall(); 3796 idetape_chrdev_release( var_group1, var_group2); 3797 /* LDV_COMMENT_BEGIN_PREP */ 3798 #ifdef CONFIG_IDE_PROC_FS 3799 #define ide_tape_devset_get(name, field) \ 3800 static int get_##name(ide_drive_t *drive) \ 3801 { \ 3802 idetape_tape_t *tape = drive->driver_data; \ 3803 return tape->field; \ 3804 } 3805 #define ide_tape_devset_set(name, field) \ 3806 static int set_##name(ide_drive_t *drive, int arg) \ 3807 { \ 3808 idetape_tape_t *tape = drive->driver_data; \ 3809 tape->field = arg; \ 3810 return 0; \ 3811 } 3812 #define ide_tape_devset_rw_field(_name, _field) \ 3813 ide_tape_devset_get(_name, _field) \ 3814 ide_tape_devset_set(_name, _field) \ 3815 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3816 #define ide_tape_devset_r_field(_name, _field) \ 3817 ide_tape_devset_get(_name, _field) \ 3818 IDE_DEVSET(_name, 0, get_##_name, NULL) 3819 #endif 3820 #ifdef CONFIG_IDE_PROC_FS 3821 #endif 3822 #ifdef CONFIG_IDE_PROC_FS 3823 #endif 3824 /* LDV_COMMENT_END_PREP */ 3825 ldv_s_idetape_fops_file_operations=0; 3826 3827 } 3828 3829 } 3830 3831 break; 3832 case 10: { 3833 3834 /** STRUCT: struct type: file_operations, struct name: idetape_fops **/ 3835 3836 3837 /* content: static long idetape_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)*/ 3838 /* LDV_COMMENT_BEGIN_PREP */ 3839 #define DRV_NAME "ide-tape" 3840 #define IDETAPE_VERSION "1.20" 3841 #undef IDETAPE_DEBUG_LOG 3842 #ifdef IDETAPE_DEBUG_LOG 3843 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3844 #else 3845 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3846 #endif 3847 #define IDETAPE_MAX_PC_RETRIES 3 3848 #define IDETAPE_FIFO_THRESHOLD 2 3849 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3850 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3851 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3852 #define IDETAPE_DSC_MA_FAST 2*HZ 3853 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3854 #define IDETAPE_DSC_MA_SLOW 30*HZ 3855 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3856 #define DOOR_UNLOCKED 0 3857 #define DOOR_LOCKED 1 3858 #define DOOR_EXPLICITLY_LOCKED 2 3859 #define IDETAPE_SPACE_OVER_FILEMARK 1 3860 #define IDETAPE_SPACE_TO_EOD 3 3861 #define IDETAPE_LU_LOAD_MASK 1 3862 #define IDETAPE_LU_RETENSION_MASK 2 3863 #define IDETAPE_LU_EOT_MASK 4 3864 #define IDETAPE_BLOCK_DESCRIPTOR 0 3865 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3866 /* LDV_COMMENT_END_PREP */ 3867 /* LDV_COMMENT_FUNCTION_CALL Function from field "unlocked_ioctl" from driver structure with callbacks "idetape_fops" */ 3868 ldv_handler_precall(); 3869 idetape_chrdev_ioctl( var_group2, var_idetape_chrdev_ioctl_35_p1, var_idetape_chrdev_ioctl_35_p2); 3870 /* LDV_COMMENT_BEGIN_PREP */ 3871 #ifdef CONFIG_IDE_PROC_FS 3872 #define ide_tape_devset_get(name, field) \ 3873 static int get_##name(ide_drive_t *drive) \ 3874 { \ 3875 idetape_tape_t *tape = drive->driver_data; \ 3876 return tape->field; \ 3877 } 3878 #define ide_tape_devset_set(name, field) \ 3879 static int set_##name(ide_drive_t *drive, int arg) \ 3880 { \ 3881 idetape_tape_t *tape = drive->driver_data; \ 3882 tape->field = arg; \ 3883 return 0; \ 3884 } 3885 #define ide_tape_devset_rw_field(_name, _field) \ 3886 ide_tape_devset_get(_name, _field) \ 3887 ide_tape_devset_set(_name, _field) \ 3888 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3889 #define ide_tape_devset_r_field(_name, _field) \ 3890 ide_tape_devset_get(_name, _field) \ 3891 IDE_DEVSET(_name, 0, get_##_name, NULL) 3892 #endif 3893 #ifdef CONFIG_IDE_PROC_FS 3894 #endif 3895 #ifdef CONFIG_IDE_PROC_FS 3896 #endif 3897 /* LDV_COMMENT_END_PREP */ 3898 3899 3900 3901 3902 } 3903 3904 break; 3905 case 11: { 3906 3907 /** STRUCT: struct type: block_device_operations, struct name: idetape_block_ops **/ 3908 if(ldv_s_idetape_block_ops_block_device_operations==0) { 3909 3910 /* content: static int idetape_open(struct block_device *bdev, fmode_t mode)*/ 3911 /* LDV_COMMENT_BEGIN_PREP */ 3912 #define DRV_NAME "ide-tape" 3913 #define IDETAPE_VERSION "1.20" 3914 #undef IDETAPE_DEBUG_LOG 3915 #ifdef IDETAPE_DEBUG_LOG 3916 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3917 #else 3918 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3919 #endif 3920 #define IDETAPE_MAX_PC_RETRIES 3 3921 #define IDETAPE_FIFO_THRESHOLD 2 3922 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3923 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3924 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3925 #define IDETAPE_DSC_MA_FAST 2*HZ 3926 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 3927 #define IDETAPE_DSC_MA_SLOW 30*HZ 3928 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 3929 #define DOOR_UNLOCKED 0 3930 #define DOOR_LOCKED 1 3931 #define DOOR_EXPLICITLY_LOCKED 2 3932 #define IDETAPE_SPACE_OVER_FILEMARK 1 3933 #define IDETAPE_SPACE_TO_EOD 3 3934 #define IDETAPE_LU_LOAD_MASK 1 3935 #define IDETAPE_LU_RETENSION_MASK 2 3936 #define IDETAPE_LU_EOT_MASK 4 3937 #define IDETAPE_BLOCK_DESCRIPTOR 0 3938 #define IDETAPE_CAPABILITIES_PAGE 0x2a 3939 #ifdef CONFIG_IDE_PROC_FS 3940 #define ide_tape_devset_get(name, field) \ 3941 static int get_##name(ide_drive_t *drive) \ 3942 { \ 3943 idetape_tape_t *tape = drive->driver_data; \ 3944 return tape->field; \ 3945 } 3946 #define ide_tape_devset_set(name, field) \ 3947 static int set_##name(ide_drive_t *drive, int arg) \ 3948 { \ 3949 idetape_tape_t *tape = drive->driver_data; \ 3950 tape->field = arg; \ 3951 return 0; \ 3952 } 3953 #define ide_tape_devset_rw_field(_name, _field) \ 3954 ide_tape_devset_get(_name, _field) \ 3955 ide_tape_devset_set(_name, _field) \ 3956 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 3957 #define ide_tape_devset_r_field(_name, _field) \ 3958 ide_tape_devset_get(_name, _field) \ 3959 IDE_DEVSET(_name, 0, get_##_name, NULL) 3960 #endif 3961 #ifdef CONFIG_IDE_PROC_FS 3962 #endif 3963 #ifdef CONFIG_IDE_PROC_FS 3964 #endif 3965 /* LDV_COMMENT_END_PREP */ 3966 /* LDV_COMMENT_FUNCTION_CALL Function from field "open" from driver structure with callbacks "idetape_block_ops". Standart function test for correct return result. */ 3967 ldv_handler_precall(); 3968 res_idetape_open_53 = idetape_open( var_group4, var_idetape_open_53_p1); 3969 ldv_check_return_value(res_idetape_open_53); 3970 if(res_idetape_open_53) 3971 goto ldv_module_exit; 3972 ldv_s_idetape_block_ops_block_device_operations++; 3973 3974 } 3975 3976 } 3977 3978 break; 3979 case 12: { 3980 3981 /** STRUCT: struct type: block_device_operations, struct name: idetape_block_ops **/ 3982 if(ldv_s_idetape_block_ops_block_device_operations==1) { 3983 3984 /* content: static void idetape_release(struct gendisk *disk, fmode_t mode)*/ 3985 /* LDV_COMMENT_BEGIN_PREP */ 3986 #define DRV_NAME "ide-tape" 3987 #define IDETAPE_VERSION "1.20" 3988 #undef IDETAPE_DEBUG_LOG 3989 #ifdef IDETAPE_DEBUG_LOG 3990 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 3991 #else 3992 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 3993 #endif 3994 #define IDETAPE_MAX_PC_RETRIES 3 3995 #define IDETAPE_FIFO_THRESHOLD 2 3996 #define IDETAPE_DSC_RW_MIN 5*HZ/100 3997 #define IDETAPE_DSC_RW_MAX 40*HZ/100 3998 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 3999 #define IDETAPE_DSC_MA_FAST 2*HZ 4000 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 4001 #define IDETAPE_DSC_MA_SLOW 30*HZ 4002 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 4003 #define DOOR_UNLOCKED 0 4004 #define DOOR_LOCKED 1 4005 #define DOOR_EXPLICITLY_LOCKED 2 4006 #define IDETAPE_SPACE_OVER_FILEMARK 1 4007 #define IDETAPE_SPACE_TO_EOD 3 4008 #define IDETAPE_LU_LOAD_MASK 1 4009 #define IDETAPE_LU_RETENSION_MASK 2 4010 #define IDETAPE_LU_EOT_MASK 4 4011 #define IDETAPE_BLOCK_DESCRIPTOR 0 4012 #define IDETAPE_CAPABILITIES_PAGE 0x2a 4013 #ifdef CONFIG_IDE_PROC_FS 4014 #define ide_tape_devset_get(name, field) \ 4015 static int get_##name(ide_drive_t *drive) \ 4016 { \ 4017 idetape_tape_t *tape = drive->driver_data; \ 4018 return tape->field; \ 4019 } 4020 #define ide_tape_devset_set(name, field) \ 4021 static int set_##name(ide_drive_t *drive, int arg) \ 4022 { \ 4023 idetape_tape_t *tape = drive->driver_data; \ 4024 tape->field = arg; \ 4025 return 0; \ 4026 } 4027 #define ide_tape_devset_rw_field(_name, _field) \ 4028 ide_tape_devset_get(_name, _field) \ 4029 ide_tape_devset_set(_name, _field) \ 4030 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 4031 #define ide_tape_devset_r_field(_name, _field) \ 4032 ide_tape_devset_get(_name, _field) \ 4033 IDE_DEVSET(_name, 0, get_##_name, NULL) 4034 #endif 4035 #ifdef CONFIG_IDE_PROC_FS 4036 #endif 4037 #ifdef CONFIG_IDE_PROC_FS 4038 #endif 4039 /* LDV_COMMENT_END_PREP */ 4040 /* LDV_COMMENT_FUNCTION_CALL Function from field "release" from driver structure with callbacks "idetape_block_ops" */ 4041 ldv_handler_precall(); 4042 idetape_release( var_group5, var_idetape_release_54_p1); 4043 ldv_s_idetape_block_ops_block_device_operations=0; 4044 4045 } 4046 4047 } 4048 4049 break; 4050 case 13: { 4051 4052 /** STRUCT: struct type: block_device_operations, struct name: idetape_block_ops **/ 4053 4054 4055 /* content: static int idetape_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg)*/ 4056 /* LDV_COMMENT_BEGIN_PREP */ 4057 #define DRV_NAME "ide-tape" 4058 #define IDETAPE_VERSION "1.20" 4059 #undef IDETAPE_DEBUG_LOG 4060 #ifdef IDETAPE_DEBUG_LOG 4061 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 4062 #else 4063 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 4064 #endif 4065 #define IDETAPE_MAX_PC_RETRIES 3 4066 #define IDETAPE_FIFO_THRESHOLD 2 4067 #define IDETAPE_DSC_RW_MIN 5*HZ/100 4068 #define IDETAPE_DSC_RW_MAX 40*HZ/100 4069 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 4070 #define IDETAPE_DSC_MA_FAST 2*HZ 4071 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 4072 #define IDETAPE_DSC_MA_SLOW 30*HZ 4073 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 4074 #define DOOR_UNLOCKED 0 4075 #define DOOR_LOCKED 1 4076 #define DOOR_EXPLICITLY_LOCKED 2 4077 #define IDETAPE_SPACE_OVER_FILEMARK 1 4078 #define IDETAPE_SPACE_TO_EOD 3 4079 #define IDETAPE_LU_LOAD_MASK 1 4080 #define IDETAPE_LU_RETENSION_MASK 2 4081 #define IDETAPE_LU_EOT_MASK 4 4082 #define IDETAPE_BLOCK_DESCRIPTOR 0 4083 #define IDETAPE_CAPABILITIES_PAGE 0x2a 4084 #ifdef CONFIG_IDE_PROC_FS 4085 #define ide_tape_devset_get(name, field) \ 4086 static int get_##name(ide_drive_t *drive) \ 4087 { \ 4088 idetape_tape_t *tape = drive->driver_data; \ 4089 return tape->field; \ 4090 } 4091 #define ide_tape_devset_set(name, field) \ 4092 static int set_##name(ide_drive_t *drive, int arg) \ 4093 { \ 4094 idetape_tape_t *tape = drive->driver_data; \ 4095 tape->field = arg; \ 4096 return 0; \ 4097 } 4098 #define ide_tape_devset_rw_field(_name, _field) \ 4099 ide_tape_devset_get(_name, _field) \ 4100 ide_tape_devset_set(_name, _field) \ 4101 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 4102 #define ide_tape_devset_r_field(_name, _field) \ 4103 ide_tape_devset_get(_name, _field) \ 4104 IDE_DEVSET(_name, 0, get_##_name, NULL) 4105 #endif 4106 #ifdef CONFIG_IDE_PROC_FS 4107 #endif 4108 #ifdef CONFIG_IDE_PROC_FS 4109 #endif 4110 /* LDV_COMMENT_END_PREP */ 4111 /* LDV_COMMENT_FUNCTION_CALL Function from field "ioctl" from driver structure with callbacks "idetape_block_ops" */ 4112 ldv_handler_precall(); 4113 idetape_ioctl( var_group4, var_idetape_ioctl_55_p1, var_idetape_ioctl_55_p2, var_idetape_ioctl_55_p3); 4114 4115 4116 4117 4118 } 4119 4120 break; 4121 default: break; 4122 4123 } 4124 4125 } 4126 4127 ldv_module_exit: 4128 4129 /** INIT: init_type: ST_MODULE_EXIT **/ 4130 /* content: static void __exit idetape_exit(void)*/ 4131 /* LDV_COMMENT_BEGIN_PREP */ 4132 #define DRV_NAME "ide-tape" 4133 #define IDETAPE_VERSION "1.20" 4134 #undef IDETAPE_DEBUG_LOG 4135 #ifdef IDETAPE_DEBUG_LOG 4136 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 4137 #else 4138 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 4139 #endif 4140 #define IDETAPE_MAX_PC_RETRIES 3 4141 #define IDETAPE_FIFO_THRESHOLD 2 4142 #define IDETAPE_DSC_RW_MIN 5*HZ/100 4143 #define IDETAPE_DSC_RW_MAX 40*HZ/100 4144 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 4145 #define IDETAPE_DSC_MA_FAST 2*HZ 4146 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 4147 #define IDETAPE_DSC_MA_SLOW 30*HZ 4148 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 4149 #define DOOR_UNLOCKED 0 4150 #define DOOR_LOCKED 1 4151 #define DOOR_EXPLICITLY_LOCKED 2 4152 #define IDETAPE_SPACE_OVER_FILEMARK 1 4153 #define IDETAPE_SPACE_TO_EOD 3 4154 #define IDETAPE_LU_LOAD_MASK 1 4155 #define IDETAPE_LU_RETENSION_MASK 2 4156 #define IDETAPE_LU_EOT_MASK 4 4157 #define IDETAPE_BLOCK_DESCRIPTOR 0 4158 #define IDETAPE_CAPABILITIES_PAGE 0x2a 4159 #ifdef CONFIG_IDE_PROC_FS 4160 #define ide_tape_devset_get(name, field) \ 4161 static int get_##name(ide_drive_t *drive) \ 4162 { \ 4163 idetape_tape_t *tape = drive->driver_data; \ 4164 return tape->field; \ 4165 } 4166 #define ide_tape_devset_set(name, field) \ 4167 static int set_##name(ide_drive_t *drive, int arg) \ 4168 { \ 4169 idetape_tape_t *tape = drive->driver_data; \ 4170 tape->field = arg; \ 4171 return 0; \ 4172 } 4173 #define ide_tape_devset_rw_field(_name, _field) \ 4174 ide_tape_devset_get(_name, _field) \ 4175 ide_tape_devset_set(_name, _field) \ 4176 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 4177 #define ide_tape_devset_r_field(_name, _field) \ 4178 ide_tape_devset_get(_name, _field) \ 4179 IDE_DEVSET(_name, 0, get_##_name, NULL) 4180 #endif 4181 #ifdef CONFIG_IDE_PROC_FS 4182 #endif 4183 #ifdef CONFIG_IDE_PROC_FS 4184 #endif 4185 /* LDV_COMMENT_END_PREP */ 4186 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver release function before driver will be uploaded from kernel. This function declared as "MODULE_EXIT(function name)". */ 4187 ldv_handler_precall(); 4188 idetape_exit(); 4189 4190 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 4191 ldv_final: ldv_check_final_state(); 4192 4193 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 4194 return; 4195 4196 } 4197 #endif 4198 4199 /* LDV_COMMENT_END_MAIN */
1 2 #include <linux/kernel.h> 3 bool ldv_is_err(const void *ptr); 4 bool ldv_is_err_or_null(const void *ptr); 5 void* ldv_err_ptr(long error); 6 long ldv_ptr_err(const void *ptr); 7 8 9 // Provide model function prototypes before their usage. 10 11 void *ldv_create_class(void); 12 int ldv_register_class(void); 13 void ldv_unregister_class(void); 14 15 int ldv_register_chrdev(int major); 16 int ldv_register_chrdev_region(void); 17 void ldv_unregister_chrdev_region(void); 18 19 int ldv_register_usb_gadget(void); 20 void ldv_unregister_usb_gadget(void); 21 #line 1 "/home/ubuntu/launches/work/current--X--drivers--X--defaultlinux-4.7-rc1.tar.xz--X--106_1a--X--cpachecker/linux-4.7-rc1.tar.xz/csd_deg_dscv/8139/dscv_tempdir/dscv/ri/106_1a/drivers/ide/ide-tape.c" 22 23 /* 24 * IDE ATAPI streaming tape driver. 25 * 26 * Copyright (C) 1995-1999 Gadi Oxman <gadio@netvision.net.il> 27 * Copyright (C) 2003-2005 Bartlomiej Zolnierkiewicz 28 * 29 * This driver was constructed as a student project in the software laboratory 30 * of the faculty of electrical engineering in the Technion - Israel's 31 * Institute Of Technology, with the guide of Avner Lottem and Dr. Ilana David. 32 * 33 * It is hereby placed under the terms of the GNU general public license. 34 * (See linux/COPYING). 35 * 36 * For a historical changelog see 37 * Documentation/ide/ChangeLog.ide-tape.1995-2002 38 */ 39 40 #define DRV_NAME "ide-tape" 41 42 #define IDETAPE_VERSION "1.20" 43 44 #include <linux/module.h> 45 #include <linux/types.h> 46 #include <linux/string.h> 47 #include <linux/kernel.h> 48 #include <linux/delay.h> 49 #include <linux/timer.h> 50 #include <linux/mm.h> 51 #include <linux/interrupt.h> 52 #include <linux/jiffies.h> 53 #include <linux/major.h> 54 #include <linux/errno.h> 55 #include <linux/genhd.h> 56 #include <linux/seq_file.h> 57 #include <linux/slab.h> 58 #include <linux/pci.h> 59 #include <linux/ide.h> 60 #include <linux/completion.h> 61 #include <linux/bitops.h> 62 #include <linux/mutex.h> 63 #include <scsi/scsi.h> 64 65 #include <asm/byteorder.h> 66 #include <linux/uaccess.h> 67 #include <linux/io.h> 68 #include <asm/unaligned.h> 69 #include <linux/mtio.h> 70 71 /* define to see debug info */ 72 #undef IDETAPE_DEBUG_LOG 73 74 #ifdef IDETAPE_DEBUG_LOG 75 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 76 #else 77 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 78 #endif 79 80 /**************************** Tunable parameters *****************************/ 81 /* 82 * After each failed packet command we issue a request sense command and retry 83 * the packet command IDETAPE_MAX_PC_RETRIES times. 84 * 85 * Setting IDETAPE_MAX_PC_RETRIES to 0 will disable retries. 86 */ 87 #define IDETAPE_MAX_PC_RETRIES 3 88 89 /* 90 * The following parameter is used to select the point in the internal tape fifo 91 * in which we will start to refill the buffer. Decreasing the following 92 * parameter will improve the system's latency and interactive response, while 93 * using a high value might improve system throughput. 94 */ 95 #define IDETAPE_FIFO_THRESHOLD 2 96 97 /* 98 * DSC polling parameters. 99 * 100 * Polling for DSC (a single bit in the status register) is a very important 101 * function in ide-tape. There are two cases in which we poll for DSC: 102 * 103 * 1. Before a read/write packet command, to ensure that we can transfer data 104 * from/to the tape's data buffers, without causing an actual media access. 105 * In case the tape is not ready yet, we take out our request from the device 106 * request queue, so that ide.c could service requests from the other device 107 * on the same interface in the meantime. 108 * 109 * 2. After the successful initialization of a "media access packet command", 110 * which is a command that can take a long time to complete (the interval can 111 * range from several seconds to even an hour). Again, we postpone our request 112 * in the middle to free the bus for the other device. The polling frequency 113 * here should be lower than the read/write frequency since those media access 114 * commands are slow. We start from a "fast" frequency - IDETAPE_DSC_MA_FAST 115 * (1 second), and if we don't receive DSC after IDETAPE_DSC_MA_THRESHOLD 116 * (5 min), we switch it to a lower frequency - IDETAPE_DSC_MA_SLOW (1 min). 117 * 118 * We also set a timeout for the timer, in case something goes wrong. The 119 * timeout should be longer then the maximum execution time of a tape operation. 120 */ 121 122 /* DSC timings. */ 123 #define IDETAPE_DSC_RW_MIN 5*HZ/100 /* 50 msec */ 124 #define IDETAPE_DSC_RW_MAX 40*HZ/100 /* 400 msec */ 125 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ /* 2 minutes */ 126 #define IDETAPE_DSC_MA_FAST 2*HZ /* 2 seconds */ 127 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ /* 5 minutes */ 128 #define IDETAPE_DSC_MA_SLOW 30*HZ /* 30 seconds */ 129 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ /* 2 hours */ 130 131 /*************************** End of tunable parameters ***********************/ 132 133 /* tape directions */ 134 enum { 135 IDETAPE_DIR_NONE = (1 << 0), 136 IDETAPE_DIR_READ = (1 << 1), 137 IDETAPE_DIR_WRITE = (1 << 2), 138 }; 139 140 /* Tape door status */ 141 #define DOOR_UNLOCKED 0 142 #define DOOR_LOCKED 1 143 #define DOOR_EXPLICITLY_LOCKED 2 144 145 /* Some defines for the SPACE command */ 146 #define IDETAPE_SPACE_OVER_FILEMARK 1 147 #define IDETAPE_SPACE_TO_EOD 3 148 149 /* Some defines for the LOAD UNLOAD command */ 150 #define IDETAPE_LU_LOAD_MASK 1 151 #define IDETAPE_LU_RETENSION_MASK 2 152 #define IDETAPE_LU_EOT_MASK 4 153 154 /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ 155 #define IDETAPE_BLOCK_DESCRIPTOR 0 156 #define IDETAPE_CAPABILITIES_PAGE 0x2a 157 158 /* 159 * Most of our global data which we need to save even as we leave the driver due 160 * to an interrupt or a timer event is stored in the struct defined below. 161 */ 162 typedef struct ide_tape_obj { 163 ide_drive_t *drive; 164 struct ide_driver *driver; 165 struct gendisk *disk; 166 struct device dev; 167 168 /* used by REQ_IDETAPE_{READ,WRITE} requests */ 169 struct ide_atapi_pc queued_pc; 170 171 /* 172 * DSC polling variables. 173 * 174 * While polling for DSC we use postponed_rq to postpone the current 175 * request so that ide.c will be able to service pending requests on the 176 * other device. Note that at most we will have only one DSC (usually 177 * data transfer) request in the device request queue. 178 */ 179 bool postponed_rq; 180 181 /* The time in which we started polling for DSC */ 182 unsigned long dsc_polling_start; 183 /* Timer used to poll for dsc */ 184 struct timer_list dsc_timer; 185 /* Read/Write dsc polling frequency */ 186 unsigned long best_dsc_rw_freq; 187 unsigned long dsc_poll_freq; 188 unsigned long dsc_timeout; 189 190 /* Read position information */ 191 u8 partition; 192 /* Current block */ 193 unsigned int first_frame; 194 195 /* Last error information */ 196 u8 sense_key, asc, ascq; 197 198 /* Character device operation */ 199 unsigned int minor; 200 /* device name */ 201 char name[4]; 202 /* Current character device data transfer direction */ 203 u8 chrdev_dir; 204 205 /* tape block size, usually 512 or 1024 bytes */ 206 unsigned short blk_size; 207 int user_bs_factor; 208 209 /* Copy of the tape's Capabilities and Mechanical Page */ 210 u8 caps[20]; 211 212 /* 213 * Active data transfer request parameters. 214 * 215 * At most, there is only one ide-tape originated data transfer request 216 * in the device request queue. This allows ide.c to easily service 217 * requests from the other device when we postpone our active request. 218 */ 219 220 /* Data buffer size chosen based on the tape's recommendation */ 221 int buffer_size; 222 /* Staging buffer of buffer_size bytes */ 223 void *buf; 224 /* The read/write cursor */ 225 void *cur; 226 /* The number of valid bytes in buf */ 227 size_t valid; 228 229 /* Measures average tape speed */ 230 unsigned long avg_time; 231 int avg_size; 232 int avg_speed; 233 234 /* the door is currently locked */ 235 int door_locked; 236 /* the tape hardware is write protected */ 237 char drv_write_prot; 238 /* the tape is write protected (hardware or opened as read-only) */ 239 char write_prot; 240 } idetape_tape_t; 241 242 static DEFINE_MUTEX(ide_tape_mutex); 243 static DEFINE_MUTEX(idetape_ref_mutex); 244 245 static DEFINE_MUTEX(idetape_chrdev_mutex); 246 247 static struct class *idetape_sysfs_class; 248 249 static void ide_tape_release(struct device *); 250 251 static struct ide_tape_obj *idetape_devs[MAX_HWIFS * MAX_DRIVES]; 252 253 static struct ide_tape_obj *ide_tape_get(struct gendisk *disk, bool cdev, 254 unsigned int i) 255 { 256 struct ide_tape_obj *tape = NULL; 257 258 mutex_lock(&idetape_ref_mutex); 259 260 if (cdev) 261 tape = idetape_devs[i]; 262 else 263 tape = ide_drv_g(disk, ide_tape_obj); 264 265 if (tape) { 266 if (ide_device_get(tape->drive)) 267 tape = NULL; 268 else 269 get_device(&tape->dev); 270 } 271 272 mutex_unlock(&idetape_ref_mutex); 273 return tape; 274 } 275 276 static void ide_tape_put(struct ide_tape_obj *tape) 277 { 278 ide_drive_t *drive = tape->drive; 279 280 mutex_lock(&idetape_ref_mutex); 281 put_device(&tape->dev); 282 ide_device_put(drive); 283 mutex_unlock(&idetape_ref_mutex); 284 } 285 286 /* 287 * called on each failed packet command retry to analyze the request sense. We 288 * currently do not utilize this information. 289 */ 290 static void idetape_analyze_error(ide_drive_t *drive) 291 { 292 idetape_tape_t *tape = drive->driver_data; 293 struct ide_atapi_pc *pc = drive->failed_pc; 294 struct request *rq = drive->hwif->rq; 295 u8 *sense = bio_data(rq->bio); 296 297 tape->sense_key = sense[2] & 0xF; 298 tape->asc = sense[12]; 299 tape->ascq = sense[13]; 300 301 ide_debug_log(IDE_DBG_FUNC, 302 "cmd: 0x%x, sense key = %x, asc = %x, ascq = %x", 303 rq->cmd[0], tape->sense_key, tape->asc, tape->ascq); 304 305 /* correct remaining bytes to transfer */ 306 if (pc->flags & PC_FLAG_DMA_ERROR) 307 rq->resid_len = tape->blk_size * get_unaligned_be32(&sense[3]); 308 309 /* 310 * If error was the result of a zero-length read or write command, 311 * with sense key=5, asc=0x22, ascq=0, let it slide. Some drives 312 * (i.e. Seagate STT3401A Travan) don't support 0-length read/writes. 313 */ 314 if ((pc->c[0] == READ_6 || pc->c[0] == WRITE_6) 315 /* length == 0 */ 316 && pc->c[4] == 0 && pc->c[3] == 0 && pc->c[2] == 0) { 317 if (tape->sense_key == 5) { 318 /* don't report an error, everything's ok */ 319 pc->error = 0; 320 /* don't retry read/write */ 321 pc->flags |= PC_FLAG_ABORT; 322 } 323 } 324 if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { 325 pc->error = IDE_DRV_ERROR_FILEMARK; 326 pc->flags |= PC_FLAG_ABORT; 327 } 328 if (pc->c[0] == WRITE_6) { 329 if ((sense[2] & 0x40) || (tape->sense_key == 0xd 330 && tape->asc == 0x0 && tape->ascq == 0x2)) { 331 pc->error = IDE_DRV_ERROR_EOD; 332 pc->flags |= PC_FLAG_ABORT; 333 } 334 } 335 if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { 336 if (tape->sense_key == 8) { 337 pc->error = IDE_DRV_ERROR_EOD; 338 pc->flags |= PC_FLAG_ABORT; 339 } 340 if (!(pc->flags & PC_FLAG_ABORT) && 341 (blk_rq_bytes(rq) - rq->resid_len)) 342 pc->retries = IDETAPE_MAX_PC_RETRIES + 1; 343 } 344 } 345 346 static void ide_tape_handle_dsc(ide_drive_t *); 347 348 static int ide_tape_callback(ide_drive_t *drive, int dsc) 349 { 350 idetape_tape_t *tape = drive->driver_data; 351 struct ide_atapi_pc *pc = drive->pc; 352 struct request *rq = drive->hwif->rq; 353 int uptodate = pc->error ? 0 : 1; 354 int err = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; 355 356 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, dsc: %d, err: %d", rq->cmd[0], 357 dsc, err); 358 359 if (dsc) 360 ide_tape_handle_dsc(drive); 361 362 if (drive->failed_pc == pc) 363 drive->failed_pc = NULL; 364 365 if (pc->c[0] == REQUEST_SENSE) { 366 if (uptodate) 367 idetape_analyze_error(drive); 368 else 369 printk(KERN_ERR "ide-tape: Error in REQUEST SENSE " 370 "itself - Aborting request!\n"); 371 } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { 372 unsigned int blocks = 373 (blk_rq_bytes(rq) - rq->resid_len) / tape->blk_size; 374 375 tape->avg_size += blocks * tape->blk_size; 376 377 if (time_after_eq(jiffies, tape->avg_time + HZ)) { 378 tape->avg_speed = tape->avg_size * HZ / 379 (jiffies - tape->avg_time) / 1024; 380 tape->avg_size = 0; 381 tape->avg_time = jiffies; 382 } 383 384 tape->first_frame += blocks; 385 386 if (pc->error) { 387 uptodate = 0; 388 err = pc->error; 389 } 390 } 391 rq->errors = err; 392 393 return uptodate; 394 } 395 396 /* 397 * Postpone the current request so that ide.c will be able to service requests 398 * from another device on the same port while we are polling for DSC. 399 */ 400 static void ide_tape_stall_queue(ide_drive_t *drive) 401 { 402 idetape_tape_t *tape = drive->driver_data; 403 404 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, dsc_poll_freq: %lu", 405 drive->hwif->rq->cmd[0], tape->dsc_poll_freq); 406 407 tape->postponed_rq = true; 408 409 ide_stall_queue(drive, tape->dsc_poll_freq); 410 } 411 412 static void ide_tape_handle_dsc(ide_drive_t *drive) 413 { 414 idetape_tape_t *tape = drive->driver_data; 415 416 /* Media access command */ 417 tape->dsc_polling_start = jiffies; 418 tape->dsc_poll_freq = IDETAPE_DSC_MA_FAST; 419 tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT; 420 /* Allow ide.c to handle other requests */ 421 ide_tape_stall_queue(drive); 422 } 423 424 /* 425 * Packet Command Interface 426 * 427 * The current Packet Command is available in drive->pc, and will not change 428 * until we finish handling it. Each packet command is associated with a 429 * callback function that will be called when the command is finished. 430 * 431 * The handling will be done in three stages: 432 * 433 * 1. ide_tape_issue_pc will send the packet command to the drive, and will set 434 * the interrupt handler to ide_pc_intr. 435 * 436 * 2. On each interrupt, ide_pc_intr will be called. This step will be 437 * repeated until the device signals us that no more interrupts will be issued. 438 * 439 * 3. ATAPI Tape media access commands have immediate status with a delayed 440 * process. In case of a successful initiation of a media access packet command, 441 * the DSC bit will be set when the actual execution of the command is finished. 442 * Since the tape drive will not issue an interrupt, we have to poll for this 443 * event. In this case, we define the request as "low priority request" by 444 * setting rq_status to IDETAPE_RQ_POSTPONED, set a timer to poll for DSC and 445 * exit the driver. 446 * 447 * ide.c will then give higher priority to requests which originate from the 448 * other device, until will change rq_status to RQ_ACTIVE. 449 * 450 * 4. When the packet command is finished, it will be checked for errors. 451 * 452 * 5. In case an error was found, we queue a request sense packet command in 453 * front of the request queue and retry the operation up to 454 * IDETAPE_MAX_PC_RETRIES times. 455 * 456 * 6. In case no error was found, or we decided to give up and not to retry 457 * again, the callback function will be called and then we will handle the next 458 * request. 459 */ 460 461 static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive, 462 struct ide_cmd *cmd, 463 struct ide_atapi_pc *pc) 464 { 465 idetape_tape_t *tape = drive->driver_data; 466 struct request *rq = drive->hwif->rq; 467 468 if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) 469 drive->failed_pc = pc; 470 471 /* Set the current packet command */ 472 drive->pc = pc; 473 474 if (pc->retries > IDETAPE_MAX_PC_RETRIES || 475 (pc->flags & PC_FLAG_ABORT)) { 476 477 /* 478 * We will "abort" retrying a packet command in case legitimate 479 * error code was received (crossing a filemark, or end of the 480 * media, for example). 481 */ 482 if (!(pc->flags & PC_FLAG_ABORT)) { 483 if (!(pc->c[0] == TEST_UNIT_READY && 484 tape->sense_key == 2 && tape->asc == 4 && 485 (tape->ascq == 1 || tape->ascq == 8))) { 486 printk(KERN_ERR "ide-tape: %s: I/O error, " 487 "pc = %2x, key = %2x, " 488 "asc = %2x, ascq = %2x\n", 489 tape->name, pc->c[0], 490 tape->sense_key, tape->asc, 491 tape->ascq); 492 } 493 /* Giving up */ 494 pc->error = IDE_DRV_ERROR_GENERAL; 495 } 496 497 drive->failed_pc = NULL; 498 drive->pc_callback(drive, 0); 499 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); 500 return ide_stopped; 501 } 502 ide_debug_log(IDE_DBG_SENSE, "retry #%d, cmd: 0x%02x", pc->retries, 503 pc->c[0]); 504 505 pc->retries++; 506 507 return ide_issue_pc(drive, cmd); 508 } 509 510 /* A mode sense command is used to "sense" tape parameters. */ 511 static void idetape_create_mode_sense_cmd(struct ide_atapi_pc *pc, u8 page_code) 512 { 513 ide_init_pc(pc); 514 pc->c[0] = MODE_SENSE; 515 if (page_code != IDETAPE_BLOCK_DESCRIPTOR) 516 /* DBD = 1 - Don't return block descriptors */ 517 pc->c[1] = 8; 518 pc->c[2] = page_code; 519 /* 520 * Changed pc->c[3] to 0 (255 will at best return unused info). 521 * 522 * For SCSI this byte is defined as subpage instead of high byte 523 * of length and some IDE drives seem to interpret it this way 524 * and return an error when 255 is used. 525 */ 526 pc->c[3] = 0; 527 /* We will just discard data in that case */ 528 pc->c[4] = 255; 529 if (page_code == IDETAPE_BLOCK_DESCRIPTOR) 530 pc->req_xfer = 12; 531 else if (page_code == IDETAPE_CAPABILITIES_PAGE) 532 pc->req_xfer = 24; 533 else 534 pc->req_xfer = 50; 535 } 536 537 static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) 538 { 539 ide_hwif_t *hwif = drive->hwif; 540 idetape_tape_t *tape = drive->driver_data; 541 struct ide_atapi_pc *pc = drive->pc; 542 u8 stat; 543 544 stat = hwif->tp_ops->read_status(hwif); 545 546 if (stat & ATA_DSC) { 547 if (stat & ATA_ERR) { 548 /* Error detected */ 549 if (pc->c[0] != TEST_UNIT_READY) 550 printk(KERN_ERR "ide-tape: %s: I/O error, ", 551 tape->name); 552 /* Retry operation */ 553 ide_retry_pc(drive); 554 return ide_stopped; 555 } 556 pc->error = 0; 557 } else { 558 pc->error = IDE_DRV_ERROR_GENERAL; 559 drive->failed_pc = NULL; 560 } 561 drive->pc_callback(drive, 0); 562 return ide_stopped; 563 } 564 565 static void ide_tape_create_rw_cmd(idetape_tape_t *tape, 566 struct ide_atapi_pc *pc, struct request *rq, 567 u8 opcode) 568 { 569 unsigned int length = blk_rq_sectors(rq) / (tape->blk_size >> 9); 570 571 ide_init_pc(pc); 572 put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); 573 pc->c[1] = 1; 574 575 if (blk_rq_bytes(rq) == tape->buffer_size) 576 pc->flags |= PC_FLAG_DMA_OK; 577 578 if (opcode == READ_6) 579 pc->c[0] = READ_6; 580 else if (opcode == WRITE_6) { 581 pc->c[0] = WRITE_6; 582 pc->flags |= PC_FLAG_WRITING; 583 } 584 585 memcpy(rq->cmd, pc->c, 12); 586 } 587 588 static ide_startstop_t idetape_do_request(ide_drive_t *drive, 589 struct request *rq, sector_t block) 590 { 591 ide_hwif_t *hwif = drive->hwif; 592 idetape_tape_t *tape = drive->driver_data; 593 struct ide_atapi_pc *pc = NULL; 594 struct ide_cmd cmd; 595 u8 stat; 596 597 ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, sector: %llu, nr_sectors: %u", 598 rq->cmd[0], (unsigned long long)blk_rq_pos(rq), 599 blk_rq_sectors(rq)); 600 601 BUG_ON(!(rq->cmd_type == REQ_TYPE_DRV_PRIV || 602 rq->cmd_type == REQ_TYPE_ATA_SENSE)); 603 604 /* Retry a failed packet command */ 605 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { 606 pc = drive->failed_pc; 607 goto out; 608 } 609 610 /* 611 * If the tape is still busy, postpone our request and service 612 * the other device meanwhile. 613 */ 614 stat = hwif->tp_ops->read_status(hwif); 615 616 if ((drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) == 0 && 617 (rq->cmd[13] & REQ_IDETAPE_PC2) == 0) 618 drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; 619 620 if (drive->dev_flags & IDE_DFLAG_POST_RESET) { 621 drive->atapi_flags |= IDE_AFLAG_IGNORE_DSC; 622 drive->dev_flags &= ~IDE_DFLAG_POST_RESET; 623 } 624 625 if (!(drive->atapi_flags & IDE_AFLAG_IGNORE_DSC) && 626 !(stat & ATA_DSC)) { 627 if (!tape->postponed_rq) { 628 tape->dsc_polling_start = jiffies; 629 tape->dsc_poll_freq = tape->best_dsc_rw_freq; 630 tape->dsc_timeout = jiffies + IDETAPE_DSC_RW_TIMEOUT; 631 } else if (time_after(jiffies, tape->dsc_timeout)) { 632 printk(KERN_ERR "ide-tape: %s: DSC timeout\n", 633 tape->name); 634 if (rq->cmd[13] & REQ_IDETAPE_PC2) { 635 idetape_media_access_finished(drive); 636 return ide_stopped; 637 } else { 638 return ide_do_reset(drive); 639 } 640 } else if (time_after(jiffies, 641 tape->dsc_polling_start + 642 IDETAPE_DSC_MA_THRESHOLD)) 643 tape->dsc_poll_freq = IDETAPE_DSC_MA_SLOW; 644 ide_tape_stall_queue(drive); 645 return ide_stopped; 646 } else { 647 drive->atapi_flags &= ~IDE_AFLAG_IGNORE_DSC; 648 tape->postponed_rq = false; 649 } 650 651 if (rq->cmd[13] & REQ_IDETAPE_READ) { 652 pc = &tape->queued_pc; 653 ide_tape_create_rw_cmd(tape, pc, rq, READ_6); 654 goto out; 655 } 656 if (rq->cmd[13] & REQ_IDETAPE_WRITE) { 657 pc = &tape->queued_pc; 658 ide_tape_create_rw_cmd(tape, pc, rq, WRITE_6); 659 goto out; 660 } 661 if (rq->cmd[13] & REQ_IDETAPE_PC1) { 662 pc = (struct ide_atapi_pc *)rq->special; 663 rq->cmd[13] &= ~(REQ_IDETAPE_PC1); 664 rq->cmd[13] |= REQ_IDETAPE_PC2; 665 goto out; 666 } 667 if (rq->cmd[13] & REQ_IDETAPE_PC2) { 668 idetape_media_access_finished(drive); 669 return ide_stopped; 670 } 671 BUG(); 672 673 out: 674 /* prepare sense request for this command */ 675 ide_prep_sense(drive, rq); 676 677 memset(&cmd, 0, sizeof(cmd)); 678 679 if (rq_data_dir(rq)) 680 cmd.tf_flags |= IDE_TFLAG_WRITE; 681 682 cmd.rq = rq; 683 684 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); 685 ide_map_sg(drive, &cmd); 686 687 return ide_tape_issue_pc(drive, &cmd, pc); 688 } 689 690 /* 691 * Write a filemark if write_filemark=1. Flush the device buffers without 692 * writing a filemark otherwise. 693 */ 694 static void idetape_create_write_filemark_cmd(ide_drive_t *drive, 695 struct ide_atapi_pc *pc, int write_filemark) 696 { 697 ide_init_pc(pc); 698 pc->c[0] = WRITE_FILEMARKS; 699 pc->c[4] = write_filemark; 700 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 701 } 702 703 static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout) 704 { 705 idetape_tape_t *tape = drive->driver_data; 706 struct gendisk *disk = tape->disk; 707 int load_attempted = 0; 708 709 /* Wait for the tape to become ready */ 710 set_bit(ilog2(IDE_AFLAG_MEDIUM_PRESENT), &drive->atapi_flags); 711 timeout += jiffies; 712 while (time_before(jiffies, timeout)) { 713 if (ide_do_test_unit_ready(drive, disk) == 0) 714 return 0; 715 if ((tape->sense_key == 2 && tape->asc == 4 && tape->ascq == 2) 716 || (tape->asc == 0x3A)) { 717 /* no media */ 718 if (load_attempted) 719 return -ENOMEDIUM; 720 ide_do_start_stop(drive, disk, IDETAPE_LU_LOAD_MASK); 721 load_attempted = 1; 722 /* not about to be ready */ 723 } else if (!(tape->sense_key == 2 && tape->asc == 4 && 724 (tape->ascq == 1 || tape->ascq == 8))) 725 return -EIO; 726 msleep(100); 727 } 728 return -EIO; 729 } 730 731 static int idetape_flush_tape_buffers(ide_drive_t *drive) 732 { 733 struct ide_tape_obj *tape = drive->driver_data; 734 struct ide_atapi_pc pc; 735 int rc; 736 737 idetape_create_write_filemark_cmd(drive, &pc, 0); 738 rc = ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0); 739 if (rc) 740 return rc; 741 idetape_wait_ready(drive, 60 * 5 * HZ); 742 return 0; 743 } 744 745 static int ide_tape_read_position(ide_drive_t *drive) 746 { 747 idetape_tape_t *tape = drive->driver_data; 748 struct ide_atapi_pc pc; 749 u8 buf[20]; 750 751 ide_debug_log(IDE_DBG_FUNC, "enter"); 752 753 /* prep cmd */ 754 ide_init_pc(&pc); 755 pc.c[0] = READ_POSITION; 756 pc.req_xfer = 20; 757 758 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) 759 return -1; 760 761 if (!pc.error) { 762 ide_debug_log(IDE_DBG_FUNC, "BOP - %s", 763 (buf[0] & 0x80) ? "Yes" : "No"); 764 ide_debug_log(IDE_DBG_FUNC, "EOP - %s", 765 (buf[0] & 0x40) ? "Yes" : "No"); 766 767 if (buf[0] & 0x4) { 768 printk(KERN_INFO "ide-tape: Block location is unknown" 769 "to the tape\n"); 770 clear_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), 771 &drive->atapi_flags); 772 return -1; 773 } else { 774 ide_debug_log(IDE_DBG_FUNC, "Block Location: %u", 775 be32_to_cpup((__be32 *)&buf[4])); 776 777 tape->partition = buf[1]; 778 tape->first_frame = be32_to_cpup((__be32 *)&buf[4]); 779 set_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), 780 &drive->atapi_flags); 781 } 782 } 783 784 return tape->first_frame; 785 } 786 787 static void idetape_create_locate_cmd(ide_drive_t *drive, 788 struct ide_atapi_pc *pc, 789 unsigned int block, u8 partition, int skip) 790 { 791 ide_init_pc(pc); 792 pc->c[0] = POSITION_TO_ELEMENT; 793 pc->c[1] = 2; 794 put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]); 795 pc->c[8] = partition; 796 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 797 } 798 799 static void __ide_tape_discard_merge_buffer(ide_drive_t *drive) 800 { 801 idetape_tape_t *tape = drive->driver_data; 802 803 if (tape->chrdev_dir != IDETAPE_DIR_READ) 804 return; 805 806 clear_bit(ilog2(IDE_AFLAG_FILEMARK), &drive->atapi_flags); 807 tape->valid = 0; 808 if (tape->buf != NULL) { 809 kfree(tape->buf); 810 tape->buf = NULL; 811 } 812 813 tape->chrdev_dir = IDETAPE_DIR_NONE; 814 } 815 816 /* 817 * Position the tape to the requested block using the LOCATE packet command. 818 * A READ POSITION command is then issued to check where we are positioned. Like 819 * all higher level operations, we queue the commands at the tail of the request 820 * queue and wait for their completion. 821 */ 822 static int idetape_position_tape(ide_drive_t *drive, unsigned int block, 823 u8 partition, int skip) 824 { 825 idetape_tape_t *tape = drive->driver_data; 826 struct gendisk *disk = tape->disk; 827 int ret; 828 struct ide_atapi_pc pc; 829 830 if (tape->chrdev_dir == IDETAPE_DIR_READ) 831 __ide_tape_discard_merge_buffer(drive); 832 idetape_wait_ready(drive, 60 * 5 * HZ); 833 idetape_create_locate_cmd(drive, &pc, block, partition, skip); 834 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 835 if (ret) 836 return ret; 837 838 ret = ide_tape_read_position(drive); 839 if (ret < 0) 840 return ret; 841 return 0; 842 } 843 844 static void ide_tape_discard_merge_buffer(ide_drive_t *drive, 845 int restore_position) 846 { 847 idetape_tape_t *tape = drive->driver_data; 848 int seek, position; 849 850 __ide_tape_discard_merge_buffer(drive); 851 if (restore_position) { 852 position = ide_tape_read_position(drive); 853 seek = position > 0 ? position : 0; 854 if (idetape_position_tape(drive, seek, 0, 0)) { 855 printk(KERN_INFO "ide-tape: %s: position_tape failed in" 856 " %s\n", tape->name, __func__); 857 return; 858 } 859 } 860 } 861 862 /* 863 * Generate a read/write request for the block device interface and wait for it 864 * to be serviced. 865 */ 866 static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size) 867 { 868 idetape_tape_t *tape = drive->driver_data; 869 struct request *rq; 870 int ret; 871 872 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, size: %d", cmd, size); 873 874 BUG_ON(cmd != REQ_IDETAPE_READ && cmd != REQ_IDETAPE_WRITE); 875 BUG_ON(size < 0 || size % tape->blk_size); 876 877 rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); 878 rq->cmd_type = REQ_TYPE_DRV_PRIV; 879 rq->cmd[13] = cmd; 880 rq->rq_disk = tape->disk; 881 rq->__sector = tape->first_frame; 882 883 if (size) { 884 ret = blk_rq_map_kern(drive->queue, rq, tape->buf, size, 885 __GFP_RECLAIM); 886 if (ret) 887 goto out_put; 888 } 889 890 blk_execute_rq(drive->queue, tape->disk, rq, 0); 891 892 /* calculate the number of transferred bytes and update buffer state */ 893 size -= rq->resid_len; 894 tape->cur = tape->buf; 895 if (cmd == REQ_IDETAPE_READ) 896 tape->valid = size; 897 else 898 tape->valid = 0; 899 900 ret = size; 901 if (rq->errors == IDE_DRV_ERROR_GENERAL) 902 ret = -EIO; 903 out_put: 904 blk_put_request(rq); 905 return ret; 906 } 907 908 static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc) 909 { 910 ide_init_pc(pc); 911 pc->c[0] = INQUIRY; 912 pc->c[4] = 254; 913 pc->req_xfer = 254; 914 } 915 916 static void idetape_create_rewind_cmd(ide_drive_t *drive, 917 struct ide_atapi_pc *pc) 918 { 919 ide_init_pc(pc); 920 pc->c[0] = REZERO_UNIT; 921 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 922 } 923 924 static void idetape_create_erase_cmd(struct ide_atapi_pc *pc) 925 { 926 ide_init_pc(pc); 927 pc->c[0] = ERASE; 928 pc->c[1] = 1; 929 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 930 } 931 932 static void idetape_create_space_cmd(struct ide_atapi_pc *pc, int count, u8 cmd) 933 { 934 ide_init_pc(pc); 935 pc->c[0] = SPACE; 936 put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]); 937 pc->c[1] = cmd; 938 pc->flags |= PC_FLAG_WAIT_FOR_DSC; 939 } 940 941 static void ide_tape_flush_merge_buffer(ide_drive_t *drive) 942 { 943 idetape_tape_t *tape = drive->driver_data; 944 945 if (tape->chrdev_dir != IDETAPE_DIR_WRITE) { 946 printk(KERN_ERR "ide-tape: bug: Trying to empty merge buffer" 947 " but we are not writing.\n"); 948 return; 949 } 950 if (tape->buf) { 951 size_t aligned = roundup(tape->valid, tape->blk_size); 952 953 memset(tape->cur, 0, aligned - tape->valid); 954 idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE, aligned); 955 kfree(tape->buf); 956 tape->buf = NULL; 957 } 958 tape->chrdev_dir = IDETAPE_DIR_NONE; 959 } 960 961 static int idetape_init_rw(ide_drive_t *drive, int dir) 962 { 963 idetape_tape_t *tape = drive->driver_data; 964 int rc; 965 966 BUG_ON(dir != IDETAPE_DIR_READ && dir != IDETAPE_DIR_WRITE); 967 968 if (tape->chrdev_dir == dir) 969 return 0; 970 971 if (tape->chrdev_dir == IDETAPE_DIR_READ) 972 ide_tape_discard_merge_buffer(drive, 1); 973 else if (tape->chrdev_dir == IDETAPE_DIR_WRITE) { 974 ide_tape_flush_merge_buffer(drive); 975 idetape_flush_tape_buffers(drive); 976 } 977 978 if (tape->buf || tape->valid) { 979 printk(KERN_ERR "ide-tape: valid should be 0 now\n"); 980 tape->valid = 0; 981 } 982 983 tape->buf = kmalloc(tape->buffer_size, GFP_KERNEL); 984 if (!tape->buf) 985 return -ENOMEM; 986 tape->chrdev_dir = dir; 987 tape->cur = tape->buf; 988 989 /* 990 * Issue a 0 rw command to ensure that DSC handshake is 991 * switched from completion mode to buffer available mode. No 992 * point in issuing this if DSC overlap isn't supported, some 993 * drives (Seagate STT3401A) will return an error. 994 */ 995 if (drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) { 996 int cmd = dir == IDETAPE_DIR_READ ? REQ_IDETAPE_READ 997 : REQ_IDETAPE_WRITE; 998 999 rc = idetape_queue_rw_tail(drive, cmd, 0); 1000 if (rc < 0) { 1001 kfree(tape->buf); 1002 tape->buf = NULL; 1003 tape->chrdev_dir = IDETAPE_DIR_NONE; 1004 return rc; 1005 } 1006 } 1007 1008 return 0; 1009 } 1010 1011 static void idetape_pad_zeros(ide_drive_t *drive, int bcount) 1012 { 1013 idetape_tape_t *tape = drive->driver_data; 1014 1015 memset(tape->buf, 0, tape->buffer_size); 1016 1017 while (bcount) { 1018 unsigned int count = min(tape->buffer_size, bcount); 1019 1020 idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE, count); 1021 bcount -= count; 1022 } 1023 } 1024 1025 /* 1026 * Rewinds the tape to the Beginning Of the current Partition (BOP). We 1027 * currently support only one partition. 1028 */ 1029 static int idetape_rewind_tape(ide_drive_t *drive) 1030 { 1031 struct ide_tape_obj *tape = drive->driver_data; 1032 struct gendisk *disk = tape->disk; 1033 struct ide_atapi_pc pc; 1034 int ret; 1035 1036 ide_debug_log(IDE_DBG_FUNC, "enter"); 1037 1038 idetape_create_rewind_cmd(drive, &pc); 1039 ret = ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 1040 if (ret) 1041 return ret; 1042 1043 ret = ide_tape_read_position(drive); 1044 if (ret < 0) 1045 return ret; 1046 return 0; 1047 } 1048 1049 /* mtio.h compatible commands should be issued to the chrdev interface. */ 1050 static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, 1051 unsigned long arg) 1052 { 1053 idetape_tape_t *tape = drive->driver_data; 1054 void __user *argp = (void __user *)arg; 1055 1056 struct idetape_config { 1057 int dsc_rw_frequency; 1058 int dsc_media_access_frequency; 1059 int nr_stages; 1060 } config; 1061 1062 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%04x", cmd); 1063 1064 switch (cmd) { 1065 case 0x0340: 1066 if (copy_from_user(&config, argp, sizeof(config))) 1067 return -EFAULT; 1068 tape->best_dsc_rw_freq = config.dsc_rw_frequency; 1069 break; 1070 case 0x0350: 1071 memset(&config, 0, sizeof(config)); 1072 config.dsc_rw_frequency = (int) tape->best_dsc_rw_freq; 1073 config.nr_stages = 1; 1074 if (copy_to_user(argp, &config, sizeof(config))) 1075 return -EFAULT; 1076 break; 1077 default: 1078 return -EIO; 1079 } 1080 return 0; 1081 } 1082 1083 static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op, 1084 int mt_count) 1085 { 1086 idetape_tape_t *tape = drive->driver_data; 1087 struct gendisk *disk = tape->disk; 1088 struct ide_atapi_pc pc; 1089 int retval, count = 0; 1090 int sprev = !!(tape->caps[4] & 0x20); 1091 1092 1093 ide_debug_log(IDE_DBG_FUNC, "mt_op: %d, mt_count: %d", mt_op, mt_count); 1094 1095 if (mt_count == 0) 1096 return 0; 1097 if (MTBSF == mt_op || MTBSFM == mt_op) { 1098 if (!sprev) 1099 return -EIO; 1100 mt_count = -mt_count; 1101 } 1102 1103 if (tape->chrdev_dir == IDETAPE_DIR_READ) { 1104 tape->valid = 0; 1105 if (test_and_clear_bit(ilog2(IDE_AFLAG_FILEMARK), 1106 &drive->atapi_flags)) 1107 ++count; 1108 ide_tape_discard_merge_buffer(drive, 0); 1109 } 1110 1111 switch (mt_op) { 1112 case MTFSF: 1113 case MTBSF: 1114 idetape_create_space_cmd(&pc, mt_count - count, 1115 IDETAPE_SPACE_OVER_FILEMARK); 1116 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 1117 case MTFSFM: 1118 case MTBSFM: 1119 if (!sprev) 1120 return -EIO; 1121 retval = idetape_space_over_filemarks(drive, MTFSF, 1122 mt_count - count); 1123 if (retval) 1124 return retval; 1125 count = (MTBSFM == mt_op ? 1 : -1); 1126 return idetape_space_over_filemarks(drive, MTFSF, count); 1127 default: 1128 printk(KERN_ERR "ide-tape: MTIO operation %d not supported\n", 1129 mt_op); 1130 return -EIO; 1131 } 1132 } 1133 1134 /* 1135 * Our character device read / write functions. 1136 * 1137 * The tape is optimized to maximize throughput when it is transferring an 1138 * integral number of the "continuous transfer limit", which is a parameter of 1139 * the specific tape (26kB on my particular tape, 32kB for Onstream). 1140 * 1141 * As of version 1.3 of the driver, the character device provides an abstract 1142 * continuous view of the media - any mix of block sizes (even 1 byte) on the 1143 * same backup/restore procedure is supported. The driver will internally 1144 * convert the requests to the recommended transfer unit, so that an unmatch 1145 * between the user's block size to the recommended size will only result in a 1146 * (slightly) increased driver overhead, but will no longer hit performance. 1147 * This is not applicable to Onstream. 1148 */ 1149 static ssize_t idetape_chrdev_read(struct file *file, char __user *buf, 1150 size_t count, loff_t *ppos) 1151 { 1152 struct ide_tape_obj *tape = file->private_data; 1153 ide_drive_t *drive = tape->drive; 1154 size_t done = 0; 1155 ssize_t ret = 0; 1156 int rc; 1157 1158 ide_debug_log(IDE_DBG_FUNC, "count %Zd", count); 1159 1160 if (tape->chrdev_dir != IDETAPE_DIR_READ) { 1161 if (test_bit(ilog2(IDE_AFLAG_DETECT_BS), &drive->atapi_flags)) 1162 if (count > tape->blk_size && 1163 (count % tape->blk_size) == 0) 1164 tape->user_bs_factor = count / tape->blk_size; 1165 } 1166 1167 rc = idetape_init_rw(drive, IDETAPE_DIR_READ); 1168 if (rc < 0) 1169 return rc; 1170 1171 while (done < count) { 1172 size_t todo; 1173 1174 /* refill if staging buffer is empty */ 1175 if (!tape->valid) { 1176 /* If we are at a filemark, nothing more to read */ 1177 if (test_bit(ilog2(IDE_AFLAG_FILEMARK), 1178 &drive->atapi_flags)) 1179 break; 1180 /* read */ 1181 if (idetape_queue_rw_tail(drive, REQ_IDETAPE_READ, 1182 tape->buffer_size) <= 0) 1183 break; 1184 } 1185 1186 /* copy out */ 1187 todo = min_t(size_t, count - done, tape->valid); 1188 if (copy_to_user(buf + done, tape->cur, todo)) 1189 ret = -EFAULT; 1190 1191 tape->cur += todo; 1192 tape->valid -= todo; 1193 done += todo; 1194 } 1195 1196 if (!done && test_bit(ilog2(IDE_AFLAG_FILEMARK), &drive->atapi_flags)) { 1197 idetape_space_over_filemarks(drive, MTFSF, 1); 1198 return 0; 1199 } 1200 1201 return ret ? ret : done; 1202 } 1203 1204 static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, 1205 size_t count, loff_t *ppos) 1206 { 1207 struct ide_tape_obj *tape = file->private_data; 1208 ide_drive_t *drive = tape->drive; 1209 size_t done = 0; 1210 ssize_t ret = 0; 1211 int rc; 1212 1213 /* The drive is write protected. */ 1214 if (tape->write_prot) 1215 return -EACCES; 1216 1217 ide_debug_log(IDE_DBG_FUNC, "count %Zd", count); 1218 1219 /* Initialize write operation */ 1220 rc = idetape_init_rw(drive, IDETAPE_DIR_WRITE); 1221 if (rc < 0) 1222 return rc; 1223 1224 while (done < count) { 1225 size_t todo; 1226 1227 /* flush if staging buffer is full */ 1228 if (tape->valid == tape->buffer_size && 1229 idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE, 1230 tape->buffer_size) <= 0) 1231 return rc; 1232 1233 /* copy in */ 1234 todo = min_t(size_t, count - done, 1235 tape->buffer_size - tape->valid); 1236 if (copy_from_user(tape->cur, buf + done, todo)) 1237 ret = -EFAULT; 1238 1239 tape->cur += todo; 1240 tape->valid += todo; 1241 done += todo; 1242 } 1243 1244 return ret ? ret : done; 1245 } 1246 1247 static int idetape_write_filemark(ide_drive_t *drive) 1248 { 1249 struct ide_tape_obj *tape = drive->driver_data; 1250 struct ide_atapi_pc pc; 1251 1252 /* Write a filemark */ 1253 idetape_create_write_filemark_cmd(drive, &pc, 1); 1254 if (ide_queue_pc_tail(drive, tape->disk, &pc, NULL, 0)) { 1255 printk(KERN_ERR "ide-tape: Couldn't write a filemark\n"); 1256 return -EIO; 1257 } 1258 return 0; 1259 } 1260 1261 /* 1262 * Called from idetape_chrdev_ioctl when the general mtio MTIOCTOP ioctl is 1263 * requested. 1264 * 1265 * Note: MTBSF and MTBSFM are not supported when the tape doesn't support 1266 * spacing over filemarks in the reverse direction. In this case, MTFSFM is also 1267 * usually not supported. 1268 * 1269 * The following commands are currently not supported: 1270 * 1271 * MTFSS, MTBSS, MTWSM, MTSETDENSITY, MTSETDRVBUFFER, MT_ST_BOOLEANS, 1272 * MT_ST_WRITE_THRESHOLD. 1273 */ 1274 static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) 1275 { 1276 idetape_tape_t *tape = drive->driver_data; 1277 struct gendisk *disk = tape->disk; 1278 struct ide_atapi_pc pc; 1279 int i, retval; 1280 1281 ide_debug_log(IDE_DBG_FUNC, "MTIOCTOP ioctl: mt_op: %d, mt_count: %d", 1282 mt_op, mt_count); 1283 1284 switch (mt_op) { 1285 case MTFSF: 1286 case MTFSFM: 1287 case MTBSF: 1288 case MTBSFM: 1289 if (!mt_count) 1290 return 0; 1291 return idetape_space_over_filemarks(drive, mt_op, mt_count); 1292 default: 1293 break; 1294 } 1295 1296 switch (mt_op) { 1297 case MTWEOF: 1298 if (tape->write_prot) 1299 return -EACCES; 1300 ide_tape_discard_merge_buffer(drive, 1); 1301 for (i = 0; i < mt_count; i++) { 1302 retval = idetape_write_filemark(drive); 1303 if (retval) 1304 return retval; 1305 } 1306 return 0; 1307 case MTREW: 1308 ide_tape_discard_merge_buffer(drive, 0); 1309 if (idetape_rewind_tape(drive)) 1310 return -EIO; 1311 return 0; 1312 case MTLOAD: 1313 ide_tape_discard_merge_buffer(drive, 0); 1314 return ide_do_start_stop(drive, disk, IDETAPE_LU_LOAD_MASK); 1315 case MTUNLOAD: 1316 case MTOFFL: 1317 /* 1318 * If door is locked, attempt to unlock before 1319 * attempting to eject. 1320 */ 1321 if (tape->door_locked) { 1322 if (!ide_set_media_lock(drive, disk, 0)) 1323 tape->door_locked = DOOR_UNLOCKED; 1324 } 1325 ide_tape_discard_merge_buffer(drive, 0); 1326 retval = ide_do_start_stop(drive, disk, !IDETAPE_LU_LOAD_MASK); 1327 if (!retval) 1328 clear_bit(ilog2(IDE_AFLAG_MEDIUM_PRESENT), 1329 &drive->atapi_flags); 1330 return retval; 1331 case MTNOP: 1332 ide_tape_discard_merge_buffer(drive, 0); 1333 return idetape_flush_tape_buffers(drive); 1334 case MTRETEN: 1335 ide_tape_discard_merge_buffer(drive, 0); 1336 return ide_do_start_stop(drive, disk, 1337 IDETAPE_LU_RETENSION_MASK | IDETAPE_LU_LOAD_MASK); 1338 case MTEOM: 1339 idetape_create_space_cmd(&pc, 0, IDETAPE_SPACE_TO_EOD); 1340 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 1341 case MTERASE: 1342 (void)idetape_rewind_tape(drive); 1343 idetape_create_erase_cmd(&pc); 1344 return ide_queue_pc_tail(drive, disk, &pc, NULL, 0); 1345 case MTSETBLK: 1346 if (mt_count) { 1347 if (mt_count < tape->blk_size || 1348 mt_count % tape->blk_size) 1349 return -EIO; 1350 tape->user_bs_factor = mt_count / tape->blk_size; 1351 clear_bit(ilog2(IDE_AFLAG_DETECT_BS), 1352 &drive->atapi_flags); 1353 } else 1354 set_bit(ilog2(IDE_AFLAG_DETECT_BS), 1355 &drive->atapi_flags); 1356 return 0; 1357 case MTSEEK: 1358 ide_tape_discard_merge_buffer(drive, 0); 1359 return idetape_position_tape(drive, 1360 mt_count * tape->user_bs_factor, tape->partition, 0); 1361 case MTSETPART: 1362 ide_tape_discard_merge_buffer(drive, 0); 1363 return idetape_position_tape(drive, 0, mt_count, 0); 1364 case MTFSR: 1365 case MTBSR: 1366 case MTLOCK: 1367 retval = ide_set_media_lock(drive, disk, 1); 1368 if (retval) 1369 return retval; 1370 tape->door_locked = DOOR_EXPLICITLY_LOCKED; 1371 return 0; 1372 case MTUNLOCK: 1373 retval = ide_set_media_lock(drive, disk, 0); 1374 if (retval) 1375 return retval; 1376 tape->door_locked = DOOR_UNLOCKED; 1377 return 0; 1378 default: 1379 printk(KERN_ERR "ide-tape: MTIO operation %d not supported\n", 1380 mt_op); 1381 return -EIO; 1382 } 1383 } 1384 1385 /* 1386 * Our character device ioctls. General mtio.h magnetic io commands are 1387 * supported here, and not in the corresponding block interface. Our own 1388 * ide-tape ioctls are supported on both interfaces. 1389 */ 1390 static long do_idetape_chrdev_ioctl(struct file *file, 1391 unsigned int cmd, unsigned long arg) 1392 { 1393 struct ide_tape_obj *tape = file->private_data; 1394 ide_drive_t *drive = tape->drive; 1395 struct mtop mtop; 1396 struct mtget mtget; 1397 struct mtpos mtpos; 1398 int block_offset = 0, position = tape->first_frame; 1399 void __user *argp = (void __user *)arg; 1400 1401 ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x", cmd); 1402 1403 if (tape->chrdev_dir == IDETAPE_DIR_WRITE) { 1404 ide_tape_flush_merge_buffer(drive); 1405 idetape_flush_tape_buffers(drive); 1406 } 1407 if (cmd == MTIOCGET || cmd == MTIOCPOS) { 1408 block_offset = tape->valid / 1409 (tape->blk_size * tape->user_bs_factor); 1410 position = ide_tape_read_position(drive); 1411 if (position < 0) 1412 return -EIO; 1413 } 1414 switch (cmd) { 1415 case MTIOCTOP: 1416 if (copy_from_user(&mtop, argp, sizeof(struct mtop))) 1417 return -EFAULT; 1418 return idetape_mtioctop(drive, mtop.mt_op, mtop.mt_count); 1419 case MTIOCGET: 1420 memset(&mtget, 0, sizeof(struct mtget)); 1421 mtget.mt_type = MT_ISSCSI2; 1422 mtget.mt_blkno = position / tape->user_bs_factor - block_offset; 1423 mtget.mt_dsreg = 1424 ((tape->blk_size * tape->user_bs_factor) 1425 << MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK; 1426 1427 if (tape->drv_write_prot) 1428 mtget.mt_gstat |= GMT_WR_PROT(0xffffffff); 1429 1430 if (copy_to_user(argp, &mtget, sizeof(struct mtget))) 1431 return -EFAULT; 1432 return 0; 1433 case MTIOCPOS: 1434 mtpos.mt_blkno = position / tape->user_bs_factor - block_offset; 1435 if (copy_to_user(argp, &mtpos, sizeof(struct mtpos))) 1436 return -EFAULT; 1437 return 0; 1438 default: 1439 if (tape->chrdev_dir == IDETAPE_DIR_READ) 1440 ide_tape_discard_merge_buffer(drive, 1); 1441 return idetape_blkdev_ioctl(drive, cmd, arg); 1442 } 1443 } 1444 1445 static long idetape_chrdev_ioctl(struct file *file, 1446 unsigned int cmd, unsigned long arg) 1447 { 1448 long ret; 1449 mutex_lock(&ide_tape_mutex); 1450 ret = do_idetape_chrdev_ioctl(file, cmd, arg); 1451 mutex_unlock(&ide_tape_mutex); 1452 return ret; 1453 } 1454 1455 /* 1456 * Do a mode sense page 0 with block descriptor and if it succeeds set the tape 1457 * block size with the reported value. 1458 */ 1459 static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) 1460 { 1461 idetape_tape_t *tape = drive->driver_data; 1462 struct ide_atapi_pc pc; 1463 u8 buf[12]; 1464 1465 idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); 1466 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { 1467 printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); 1468 if (tape->blk_size == 0) { 1469 printk(KERN_WARNING "ide-tape: Cannot deal with zero " 1470 "block size, assuming 32k\n"); 1471 tape->blk_size = 32768; 1472 } 1473 return; 1474 } 1475 tape->blk_size = (buf[4 + 5] << 16) + 1476 (buf[4 + 6] << 8) + 1477 buf[4 + 7]; 1478 tape->drv_write_prot = (buf[2] & 0x80) >> 7; 1479 1480 ide_debug_log(IDE_DBG_FUNC, "blk_size: %d, write_prot: %d", 1481 tape->blk_size, tape->drv_write_prot); 1482 } 1483 1484 static int idetape_chrdev_open(struct inode *inode, struct file *filp) 1485 { 1486 unsigned int minor = iminor(inode), i = minor & ~0xc0; 1487 ide_drive_t *drive; 1488 idetape_tape_t *tape; 1489 int retval; 1490 1491 if (i >= MAX_HWIFS * MAX_DRIVES) 1492 return -ENXIO; 1493 1494 mutex_lock(&idetape_chrdev_mutex); 1495 1496 tape = ide_tape_get(NULL, true, i); 1497 if (!tape) { 1498 mutex_unlock(&idetape_chrdev_mutex); 1499 return -ENXIO; 1500 } 1501 1502 drive = tape->drive; 1503 filp->private_data = tape; 1504 1505 ide_debug_log(IDE_DBG_FUNC, "enter"); 1506 1507 /* 1508 * We really want to do nonseekable_open(inode, filp); here, but some 1509 * versions of tar incorrectly call lseek on tapes and bail out if that 1510 * fails. So we disallow pread() and pwrite(), but permit lseeks. 1511 */ 1512 filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); 1513 1514 1515 if (test_and_set_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags)) { 1516 retval = -EBUSY; 1517 goto out_put_tape; 1518 } 1519 1520 retval = idetape_wait_ready(drive, 60 * HZ); 1521 if (retval) { 1522 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); 1523 printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name); 1524 goto out_put_tape; 1525 } 1526 1527 ide_tape_read_position(drive); 1528 if (!test_bit(ilog2(IDE_AFLAG_ADDRESS_VALID), &drive->atapi_flags)) 1529 (void)idetape_rewind_tape(drive); 1530 1531 /* Read block size and write protect status from drive. */ 1532 ide_tape_get_bsize_from_bdesc(drive); 1533 1534 /* Set write protect flag if device is opened as read-only. */ 1535 if ((filp->f_flags & O_ACCMODE) == O_RDONLY) 1536 tape->write_prot = 1; 1537 else 1538 tape->write_prot = tape->drv_write_prot; 1539 1540 /* Make sure drive isn't write protected if user wants to write. */ 1541 if (tape->write_prot) { 1542 if ((filp->f_flags & O_ACCMODE) == O_WRONLY || 1543 (filp->f_flags & O_ACCMODE) == O_RDWR) { 1544 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); 1545 retval = -EROFS; 1546 goto out_put_tape; 1547 } 1548 } 1549 1550 /* Lock the tape drive door so user can't eject. */ 1551 if (tape->chrdev_dir == IDETAPE_DIR_NONE) { 1552 if (!ide_set_media_lock(drive, tape->disk, 1)) { 1553 if (tape->door_locked != DOOR_EXPLICITLY_LOCKED) 1554 tape->door_locked = DOOR_LOCKED; 1555 } 1556 } 1557 mutex_unlock(&idetape_chrdev_mutex); 1558 1559 return 0; 1560 1561 out_put_tape: 1562 ide_tape_put(tape); 1563 1564 mutex_unlock(&idetape_chrdev_mutex); 1565 1566 return retval; 1567 } 1568 1569 static void idetape_write_release(ide_drive_t *drive, unsigned int minor) 1570 { 1571 idetape_tape_t *tape = drive->driver_data; 1572 1573 ide_tape_flush_merge_buffer(drive); 1574 tape->buf = kmalloc(tape->buffer_size, GFP_KERNEL); 1575 if (tape->buf != NULL) { 1576 idetape_pad_zeros(drive, tape->blk_size * 1577 (tape->user_bs_factor - 1)); 1578 kfree(tape->buf); 1579 tape->buf = NULL; 1580 } 1581 idetape_write_filemark(drive); 1582 idetape_flush_tape_buffers(drive); 1583 idetape_flush_tape_buffers(drive); 1584 } 1585 1586 static int idetape_chrdev_release(struct inode *inode, struct file *filp) 1587 { 1588 struct ide_tape_obj *tape = filp->private_data; 1589 ide_drive_t *drive = tape->drive; 1590 unsigned int minor = iminor(inode); 1591 1592 mutex_lock(&idetape_chrdev_mutex); 1593 1594 tape = drive->driver_data; 1595 1596 ide_debug_log(IDE_DBG_FUNC, "enter"); 1597 1598 if (tape->chrdev_dir == IDETAPE_DIR_WRITE) 1599 idetape_write_release(drive, minor); 1600 if (tape->chrdev_dir == IDETAPE_DIR_READ) { 1601 if (minor < 128) 1602 ide_tape_discard_merge_buffer(drive, 1); 1603 } 1604 1605 if (minor < 128 && test_bit(ilog2(IDE_AFLAG_MEDIUM_PRESENT), 1606 &drive->atapi_flags)) 1607 (void) idetape_rewind_tape(drive); 1608 1609 if (tape->chrdev_dir == IDETAPE_DIR_NONE) { 1610 if (tape->door_locked == DOOR_LOCKED) { 1611 if (!ide_set_media_lock(drive, tape->disk, 0)) 1612 tape->door_locked = DOOR_UNLOCKED; 1613 } 1614 } 1615 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); 1616 ide_tape_put(tape); 1617 1618 mutex_unlock(&idetape_chrdev_mutex); 1619 1620 return 0; 1621 } 1622 1623 static void idetape_get_inquiry_results(ide_drive_t *drive) 1624 { 1625 idetape_tape_t *tape = drive->driver_data; 1626 struct ide_atapi_pc pc; 1627 u8 pc_buf[256]; 1628 char fw_rev[4], vendor_id[8], product_id[16]; 1629 1630 idetape_create_inquiry_cmd(&pc); 1631 if (ide_queue_pc_tail(drive, tape->disk, &pc, pc_buf, pc.req_xfer)) { 1632 printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", 1633 tape->name); 1634 return; 1635 } 1636 memcpy(vendor_id, &pc_buf[8], 8); 1637 memcpy(product_id, &pc_buf[16], 16); 1638 memcpy(fw_rev, &pc_buf[32], 4); 1639 1640 ide_fixstring(vendor_id, 8, 0); 1641 ide_fixstring(product_id, 16, 0); 1642 ide_fixstring(fw_rev, 4, 0); 1643 1644 printk(KERN_INFO "ide-tape: %s <-> %s: %.8s %.16s rev %.4s\n", 1645 drive->name, tape->name, vendor_id, product_id, fw_rev); 1646 } 1647 1648 /* 1649 * Ask the tape about its various parameters. In particular, we will adjust our 1650 * data transfer buffer size to the recommended value as returned by the tape. 1651 */ 1652 static void idetape_get_mode_sense_results(ide_drive_t *drive) 1653 { 1654 idetape_tape_t *tape = drive->driver_data; 1655 struct ide_atapi_pc pc; 1656 u8 buf[24], *caps; 1657 u8 speed, max_speed; 1658 1659 idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); 1660 if (ide_queue_pc_tail(drive, tape->disk, &pc, buf, pc.req_xfer)) { 1661 printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" 1662 " some default values\n"); 1663 tape->blk_size = 512; 1664 put_unaligned(52, (u16 *)&tape->caps[12]); 1665 put_unaligned(540, (u16 *)&tape->caps[14]); 1666 put_unaligned(6*52, (u16 *)&tape->caps[16]); 1667 return; 1668 } 1669 caps = buf + 4 + buf[3]; 1670 1671 /* convert to host order and save for later use */ 1672 speed = be16_to_cpup((__be16 *)&caps[14]); 1673 max_speed = be16_to_cpup((__be16 *)&caps[8]); 1674 1675 *(u16 *)&caps[8] = max_speed; 1676 *(u16 *)&caps[12] = be16_to_cpup((__be16 *)&caps[12]); 1677 *(u16 *)&caps[14] = speed; 1678 *(u16 *)&caps[16] = be16_to_cpup((__be16 *)&caps[16]); 1679 1680 if (!speed) { 1681 printk(KERN_INFO "ide-tape: %s: invalid tape speed " 1682 "(assuming 650KB/sec)\n", drive->name); 1683 *(u16 *)&caps[14] = 650; 1684 } 1685 if (!max_speed) { 1686 printk(KERN_INFO "ide-tape: %s: invalid max_speed " 1687 "(assuming 650KB/sec)\n", drive->name); 1688 *(u16 *)&caps[8] = 650; 1689 } 1690 1691 memcpy(&tape->caps, caps, 20); 1692 1693 /* device lacks locking support according to capabilities page */ 1694 if ((caps[6] & 1) == 0) 1695 drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; 1696 1697 if (caps[7] & 0x02) 1698 tape->blk_size = 512; 1699 else if (caps[7] & 0x04) 1700 tape->blk_size = 1024; 1701 } 1702 1703 #ifdef CONFIG_IDE_PROC_FS 1704 #define ide_tape_devset_get(name, field) \ 1705 static int get_##name(ide_drive_t *drive) \ 1706 { \ 1707 idetape_tape_t *tape = drive->driver_data; \ 1708 return tape->field; \ 1709 } 1710 1711 #define ide_tape_devset_set(name, field) \ 1712 static int set_##name(ide_drive_t *drive, int arg) \ 1713 { \ 1714 idetape_tape_t *tape = drive->driver_data; \ 1715 tape->field = arg; \ 1716 return 0; \ 1717 } 1718 1719 #define ide_tape_devset_rw_field(_name, _field) \ 1720 ide_tape_devset_get(_name, _field) \ 1721 ide_tape_devset_set(_name, _field) \ 1722 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 1723 1724 #define ide_tape_devset_r_field(_name, _field) \ 1725 ide_tape_devset_get(_name, _field) \ 1726 IDE_DEVSET(_name, 0, get_##_name, NULL) 1727 1728 static int mulf_tdsc(ide_drive_t *drive) { return 1000; } 1729 static int divf_tdsc(ide_drive_t *drive) { return HZ; } 1730 static int divf_buffer(ide_drive_t *drive) { return 2; } 1731 static int divf_buffer_size(ide_drive_t *drive) { return 1024; } 1732 1733 ide_devset_rw_flag(dsc_overlap, IDE_DFLAG_DSC_OVERLAP); 1734 1735 ide_tape_devset_rw_field(tdsc, best_dsc_rw_freq); 1736 1737 ide_tape_devset_r_field(avg_speed, avg_speed); 1738 ide_tape_devset_r_field(speed, caps[14]); 1739 ide_tape_devset_r_field(buffer, caps[16]); 1740 ide_tape_devset_r_field(buffer_size, buffer_size); 1741 1742 static const struct ide_proc_devset idetape_settings[] = { 1743 __IDE_PROC_DEVSET(avg_speed, 0, 0xffff, NULL, NULL), 1744 __IDE_PROC_DEVSET(buffer, 0, 0xffff, NULL, divf_buffer), 1745 __IDE_PROC_DEVSET(buffer_size, 0, 0xffff, NULL, divf_buffer_size), 1746 __IDE_PROC_DEVSET(dsc_overlap, 0, 1, NULL, NULL), 1747 __IDE_PROC_DEVSET(speed, 0, 0xffff, NULL, NULL), 1748 __IDE_PROC_DEVSET(tdsc, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX, 1749 mulf_tdsc, divf_tdsc), 1750 { NULL }, 1751 }; 1752 #endif 1753 1754 /* 1755 * The function below is called to: 1756 * 1757 * 1. Initialize our various state variables. 1758 * 2. Ask the tape for its capabilities. 1759 * 3. Allocate a buffer which will be used for data transfer. The buffer size 1760 * is chosen based on the recommendation which we received in step 2. 1761 * 1762 * Note that at this point ide.c already assigned us an irq, so that we can 1763 * queue requests here and wait for their completion. 1764 */ 1765 static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) 1766 { 1767 unsigned long t; 1768 int speed; 1769 int buffer_size; 1770 u16 *ctl = (u16 *)&tape->caps[12]; 1771 1772 ide_debug_log(IDE_DBG_FUNC, "minor: %d", minor); 1773 1774 drive->pc_callback = ide_tape_callback; 1775 1776 drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; 1777 1778 if (drive->hwif->host_flags & IDE_HFLAG_NO_DSC) { 1779 printk(KERN_INFO "ide-tape: %s: disabling DSC overlap\n", 1780 tape->name); 1781 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; 1782 } 1783 1784 /* Seagate Travan drives do not support DSC overlap. */ 1785 if (strstr((char *)&drive->id[ATA_ID_PROD], "Seagate STT3401")) 1786 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; 1787 1788 tape->minor = minor; 1789 tape->name[0] = 'h'; 1790 tape->name[1] = 't'; 1791 tape->name[2] = '0' + minor; 1792 tape->chrdev_dir = IDETAPE_DIR_NONE; 1793 1794 idetape_get_inquiry_results(drive); 1795 idetape_get_mode_sense_results(drive); 1796 ide_tape_get_bsize_from_bdesc(drive); 1797 tape->user_bs_factor = 1; 1798 tape->buffer_size = *ctl * tape->blk_size; 1799 while (tape->buffer_size > 0xffff) { 1800 printk(KERN_NOTICE "ide-tape: decreasing stage size\n"); 1801 *ctl /= 2; 1802 tape->buffer_size = *ctl * tape->blk_size; 1803 } 1804 buffer_size = tape->buffer_size; 1805 1806 /* select the "best" DSC read/write polling freq */ 1807 speed = max(*(u16 *)&tape->caps[14], *(u16 *)&tape->caps[8]); 1808 1809 t = (IDETAPE_FIFO_THRESHOLD * tape->buffer_size * HZ) / (speed * 1000); 1810 1811 /* 1812 * Ensure that the number we got makes sense; limit it within 1813 * IDETAPE_DSC_RW_MIN and IDETAPE_DSC_RW_MAX. 1814 */ 1815 tape->best_dsc_rw_freq = clamp_t(unsigned long, t, IDETAPE_DSC_RW_MIN, 1816 IDETAPE_DSC_RW_MAX); 1817 printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, " 1818 "%ums tDSC%s\n", 1819 drive->name, tape->name, *(u16 *)&tape->caps[14], 1820 (*(u16 *)&tape->caps[16] * 512) / tape->buffer_size, 1821 tape->buffer_size / 1024, 1822 jiffies_to_msecs(tape->best_dsc_rw_freq), 1823 (drive->dev_flags & IDE_DFLAG_USING_DMA) ? ", DMA" : ""); 1824 1825 ide_proc_register_driver(drive, tape->driver); 1826 } 1827 1828 static void ide_tape_remove(ide_drive_t *drive) 1829 { 1830 idetape_tape_t *tape = drive->driver_data; 1831 1832 ide_proc_unregister_driver(drive, tape->driver); 1833 device_del(&tape->dev); 1834 ide_unregister_region(tape->disk); 1835 1836 mutex_lock(&idetape_ref_mutex); 1837 put_device(&tape->dev); 1838 mutex_unlock(&idetape_ref_mutex); 1839 } 1840 1841 static void ide_tape_release(struct device *dev) 1842 { 1843 struct ide_tape_obj *tape = to_ide_drv(dev, ide_tape_obj); 1844 ide_drive_t *drive = tape->drive; 1845 struct gendisk *g = tape->disk; 1846 1847 BUG_ON(tape->valid); 1848 1849 drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; 1850 drive->driver_data = NULL; 1851 device_destroy(idetape_sysfs_class, MKDEV(IDETAPE_MAJOR, tape->minor)); 1852 device_destroy(idetape_sysfs_class, 1853 MKDEV(IDETAPE_MAJOR, tape->minor + 128)); 1854 idetape_devs[tape->minor] = NULL; 1855 g->private_data = NULL; 1856 put_disk(g); 1857 kfree(tape); 1858 } 1859 1860 #ifdef CONFIG_IDE_PROC_FS 1861 static int idetape_name_proc_show(struct seq_file *m, void *v) 1862 { 1863 ide_drive_t *drive = (ide_drive_t *) m->private; 1864 idetape_tape_t *tape = drive->driver_data; 1865 1866 seq_printf(m, "%s\n", tape->name); 1867 return 0; 1868 } 1869 1870 static int idetape_name_proc_open(struct inode *inode, struct file *file) 1871 { 1872 return single_open(file, idetape_name_proc_show, PDE_DATA(inode)); 1873 } 1874 1875 static const struct file_operations idetape_name_proc_fops = { 1876 .owner = THIS_MODULE, 1877 .open = idetape_name_proc_open, 1878 .read = seq_read, 1879 .llseek = seq_lseek, 1880 .release = single_release, 1881 }; 1882 1883 static ide_proc_entry_t idetape_proc[] = { 1884 { "capacity", S_IFREG|S_IRUGO, &ide_capacity_proc_fops }, 1885 { "name", S_IFREG|S_IRUGO, &idetape_name_proc_fops }, 1886 {} 1887 }; 1888 1889 static ide_proc_entry_t *ide_tape_proc_entries(ide_drive_t *drive) 1890 { 1891 return idetape_proc; 1892 } 1893 1894 static const struct ide_proc_devset *ide_tape_proc_devsets(ide_drive_t *drive) 1895 { 1896 return idetape_settings; 1897 } 1898 #endif 1899 1900 static int ide_tape_probe(ide_drive_t *); 1901 1902 static struct ide_driver idetape_driver = { 1903 .gen_driver = { 1904 .owner = THIS_MODULE, 1905 .name = "ide-tape", 1906 .bus = &ide_bus_type, 1907 }, 1908 .probe = ide_tape_probe, 1909 .remove = ide_tape_remove, 1910 .version = IDETAPE_VERSION, 1911 .do_request = idetape_do_request, 1912 #ifdef CONFIG_IDE_PROC_FS 1913 .proc_entries = ide_tape_proc_entries, 1914 .proc_devsets = ide_tape_proc_devsets, 1915 #endif 1916 }; 1917 1918 /* Our character device supporting functions, passed to register_chrdev. */ 1919 static const struct file_operations idetape_fops = { 1920 .owner = THIS_MODULE, 1921 .read = idetape_chrdev_read, 1922 .write = idetape_chrdev_write, 1923 .unlocked_ioctl = idetape_chrdev_ioctl, 1924 .open = idetape_chrdev_open, 1925 .release = idetape_chrdev_release, 1926 .llseek = noop_llseek, 1927 }; 1928 1929 static int idetape_open(struct block_device *bdev, fmode_t mode) 1930 { 1931 struct ide_tape_obj *tape; 1932 1933 mutex_lock(&ide_tape_mutex); 1934 tape = ide_tape_get(bdev->bd_disk, false, 0); 1935 mutex_unlock(&ide_tape_mutex); 1936 1937 if (!tape) 1938 return -ENXIO; 1939 1940 return 0; 1941 } 1942 1943 static void idetape_release(struct gendisk *disk, fmode_t mode) 1944 { 1945 struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); 1946 1947 mutex_lock(&ide_tape_mutex); 1948 ide_tape_put(tape); 1949 mutex_unlock(&ide_tape_mutex); 1950 } 1951 1952 static int idetape_ioctl(struct block_device *bdev, fmode_t mode, 1953 unsigned int cmd, unsigned long arg) 1954 { 1955 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj); 1956 ide_drive_t *drive = tape->drive; 1957 int err; 1958 1959 mutex_lock(&ide_tape_mutex); 1960 err = generic_ide_ioctl(drive, bdev, cmd, arg); 1961 if (err == -EINVAL) 1962 err = idetape_blkdev_ioctl(drive, cmd, arg); 1963 mutex_unlock(&ide_tape_mutex); 1964 1965 return err; 1966 } 1967 1968 static const struct block_device_operations idetape_block_ops = { 1969 .owner = THIS_MODULE, 1970 .open = idetape_open, 1971 .release = idetape_release, 1972 .ioctl = idetape_ioctl, 1973 }; 1974 1975 static int ide_tape_probe(ide_drive_t *drive) 1976 { 1977 idetape_tape_t *tape; 1978 struct gendisk *g; 1979 int minor; 1980 1981 ide_debug_log(IDE_DBG_FUNC, "enter"); 1982 1983 if (!strstr(DRV_NAME, drive->driver_req)) 1984 goto failed; 1985 1986 if (drive->media != ide_tape) 1987 goto failed; 1988 1989 if ((drive->dev_flags & IDE_DFLAG_ID_READ) && 1990 ide_check_atapi_device(drive, DRV_NAME) == 0) { 1991 printk(KERN_ERR "ide-tape: %s: not supported by this version of" 1992 " the driver\n", drive->name); 1993 goto failed; 1994 } 1995 tape = kzalloc(sizeof(idetape_tape_t), GFP_KERNEL); 1996 if (tape == NULL) { 1997 printk(KERN_ERR "ide-tape: %s: Can't allocate a tape struct\n", 1998 drive->name); 1999 goto failed; 2000 } 2001 2002 g = alloc_disk(1 << PARTN_BITS); 2003 if (!g) 2004 goto out_free_tape; 2005 2006 ide_init_disk(g, drive); 2007 2008 tape->dev.parent = &drive->gendev; 2009 tape->dev.release = ide_tape_release; 2010 dev_set_name(&tape->dev, "%s", dev_name(&drive->gendev)); 2011 2012 if (device_register(&tape->dev)) 2013 goto out_free_disk; 2014 2015 tape->drive = drive; 2016 tape->driver = &idetape_driver; 2017 tape->disk = g; 2018 2019 g->private_data = &tape->driver; 2020 2021 drive->driver_data = tape; 2022 2023 mutex_lock(&idetape_ref_mutex); 2024 for (minor = 0; idetape_devs[minor]; minor++) 2025 ; 2026 idetape_devs[minor] = tape; 2027 mutex_unlock(&idetape_ref_mutex); 2028 2029 idetape_setup(drive, tape, minor); 2030 2031 device_create(idetape_sysfs_class, &drive->gendev, 2032 MKDEV(IDETAPE_MAJOR, minor), NULL, "%s", tape->name); 2033 device_create(idetape_sysfs_class, &drive->gendev, 2034 MKDEV(IDETAPE_MAJOR, minor + 128), NULL, 2035 "n%s", tape->name); 2036 2037 g->fops = &idetape_block_ops; 2038 ide_register_region(g); 2039 2040 return 0; 2041 2042 out_free_disk: 2043 put_disk(g); 2044 out_free_tape: 2045 kfree(tape); 2046 failed: 2047 return -ENODEV; 2048 } 2049 2050 static void __exit idetape_exit(void) 2051 { 2052 driver_unregister(&idetape_driver.gen_driver); 2053 class_destroy(idetape_sysfs_class); 2054 unregister_chrdev(IDETAPE_MAJOR, "ht"); 2055 } 2056 2057 static int __init idetape_init(void) 2058 { 2059 int error = 1; 2060 idetape_sysfs_class = class_create(THIS_MODULE, "ide_tape"); 2061 if (IS_ERR(idetape_sysfs_class)) { 2062 idetape_sysfs_class = NULL; 2063 printk(KERN_ERR "Unable to create sysfs class for ide tapes\n"); 2064 error = -EBUSY; 2065 goto out; 2066 } 2067 2068 if (register_chrdev(IDETAPE_MAJOR, "ht", &idetape_fops)) { 2069 printk(KERN_ERR "ide-tape: Failed to register chrdev" 2070 " interface\n"); 2071 error = -EBUSY; 2072 goto out_free_class; 2073 } 2074 2075 error = driver_register(&idetape_driver.gen_driver); 2076 if (error) 2077 goto out_free_driver; 2078 2079 return 0; 2080 2081 out_free_driver: 2082 driver_unregister(&idetape_driver.gen_driver); 2083 out_free_class: 2084 class_destroy(idetape_sysfs_class); 2085 out: 2086 return error; 2087 } 2088 2089 MODULE_ALIAS("ide:*m-tape*"); 2090 module_init(idetape_init); 2091 module_exit(idetape_exit); 2092 MODULE_ALIAS_CHARDEV_MAJOR(IDETAPE_MAJOR); 2093 MODULE_DESCRIPTION("ATAPI Streaming TAPE Driver"); 2094 MODULE_LICENSE("GPL"); 2095 2096 2097 2098 2099 2100 /* LDV_COMMENT_BEGIN_MAIN */ 2101 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 2102 2103 /*###########################################################################*/ 2104 2105 /*############## Driver Environment Generator 0.2 output ####################*/ 2106 2107 /*###########################################################################*/ 2108 2109 2110 2111 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test if all kernel resources are correctly released by driver before driver will be unloaded. */ 2112 void ldv_check_final_state(void); 2113 2114 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 2115 void ldv_check_return_value(int res); 2116 2117 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 2118 void ldv_check_return_value_probe(int res); 2119 2120 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 2121 void ldv_initialize(void); 2122 2123 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 2124 void ldv_handler_precall(void); 2125 2126 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 2127 int nondet_int(void); 2128 2129 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 2130 int LDV_IN_INTERRUPT; 2131 2132 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 2133 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 2134 2135 2136 2137 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 2138 /*============================= VARIABLE DECLARATION PART =============================*/ 2139 /** STRUCT: struct type: file_operations, struct name: idetape_name_proc_fops **/ 2140 /* content: static int idetape_name_proc_open(struct inode *inode, struct file *file)*/ 2141 /* LDV_COMMENT_BEGIN_PREP */ 2142 #define DRV_NAME "ide-tape" 2143 #define IDETAPE_VERSION "1.20" 2144 #undef IDETAPE_DEBUG_LOG 2145 #ifdef IDETAPE_DEBUG_LOG 2146 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2147 #else 2148 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2149 #endif 2150 #define IDETAPE_MAX_PC_RETRIES 3 2151 #define IDETAPE_FIFO_THRESHOLD 2 2152 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2153 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2154 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2155 #define IDETAPE_DSC_MA_FAST 2*HZ 2156 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2157 #define IDETAPE_DSC_MA_SLOW 30*HZ 2158 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2159 #define DOOR_UNLOCKED 0 2160 #define DOOR_LOCKED 1 2161 #define DOOR_EXPLICITLY_LOCKED 2 2162 #define IDETAPE_SPACE_OVER_FILEMARK 1 2163 #define IDETAPE_SPACE_TO_EOD 3 2164 #define IDETAPE_LU_LOAD_MASK 1 2165 #define IDETAPE_LU_RETENSION_MASK 2 2166 #define IDETAPE_LU_EOT_MASK 4 2167 #define IDETAPE_BLOCK_DESCRIPTOR 0 2168 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2169 #ifdef CONFIG_IDE_PROC_FS 2170 #define ide_tape_devset_get(name, field) \ 2171 static int get_##name(ide_drive_t *drive) \ 2172 { \ 2173 idetape_tape_t *tape = drive->driver_data; \ 2174 return tape->field; \ 2175 } 2176 #define ide_tape_devset_set(name, field) \ 2177 static int set_##name(ide_drive_t *drive, int arg) \ 2178 { \ 2179 idetape_tape_t *tape = drive->driver_data; \ 2180 tape->field = arg; \ 2181 return 0; \ 2182 } 2183 #define ide_tape_devset_rw_field(_name, _field) \ 2184 ide_tape_devset_get(_name, _field) \ 2185 ide_tape_devset_set(_name, _field) \ 2186 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2187 #define ide_tape_devset_r_field(_name, _field) \ 2188 ide_tape_devset_get(_name, _field) \ 2189 IDE_DEVSET(_name, 0, get_##_name, NULL) 2190 #endif 2191 #ifdef CONFIG_IDE_PROC_FS 2192 /* LDV_COMMENT_END_PREP */ 2193 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_name_proc_open" */ 2194 struct inode * var_group1; 2195 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_name_proc_open" */ 2196 struct file * var_group2; 2197 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "idetape_name_proc_open" */ 2198 static int res_idetape_name_proc_open_50; 2199 /* LDV_COMMENT_BEGIN_PREP */ 2200 #endif 2201 #ifdef CONFIG_IDE_PROC_FS 2202 #endif 2203 /* LDV_COMMENT_END_PREP */ 2204 2205 /** STRUCT: struct type: ide_driver, struct name: idetape_driver **/ 2206 /* content: static int ide_tape_probe(ide_drive_t *drive)*/ 2207 /* LDV_COMMENT_BEGIN_PREP */ 2208 #define DRV_NAME "ide-tape" 2209 #define IDETAPE_VERSION "1.20" 2210 #undef IDETAPE_DEBUG_LOG 2211 #ifdef IDETAPE_DEBUG_LOG 2212 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2213 #else 2214 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2215 #endif 2216 #define IDETAPE_MAX_PC_RETRIES 3 2217 #define IDETAPE_FIFO_THRESHOLD 2 2218 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2219 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2220 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2221 #define IDETAPE_DSC_MA_FAST 2*HZ 2222 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2223 #define IDETAPE_DSC_MA_SLOW 30*HZ 2224 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2225 #define DOOR_UNLOCKED 0 2226 #define DOOR_LOCKED 1 2227 #define DOOR_EXPLICITLY_LOCKED 2 2228 #define IDETAPE_SPACE_OVER_FILEMARK 1 2229 #define IDETAPE_SPACE_TO_EOD 3 2230 #define IDETAPE_LU_LOAD_MASK 1 2231 #define IDETAPE_LU_RETENSION_MASK 2 2232 #define IDETAPE_LU_EOT_MASK 4 2233 #define IDETAPE_BLOCK_DESCRIPTOR 0 2234 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2235 #ifdef CONFIG_IDE_PROC_FS 2236 #define ide_tape_devset_get(name, field) \ 2237 static int get_##name(ide_drive_t *drive) \ 2238 { \ 2239 idetape_tape_t *tape = drive->driver_data; \ 2240 return tape->field; \ 2241 } 2242 #define ide_tape_devset_set(name, field) \ 2243 static int set_##name(ide_drive_t *drive, int arg) \ 2244 { \ 2245 idetape_tape_t *tape = drive->driver_data; \ 2246 tape->field = arg; \ 2247 return 0; \ 2248 } 2249 #define ide_tape_devset_rw_field(_name, _field) \ 2250 ide_tape_devset_get(_name, _field) \ 2251 ide_tape_devset_set(_name, _field) \ 2252 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2253 #define ide_tape_devset_r_field(_name, _field) \ 2254 ide_tape_devset_get(_name, _field) \ 2255 IDE_DEVSET(_name, 0, get_##_name, NULL) 2256 #endif 2257 #ifdef CONFIG_IDE_PROC_FS 2258 #endif 2259 #ifdef CONFIG_IDE_PROC_FS 2260 #endif 2261 /* LDV_COMMENT_END_PREP */ 2262 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ide_tape_probe" */ 2263 ide_drive_t * var_ide_tape_probe_56_p0; 2264 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ide_tape_probe" */ 2265 static int res_ide_tape_probe_56; 2266 /* content: static void ide_tape_remove(ide_drive_t *drive)*/ 2267 /* LDV_COMMENT_BEGIN_PREP */ 2268 #define DRV_NAME "ide-tape" 2269 #define IDETAPE_VERSION "1.20" 2270 #undef IDETAPE_DEBUG_LOG 2271 #ifdef IDETAPE_DEBUG_LOG 2272 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2273 #else 2274 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2275 #endif 2276 #define IDETAPE_MAX_PC_RETRIES 3 2277 #define IDETAPE_FIFO_THRESHOLD 2 2278 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2279 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2280 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2281 #define IDETAPE_DSC_MA_FAST 2*HZ 2282 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2283 #define IDETAPE_DSC_MA_SLOW 30*HZ 2284 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2285 #define DOOR_UNLOCKED 0 2286 #define DOOR_LOCKED 1 2287 #define DOOR_EXPLICITLY_LOCKED 2 2288 #define IDETAPE_SPACE_OVER_FILEMARK 1 2289 #define IDETAPE_SPACE_TO_EOD 3 2290 #define IDETAPE_LU_LOAD_MASK 1 2291 #define IDETAPE_LU_RETENSION_MASK 2 2292 #define IDETAPE_LU_EOT_MASK 4 2293 #define IDETAPE_BLOCK_DESCRIPTOR 0 2294 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2295 #ifdef CONFIG_IDE_PROC_FS 2296 #define ide_tape_devset_get(name, field) \ 2297 static int get_##name(ide_drive_t *drive) \ 2298 { \ 2299 idetape_tape_t *tape = drive->driver_data; \ 2300 return tape->field; \ 2301 } 2302 #define ide_tape_devset_set(name, field) \ 2303 static int set_##name(ide_drive_t *drive, int arg) \ 2304 { \ 2305 idetape_tape_t *tape = drive->driver_data; \ 2306 tape->field = arg; \ 2307 return 0; \ 2308 } 2309 #define ide_tape_devset_rw_field(_name, _field) \ 2310 ide_tape_devset_get(_name, _field) \ 2311 ide_tape_devset_set(_name, _field) \ 2312 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 2313 #define ide_tape_devset_r_field(_name, _field) \ 2314 ide_tape_devset_get(_name, _field) \ 2315 IDE_DEVSET(_name, 0, get_##_name, NULL) 2316 #endif 2317 /* LDV_COMMENT_END_PREP */ 2318 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ide_tape_remove" */ 2319 ide_drive_t * var_ide_tape_remove_47_p0; 2320 /* LDV_COMMENT_BEGIN_PREP */ 2321 #ifdef CONFIG_IDE_PROC_FS 2322 #endif 2323 #ifdef CONFIG_IDE_PROC_FS 2324 #endif 2325 /* LDV_COMMENT_END_PREP */ 2326 /* content: static ide_startstop_t idetape_do_request(ide_drive_t *drive, struct request *rq, sector_t block)*/ 2327 /* LDV_COMMENT_BEGIN_PREP */ 2328 #define DRV_NAME "ide-tape" 2329 #define IDETAPE_VERSION "1.20" 2330 #undef IDETAPE_DEBUG_LOG 2331 #ifdef IDETAPE_DEBUG_LOG 2332 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) 2333 #else 2334 #define ide_debug_log(lvl, fmt, args...) do {} while (0) 2335 #endif 2336 #define IDETAPE_MAX_PC_RETRIES 3 2337 #define IDETAPE_FIFO_THRESHOLD 2 2338 #define IDETAPE_DSC_RW_MIN 5*HZ/100 2339 #define IDETAPE_DSC_RW_MAX 40*HZ/100 2340 #define IDETAPE_DSC_RW_TIMEOUT 2*60*HZ 2341 #define IDETAPE_DSC_MA_FAST 2*HZ 2342 #define IDETAPE_DSC_MA_THRESHOLD 5*60*HZ 2343 #define IDETAPE_DSC_MA_SLOW 30*HZ 2344 #define IDETAPE_DSC_MA_TIMEOUT 2*60*60*HZ 2345 #define DOOR_UNLOCKED 0 2346 #define DOOR_LOCKED 1 2347 #define DOOR_EXPLICITLY_LOCKED 2 2348 #define IDETAPE_SPACE_OVER_FILEMARK 1 2349 #define IDETAPE_SPACE_TO_EOD 3 2350 #define IDETAPE_LU_LOAD_MASK 1 2351 #define IDETAPE_LU_RETENSION_MASK 2 2352 #define IDETAPE_LU_EOT_MASK 4 2353 #define IDETAPE_BLOCK_DESCRIPTOR 0 2354 #define IDETAPE_CAPABILITIES_PAGE 0x2a 2355 /* LDV_COMMENT_END_PREP */ 2356 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_do_request" */ 2357 ide_drive_t * var_idetape_do_request_10_p0; 2358 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_do_request" */ 2359 struct request * var_group3; 2360 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "idetape_do_request" */ 2361 sector_t var_idetape_do_request_10_p2; 2362 /* LDV_COMMENT_BEGIN_PREP */ 2363 #ifdef CONFIG_IDE_PROC_FS 2364 #define i