ioctl.c (146054090b0859b28fc39015c7704ccc3c3a347f) ioctl.c (0ff40a910f5649dfacc4fb5daa7e73692196342d)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007 Oracle. All rights reserved.
4 */
5
6#include <linux/kernel.h>
7#include <linux/bio.h>
8#include <linux/file.h>

--- 2375 unchanged lines hidden (view full) ---

2384 goto out;
2385 }
2386
2387 key.objectid = dirid;
2388 key.type = BTRFS_INODE_REF_KEY;
2389 key.offset = (u64)-1;
2390
2391 while (1) {
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007 Oracle. All rights reserved.
4 */
5
6#include <linux/kernel.h>
7#include <linux/bio.h>
8#include <linux/file.h>

--- 2375 unchanged lines hidden (view full) ---

2384 goto out;
2385 }
2386
2387 key.objectid = dirid;
2388 key.type = BTRFS_INODE_REF_KEY;
2389 key.offset = (u64)-1;
2390
2391 while (1) {
2392 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
2392 ret = btrfs_search_backwards(root, &key, path);
2393 if (ret < 0)
2394 goto out;
2395 else if (ret > 0) {
2393 if (ret < 0)
2394 goto out;
2395 else if (ret > 0) {
2396 ret = btrfs_previous_item(root, path, dirid,
2397 BTRFS_INODE_REF_KEY);
2398 if (ret < 0)
2399 goto out;
2400 else if (ret > 0) {
2401 ret = -ENOENT;
2402 goto out;
2403 }
2396 ret = -ENOENT;
2397 goto out;
2404 }
2405
2406 l = path->nodes[0];
2407 slot = path->slots[0];
2398 }
2399
2400 l = path->nodes[0];
2401 slot = path->slots[0];
2408 btrfs_item_key_to_cpu(l, &key, slot);
2409
2410 iref = btrfs_item_ptr(l, slot, struct btrfs_inode_ref);
2411 len = btrfs_inode_ref_name_len(l, iref);
2412 ptr -= len + 1;
2413 total_len += len + 1;
2414 if (ptr < name) {
2415 ret = -ENAMETOOLONG;
2416 goto out;

--- 58 unchanged lines hidden (view full) ---

2475 ret = PTR_ERR(root);
2476 goto out;
2477 }
2478
2479 key.objectid = dirid;
2480 key.type = BTRFS_INODE_REF_KEY;
2481 key.offset = (u64)-1;
2482 while (1) {
2402
2403 iref = btrfs_item_ptr(l, slot, struct btrfs_inode_ref);
2404 len = btrfs_inode_ref_name_len(l, iref);
2405 ptr -= len + 1;
2406 total_len += len + 1;
2407 if (ptr < name) {
2408 ret = -ENAMETOOLONG;
2409 goto out;

--- 58 unchanged lines hidden (view full) ---

2468 ret = PTR_ERR(root);
2469 goto out;
2470 }
2471
2472 key.objectid = dirid;
2473 key.type = BTRFS_INODE_REF_KEY;
2474 key.offset = (u64)-1;
2475 while (1) {
2483 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
2484 if (ret < 0) {
2476 ret = btrfs_search_backwards(root, &key, path);
2477 if (ret < 0)
2485 goto out_put;
2478 goto out_put;
2486 } else if (ret > 0) {
2487 ret = btrfs_previous_item(root, path, dirid,
2488 BTRFS_INODE_REF_KEY);
2489 if (ret < 0) {
2490 goto out_put;
2491 } else if (ret > 0) {
2492 ret = -ENOENT;
2493 goto out_put;
2494 }
2479 else if (ret > 0) {
2480 ret = -ENOENT;
2481 goto out_put;
2495 }
2496
2497 leaf = path->nodes[0];
2498 slot = path->slots[0];
2482 }
2483
2484 leaf = path->nodes[0];
2485 slot = path->slots[0];
2499 btrfs_item_key_to_cpu(leaf, &key, slot);
2500
2501 iref = btrfs_item_ptr(leaf, slot, struct btrfs_inode_ref);
2502 len = btrfs_inode_ref_name_len(leaf, iref);
2503 ptr -= len + 1;
2504 total_len += len + 1;
2505 if (ptr < args->path) {
2506 ret = -ENAMETOOLONG;
2507 goto out_put;

--- 2546 unchanged lines hidden ---
2486
2487 iref = btrfs_item_ptr(leaf, slot, struct btrfs_inode_ref);
2488 len = btrfs_inode_ref_name_len(leaf, iref);
2489 ptr -= len + 1;
2490 total_len += len + 1;
2491 if (ptr < args->path) {
2492 ret = -ENAMETOOLONG;
2493 goto out_put;

--- 2546 unchanged lines hidden ---