@@ -702,6 +702,38 @@ void xfs_handle_lseek(struct xfs_registers_t* registers)
702702 }
703703}
704704
705+ void xfs_handle_umount (struct xfs_registers_t * registers )
706+ {
707+ const int mount_point = registers -> mount_point ;
708+
709+ if (mount_point < 0 || mount_point >= 4 )
710+ {
711+ XFS_DEBUG ("xfs: umount failed: invalid mount_point=%d\n" , mount_point );
712+ registers -> result = XFS_ERR_INVAL ;
713+ registers -> status = XFS_STATUS_ERROR ;
714+ return ;
715+ }
716+
717+ if (xfs_mounted_engines [mount_point ].engine == NULL )
718+ {
719+ XFS_DEBUG ("xfs: umount mount_point=%d (already idle)\n" , mount_point );
720+ registers -> result = 0 ;
721+ registers -> status = XFS_STATUS_COMPLETE ;
722+ return ;
723+ }
724+
725+ struct xfs_engine_t * const eng = xfs_mounted_engines [mount_point ].engine ;
726+ if (eng -> unmount )
727+ eng -> unmount (eng , & xfs_mounted_engines [mount_point ]);
728+
729+ xfs_mounted_engines [mount_point ].engine = NULL ;
730+
731+ XFS_DEBUG ("xfs: umount success mount_point=%d\n" , mount_point );
732+ registers -> result = 0 ;
733+ registers -> status = XFS_STATUS_COMPLETE ;
734+ }
735+
736+
705737/**
706738 * Handle XFS command dispatch
707739 * This function processes a command from the registers and dispatches to the appropriate handler
@@ -799,6 +831,11 @@ void xfs_handle_command(struct xfs_registers_t* registers)
799831 xfs_handle_lseek (registers );
800832 break ;
801833 }
834+ case XFS_CMD_UNMOUNT :
835+ {
836+ xfs_handle_umount (registers );
837+ break ;
838+ }
802839 default :
803840 {
804841 XFS_DEBUG ("xfs: unknown command=%d\n" , command );
0 commit comments