Messages in this thread Patch in this message | | | Date | Thu, 30 Jul 98 00:09 BST | From | (Alan Cox) | Subject | PATCH: new umount syscall |
| |
This moves umount to "oldumount" and adds a new umount() syscall. The new one takes the MNT_FORCE flag to ask for a forced umount. API wise it is identical to Digcompaqital Unix. That should mean it minimizes damage
Alan
--- include/linux/mount.h~ Sun Jul 26 00:38:54 1998 +++ include/linux/mount.h Wed Jul 29 23:21:49 1998 @@ -37,4 +37,10 @@ struct vfsmount *lookup_vfsmnt(kdev_t dev); +/* + * Umount options + */ + +#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ + #endif /* _LINUX_MOUNT_H */ --- fs/super.c~ Sun Jul 26 00:42:39 1998 +++ fs/super.c Wed Jul 29 23:24:37 1998 @@ -650,7 +650,7 @@ dentry->d_covers = covered; } -static int do_umount(kdev_t dev, int unmount_root) +static int do_umount(kdev_t dev, int unmount_root, int flags) { struct super_block * sb; int retval; @@ -682,7 +682,7 @@ * about for the moment. */ - if(sb->s_op->umount_begin) + if( (flags&MNT_FORCE) && sb->s_op->umount_begin) sb->s_op->umount_begin(sb); /* @@ -734,7 +734,7 @@ return retval; } -static int umount_dev(kdev_t dev) +static int umount_dev(kdev_t dev, int flags) { int retval; struct inode * inode = get_empty_inode(); @@ -752,7 +752,7 @@ down(&mount_sem); - retval = do_umount(dev,0); + retval = do_umount(dev, 0, flags); if (!retval) { fsync_dev(dev); if (dev != ROOT_DEV) { @@ -778,10 +778,11 @@ * If any other fields are ever needed by any block device release * functions, they should be faked here. -- jrs * - * For 2.3.x we want a new sys_umount syscall with flags (ie 'force') + * We now support a flag for forced unmount like the other 'big iron' + * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD */ -asmlinkage int sys_umount(char * name) +asmlinkage int sys_umount(char * name, int flags) { struct dentry * dentry; int retval; @@ -811,10 +812,19 @@ dput(dentry); if (!retval) - retval = umount_dev(dev); + retval = umount_dev(dev, flags); } unlock_kernel(); return retval; +} + +/* + * The 2.0 compatible umount. No flags. + */ + +asmlinkage int sys_oldumount(char * name) +{ + sys_umount(name,0); } /* @@ -1274,7 +1274,7 @@ int umount_error; printk(KERN_NOTICE "Trying to unmount old root ... "); - umount_error = do_umount(old_root_dev,1); + umount_error = do_umount(old_root_dev,1, 0); if (!umount_error) { printk("okay\n"); invalidate_buffers(old_root_dev); --- arch/i386/kernel/entry.S~ Sun Jul 26 00:40:04 1998 +++ arch/i386/kernel/entry.S Wed Jul 29 23:10:03 1998 @@ -396,7 +396,7 @@ .long SYMBOL_NAME(sys_lseek) .long SYMBOL_NAME(sys_getpid) /* 20 */ .long SYMBOL_NAME(sys_mount) - .long SYMBOL_NAME(sys_umount) + .long SYMBOL_NAME(sys_oldumount) .long SYMBOL_NAME(sys_setuid) .long SYMBOL_NAME(sys_getuid) .long SYMBOL_NAME(sys_stime) /* 25 */ @@ -426,7 +426,7 @@ .long SYMBOL_NAME(sys_geteuid) .long SYMBOL_NAME(sys_getegid) /* 50 */ .long SYMBOL_NAME(sys_acct) - .long SYMBOL_NAME(sys_ni_syscall) /* old phys syscall holder */ + .long SYMBOL_NAME(sys_umount) /* recycled never used phys() */ .long SYMBOL_NAME(sys_ni_syscall) /* old lock syscall holder */ .long SYMBOL_NAME(sys_ioctl) .long SYMBOL_NAME(sys_fcntl) /* 55 */ --- include/asm-i386/unistd.h~ Sun Jul 26 00:38:57 1998 +++ include/asm-i386/unistd.h Wed Jul 29 23:10:37 1998 @@ -27,7 +27,7 @@ #define __NR_lseek 19 #define __NR_getpid 20 #define __NR_mount 21 -#define __NR_umount 22 +#define __NR_oldumount 22 #define __NR_setuid 23 #define __NR_getuid 24 #define __NR_stime 25 @@ -57,7 +57,7 @@ #define __NR_geteuid 49 #define __NR_getegid 50 #define __NR_acct 51 -#define __NR_phys 52 +#define __NR_umount 52 #define __NR_lock 53 #define __NR_ioctl 54 #define __NR_fcntl 55 --- arch/alpha/kernel/osf_sys.c~ Sun Jul 26 00:40:06 1998 +++ arch/alpha/kernel/osf_sys.c Wed Jul 29 23:59:49 1998 @@ -46,7 +46,7 @@ extern kdev_t get_unnamed_dev(void); extern void put_unnamed_dev(kdev_t); -extern asmlinkage int sys_umount(char *); +extern asmlinkage int sys_umount(char *, int); extern asmlinkage int sys_swapon(const char *specialfile, int swap_flags); extern asmlinkage unsigned long sys_brk(unsigned long); @@ -524,7 +524,7 @@ int ret; lock_kernel(); - ret = sys_umount(path); + ret = sys_umount(path,flag); unlock_kernel(); return ret; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html
| |