[PATCH 12/14] lib/xshm: Split big function