opr: implement the BSD ffs() functions