This commit was manufactured by cvs2svn to create branch
[linux-2.6.git] / drivers / char / mem.c
1 /*
2  *  linux/drivers/char/mem.c
3  *
4  *  Copyright (C) 1991, 1992  Linus Torvalds
5  *
6  *  Added devfs support. 
7  *    Jan-11-1998, C. Scott Ananian <cananian@alumni.princeton.edu>
8  *  Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com>
9  */
10
11 #include <linux/config.h>
12 #include <linux/mm.h>
13 #include <linux/miscdevice.h>
14 #include <linux/slab.h>
15 #include <linux/vmalloc.h>
16 #include <linux/mman.h>
17 #include <linux/random.h>
18 #include <linux/init.h>
19 #include <linux/raw.h>
20 #include <linux/tty.h>
21 #include <linux/capability.h>
22 #include <linux/smp_lock.h>
23 #include <linux/devfs_fs_kernel.h>
24 #include <linux/ptrace.h>
25 #include <linux/device.h>
26 #include <linux/highmem.h>
27 #include <linux/crash_dump.h>
28
29 #include <asm/uaccess.h>
30 #include <asm/io.h>
31
32 #ifdef CONFIG_IA64
33 # include <linux/efi.h>
34 #endif
35
36 #if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR)
37 extern void tapechar_init(void);
38 #endif
39
40 /*
41  * Architectures vary in how they handle caching for addresses
42  * outside of main memory.
43  *
44  */
45 static inline int uncached_access(struct file *file, unsigned long addr)
46 {
47 #if defined(__i386__)
48         /*
49          * On the PPro and successors, the MTRRs are used to set
50          * memory types for physical addresses outside main memory,
51          * so blindly setting PCD or PWT on those pages is wrong.
52          * For Pentiums and earlier, the surround logic should disable
53          * caching for the high addresses through the KEN pin, but
54          * we maintain the tradition of paranoia in this code.
55          */
56         if (file->f_flags & O_SYNC)
57                 return 1;
58         return !( test_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability) ||
59                   test_bit(X86_FEATURE_K6_MTRR, boot_cpu_data.x86_capability) ||
60                   test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) ||
61                   test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) )
62           && addr >= __pa(high_memory);
63 #elif defined(__x86_64__)
64         /* 
65          * This is broken because it can generate memory type aliases,
66          * which can cause cache corruptions
67          * But it is only available for root and we have to be bug-to-bug
68          * compatible with i386.
69          */
70         if (file->f_flags & O_SYNC)
71                 return 1;
72         /* same behaviour as i386. PAT always set to cached and MTRRs control the
73            caching behaviour. 
74            Hopefully a full PAT implementation will fix that soon. */      
75         return 0;
76 #elif defined(CONFIG_IA64)
77         /*
78          * On ia64, we ignore O_SYNC because we cannot tolerate memory attribute aliases.
79          */
80         return !(efi_mem_attributes(addr) & EFI_MEMORY_WB);
81 #elif defined(CONFIG_PPC64)
82         /* On PPC64, we always do non-cacheable access to the IO hole and
83          * cacheable elsewhere. Cache paradox can checkstop the CPU and
84          * the high_memory heuristic below is wrong on machines with memory
85          * above the IO hole... Ah, and of course, XFree86 doesn't pass
86          * O_SYNC when mapping us to tap IO space. Surprised ?
87          */
88         return !page_is_ram(addr >> PAGE_SHIFT);
89 #else
90         /*
91          * Accessing memory above the top the kernel knows about or through a file pointer
92          * that was marked O_SYNC will be done non-cached.
93          */
94         if (file->f_flags & O_SYNC)
95                 return 1;
96         return addr >= __pa(high_memory);
97 #endif
98 }
99
100 #ifndef ARCH_HAS_VALID_PHYS_ADDR_RANGE
101 static inline int valid_phys_addr_range(unsigned long addr, size_t *count)
102 {
103         unsigned long end_mem;
104
105         end_mem = __pa(high_memory);
106         if (addr >= end_mem)
107                 return 0;
108
109         if (*count > end_mem - addr)
110                 *count = end_mem - addr;
111
112         return 1;
113 }
114 #endif
115
116 static inline int range_is_allowed(unsigned long from, unsigned long to)
117 {
118         unsigned long cursor;
119         
120         cursor = from >> PAGE_SHIFT;
121         while ((cursor << PAGE_SHIFT) < to) {
122                 if (!devmem_is_allowed(cursor))
123                         return 0;
124                 cursor++;
125         }
126         return 1;
127 }
128 static ssize_t do_write_mem(void *p, unsigned long realp,
129                             const char __user * buf, size_t count, loff_t *ppos)
130 {
131         ssize_t written;
132         unsigned long copied;
133
134         written = 0;
135 #if defined(__sparc__) || (defined(__mc68000__) && defined(CONFIG_MMU))
136         /* we don't have page 0 mapped on sparc and m68k.. */
137         if (realp < PAGE_SIZE) {
138                 unsigned long sz = PAGE_SIZE-realp;
139                 if (sz > count) sz = count; 
140                 /* Hmm. Do something? */
141                 buf+=sz;
142                 p+=sz;
143                 count-=sz;
144                 written+=sz;
145         }
146 #endif
147         if (!range_is_allowed(realp, realp+count))
148                 return -EPERM;
149         copied = copy_from_user(p, buf, count);
150         if (copied) {
151                 ssize_t ret = written + (count - copied);
152
153                 if (ret)
154                         return ret;
155                 return -EFAULT;
156         }
157         written += count;
158         *ppos += written;
159         return written;
160 }
161
162
163 /*
164  * This funcion reads the *physical* memory. The f_pos points directly to the 
165  * memory location. 
166  */
167 static ssize_t read_mem(struct file * file, char __user * buf,
168                         size_t count, loff_t *ppos)
169 {
170         unsigned long p = *ppos;
171         ssize_t read;
172
173         if (!valid_phys_addr_range(p, &count))
174                 return -EFAULT;
175         read = 0;
176 #if defined(__sparc__) || (defined(__mc68000__) && defined(CONFIG_MMU))
177         /* we don't have page 0 mapped on sparc and m68k.. */
178         if (p < PAGE_SIZE) {
179                 unsigned long sz = PAGE_SIZE-p;
180                 if (sz > count) 
181                         sz = count; 
182                 if (sz > 0) {
183                         if (clear_user(buf, sz))
184                                 return -EFAULT;
185                         buf += sz; 
186                         p += sz; 
187                         count -= sz; 
188                         read += sz; 
189                 }
190         }
191 #endif
192         if (!range_is_allowed(p, p+count))
193                 return -EPERM;
194         if (copy_to_user(buf, __va(p), count))
195                 return -EFAULT;
196         read += count;
197         *ppos += read;
198         return read;
199 }
200
201 static ssize_t write_mem(struct file * file, const char __user * buf, 
202                          size_t count, loff_t *ppos)
203 {
204         unsigned long p = *ppos;
205
206         if (!valid_phys_addr_range(p, &count))
207                 return -EFAULT;
208         return do_write_mem(__va(p), p, buf, count, ppos);
209 }
210
211 static int mmap_mem(struct file * file, struct vm_area_struct * vma)
212 {
213 #ifdef pgprot_noncached
214         unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
215         int uncached;
216
217         uncached = uncached_access(file, offset);
218         if (uncached)
219                 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
220 #endif
221
222         /* Remap-pfn-range will mark the range VM_IO and VM_RESERVED */
223         if (remap_pfn_range(vma,
224                             vma->vm_start,
225                             vma->vm_pgoff,
226                             vma->vm_end-vma->vm_start,
227                             vma->vm_page_prot))
228                 return -EAGAIN;
229         return 0;
230 }
231
232 #ifdef CONFIG_CRASH_DUMP
233 /*
234  * Read memory corresponding to the old kernel.
235  * If we are reading from the reserved section, which is
236  * actually used by the current kernel, we just return zeroes.
237  * Or if we are reading from the first 640k, we return from the
238  * backed up area.
239  */
240 static ssize_t read_oldmem(struct file * file, char * buf,
241                                 size_t count, loff_t *ppos)
242 {
243         unsigned long pfn;
244         unsigned backup_start, backup_end, relocate_start;
245         size_t read=0, csize;
246
247         backup_start = CRASH_BACKUP_BASE / PAGE_SIZE;
248         backup_end = backup_start + (CRASH_BACKUP_SIZE / PAGE_SIZE);
249         relocate_start = (CRASH_BACKUP_BASE + CRASH_BACKUP_SIZE) / PAGE_SIZE;
250
251         while(count) {
252                 pfn = *ppos / PAGE_SIZE;
253
254                 csize = (count > PAGE_SIZE) ? PAGE_SIZE : count;
255
256                 /* Perform translation (see comment above) */
257                 if ((pfn >= backup_start) && (pfn < backup_end)) {
258                         if (clear_user(buf, csize)) {
259                                 read = -EFAULT;
260                                 goto done;
261                         }
262
263                         goto copy_done;
264                 } else if (pfn < (CRASH_RELOCATE_SIZE / PAGE_SIZE))
265                         pfn += relocate_start;
266
267                 if (pfn > saved_max_pfn) {
268                         read = 0;
269                         goto done;
270                 }
271
272                 if (copy_oldmem_page(pfn, buf, csize, 1)) {
273                         read = -EFAULT;
274                         goto done;
275                 }
276
277 copy_done:
278                 buf += csize;
279                 *ppos += csize;
280                 read += csize;
281                 count -= csize;
282         }
283 done:
284         return read;
285 }
286 #endif
287
288 extern long vread(char *buf, char *addr, unsigned long count);
289 extern long vwrite(char *buf, char *addr, unsigned long count);
290
291 /*
292  * This function reads the *virtual* memory as seen by the kernel.
293  */
294 static ssize_t read_kmem(struct file *file, char __user *buf, 
295                          size_t count, loff_t *ppos)
296 {
297         unsigned long p = *ppos;
298         ssize_t read = 0;
299         ssize_t virtr = 0;
300         char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
301         
302         return -EPERM;
303                 
304         if (p < (unsigned long) high_memory) {
305                 read = count;
306                 if (count > (unsigned long) high_memory - p)
307                         read = (unsigned long) high_memory - p;
308
309 #if defined(__sparc__) || (defined(__mc68000__) && defined(CONFIG_MMU))
310                 /* we don't have page 0 mapped on sparc and m68k.. */
311                 if (p < PAGE_SIZE && read > 0) {
312                         size_t tmp = PAGE_SIZE - p;
313                         if (tmp > read) tmp = read;
314                         if (clear_user(buf, tmp))
315                                 return -EFAULT;
316                         buf += tmp;
317                         p += tmp;
318                         read -= tmp;
319                         count -= tmp;
320                 }
321 #endif
322                 if (copy_to_user(buf, (char *)p, read))
323                         return -EFAULT;
324                 p += read;
325                 buf += read;
326                 count -= read;
327         }
328
329         if (count > 0) {
330                 kbuf = (char *)__get_free_page(GFP_KERNEL);
331                 if (!kbuf)
332                         return -ENOMEM;
333                 while (count > 0) {
334                         int len = count;
335
336                         if (len > PAGE_SIZE)
337                                 len = PAGE_SIZE;
338                         len = vread(kbuf, (char *)p, len);
339                         if (!len)
340                                 break;
341                         if (copy_to_user(buf, kbuf, len)) {
342                                 free_page((unsigned long)kbuf);
343                                 return -EFAULT;
344                         }
345                         count -= len;
346                         buf += len;
347                         virtr += len;
348                         p += len;
349                 }
350                 free_page((unsigned long)kbuf);
351         }
352         *ppos = p;
353         return virtr + read;
354 }
355
356 #if defined(CONFIG_ISA) || !defined(__mc68000__)
357 static ssize_t read_port(struct file * file, char __user * buf,
358                          size_t count, loff_t *ppos)
359 {
360         unsigned long i = *ppos;
361         char __user *tmp = buf;
362
363         if (verify_area(VERIFY_WRITE,buf,count))
364                 return -EFAULT; 
365         while (count-- > 0 && i < 65536) {
366                 if (__put_user(inb(i),tmp) < 0) 
367                         return -EFAULT;  
368                 i++;
369                 tmp++;
370         }
371         *ppos = i;
372         return tmp-buf;
373 }
374
375 static ssize_t write_port(struct file * file, const char __user * buf,
376                           size_t count, loff_t *ppos)
377 {
378         unsigned long i = *ppos;
379         const char __user * tmp = buf;
380
381         if (verify_area(VERIFY_READ,buf,count))
382                 return -EFAULT;
383         while (count-- > 0 && i < 65536) {
384                 char c;
385                 if (__get_user(c, tmp)) 
386                         return -EFAULT; 
387                 outb(c,i);
388                 i++;
389                 tmp++;
390         }
391         *ppos = i;
392         return tmp-buf;
393 }
394 #endif
395
396 static ssize_t read_null(struct file * file, char __user * buf,
397                          size_t count, loff_t *ppos)
398 {
399         return 0;
400 }
401
402 static ssize_t write_null(struct file * file, const char __user * buf,
403                           size_t count, loff_t *ppos)
404 {
405         return count;
406 }
407
408 #ifdef CONFIG_MMU
409 /*
410  * For fun, we are using the MMU for this.
411  */
412 static inline size_t read_zero_pagealigned(char __user * buf, size_t size)
413 {
414         struct mm_struct *mm;
415         struct vm_area_struct * vma;
416         unsigned long addr=(unsigned long)buf;
417
418         mm = current->mm;
419         /* Oops, this was forgotten before. -ben */
420         down_read(&mm->mmap_sem);
421
422         /* For private mappings, just map in zero pages. */
423         for (vma = find_vma(mm, addr); vma; vma = vma->vm_next) {
424                 unsigned long count;
425
426                 if (vma->vm_start > addr || (vma->vm_flags & VM_WRITE) == 0)
427                         goto out_up;
428                 if (vma->vm_flags & (VM_SHARED | VM_HUGETLB))
429                         break;
430                 count = vma->vm_end - addr;
431                 if (count > size)
432                         count = size;
433
434                 zap_page_range(vma, addr, count, NULL);
435                 zeromap_page_range(vma, addr, count, PAGE_COPY);
436
437                 size -= count;
438                 buf += count;
439                 addr += count;
440                 if (size == 0)
441                         goto out_up;
442         }
443
444         up_read(&mm->mmap_sem);
445         
446         /* The shared case is hard. Let's do the conventional zeroing. */ 
447         do {
448                 unsigned long unwritten = clear_user(buf, PAGE_SIZE);
449                 if (unwritten)
450                         return size + unwritten - PAGE_SIZE;
451                 cond_resched();
452                 buf += PAGE_SIZE;
453                 size -= PAGE_SIZE;
454         } while (size);
455
456         return size;
457 out_up:
458         up_read(&mm->mmap_sem);
459         return size;
460 }
461
462 static ssize_t read_zero(struct file * file, char __user * buf, 
463                          size_t count, loff_t *ppos)
464 {
465         unsigned long left, unwritten, written = 0;
466
467         if (!count)
468                 return 0;
469
470         if (!access_ok(VERIFY_WRITE, buf, count))
471                 return -EFAULT;
472
473         left = count;
474
475         /* do we want to be clever? Arbitrary cut-off */
476         if (count >= PAGE_SIZE*4) {
477                 unsigned long partial;
478
479                 /* How much left of the page? */
480                 partial = (PAGE_SIZE-1) & -(unsigned long) buf;
481                 unwritten = clear_user(buf, partial);
482                 written = partial - unwritten;
483                 if (unwritten)
484                         goto out;
485                 left -= partial;
486                 buf += partial;
487                 unwritten = read_zero_pagealigned(buf, left & PAGE_MASK);
488                 written += (left & PAGE_MASK) - unwritten;
489                 if (unwritten)
490                         goto out;
491                 buf += left & PAGE_MASK;
492                 left &= ~PAGE_MASK;
493         }
494         unwritten = clear_user(buf, left);
495         written += left - unwritten;
496 out:
497         return written ? written : -EFAULT;
498 }
499
500 static int mmap_zero(struct file * file, struct vm_area_struct * vma)
501 {
502         if (vma->vm_flags & VM_SHARED)
503                 return shmem_zero_setup(vma);
504         if (zeromap_page_range(vma, vma->vm_start, vma->vm_end - vma->vm_start, vma->vm_page_prot))
505                 return -EAGAIN;
506         return 0;
507 }
508 #else /* CONFIG_MMU */
509 static ssize_t read_zero(struct file * file, char * buf, 
510                          size_t count, loff_t *ppos)
511 {
512         size_t todo = count;
513
514         while (todo) {
515                 size_t chunk = todo;
516
517                 if (chunk > 4096)
518                         chunk = 4096;   /* Just for latency reasons */
519                 if (clear_user(buf, chunk))
520                         return -EFAULT;
521                 buf += chunk;
522                 todo -= chunk;
523                 cond_resched();
524         }
525         return count;
526 }
527
528 static int mmap_zero(struct file * file, struct vm_area_struct * vma)
529 {
530         return -ENOSYS;
531 }
532 #endif /* CONFIG_MMU */
533
534 static ssize_t write_full(struct file * file, const char __user * buf,
535                           size_t count, loff_t *ppos)
536 {
537         return -ENOSPC;
538 }
539
540 /*
541  * Special lseek() function for /dev/null and /dev/zero.  Most notably, you
542  * can fopen() both devices with "a" now.  This was previously impossible.
543  * -- SRB.
544  */
545
546 static loff_t null_lseek(struct file * file, loff_t offset, int orig)
547 {
548         return file->f_pos = 0;
549 }
550
551 /*
552  * The memory devices use the full 32/64 bits of the offset, and so we cannot
553  * check against negative addresses: they are ok. The return value is weird,
554  * though, in that case (0).
555  *
556  * also note that seeking relative to the "end of file" isn't supported:
557  * it has no meaning, so it returns -EINVAL.
558  */
559 static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
560 {
561         loff_t ret;
562
563         down(&file->f_dentry->d_inode->i_sem);
564         switch (orig) {
565                 case 0:
566                         file->f_pos = offset;
567                         ret = file->f_pos;
568                         force_successful_syscall_return();
569                         break;
570                 case 1:
571                         file->f_pos += offset;
572                         ret = file->f_pos;
573                         force_successful_syscall_return();
574                         break;
575                 default:
576                         ret = -EINVAL;
577         }
578         up(&file->f_dentry->d_inode->i_sem);
579         return ret;
580 }
581
582 static int open_port(struct inode * inode, struct file * filp)
583 {
584         return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
585 }
586
587 #define mmap_kmem       mmap_mem
588 #define zero_lseek      null_lseek
589 #define full_lseek      null_lseek
590 #define write_zero      write_null
591 #define read_full       read_zero
592 #define open_mem        open_port
593 #define open_kmem       open_mem
594 #define open_oldmem     open_mem
595
596 static struct file_operations mem_fops = {
597         .llseek         = memory_lseek,
598         .read           = read_mem,
599         .write          = write_mem,
600         .mmap           = mmap_mem,
601         .open           = open_mem,
602 };
603
604 static struct file_operations kmem_fops = {
605         .llseek         = memory_lseek,
606         .read           = read_kmem,
607         .mmap           = mmap_kmem,
608         .open           = open_kmem,
609 };
610
611 static struct file_operations null_fops = {
612         .llseek         = null_lseek,
613         .read           = read_null,
614         .write          = write_null,
615 };
616
617 #if defined(CONFIG_ISA) || !defined(__mc68000__)
618 static struct file_operations port_fops = {
619         .llseek         = memory_lseek,
620         .read           = read_port,
621         .write          = write_port,
622         .open           = open_port,
623 };
624 #endif
625
626 static struct file_operations zero_fops = {
627         .llseek         = zero_lseek,
628         .read           = read_zero,
629         .write          = write_zero,
630         .mmap           = mmap_zero,
631 };
632
633 static struct file_operations full_fops = {
634         .llseek         = full_lseek,
635         .read           = read_full,
636         .write          = write_full,
637 };
638
639 #ifdef CONFIG_CRASH_DUMP
640 static struct file_operations oldmem_fops = {
641         .read   = read_oldmem,
642         .open   = open_oldmem,
643 };
644 #endif
645
646 static ssize_t kmsg_write(struct file * file, const char __user * buf,
647                           size_t count, loff_t *ppos)
648 {
649         char *tmp;
650         int ret;
651
652         tmp = kmalloc(count + 1, GFP_KERNEL);
653         if (tmp == NULL)
654                 return -ENOMEM;
655         ret = -EFAULT;
656         if (!copy_from_user(tmp, buf, count)) {
657                 tmp[count] = 0;
658                 ret = printk("%s", tmp);
659         }
660         kfree(tmp);
661         return ret;
662 }
663
664 static struct file_operations kmsg_fops = {
665         .write =        kmsg_write,
666 };
667
668 static int memory_open(struct inode * inode, struct file * filp)
669 {
670         switch (iminor(inode)) {
671                 case 1:
672                         filp->f_op = &mem_fops;
673                         break;
674                 case 2:
675                         filp->f_op = &kmem_fops;
676                         break;
677                 case 3:
678                         filp->f_op = &null_fops;
679                         break;
680 #if defined(CONFIG_ISA) || !defined(__mc68000__)
681                 case 4:
682                         filp->f_op = &port_fops;
683                         break;
684 #endif
685                 case 5:
686                         filp->f_op = &zero_fops;
687                         break;
688                 case 7:
689                         filp->f_op = &full_fops;
690                         break;
691                 case 8:
692                         filp->f_op = &random_fops;
693                         break;
694                 case 9:
695                         filp->f_op = &urandom_fops;
696                         break;
697                 case 11:
698                         filp->f_op = &kmsg_fops;
699                         break;
700 #ifdef CONFIG_CRASH_DUMP
701                 case 12:
702                         filp->f_op = &oldmem_fops;
703                         break;
704 #endif
705                 default:
706                         return -ENXIO;
707         }
708         if (filp->f_op && filp->f_op->open)
709                 return filp->f_op->open(inode,filp);
710         return 0;
711 }
712
713 static struct file_operations memory_fops = {
714         .open           = memory_open,  /* just a selector for the real open */
715 };
716
717 static const struct {
718         unsigned int            minor;
719         char                    *name;
720         umode_t                 mode;
721         struct file_operations  *fops;
722 } devlist[] = { /* list of minor devices */
723         {1, "mem",     S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
724         {3, "null",    S_IRUGO | S_IWUGO,           &null_fops},
725 #if defined(CONFIG_ISA) || !defined(__mc68000__)
726         {4, "port",    S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
727 #endif
728         {5, "zero",    S_IRUGO | S_IWUGO,           &zero_fops},
729         {7, "full",    S_IRUGO | S_IWUGO,           &full_fops},
730         {8, "random",  S_IRUGO | S_IWUSR,           &random_fops},
731         {9, "urandom", S_IRUGO | S_IWUSR,           &urandom_fops},
732         {11,"kmsg",    S_IRUGO | S_IWUSR,           &kmsg_fops},
733 #ifdef CONFIG_CRASH_DUMP
734         {12,"oldmem",    S_IRUSR | S_IWUSR | S_IRGRP, &oldmem_fops},
735 #endif
736 };
737
738 static struct class_simple *mem_class;
739
740 static int __init chr_dev_init(void)
741 {
742         int i;
743
744         if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
745                 printk("unable to get major %d for memory devs\n", MEM_MAJOR);
746
747         mem_class = class_simple_create(THIS_MODULE, "mem");
748         for (i = 0; i < ARRAY_SIZE(devlist); i++) {
749                 class_simple_device_add(mem_class,
750                                         MKDEV(MEM_MAJOR, devlist[i].minor),
751                                         NULL, devlist[i].name);
752                 devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor),
753                                 S_IFCHR | devlist[i].mode, devlist[i].name);
754         }
755         
756         return 0;
757 }
758
759 fs_initcall(chr_dev_init);