@@ -92,7 +92,7 @@ static int wait_for_subvolume_cleaning(int fd, size_t count, uint64_t *ids,
9292 for (i = 0 ; i < count ; i ++ ) {
9393 if (!ids [i ])
9494 continue ;
95- err = btrfs_util_subvolume_info_fd (fd , ids [i ], NULL );
95+ err = btrfs_util_subvolume_get_info_fd (fd , ids [i ], NULL );
9696 if (err == BTRFS_UTIL_ERROR_SUBVOLUME_NOT_FOUND ) {
9797 done ++ ;
9898 pr_verbose (LOG_DEFAULT , "Subvolume id %" PRIu64 " is gone (%zu/%zu)\n" ,
@@ -306,11 +306,11 @@ static int wait_for_commit(int fd)
306306 enum btrfs_util_error err ;
307307 uint64_t transid ;
308308
309- err = btrfs_util_start_sync_fd (fd , & transid );
309+ err = btrfs_util_fs_start_sync_fd (fd , & transid );
310310 if (err )
311311 return -1 ;
312312
313- err = btrfs_util_wait_sync_fd (fd , transid );
313+ err = btrfs_util_fs_wait_sync_fd (fd , transid );
314314 if (err )
315315 return -1 ;
316316
@@ -424,7 +424,7 @@ static int cmd_subvolume_delete(const struct cmd_struct *cmd, int argc, char **a
424424 char * subvol ;
425425
426426 path = argv [cnt ];
427- err = btrfs_util_subvolume_path (path , subvolid , & subvol );
427+ err = btrfs_util_subvolume_get_path (path , subvolid , & subvol );
428428 /*
429429 * If the subvolume is really not referred by anyone, and refs
430430 * is 0, newer kernel can handle it by just adding an orphan
@@ -451,7 +451,7 @@ static int cmd_subvolume_delete(const struct cmd_struct *cmd, int argc, char **a
451451again :
452452 path = argv [cnt ];
453453
454- err = btrfs_util_is_subvolume (path );
454+ err = btrfs_util_subvolume_is_valid (path );
455455 if (err ) {
456456 error_btrfs_util (err );
457457 ret = 1 ;
@@ -481,7 +481,7 @@ static int cmd_subvolume_delete(const struct cmd_struct *cmd, int argc, char **a
481481 }
482482
483483 default_subvol_id = 0 ;
484- err = btrfs_util_get_default_subvolume_fd (fd , & default_subvol_id );
484+ err = btrfs_util_subvolume_get_default_fd (fd , & default_subvol_id );
485485 if (err == BTRFS_UTIL_ERROR_SEARCH_FAILED ) {
486486 if (geteuid () != 0 )
487487 warning ("cannot read default subvolume id: %m" );
@@ -490,7 +490,7 @@ static int cmd_subvolume_delete(const struct cmd_struct *cmd, int argc, char **a
490490 if (subvolid > 0 ) {
491491 target_subvol_id = subvolid ;
492492 } else {
493- err = btrfs_util_subvolume_id (path , & target_subvol_id );
493+ err = btrfs_util_subvolume_get_id (path , & target_subvol_id );
494494 if (err ) {
495495 ret = 1 ;
496496 goto out ;
@@ -530,7 +530,7 @@ static int cmd_subvolume_delete(const struct cmd_struct *cmd, int argc, char **a
530530 if (err != BTRFS_UTIL_ERROR_STOP_ITERATION )
531531 warning ("failed to iterate subvolumes, nested subvolumes will not be printed: %s" , btrfs_util_strerror (err ));
532532
533- btrfs_util_destroy_subvolume_iterator (iter );
533+ btrfs_util_subvolume_iter_destroy (iter );
534534 } else {
535535 warning ("failed to create subvolume iterator, nested subvolumes will not be printed: %s" , btrfs_util_strerror (err ));
536536 }
@@ -554,9 +554,9 @@ static int cmd_subvolume_delete(const struct cmd_struct *cmd, int argc, char **a
554554
555555 /* Start deleting. */
556556 if (subvolid == 0 )
557- err = btrfs_util_delete_subvolume_fd (fd , vname , flags );
557+ err = btrfs_util_subvolume_delete_fd (fd , vname , flags );
558558 else
559- err = btrfs_util_delete_subvolume_by_id_fd (fd , subvolid );
559+ err = btrfs_util_subvolume_delete_by_id_fd (fd , subvolid );
560560 if (err ) {
561561 int saved_errno = errno ;
562562
@@ -700,7 +700,7 @@ static int cmd_subvolume_snapshot(const struct cmd_struct *cmd, int argc, char *
700700 dst = argv [optind + 1 ];
701701
702702 retval = 1 ; /* failure */
703- err = btrfs_util_is_subvolume (subvol );
703+ err = btrfs_util_subvolume_is_valid (subvol );
704704 if (err ) {
705705 error_btrfs_util (err );
706706 goto out ;
@@ -795,7 +795,7 @@ static int cmd_subvolume_get_default(const struct cmd_struct *cmd, int argc, cha
795795 if (fd < 0 )
796796 return 1 ;
797797
798- err = btrfs_util_get_default_subvolume_fd (fd , & default_id );
798+ err = btrfs_util_subvolume_get_default_fd (fd , & default_id );
799799 if (err ) {
800800 error_btrfs_util (err );
801801 goto out ;
@@ -815,13 +815,13 @@ static int cmd_subvolume_get_default(const struct cmd_struct *cmd, int argc, cha
815815 goto out ;
816816 }
817817
818- err = btrfs_util_subvolume_info_fd (fd , default_id , & subvol );
818+ err = btrfs_util_subvolume_get_info_fd (fd , default_id , & subvol );
819819 if (err ) {
820820 error_btrfs_util (err );
821821 goto out ;
822822 }
823823
824- err = btrfs_util_subvolume_path_fd (fd , default_id , & path );
824+ err = btrfs_util_subvolume_get_path_fd (fd , default_id , & path );
825825 if (err ) {
826826 error_btrfs_util (err );
827827 goto out ;
@@ -890,7 +890,7 @@ static int cmd_subvolume_set_default(const struct cmd_struct *cmd, int argc, cha
890890 path = argv [optind + 1 ];
891891 }
892892
893- err = btrfs_util_set_default_subvolume (path , objectid );
893+ err = btrfs_util_subvolume_set_default (path , objectid );
894894 if (err ) {
895895 error_btrfs_util (err );
896896 return 1 ;
@@ -1327,7 +1327,7 @@ static int cmd_subvolume_find_new(const struct cmd_struct *cmd, int argc, char *
13271327 subvol = argv [optind ];
13281328 last_gen = arg_strtou64 (argv [optind + 1 ]);
13291329
1330- err = btrfs_util_is_subvolume (subvol );
1330+ err = btrfs_util_subvolume_is_valid (subvol );
13311331 if (err ) {
13321332 error_btrfs_util (err );
13331333 return 1 ;
@@ -1337,7 +1337,7 @@ static int cmd_subvolume_find_new(const struct cmd_struct *cmd, int argc, char *
13371337 if (fd < 0 )
13381338 return 1 ;
13391339
1340- err = btrfs_util_sync_fd (fd );
1340+ err = btrfs_util_fs_sync_fd (fd );
13411341 if (err ) {
13421342 error_btrfs_util (err );
13431343 close (fd );
@@ -1583,27 +1583,24 @@ static int cmd_subvolume_show(const struct cmd_struct *cmd, int argc, char **arg
15831583 }
15841584
15851585 if (by_uuid ) {
1586- err = btrfs_util_create_subvolume_iterator_fd (fd ,
1587- BTRFS_FS_TREE_OBJECTID ,
1588- 0 , & iter );
1586+ err = btrfs_util_subvolume_iter_create_fd (fd , BTRFS_FS_TREE_OBJECTID ,
1587+ 0 , & iter );
15891588 if (err ) {
15901589 error_btrfs_util (err );
15911590 goto out ;
15921591 }
15931592
15941593 for (;;) {
1595- err = btrfs_util_subvolume_iterator_next_info (iter ,
1596- & subvol_path ,
1597- & subvol );
1594+ err = btrfs_util_subvolume_iter_next_info (iter , & subvol_path , & subvol );
15981595 if (err == BTRFS_UTIL_ERROR_STOP_ITERATION ) {
15991596 uuid_unparse (uuid_arg , uuidparse );
16001597 error ("can't find uuid '%s' on '%s'" , uuidparse ,
16011598 fullpath );
1602- btrfs_util_destroy_subvolume_iterator (iter );
1599+ btrfs_util_subvolume_iter_destroy (iter );
16031600 goto out ;
16041601 } else if (err ) {
16051602 error_btrfs_util (err );
1606- btrfs_util_destroy_subvolume_iterator (iter );
1603+ btrfs_util_subvolume_iter_destroy (iter );
16071604 goto out ;
16081605 }
16091606
@@ -1613,19 +1610,19 @@ static int cmd_subvolume_show(const struct cmd_struct *cmd, int argc, char **arg
16131610 free (subvol_path );
16141611 subvol_path = NULL ;
16151612 }
1616- btrfs_util_destroy_subvolume_iterator (iter );
1613+ btrfs_util_subvolume_iter_destroy (iter );
16171614 } else {
16181615 /*
16191616 * If !by_rootid, rootid_arg = 0, which means find the
16201617 * subvolume ID of the fd and use that.
16211618 */
1622- err = btrfs_util_subvolume_info_fd (fd , rootid_arg , & subvol );
1619+ err = btrfs_util_subvolume_get_info_fd (fd , rootid_arg , & subvol );
16231620 if (err ) {
16241621 error_btrfs_util (err );
16251622 goto out ;
16261623 }
16271624
1628- err = btrfs_util_subvolume_path_fd (fd , subvol .id , & subvol_path );
1625+ err = btrfs_util_subvolume_get_path_fd (fd , subvol .id , & subvol_path );
16291626 if (err ) {
16301627 error_btrfs_util (err );
16311628 goto out ;
@@ -1655,20 +1652,18 @@ static int cmd_subvolume_show(const struct cmd_struct *cmd, int argc, char **arg
16551652 else
16561653 pr_verbose (LOG_DEFAULT , "\tSnapshot(s):\n" );
16571654
1658- err = btrfs_util_create_subvolume_iterator_fd (fd ,
1659- BTRFS_FS_TREE_OBJECTID , 0 ,
1660- & iter );
1655+ err = btrfs_util_subvolume_iter_create_fd (fd , BTRFS_FS_TREE_OBJECTID , 0 , & iter );
16611656
16621657 for (;;) {
16631658 struct btrfs_util_subvolume_info subvol2 ;
16641659 char * path ;
16651660
1666- err = btrfs_util_subvolume_iterator_next_info (iter , & path , & subvol2 );
1661+ err = btrfs_util_subvolume_iter_next_info (iter , & path , & subvol2 );
16671662 if (err == BTRFS_UTIL_ERROR_STOP_ITERATION ) {
16681663 break ;
16691664 } else if (err ) {
16701665 error_btrfs_util (err );
1671- btrfs_util_destroy_subvolume_iterator (iter );
1666+ btrfs_util_subvolume_iter_destroy (iter );
16721667 goto out2 ;
16731668 }
16741669
@@ -1685,7 +1680,7 @@ static int cmd_subvolume_show(const struct cmd_struct *cmd, int argc, char **arg
16851680 if (bconf .output_format == CMD_FORMAT_JSON )
16861681 fmt_print_end_group (& fctx , "snapshots" );
16871682
1688- btrfs_util_destroy_subvolume_iterator (iter );
1683+ btrfs_util_subvolume_iter_destroy (iter );
16891684
16901685 ret = btrfs_qgroup_query (fd , subvol .id , & stats );
16911686 if (ret == - ENOTTY ) {
@@ -1779,7 +1774,7 @@ static int cmd_subvolume_sync(const struct cmd_struct *cmd, int argc, char **arg
17791774
17801775 id_count = argc - optind ;
17811776 if (!id_count ) {
1782- err = btrfs_util_deleted_subvolumes_fd (fd , & ids , & id_count );
1777+ err = btrfs_util_subvolume_list_deleted_fd (fd , & ids , & id_count );
17831778 if (err ) {
17841779 error_btrfs_util (err );
17851780 ret = 1 ;
0 commit comments