Lines Matching full:item
40 static void remove_and_release_share_item(struct hmdfs_share_item *item) in remove_and_release_share_item() argument
42 list_del(&item->list); in remove_and_release_share_item()
43 item->hst->item_cnt--; in remove_and_release_share_item()
44 fput(item->file); in remove_and_release_share_item()
45 kfree(item->relative_path.name); in remove_and_release_share_item()
46 kfree(item); in remove_and_release_share_item()
49 static inline bool is_share_item_timeout(struct hmdfs_share_item *item) in is_share_item_timeout() argument
51 return !item->opened && item->timeout; in is_share_item_timeout()
57 struct hmdfs_share_item *item, *tmp; in hmdfs_lookup_share_item() local
59 list_for_each_entry_safe(item, tmp, &st->item_list_head, list) { in hmdfs_lookup_share_item()
60 if (is_share_item_timeout(item)){ in hmdfs_lookup_share_item()
61 remove_and_release_share_item(item); in hmdfs_lookup_share_item()
63 if (qstr_eq(&item->relative_path, cur_relative_path)) in hmdfs_lookup_share_item()
64 return item; in hmdfs_lookup_share_item()
72 struct hmdfs_share_item *item = in share_item_timeout_work() local
75 item->timeout = true; in share_item_timeout_work()
127 void update_share_item(struct hmdfs_share_item *item, struct file *file, in update_share_item() argument
131 if (!hmdfs_is_dst_path(&file->f_path, &item->file->f_path)) { in update_share_item()
132 fput(item->file); in update_share_item()
134 item->file = file; in update_share_item()
136 memcpy(item->cid, cid, HMDFS_CID_SIZE); in update_share_item()
138 if (!cancel_delayed_work_sync(&item->d_work)) in update_share_item()
139 item->timeout = false; in update_share_item()
141 queue_delayed_work(item->hst->share_item_timeout_wq, &item->d_work, in update_share_item()
168 struct hmdfs_share_item *item; in get_path_from_share_table() local
182 item = hmdfs_lookup_share_item(&sbi->share_table, &relative_path); in get_path_from_share_table()
183 if (!item) { in get_path_from_share_table()
187 path_get(&item->file->f_path); in get_path_from_share_table()
188 *src_path = item->file->f_path; in get_path_from_share_table()
199 struct hmdfs_share_item *item, *tmp; in hmdfs_clear_share_item_offline() local
202 list_for_each_entry_safe(item, tmp, &sbi->share_table.item_list_head, in hmdfs_clear_share_item_offline()
204 if (is_dst_device(item->cid, conn->cid)) { in hmdfs_clear_share_item_offline()
205 /* release the item that was not closed properly */ in hmdfs_clear_share_item_offline()
206 if (item->opened) in hmdfs_clear_share_item_offline()
207 remove_and_release_share_item(item); in hmdfs_clear_share_item_offline()
216 struct hmdfs_share_item *item = NULL; in reset_item_opened_status() local
219 item = hmdfs_lookup_share_item(&sbi->share_table, &candidate); in reset_item_opened_status()
220 if (item) { in reset_item_opened_status()
221 item->opened = false; in reset_item_opened_status()
222 queue_delayed_work(item->hst->share_item_timeout_wq, in reset_item_opened_status()
223 &item->d_work, HZ * HMDFS_SHARE_ITEM_TIMEOUT_S); in reset_item_opened_status()
233 struct hmdfs_share_item *item = NULL; in hmdfs_close_share_item() local
245 item = hmdfs_lookup_share_item(&sbi->share_table, &relativepath); in hmdfs_close_share_item()
246 if (unlikely(!item)) { in hmdfs_close_share_item()
247 hmdfs_err("cannot get share item %s", relativepath.name); in hmdfs_close_share_item()
252 * If the item is shared to all device, we should close the item directly. in hmdfs_close_share_item()
254 if (!strcmp(item->cid, SHARE_ALL_DEVICE)) { in hmdfs_close_share_item()
258 if (unlikely(!is_dst_device(item->cid, cid))) { in hmdfs_close_share_item()
259 hmdfs_err("item not right, dst cid is: %s", item->cid); in hmdfs_close_share_item()
268 item->opened = false; in hmdfs_close_share_item()
269 queue_delayed_work(item->hst->share_item_timeout_wq, &item->d_work, in hmdfs_close_share_item()
282 struct hmdfs_share_item *item = NULL; in hmdfs_check_share_access_permission() local
286 item = hmdfs_lookup_share_item(&sbi->share_table, &candidate); in hmdfs_check_share_access_permission()
288 * When cid matches, we set the item status opened and canel in hmdfs_check_share_access_permission()
292 if (item && (is_dst_device(item->cid, cid) || !strcmp(item->cid, SHARE_ALL_DEVICE))) { in hmdfs_check_share_access_permission()
293 item->opened = true; in hmdfs_check_share_access_permission()
294 if (!cancel_delayed_work_sync(&item->d_work)) { in hmdfs_check_share_access_permission()
295 item->timeout = false; in hmdfs_check_share_access_permission()
322 struct hmdfs_share_item *item, *tmp; in hmdfs_clear_share_table() local
325 list_for_each_entry_safe(item, tmp, &sbi->share_table.item_list_head, in hmdfs_clear_share_table()
327 flush_delayed_work(&item->d_work); in hmdfs_clear_share_table()
328 remove_and_release_share_item(item); in hmdfs_clear_share_table()
339 struct hmdfs_share_item *item, *tmp; in hmdfs_clear_first_item() local
340 list_for_each_entry_safe(item, tmp, &st->item_list_head, list) { in hmdfs_clear_first_item()
341 if (!item->timeout) { in hmdfs_clear_first_item()
342 cancel_delayed_work_sync(&item->d_work); in hmdfs_clear_first_item()
344 remove_and_release_share_item(item); in hmdfs_clear_first_item()