/* *************************************************************************** * Count number of USB devices plugged into the system. * * IN: * @a Activity structure. * * RETURNS: * Number of USB devices + a pre-allocation constant. *************************************************************************** */ __nr_t wrap_get_usb_nr(struct activity *a) { __nr_t n = 0; if ((n = get_usb_nr()) >= 0) /* Return a positive number even if no USB devices have been found */ return n + NR_USB_PREALLOC; return 0; }
/* *************************************************************************** * Count number of USB devices plugged into the system. * * IN: * @a Activity structure. * * RETURNS: * Number of USB devices + a pre-allocation constant. Number cannot exceed * MAX_NR_USB. *************************************************************************** */ __nr_t wrap_get_usb_nr(struct activity *a) { __nr_t n = 0; if ((n = get_usb_nr()) >= 0) { /* Return a positive number even if no USB devices have been found */ if ((n + NR_USB_PREALLOC) > MAX_NR_USB) return MAX_NR_USB; else return n + NR_USB_PREALLOC; } return 0; }