| Function report | 
| Source Code: fs\namei.c | Create Date:2022-07-28 20:05:13 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:Handle the last step of open()
Proto:static int do_last(struct nameidata *nd, struct file *file, const struct open_flags *op)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct nameidata * | nd | |
| struct file * | file | |
| const struct open_flags * | op | 
| 3208 | will_truncate = (open_flag & O_TRUNC) != 0 | 
| 3209 | bool got_write = false | 
| 3216 | flags &= ~rnal use only | 
| 3220 | error = handle_dots(nd, last_type) | 
| 3221 | If Value for the false possibility is greater at compile time(error) Then Return error | 
| 3223 | Go to finish_open | 
| 3227 | If name[len] Then flags |= llow links at the end | quire a directory | 
| 3231 | If Value is more likely to compile time(error > 0) Then Go to finish_lookup | 
| 3238 | BUG_ON(flags & RCU pathwalk mode; semi-internal ) | 
| 3239 | Else | 
| 3250 | audit_inode(name, dir, dentry represents the parent ) | 
| 3252 | If Value for the false possibility is greater at compile time(name[len]) Then Return -EISDIR | 
| 3257 | error = mnt_want_write(mnt) | 
| 3266 | If open_flag & O_CREAT Then inode_lock( Where the name belongs to - NULL is * negative ) | 
| 3271 | If open_flag & O_CREAT Then inode_unlock( Where the name belongs to - NULL is * negative ) | 
| 3279 | If f_mode & FMODE_OPENED Then | 
| 3280 | If f_mode & FMODE_CREATED || Not S_ISREG(i_mode) Then will_truncate = false | 
| 3284 | audit_inode(name, dentry, 0) | 
| 3285 | Go to opened | 
| 3288 | If f_mode & FMODE_CREATED Then | 
| 3291 | will_truncate = false | 
| 3292 | acc_mode = 0 | 
| 3293 | path_to_nameidata( & path, nd) | 
| 3294 | Go to finish_open_created | 
| 3302 | If got_write Then | 
| 3303 | mnt_drop_write(mnt) | 
| 3304 | got_write = false | 
| 3308 | If Value for the false possibility is greater at compile time(error < 0) Then Return error | 
| 3314 | audit_inode(name, dentry, 0) | 
| 3317 | path_to_nameidata( & path, nd) | 
| 3318 | Return -EEXIST | 
| 3321 | seq = 0 | 
| 3323 | finish_lookup : | 
| 3325 | If Value for the false possibility is greater at compile time(error) Then Return error | 
| 3327 | finish_open : | 
| 3332 | audit_inode(name, dentry, 0) | 
| 3337 | error = may_create_in_sticky - Check whether an O_CREAT open in a sticky directory* should be allowed, or not, on files that already* exist | 
| 3339 | If Value for the false possibility is greater at compile time(error) Then Go to out | 
| 3343 | If flags & quire a directory && Not d_can_lookup(dentry) Then Go to out | 
| 3345 | If Not d_is_reg(dentry) Then will_truncate = false | 
| 3348 | If will_truncate Then | 
| 3354 | finish_open_created : | 
| 3358 | BUG_ON(f_mode & FMODE_OPENED) | 
| 3359 | error = vfs_open - open the file at the given path*@path: path to open*@file: newly allocated file with f_flag initialized*@cred: credentials to use | 
| 3362 | opened : | 
| 3363 | error = ima_file_check(file, acc_mode) | 
| 3364 | If Not error && will_truncate Then error = handle_truncate(file) | 
| 3366 | out : | 
| 3367 | If Value for the false possibility is greater at compile time(error > 0) Then | 
| 3371 | If got_write Then mnt_drop_write(mnt) | 
| 3373 | Return error | 
| Name | Describe | 
|---|---|
| path_openat | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |