函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\notify\mark.c Create Date:2022-07-29 10:48:10
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Add mark into proper place in given list of marks. These marks may be used* for the fsnotify backend to determine which event types should be delivered* to which group and for which inodes. These marks are ordered according to

函数原型:static int fsnotify_add_mark_list(struct fsnotify_mark *mark, fsnotify_connp_t *connp, unsigned int type, int allow_dups, __kernel_fsid_t *fsid)

返回类型:int

参数:

类型参数名称
struct fsnotify_mark *mark
fsnotify_connp_t *connp
unsigned inttype
intallow_dups
__kernel_fsid_t *fsid
547  struct fsnotify_mark * lmark, * last = NULL
550  err等于0
552  如果WARN_ON(!fsnotify_valid_obj_type(type))则返回:负EINVAL
556  如果fsidWARN_ON_ONCE(!val[0] && !val[1])则返回:负ENODEV
559  restart :
560  加自旋锁
561  conn等于Get mark connector, make sure it is alive and return with its lock held.* This is for users that get connector pointer from inode or mount. Users that* hold reference to a mark on the list may directly lock connector->lock as
562  如果非conn
563  自旋锁解锁
564  err等于fsnotify_attach_connector_to_object(connp, type, fsid)
565  如果err则返回:err
567  转到:restart
568  否则如果fsid且非 flags [lock] 按位与FSNOTIFY_CONN_FLAG_HAS_FSID的值则
569  fsid of filesystem containing object 等于fsid
571  smp_wmb()
572  flags [lock] 或等于FSNOTIFY_CONN_FLAG_HAS_FSID
573  否则如果fsid flags [lock] 按位与FSNOTIFY_CONN_FLAG_HAS_FSIDval[0]不等于val[0]或val[1]不等于val[1]的值则
583  pr_warn_ratelimited("%s: fsid mismatch on object of type %u: %x.%x != %x.%x\n", __func__, Type of object [lock] , val[0], val[1], val[0], val[1])
587  err等于负EXDEV
588  转到:out_err
592  如果hlist_empty( & list)则
593  添加哈希记录
594  转到:added
599  last等于lmark
604  err等于负EEXIST
605  转到:out_err
608  cmp等于Sorting function for lists of fsnotify marks.* Fanotify supports different notification classes (reflected as priority of* notification group). Events shall be passed to notification groups in* decreasing priority order
609  如果cmp大于等于0则
611  转到:added
615  BUG_ON(last == NULL)
617  hlist_add_behind_rcu*@n: the new element to add to the hash list
618  added :
624  WRITE_ONCE( Head of list of marks for an object [mark ref] , conn)
625  out_err :
626  自旋锁解锁
627  自旋锁解锁
628  返回:err
调用者
名称描述
fsnotify_add_mark_lockedAttach an initialized mark to a given group and fs object.* These marks may be used for the fsnotify backend to determine which* event types should be delivered to which group.