Linux mount operation

Source: Internet
Author: User

1, call: From the user state into the kernel state:

Syscall_define5 (Mount, Char __user *, Dev_name, Char __user *, Dir_name,char __user *, type, unsigned long, flags, void __ User *, data) {int Ret;char *kernel_type;struct filename *kernel_dir;char *kernel_dev;unsigned long data_page;        /* Copy data from user space to kernel space: type, mount path, parameters, etc. */ret = copy_mount_string (type, &kernel_type);  if (Ret < 0) goto Out_type;kernel_dir = GetName (Dir_name), if (Is_err (Kernel_dir)) {ret = Ptr_err (kernel_dir); Goto Out_d IR;} ret = copy_mount_string (Dev_name, &kernel_dev); if (Ret < 0) goto Out_dev;ret = copy_mount_options (data, &data_page); if (Ret < 0) goto Out_data;ret = Do_mount (Kernel_dev, Kernel_dir->name, Kernel_type, Flags, (void *) data_page); free_ Page (data_page); Out_data:kfree (Kernel_dev); Out_dev:putname (Kernel_dir); Out_dir:kfree (Kernel_type); Out_type: return ret;}

Note: struct filename *kernel_dir

struct filename {const char*name;/* pointer to actual string */const __user char*uptr;/* original userland pointer */struc T audit_names*aname;boolseparate; /* should "name" be freed? */};

  

Linux mount operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.