@@ -623,24 +623,42 @@ utils::symver! {
623623#[ no_mangle]
624624pub unsafe extern "C" fn pathrs_inroot_symlink (
625625 root_fd : CBorrowedFd < ' _ > ,
626- path : * const c_char ,
627626 target : * const c_char ,
627+ linkpath : * const c_char ,
628628) -> c_int {
629629 || -> Result < _ , Error > {
630630 let root_fd = root_fd. try_as_borrowed_fd ( ) ?;
631631 let root = RootRef :: from_fd ( root_fd) ;
632- let path = unsafe { utils:: parse_path ( path) ? } ; // SAFETY: C caller guarantees path is safe.
633632 let target = unsafe { utils:: parse_path ( target) ? } ; // SAFETY: C caller guarantees path is safe.
634- root. create ( path, & InodeType :: Symlink ( target. into ( ) ) )
633+ let linkpath = unsafe { utils:: parse_path ( linkpath) ? } ; // SAFETY: C caller guarantees path is safe.
634+ root. create ( linkpath, & InodeType :: Symlink ( target. into ( ) ) )
635635 } ( )
636636 . into_c_return ( )
637637}
638638utils:: symver! {
639- fn pathrs_inroot_symlink <- ( pathrs_inroot_symlink, version = "LIBPATHRS_0.2" , default ) ;
639+ fn pathrs_inroot_symlink <- ( pathrs_inroot_symlink, version = "LIBPATHRS_0.3" , default ) ;
640+ }
641+
642+ /// A compatibility shim for `pathrs_inroot_symlink`, which previously took its
643+ /// arguments in the wrong order.
644+ ///
645+ /// cbindgen:ignore
646+ #[ no_mangle]
647+ pub unsafe extern "C" fn __pathrs_inroot_symlink_v1 (
648+ root_fd : CBorrowedFd < ' _ > ,
649+ path : * const c_char ,
650+ target : * const c_char ,
651+ ) -> c_int {
652+ pathrs_inroot_symlink ( root_fd, target, path)
653+ }
654+ utils:: symver! {
655+ // The old version of pathrs_inroot_symlink had "target" and "linkpath"
656+ // flipped.
657+ fn __pathrs_inroot_symlink_v1 <- ( pathrs_inroot_symlink, version = "LIBPATHRS_0.2" ) ;
640658 // This symbol was renamed in libpathrs 0.2. For backward compatibility with
641659 // pre-symbol-versioned builds of libpathrs, it needs to be a default so
642660 // that loaders will pick it when searching for the unversioned name.
643- fn pathrs_inroot_symlink <- ( pathrs_symlink, version = "LIBPATHRS_0.1" , default ) ;
661+ fn __pathrs_inroot_symlink_v1 <- ( pathrs_symlink, version = "LIBPATHRS_0.1" , default ) ;
644662}
645663
646664/// Create a hardlink within the rootfs referenced by root_fd. Both the hardlink
@@ -657,22 +675,40 @@ utils::symver! {
657675#[ no_mangle]
658676pub unsafe extern "C" fn pathrs_inroot_hardlink (
659677 root_fd : CBorrowedFd < ' _ > ,
660- path : * const c_char ,
661678 target : * const c_char ,
679+ linkpath : * const c_char ,
662680) -> c_int {
663681 || -> Result < _ , Error > {
664682 let root_fd = root_fd. try_as_borrowed_fd ( ) ?;
665683 let root = RootRef :: from_fd ( root_fd) ;
666- let path = unsafe { utils:: parse_path ( path) ? } ; // SAFETY: C caller guarantees path is safe.
667684 let target = unsafe { utils:: parse_path ( target) ? } ; // SAFETY: C caller guarantees path is safe.
668- root. create ( path, & InodeType :: Hardlink ( target. into ( ) ) )
685+ let linkpath = unsafe { utils:: parse_path ( linkpath) ? } ; // SAFETY: C caller guarantees path is safe.
686+ root. create ( linkpath, & InodeType :: Hardlink ( target. into ( ) ) )
669687 } ( )
670688 . into_c_return ( )
671689}
672690utils:: symver! {
673- fn pathrs_inroot_hardlink <- ( pathrs_inroot_hardlink, version = "LIBPATHRS_0.2" , default ) ;
691+ fn pathrs_inroot_hardlink <- ( pathrs_inroot_hardlink, version = "LIBPATHRS_0.3" , default ) ;
692+ }
693+
694+ /// A compatibility shim for `pathrs_inroot_hardlink`, which previously took its
695+ /// arguments in the wrong order.
696+ ///
697+ /// cbindgen:ignore
698+ #[ no_mangle]
699+ pub unsafe extern "C" fn __pathrs_inroot_hardlink_v1 (
700+ root_fd : CBorrowedFd < ' _ > ,
701+ path : * const c_char ,
702+ target : * const c_char ,
703+ ) -> c_int {
704+ pathrs_inroot_hardlink ( root_fd, target, path)
705+ }
706+ utils:: symver! {
707+ // The old version of pathrs_inroot_hardlink had "target" and "linkpath"
708+ // flipped.
709+ fn __pathrs_inroot_hardlink_v1 <- ( pathrs_inroot_hardlink, version = "LIBPATHRS_0.2" ) ;
674710 // This symbol was renamed in libpathrs 0.2. For backward compatibility with
675711 // pre-symbol-versioned builds of libpathrs, it needs to be a default so
676712 // that loaders will pick it when searching for the unversioned name.
677- fn pathrs_inroot_hardlink <- ( pathrs_hardlink, version = "LIBPATHRS_0.1" , default ) ;
713+ fn __pathrs_inroot_hardlink_v1 <- ( pathrs_hardlink, version = "LIBPATHRS_0.1" , default ) ;
678714}
0 commit comments