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